浏览代码

Clean up the code a bit

João Brázio 9 年前
父节点
当前提交
793cd0ae3b
共有 3 个文件被更改,包括 9 次插入10 次删除
  1. 5
    6
      Marlin/Marlin_main.cpp
  2. 2
    2
      Marlin/dogm_lcd_implementation.h
  3. 2
    2
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 5
- 6
Marlin/Marlin_main.cpp 查看文件

3837
   // Detect if a print job has finished.
3837
   // Detect if a print job has finished.
3838
   // When the target temperature for all extruders is zero then we must have
3838
   // When the target temperature for all extruders is zero then we must have
3839
   // finished printing.
3839
   // finished printing.
3840
-  if( print_job_start_ms != 0 ) {
3840
+  if (print_job_start_ms) {
3841
     bool all_extruders_cooling = true;
3841
     bool all_extruders_cooling = true;
3842
     for (int i = 0; i < EXTRUDERS; i++) if( degTargetHotend(i) > 0 ) {
3842
     for (int i = 0; i < EXTRUDERS; i++) if( degTargetHotend(i) > 0 ) {
3843
       all_extruders_cooling = false;
3843
       all_extruders_cooling = false;
3957
  *       Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling.
3957
  *       Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling.
3958
  */
3958
  */
3959
 inline void gcode_M109() {
3959
 inline void gcode_M109() {
3960
-  float temp;
3961
   bool no_wait_for_cooling = true;
3960
   bool no_wait_for_cooling = true;
3962
 
3961
 
3963
   if (setTargetedHotend(109)) return;
3962
   if (setTargetedHotend(109)) return;
3965
 
3964
 
3966
   no_wait_for_cooling = code_seen('S');
3965
   no_wait_for_cooling = code_seen('S');
3967
   if (no_wait_for_cooling || code_seen('R')) {
3966
   if (no_wait_for_cooling || code_seen('R')) {
3968
-    temp = code_value();
3967
+    float temp = code_value();
3969
     setTargetHotend(temp, target_extruder);
3968
     setTargetHotend(temp, target_extruder);
3970
     #if ENABLED(DUAL_X_CARRIAGE)
3969
     #if ENABLED(DUAL_X_CARRIAGE)
3971
       if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
3970
       if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
3972
         setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
3971
         setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
3973
     #endif
3972
     #endif
3974
-  }
3975
 
3973
 
3976
-  // Only makes sense to show the heating message if we're in fact heating.
3977
-  if( temp > 0 ) LCD_MESSAGEPGM(MSG_HEATING);
3974
+    // Only makes sense to show the heating message if we're in fact heating.
3975
+    if (temp > 0) LCD_MESSAGEPGM(MSG_HEATING);
3976
+  }
3978
 
3977
 
3979
   #if ENABLED(AUTOTEMP)
3978
   #if ENABLED(AUTOTEMP)
3980
     autotemp_enabled = code_seen('F');
3979
     autotemp_enabled = code_seen('F');

+ 2
- 2
Marlin/dogm_lcd_implementation.h 查看文件

306
 
306
 
307
     u8g.setPrintPos(80,48);
307
     u8g.setPrintPos(80,48);
308
     if (print_job_start_ms != 0) {
308
     if (print_job_start_ms != 0) {
309
-      uint16_t time = ((print_job_stop_ms > print_job_start_ms)
310
-                       ? print_job_stop_ms : millis()) / 60000 - print_job_start_ms / 60000;
309
+      uint16_t time = (((print_job_stop_ms > print_job_start_ms)
310
+                       ? print_job_stop_ms : millis()) - print_job_start_ms) / 60000;
311
       lcd_print(itostr2(time/60));
311
       lcd_print(itostr2(time/60));
312
       lcd_print(':');
312
       lcd_print(':');
313
       lcd_print(itostr2(time%60));
313
       lcd_print(itostr2(time%60));

+ 2
- 2
Marlin/ultralcd_implementation_hitachi_HD44780.h 查看文件

707
     lcd.setCursor(LCD_WIDTH - 6, 2);
707
     lcd.setCursor(LCD_WIDTH - 6, 2);
708
     lcd.print(LCD_STR_CLOCK[0]);
708
     lcd.print(LCD_STR_CLOCK[0]);
709
     if (print_job_start_ms != 0) {
709
     if (print_job_start_ms != 0) {
710
-      uint16_t time = ((print_job_stop_ms > print_job_start_ms)
711
-                       ? print_job_stop_ms : millis()) / 60000 - print_job_start_ms / 60000;
710
+      uint16_t time = (((print_job_stop_ms > print_job_start_ms)
711
+                       ? print_job_stop_ms : millis()) - print_job_start_ms) / 60000;
712
       lcd.print(itostr2(time / 60));
712
       lcd.print(itostr2(time / 60));
713
       lcd.print(':');
713
       lcd.print(':');
714
       lcd.print(itostr2(time % 60));
714
       lcd.print(itostr2(time % 60));

正在加载...
取消
保存