+ // check soft endstops only for homed axis that are enabled
+ if(soft_endstop_enabled) {
+ for (int i = 0; i <= Z_AXIS; ++i) {
+ if(!is_homed(i)) continue;
+ if( (!isnan(soft_endstop_min[i]) && transformed_target[i] < soft_endstop_min[i]) || (!isnan(soft_endstop_max[i]) && transformed_target[i] > soft_endstop_max[i]) ) {
+ if(soft_endstop_halt) {
+ if(THEKERNEL->is_grbl_mode()) {
+ THEKERNEL->streams->printf("error: ");
+ }else{
+ THEKERNEL->streams->printf("Error: ");
+ }
+
+ THEKERNEL->streams->printf("Soft Endstop %c was exceeded - reset or $X or M999 required\n", i+'X');
+ THEKERNEL->call_event(ON_HALT, nullptr);
+ return false;
+
+ //} else if(soft_endstop_truncate) {
+ // TODO VERY hard to do need to go back and change the target, and calculate intercept with the edge
+ // and store all preceding vectors that have on eor more points ourtside of bounds so we can create a propper clip against the boundaries
+
+ } else {
+ // ignore it
+ if(THEKERNEL->is_grbl_mode()) {
+ THEKERNEL->streams->printf("error: ");
+ }else{
+ THEKERNEL->streams->printf("Error: ");
+ }
+ THEKERNEL->streams->printf("Soft Endstop %c was exceeded - entire move ignored\n", i+'X');
+ return false;
+ }
+ }
+ }
+ }
+
+