From 793cd0ae3b13bcc31f116ead6da9dbe527128817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Br=C3=A1zio?= Date: Thu, 10 Mar 2016 11:52:43 +0000 Subject: [PATCH] Clean up the code a bit --- Marlin/Marlin_main.cpp | 11 +++++------ Marlin/dogm_lcd_implementation.h | 4 ++-- Marlin/ultralcd_implementation_hitachi_HD44780.h | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index dd9c0b53b0..5fa631f1a3 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3837,7 +3837,7 @@ inline void gcode_M104() { // Detect if a print job has finished. // When the target temperature for all extruders is zero then we must have // finished printing. - if( print_job_start_ms != 0 ) { + if (print_job_start_ms) { bool all_extruders_cooling = true; for (int i = 0; i < EXTRUDERS; i++) if( degTargetHotend(i) > 0 ) { all_extruders_cooling = false; @@ -3957,7 +3957,6 @@ inline void gcode_M105() { * Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling. */ inline void gcode_M109() { - float temp; bool no_wait_for_cooling = true; if (setTargetedHotend(109)) return; @@ -3965,16 +3964,16 @@ inline void gcode_M109() { no_wait_for_cooling = code_seen('S'); if (no_wait_for_cooling || code_seen('R')) { - temp = code_value(); + float temp = code_value(); setTargetHotend(temp, target_extruder); #if ENABLED(DUAL_X_CARRIAGE) if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0) setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset); #endif - } - // Only makes sense to show the heating message if we're in fact heating. - if( temp > 0 ) LCD_MESSAGEPGM(MSG_HEATING); + // Only makes sense to show the heating message if we're in fact heating. + if (temp > 0) LCD_MESSAGEPGM(MSG_HEATING); + } #if ENABLED(AUTOTEMP) autotemp_enabled = code_seen('F'); diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 12a7d99804..e7ebea71d1 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -306,8 +306,8 @@ static void lcd_implementation_status_screen() { u8g.setPrintPos(80,48); if (print_job_start_ms != 0) { - uint16_t time = ((print_job_stop_ms > print_job_start_ms) - ? print_job_stop_ms : millis()) / 60000 - print_job_start_ms / 60000; + uint16_t time = (((print_job_stop_ms > print_job_start_ms) + ? print_job_stop_ms : millis()) - print_job_start_ms) / 60000; lcd_print(itostr2(time/60)); lcd_print(':'); lcd_print(itostr2(time%60)); diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 5357081aed..92114db491 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -707,8 +707,8 @@ static void lcd_implementation_status_screen() { lcd.setCursor(LCD_WIDTH - 6, 2); lcd.print(LCD_STR_CLOCK[0]); if (print_job_start_ms != 0) { - uint16_t time = ((print_job_stop_ms > print_job_start_ms) - ? print_job_stop_ms : millis()) / 60000 - print_job_start_ms / 60000; + uint16_t time = (((print_job_stop_ms > print_job_start_ms) + ? print_job_stop_ms : millis()) - print_job_start_ms) / 60000; lcd.print(itostr2(time / 60)); lcd.print(':'); lcd.print(itostr2(time % 60));