Clean up the code a bit

This commit is contained in:
João Brázio 2016-03-10 11:52:43 +00:00
parent 986b508ff7
commit 793cd0ae3b
3 changed files with 9 additions and 10 deletions

View file

@ -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');

View file

@ -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));

View file

@ -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));