Browse Source

Spacing, coding standards

Scott Lahteine 8 years ago
parent
commit
d9dcef8a87

+ 3
- 3
Marlin/Configuration_adv.h View File

@@ -728,9 +728,9 @@
728 728
                                               // or until outcoming filament color is not clear for filament color change
729 729
   #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3  // Extrude filament feedrate in mm/s - must be slower than load feedrate
730 730
   #define FILAMENT_CHANGE_NOZZLE_TIMEOUT 45L  // Turn off nozzle if user doesn't change filament within this time limit in seconds
731
-  #define FILAMENT_CHANGE_NUMBER_OF_ALERT_BEEPS  5L             // Number of alert beeps before printer goes quiet 
732
-  #define STEPPER_MOTORS_DONT_TIMEOUT_DURING_FILAMENT_CHANGE    // Enable to make stepper motors hold position during filament change even if it 
733
-                                                                // takes longer than DEFAULT_STEPPER_DEACTIVE_TIME
731
+  #define FILAMENT_CHANGE_NUMBER_OF_ALERT_BEEPS  5L  // Number of alert beeps before printer goes quiet
732
+  #define FILAMENT_CHANGE_NO_STEPPER_TIMEOUT         // Enable to have stepper motors hold position during filament change
733
+                                                     // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
734 734
 #endif
735 735
 
736 736
 /******************************************************************************\

+ 36
- 40
Marlin/Marlin_main.cpp View File

@@ -7310,7 +7310,7 @@ inline void gcode_M503() {
7310 7310
     }
7311 7311
   }
7312 7312
 
7313
-  bool busy_doing_M600 = false;
7313
+  static bool busy_doing_M600 = false;
7314 7314
 
7315 7315
   /**
7316 7316
    * M600: Pause for filament change
@@ -7351,8 +7351,6 @@ inline void gcode_M503() {
7351 7351
       #define RUNPLAN(RATE_MM_S) line_to_destination(RATE_MM_S);
7352 7352
     #endif
7353 7353
 
7354
-    KEEPALIVE_STATE(IN_HANDLER);
7355
-
7356 7354
     // Initial retract before move to filament change position
7357 7355
     if (code_seen('E')) destination[E_AXIS] += code_value_axis_units(E_AXIS);
7358 7356
     #if defined(FILAMENT_CHANGE_RETRACT_LENGTH) && FILAMENT_CHANGE_RETRACT_LENGTH > 0
@@ -7409,10 +7407,9 @@ inline void gcode_M503() {
7409 7407
     disable_e3();
7410 7408
     delay(100);
7411 7409
 
7412
-    millis_t nozzle_timeout = millis() + FILAMENT_CHANGE_NOZZLE_TIMEOUT*1000L;
7410
+    millis_t nozzle_timeout = millis() + FILAMENT_CHANGE_NOZZLE_TIMEOUT * 1000L;
7413 7411
     bool nozzle_timed_out = false;
7414 7412
     float temps[4];
7415
-    int iii;
7416 7413
 
7417 7414
     // Wait for filament insert by user and press button
7418 7415
     lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_INSERT);
@@ -7422,62 +7419,62 @@ inline void gcode_M503() {
7422 7419
     wait_for_user = true;    // LCD click or M108 will clear this
7423 7420
     next_buzz = 0;
7424 7421
     runout_beep = 0;
7425
-    for( iii=0; iii<HOTENDS; iii++)      //Save nozzle temps
7426
-      temps[iii] = thermalManager.target_temperature[iii]; 
7422
+    HOTEND_LOOP() temps[e] = thermalManager.target_temperature[e]; // Save nozzle temps
7427 7423
 
7428 7424
     while (wait_for_user) {
7429 7425
       millis_t current_ms = millis();
7430
-      if (nozzle_timed_out == true)
7426
+      if (nozzle_timed_out)
7431 7427
         lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_CLICK_TO_HEAT_NOZZLE);
7428
+
7432 7429
       #if HAS_BUZZER 
7433 7430
         filament_change_beep();
7434
-      #endif //HAS_BUZZER
7431
+      #endif
7435 7432
 
7436 7433
       if (current_ms >= nozzle_timeout) {
7437
-        if (nozzle_timed_out == false ) {
7438
-          nozzle_timed_out = true;         // if the nozzle time out happens, remember we turned off the nozzles. 
7439
-          for( iii=0; iii<HOTENDS; iii++)  // turn off all the nozzles
7440
-            thermalManager.setTargetHotend( 0.0 , iii );
7441
-
7434
+        if (!nozzle_timed_out) {
7435
+          nozzle_timed_out = true; // on nozzle timeout remember the nozzles need to be reheated
7436
+          HOTEND_LOOP() thermalManager.setTargetHotend(0, e); // Turn off all the nozzles
7442 7437
           lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_CLICK_TO_HEAT_NOZZLE);
7443 7438
         }
7444 7439
       }
7445 7440
       idle(true);
7446 7441
     }
7447 7442
 
7448
-    if (nozzle_timed_out == true ) {      // Turn nozzles back on if we turned them off.
7449
-      for( iii=0; iii<HOTENDS; iii++)
7450
-        thermalManager.setTargetHotend( temps[iii] , iii );
7451
-      lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT);
7452
-    }
7443
+    if (nozzle_timed_out)      // Turn nozzles back on if they were turned off
7444
+      HOTEND_LOOP() thermalManager.setTargetHotend(temps[e], e);
7453 7445
 
7454
-KEEP_CHECKING_TEMPS:
7455
-    idle();
7456
-    for( iii=0; iii<HOTENDS; iii++){
7457
-      if (abs(thermalManager.degHotend(iii)-temps[iii]) > 3 ) {
7458
-        lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT);
7459
-        goto KEEP_CHECKING_TEMPS;
7446
+    // Show "wait for heating"
7447
+    lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT);
7448
+
7449
+    wait_for_heatup = true;
7450
+    while (wait_for_heatup) {
7451
+      idle();
7452
+      wait_for_heatup = false;
7453
+      HOTEND_LOOP() {
7454
+        if (abs(thermalManager.degHotend(e) - temps[e]) > 3) {
7455
+          wait_for_heatup = true;
7456
+          break;
7457
+        }
7460 7458
       }
7461 7459
     }
7462 7460
 
7461
+    // Show "insert filament"
7462
+    if (nozzle_timed_out)
7463
+      lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_INSERT);
7464
+
7463 7465
     wait_for_user = true;    // LCD click or M108 will clear this
7464 7466
     next_buzz = 0;
7465 7467
     runout_beep = 0;
7466
-    while (wait_for_user) {
7467
-      if (nozzle_timed_out == true)
7468
-        lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_INSERT);
7469
-      else break;
7468
+    while (wait_for_user && nozzle_timed_out) {
7470 7469
       #if HAS_BUZZER
7471 7470
         filament_change_beep();
7472 7471
       #endif
7473 7472
       idle(true);
7474 7473
     }
7475 7474
 
7476
-    // Show load message
7475
+    // Show "load" message
7477 7476
     lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_LOAD);
7478 7477
 
7479
-    idle();
7480
-
7481 7478
     // Load filament
7482 7479
     if (code_seen('L')) destination[E_AXIS] -= code_value_axis_units(E_AXIS);
7483 7480
     #if defined(FILAMENT_CHANGE_LOAD_LENGTH) && FILAMENT_CHANGE_LOAD_LENGTH > 0
@@ -7504,8 +7501,6 @@ KEEP_CHECKING_TEMPS:
7504 7501
 
7505 7502
     lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_RESUME);
7506 7503
 
7507
-    KEEPALIVE_STATE(IN_HANDLER);
7508
-
7509 7504
     // Set extruder to saved position
7510 7505
     destination[E_AXIS] = current_position[E_AXIS] = lastpos[E_AXIS];
7511 7506
     planner.set_e_position_mm(current_position[E_AXIS]);
@@ -10144,14 +10139,15 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
10144 10139
   millis_t ms = millis();
10145 10140
 
10146 10141
   if (max_inactive_time && ELAPSED(ms, previous_cmd_ms + max_inactive_time)) kill(PSTR(MSG_KILLED));
10147
-	
10148
-  #if ENABLED(FILAMENT_CHANGE_FEATURE)
10149
-    #ifdef STEPPER_MOTORS_DONT_TIMEOUT_DURING_FILAMENT_CHANGE
10150
-      if (busy_doing_M600 == false )	   // We only allow the stepper motors to time out if
10151
-    #endif                                 // we are not in the middle of an M600 command.
10142
+
10143
+  // Prevent steppers timing-out in the middle of M600
10144
+  #if ENABLED(FILAMENT_CHANGE_FEATURE) && ENABLED(FILAMENT_CHANGE_NO_STEPPER_TIMEOUT)
10145
+    #define M600_TEST !busy_doing_M600
10146
+  #else
10147
+    #define M600_TEST true
10152 10148
   #endif
10153 10149
              
10154
-  if (stepper_inactive_time && ELAPSED(ms, previous_cmd_ms + stepper_inactive_time)
10150
+  if (M600_TEST && stepper_inactive_time && ELAPSED(ms, previous_cmd_ms + stepper_inactive_time)
10155 10151
       && !ignore_stepper_queue && !planner.blocks_queued()) {
10156 10152
     #if ENABLED(DISABLE_INACTIVE_X)
10157 10153
       disable_x();

+ 8
- 15
Marlin/ultralcd.cpp View File

@@ -950,7 +950,7 @@ void kill_screen(const char* lcd_msg) {
950 950
     // Change filament
951 951
     //
952 952
     #if ENABLED(FILAMENT_CHANGE_FEATURE)
953
-   	  if (!thermalManager.tooColdToExtrude(active_extruder))
953
+      if (!thermalManager.tooColdToExtrude(active_extruder))
954 954
         MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_enqueue_filament_change);
955 955
     #endif
956 956
 
@@ -2446,19 +2446,19 @@ KeepDrawing:
2446 2446
     }
2447 2447
   #endif // LCD_INFO_MENU
2448 2448
 
2449
-    /**
2450
-     *
2451
-     * Filament Change Feature Screens
2452
-     *
2453
-     */
2449
+  /**
2450
+   *
2451
+   * Filament Change Feature Screens
2452
+   *
2453
+   */
2454 2454
   #if ENABLED(FILAMENT_CHANGE_FEATURE)
