Commit 8f323a13 authored by MagoKimbra's avatar MagoKimbra

Fix DebugLevel

parent dbf13a8b
...@@ -317,9 +317,6 @@ enum DebugFlags { ...@@ -317,9 +317,6 @@ enum DebugFlags {
DEBUG_COMMUNICATION = BIT(4) DEBUG_COMMUNICATION = BIT(4)
}; };
extern uint8_t debugLevel; extern uint8_t debugLevel;
extern inline bool debugDryrun() {
return ((debugLevel & 8) != 0);
}
#ifdef FIRMWARE_TEST #ifdef FIRMWARE_TEST
void FirmwareTest(); void FirmwareTest();
......
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
bool Running = true; bool Running = true;
uint8_t debugLevel = DEBUG_INFO|DEBUG_DRYRUN; uint8_t debugLevel = DEBUG_INFO|DEBUG_COMMUNICATION;
static float feedrate = 1500.0, next_feedrate, saved_feedrate; static float feedrate = 1500.0, next_feedrate, saved_feedrate;
float current_position[NUM_AXIS] = { 0.0 }; float current_position[NUM_AXIS] = { 0.0 };
...@@ -4110,7 +4110,7 @@ inline void gcode_M92() { ...@@ -4110,7 +4110,7 @@ inline void gcode_M92() {
*/ */
inline void gcode_M104() { inline void gcode_M104() {
if (setTargetedHotend(104)) return; if (setTargetedHotend(104)) return;
if (debugDryrun()) return; if (debugLevel & DEBUG_DRYRUN) return;
#if HOTENDS == 1 #if HOTENDS == 1
if (target_extruder != active_extruder) return; if (target_extruder != active_extruder) return;
#endif #endif
...@@ -4197,7 +4197,7 @@ inline void gcode_M105() { ...@@ -4197,7 +4197,7 @@ inline void gcode_M105() {
*/ */
inline void gcode_M109() { inline void gcode_M109() {
if (setTargetedHotend(109)) return; if (setTargetedHotend(109)) return;
if (debugDryrun()) return; if (debugLevel & DEBUG_DRYRUN) return;
#if HOTENDS == 1 #if HOTENDS == 1
if (target_extruder != active_extruder) return; if (target_extruder != active_extruder) return;
#endif #endif
...@@ -4229,8 +4229,11 @@ inline void gcode_M109() { ...@@ -4229,8 +4229,11 @@ inline void gcode_M109() {
*/ */
inline void gcode_M111() { inline void gcode_M111() {
debugLevel = code_seen('S') ? code_value_short() : DEBUG_INFO|DEBUG_COMMUNICATION; debugLevel = code_seen('S') ? code_value_short() : DEBUG_INFO|DEBUG_COMMUNICATION;
if (debugDryrun()) { if (debugLevel & DEBUG_ECHO) ECHO_LM(DB, MSG_DEBUG_ECHO);
ECHO_LM(DB, MSG_DRYRUN_ENABLED); //if (debugLevel & DEBUG_INFO) ECHO_LM(DB, MSG_DEBUG_INFO);
//if (debugLevel & DEBUG_ERRORS) ECHO_LM(DB, MSG_DEBUG_ERRORS);
if (debugLevel & DEBUG_DRYRUN) {
ECHO_LM(DB, MSG_DEBUG_DRYRUN);
setTargetBed(0); setTargetBed(0);
for (int8_t cur_hotend = 0; cur_hotend < HOTENDS; ++cur_hotend) { for (int8_t cur_hotend = 0; cur_hotend < HOTENDS; ++cur_hotend) {
setTargetHotend(0, cur_hotend); setTargetHotend(0, cur_hotend);
...@@ -4390,7 +4393,7 @@ inline void gcode_M121() { enable_endstops(true); } ...@@ -4390,7 +4393,7 @@ inline void gcode_M121() { enable_endstops(true); }
* M140: Set bed temperature * M140: Set bed temperature
*/ */
inline void gcode_M140() { inline void gcode_M140() {
if (debugDryrun()) return; if (debugLevel & DEBUG_DRYRUN) return;
if (code_seen('S')) setTargetBed(code_value()); if (code_seen('S')) setTargetBed(code_value());
} }
...@@ -4485,7 +4488,7 @@ inline void gcode_M140() { ...@@ -4485,7 +4488,7 @@ inline void gcode_M140() {
* Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling * Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
*/ */
inline void gcode_M190() { inline void gcode_M190() {
if (debugDryrun()) return; if (debugLevel & DEBUG_DRYRUN) return;
LCD_MESSAGEPGM(MSG_BED_HEATING); LCD_MESSAGEPGM(MSG_BED_HEATING);
no_wait_for_cooling = code_seen('S'); no_wait_for_cooling = code_seen('S');
if (no_wait_for_cooling || code_seen('R')) if (no_wait_for_cooling || code_seen('R'))
...@@ -6330,7 +6333,7 @@ void clamp_to_software_endstops(float target[3]) { ...@@ -6330,7 +6333,7 @@ void clamp_to_software_endstops(float target[3]) {
inline float prevent_dangerous_extrude(float &curr_e, float &dest_e) { inline float prevent_dangerous_extrude(float &curr_e, float &dest_e) {
float de = dest_e - curr_e; float de = dest_e - curr_e;
if (debugDryrun()) return de; if (debugLevel & DEBUG_DRYRUN) return de;
if (de) { if (de) {
if (degHotend(active_extruder) < extrude_min_temp) { if (degHotend(active_extruder) < extrude_min_temp) {
curr_e = dest_e; // Behave as if the move really took place, but ignore E part curr_e = dest_e; // Behave as if the move really took place, but ignore E part
...@@ -6785,7 +6788,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { ...@@ -6785,7 +6788,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
#endif #endif
#ifdef IDLE_OOZING_PREVENT #ifdef IDLE_OOZING_PREVENT
if (degHotend(active_extruder) > IDLE_OOZING_MINTEMP && !debugDryrun() && !axis_is_moving && idleoozing_enabled) { if (degHotend(active_extruder) > IDLE_OOZING_MINTEMP && !(debugLevel & DEBUG_DRYRUN) && !axis_is_moving && idleoozing_enabled) {
#ifdef FILAMENTCHANGEENABLE #ifdef FILAMENTCHANGEENABLE
if (!filament_changing) if (!filament_changing)
#endif #endif
......
...@@ -222,12 +222,11 @@ ...@@ -222,12 +222,11 @@
#define MSG_MAXTEMP_EXTRUDER_OFF ": Extruder" MSG_SWITCHED_OFF_MAX #define MSG_MAXTEMP_EXTRUDER_OFF ": Extruder" MSG_SWITCHED_OFF_MAX
#define MSG_MAXTEMP_BED_OFF "Heated bed" MSG_SWITCHED_OFF_MAX #define MSG_MAXTEMP_BED_OFF "Heated bed" MSG_SWITCHED_OFF_MAX
#define MSG_ENDSTOP_XS "X" #define MSG_ENDSTOP_XS "X"
#define MSG_ENDSTOP_YS "Y" #define MSG_ENDSTOP_YS "Y"
#define MSG_ENDSTOP_ZS "Z" #define MSG_ENDSTOP_ZS "Z"
#define MSG_ENDSTOP_ZPS "ZP" #define MSG_ENDSTOP_ZPS "ZP"
#define MSG_ENDSTOP_ES "E" #define MSG_ENDSTOP_ES "E"
//watchdog.cpp //watchdog.cpp
#define MSG_WATCHDOG_RESET "Something is wrong, please turn off the printer." #define MSG_WATCHDOG_RESET "Something is wrong, please turn off the printer."
...@@ -239,7 +238,6 @@ ...@@ -239,7 +238,6 @@
#define MSG_BED_LEVELLING_X " X: " #define MSG_BED_LEVELLING_X " X: "
#define MSG_BED_LEVELLING_Y " Y: " #define MSG_BED_LEVELLING_Y " Y: "
#define MSG_BED_LEVELLING_Z " Z: " #define MSG_BED_LEVELLING_Z " Z: "
#define MSG_DRYRUN_ENABLED "DEBUG DRYRUN ENABLED"
// LCD Menu Messages // LCD Menu Messages
......
...@@ -152,6 +152,10 @@ ...@@ -152,6 +152,10 @@
#define MSG_ERR_MINTEMP "Err: MINTEMP" #define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED" #define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#define MSG_DEBUG_ECHO "DEBUG ECHO ENABLED"
#define MSG_DEBUG_INFO "DEBUG INFO ENABLED"
#define MSG_DEBUG_ERRORS "DEBUG ERRORS ENABLED"
#define MSG_DEBUG_DRYRUN "DEBUG DRYRUN ENABLED"
#ifdef DELTA #ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration" #define MSG_DELTA_CALIBRATE "Delta Calibration"
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#define MSG_EXTRUDE "Estrudi" #define MSG_EXTRUDE "Estrudi"
#define MSG_RETRACT "Ritrai" #define MSG_RETRACT "Ritrai"
#define MSG_MOVE_AXIS "Muovi Asse" #define MSG_MOVE_AXIS "Muovi Asse"
#define MSG_LEVEL_BED "Level bed"
#define MSG_MOVE_X "Muovi X" #define MSG_MOVE_X "Muovi X"
#define MSG_MOVE_Y "Muovi Y" #define MSG_MOVE_Y "Muovi Y"
#define MSG_MOVE_Z "Muovi Z" #define MSG_MOVE_Z "Muovi Z"
...@@ -59,15 +60,15 @@ ...@@ -59,15 +60,15 @@
#define MSG_MOVE_01MM "Muovi di 0.1mm" #define MSG_MOVE_01MM "Muovi di 0.1mm"
#define MSG_MOVE_1MM "Muovi di 1mm" #define MSG_MOVE_1MM "Muovi di 1mm"
#define MSG_MOVE_10MM "Muovi di 10mm" #define MSG_MOVE_10MM "Muovi di 10mm"
#define MSG_SPEED "Velcità" #define MSG_SPEED "Velocità"
#define MSG_NOZZLE "Ugello" #define MSG_NOZZLE "Ugello"
#define MSG_BED "Piatto" #define MSG_BED "Piatto"
#define MSG_FAN_SPEED "Ventola" #define MSG_FAN_SPEED "Ventola"
#define MSG_FLOW "Flusso" #define MSG_FLOW "Flusso"
#define MSG_CONTROL "Controllo" #define MSG_CONTROL "Controllo"
#define MSG_MIN LCD_STR_THERMOMETER " Min" #define MSG_MIN " "LCD_STR_THERMOMETER " Min"
#define MSG_MAX LCD_STR_THERMOMETER " Max" #define MSG_MAX " "LCD_STR_THERMOMETER " Max"
#define MSG_FACTOR LCD_STR_THERMOMETER " Fact" #define MSG_FACTOR " "LCD_STR_THERMOMETER " Fact"
#define MSG_IDLEOOZING "Anti oozing" #define MSG_IDLEOOZING "Anti oozing"
#define MSG_AUTOTEMP "Autotemp" #define MSG_AUTOTEMP "Autotemp"
#define MSG_ON "On " #define MSG_ON "On "
...@@ -151,6 +152,10 @@ ...@@ -151,6 +152,10 @@
#define MSG_ERR_MINTEMP "Err: MINTEMP" #define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED" #define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#define MSG_DEBUG_ECHO "DEBUG RIPETI"
#define MSG_DEBUG_INFO "DEBUG INFO"
#define MSG_DEBUG_ERRORS "DEBUG ERRORI"
#define MSG_DEBUG_DRYRUN "DEBUG STAMPA A VUOTO"
#ifdef DELTA #ifdef DELTA
#define MSG_DELTA_CALIBRATE "Calibraz. Delta" #define MSG_DELTA_CALIBRATE "Calibraz. Delta"
......
...@@ -515,7 +515,7 @@ float junction_deviation = 0.1; ...@@ -515,7 +515,7 @@ float junction_deviation = 0.1;
if (extruder != 1) if (extruder != 1)
#endif // NPR2 #endif // NPR2
{ {
if (degHotend(extruder) < extrude_min_temp && !debugDryrun()) { if (degHotend(extruder) < extrude_min_temp && !(debugLevel & DEBUG_DRYRUN)) {
position[E_AXIS] = target[E_AXIS]; //behave as if the move really took place, but ignore E part position[E_AXIS] = target[E_AXIS]; //behave as if the move really took place, but ignore E part
de = 0; // no difference de = 0; // no difference
ECHO_S(OK); ECHO_S(OK);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment