From feb82d42eb8a0dc8c6d272a0acfe10fd3356655c Mon Sep 17 00:00:00 2001 From: michalprusa Date: Thu, 25 Feb 2016 12:27:08 +0100 Subject: [PATCH] M119 report fixed and added new gcode Fixed reporting enstop status and added PRUSA LiveZ to reset live Z adjusting --- Firmware/Marlin_main.cpp | 47 ++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3e491c46..0cb8bdca 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1441,6 +1441,8 @@ void process_commands() } else if(code_seen('Lang')) { lcd_force_language_selection(); + } else if(code_seen('LiveZ')) { + EEPROM_save_B(4089,0); } } @@ -3081,30 +3083,61 @@ Sigma_Exit: enable_endstops(true) ; break; case 119: // M119 - SERIAL_PROTOCOLLN(MSG_M119_REPORT); + SERIAL_PROTOCOLRPGM(MSG_M119_REPORT); + SERIAL_PROTOCOLLN(""); #if defined(X_MIN_PIN) && X_MIN_PIN > -1 SERIAL_PROTOCOLRPGM(MSG_X_MIN); - SERIAL_PROTOCOLLN(((READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); + if(READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING){ + SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_HIT); + }else{ + SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_OPEN); + } + SERIAL_PROTOCOLLN(""); #endif #if defined(X_MAX_PIN) && X_MAX_PIN > -1 SERIAL_PROTOCOLRPGM(MSG_X_MAX); - SERIAL_PROTOCOLLN(((READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); + if(READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING){ + SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_HIT); + }else{ + SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_OPEN); + } + SERIAL_PROTOCOLLN(""); #endif #if defined(Y_MIN_PIN) && Y_MIN_PIN > -1 SERIAL_PROTOCOLRPGM(MSG_Y_MIN); - SERIAL_PROTOCOLLN(((READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); + if(READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING){ + SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_HIT); + }else{ + SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_OPEN); + } + SERIAL_PROTOCOLLN(""); #endif #if defined(Y_MAX_PIN) && Y_MAX_PIN > -1 SERIAL_PROTOCOLRPGM(MSG_Y_MAX); - SERIAL_PROTOCOLLN(((READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); + if(READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING){ + SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_HIT); + }else{ + SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_OPEN); + } + SERIAL_PROTOCOLLN(""); #endif #if defined(Z_MIN_PIN) && Z_MIN_PIN > -1 SERIAL_PROTOCOLRPGM(MSG_Z_MIN); - SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); + if(READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING){ + SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_HIT); + }else{ + SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_OPEN); + } + SERIAL_PROTOCOLLN(""); #endif #if defined(Z_MAX_PIN) && Z_MAX_PIN > -1 SERIAL_PROTOCOLRPGM(MSG_Z_MAX); - SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); + if(READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING){ + SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_HIT); + }else{ + SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_OPEN); + } + SERIAL_PROTOCOLLN(""); #endif break; //TODO: update for all axis, use for loop