2455 2455
 
2456 2456
     void lcd_filament_change_toocold_menu() {
2457 2457
       START_MENU();
2458 2458
       STATIC_ITEM(MSG_HEATING_FAILED_LCD, true, true);
2459
-      STATIC_ITEM (MSG_FILAMENT_CHANGE_MINTEMP STRINGIFY(EXTRUDE_MINTEMP) ".", false, false);
2459
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_MINTEMP STRINGIFY(EXTRUDE_MINTEMP) ".", false, false);
2460 2460
       MENU_BACK(MSG_BACK);
2461
-      STATIC_ITEM (" ");
2461
+      STATIC_ITEM(" ");
2462 2462
       STATIC_ITEM(MSG_FILAMENT_CHANGE_NOZZLE, false, true);
2463 2463
       lcd_implementation_hotend_status();
2464 2464
       END_MENU();
@@ -2604,31 +2604,24 @@ KeepDrawing:
2604 2604
       switch (message) {
2605 2605
         case FILAMENT_CHANGE_MESSAGE_INIT:
2606 2606
           defer_return_to_status = true;
2607
-          lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
2608 2607
           lcd_goto_screen(lcd_filament_change_init_message);
2609 2608
           break;
2610 2609
         case FILAMENT_CHANGE_MESSAGE_UNLOAD:
2611
-          lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
2612 2610
           lcd_goto_screen(lcd_filament_change_unload_message);
2613 2611
           break;
2614 2612
         case FILAMENT_CHANGE_MESSAGE_INSERT:
2615
-          lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
2616 2613
           lcd_goto_screen(lcd_filament_change_insert_message);
2617 2614
           break;
2618 2615
         case FILAMENT_CHANGE_MESSAGE_LOAD:
2619
-          lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
2620 2616
           lcd_goto_screen(lcd_filament_change_load_message);
2621 2617
           break;
2622 2618
         case FILAMENT_CHANGE_MESSAGE_EXTRUDE:
2623
-          lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
2624 2619
           lcd_goto_screen(lcd_filament_change_extrude_message);
2625 2620
           break;
2626 2621
         case FILAMENT_CHANGE_MESSAGE_CLICK_TO_HEAT_NOZZLE:
2627
-          lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
2628 2622
           lcd_goto_screen(lcd_filament_change_heat_nozzle);
2629 2623
           break;
2630 2624
         case FILAMENT_CHANGE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT:
2631
-          lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
2632 2625
           lcd_goto_screen(lcd_filament_change_wait_for_nozzles_to_heat);
2633 2626
           break;
2634 2627
         case FILAMENT_CHANGE_MESSAGE_OPTION:

+ 3
- 3
Marlin/ultralcd_impl_DOGM.h View File

@@ -382,9 +382,9 @@ FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr,
382 382
 
383 383
 static void lcd_implementation_hotend_status() {
384 384
   u8g.setPrintPos(58, 60);
385
-  lcd_print( (char) '0'+active_extruder );
386
-  lcd_print( ' ' ); 
387
-  lcd_print( ' ' ); 
385
+  lcd_print((char)('0' + active_extruder));
386
+  lcd_print(' ');
387
+  lcd_print(' ');
388 388
   lcd_print(itostr3(thermalManager.degHotend(active_extruder)));
389 389
   lcd_print('/');
390 390
   lcd_print(itostr3(thermalManager.degTargetHotend(active_extruder)));

+ 1
- 1
Marlin/ultralcd_impl_HD44780.h View File

@@ -593,7 +593,7 @@ FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr,
593 593
 #endif // LCD_PROGRESS_BAR
594 594
 
595 595
 static void lcd_implementation_hotend_status() {
596
-  lcd.setCursor(10,3);
596
+  lcd.setCursor(10, 3);
597 597
   lcd.print(LCD_STR_THERMOMETER[active_extruder]);
598 598
   lcd.print(itostr3(thermalManager.degHotend(active_extruder)));
599 599
   lcd.print('/');

Loading…
Cancel
Save