Browse Source

✨ Optional HOST_STATUS_NOTIFICATIONS (#22833)

Taylor Talkington 3 years ago
parent
commit
7763f9385d
No account linked to committer's email address

+ 7
- 4
Marlin/Configuration_adv.h View File

3952
  */
3952
  */
3953
 //#define HOST_ACTION_COMMANDS
3953
 //#define HOST_ACTION_COMMANDS
3954
 #if ENABLED(HOST_ACTION_COMMANDS)
3954
 #if ENABLED(HOST_ACTION_COMMANDS)
3955
-  //#define HOST_PAUSE_M76
3956
-  //#define HOST_PROMPT_SUPPORT
3957
-  //#define HOST_START_MENU_ITEM      // Add a menu item that tells the host to start
3958
-  //#define HOST_SHUTDOWN_MENU_ITEM   // Add a menu item that tells the host to shut down
3955
+  //#define HOST_PAUSE_M76                // Tell the host to pause in response to M76
3956
+  //#define HOST_PROMPT_SUPPORT           // Initiate host prompts to get user feedback
3957
+  #if ENABLED(HOST_PROMPT_SUPPORT)
3958
+    //#define HOST_STATUS_NOTIFICATIONS   // Send some status messages to the host as notifications
3959
+  #endif
3960
+  //#define HOST_START_MENU_ITEM          // Add a menu item that tells the host to start
3961
+  //#define HOST_SHUTDOWN_MENU_ITEM       // Add a menu item that tells the host to shut down
3959
 #endif
3962
 #endif
3960
 
3963
 
3961
 /**
3964
 /**

+ 8
- 0
Marlin/src/gcode/control/M111.cpp View File

22
 
22
 
23
 #include "../gcode.h"
23
 #include "../gcode.h"
24
 
24
 
25
+#if ENABLED(HOST_ACTION_COMMANDS)
26
+  #include "../../feature/host_actions.h"
27
+#endif
28
+
25
 /**
29
 /**
26
  * M111: Set the debug level
30
  * M111: Set the debug level
27
  */
31
  */
28
 void GcodeSuite::M111() {
32
 void GcodeSuite::M111() {
29
   if (parser.seenval('S')) marlin_debug_flags = parser.value_byte();
33
   if (parser.seenval('S')) marlin_debug_flags = parser.value_byte();
30
 
34
 
35
+  #if EITHER(HOST_ACTION_COMMANDS, HOST_PROMPT_SUPPORT)
36
+    if (parser.seenval('H')) hostui.flag.bits = parser.value_byte();
37
+  #endif
38
+
31
   static PGMSTR(str_debug_1, STR_DEBUG_ECHO);
39
   static PGMSTR(str_debug_1, STR_DEBUG_ECHO);
32
   static PGMSTR(str_debug_2, STR_DEBUG_INFO);
40
   static PGMSTR(str_debug_2, STR_DEBUG_INFO);
33
   static PGMSTR(str_debug_4, STR_DEBUG_ERRORS);
41
   static PGMSTR(str_debug_4, STR_DEBUG_ERRORS);

+ 0
- 6
Marlin/src/inc/SanityCheck.h View File

611
   #error "DEFAULT_LCD_BRIGHTNESS is now LCD_BRIGHTNESS_DEFAULT."
611
   #error "DEFAULT_LCD_BRIGHTNESS is now LCD_BRIGHTNESS_DEFAULT."
612
 #endif
612
 #endif
613
 
613
 
614
-#if MB(DUE3DOM_MINI) && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
615
-  #warning "Onboard temperature sensor for BOARD_DUE3DOM_MINI has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
616
-#elif MB(BTT_SKR_E3_TURBO) && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
617
-  #warning "Onboard temperature sensor for BOARD_BTT_SKR_E3_TURBO has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
618
-#endif
619
-
620
 constexpr float arm[] = AXIS_RELATIVE_MODES;
614
 constexpr float arm[] = AXIS_RELATIVE_MODES;
621
 static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _LOGICAL_AXES_STR "elements.");
615
 static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _LOGICAL_AXES_STR "elements.");
622
 
616
 

+ 10
- 0
Marlin/src/inc/Warnings.cpp View File

59
   #warning "Your Configuration provides no method to acquire user feedback!"
59
   #warning "Your Configuration provides no method to acquire user feedback!"
60
 #endif
60
 #endif
61
 
61
 
62
+#if MB(DUE3DOM_MINI) && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
63
+  #warning "Onboard temperature sensor for BOARD_DUE3DOM_MINI has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
64
+#elif MB(BTT_SKR_E3_TURBO) && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
65
+  #warning "Onboard temperature sensor for BOARD_BTT_SKR_E3_TURBO has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
66
+#endif
67
+
62
 #ifndef NO_AUTO_ASSIGN_WARNING
68
 #ifndef NO_AUTO_ASSIGN_WARNING
63
 
69
 
64
   #if AUTO_ASSIGNED_X2_STEPPER
70
   #if AUTO_ASSIGNED_X2_STEPPER
541
   #warning "Creality 4.2.2 boards come with a variety of stepper drivers. Check the board label and set the correct *_DRIVER_TYPE! (C=HR4988, E=A4988, A=TMC2208, B=TMC2209, H=TMC2225)."
547
   #warning "Creality 4.2.2 boards come with a variety of stepper drivers. Check the board label and set the correct *_DRIVER_TYPE! (C=HR4988, E=A4988, A=TMC2208, B=TMC2209, H=TMC2225)."
542
 #endif
548
 #endif
543
 
549
 
550
+#if PRINTCOUNTER_SYNC
551
+  #warning "To prevent step loss, motion will pause for PRINTCOUNTER auto-save."
552
+#endif
553
+
544
 #if HOMING_Z_WITH_PROBE && IS_CARTESIAN && DISABLED(Z_SAFE_HOMING)
554
 #if HOMING_Z_WITH_PROBE && IS_CARTESIAN && DISABLED(Z_SAFE_HOMING)
545
   #error "Z_SAFE_HOMING is recommended when homing with a probe. Enable Z_SAFE_HOMING or comment out this line to continue."
555
   #error "Z_SAFE_HOMING is recommended when homing with a probe. Enable Z_SAFE_HOMING or comment out this line to continue."
546
 #endif
556
 #endif

+ 5
- 2
Marlin/src/lcd/marlinui.cpp View File

1363
   void MarlinUI::set_status(const char * const cstr, const bool persist) {
1363
   void MarlinUI::set_status(const char * const cstr, const bool persist) {
1364
     if (alert_level) return;
1364
     if (alert_level) return;
1365
 
1365
 
1366
-    TERN_(HOST_PROMPT_SUPPORT, hostui.notify(cstr));
1366
+    TERN_(HOST_STATUS_NOTIFICATIONS, hostui.notify(cstr));
1367
 
1367
 
1368
     // Here we have a problem. The message is encoded in UTF8, so
1368
     // Here we have a problem. The message is encoded in UTF8, so
1369
     // arbitrarily cutting it will be a problem. We MUST be sure
1369
     // arbitrarily cutting it will be a problem. We MUST be sure
1435
     if (level < alert_level) return;
1435
     if (level < alert_level) return;
1436
     alert_level = level;
1436
     alert_level = level;
1437
 
1437
 
1438
-    TERN_(HOST_PROMPT_SUPPORT, hostui.notify(fstr));
1438
+    TERN_(HOST_STATUS_NOTIFICATIONS, hostui.notify(fstr));
1439
 
1439
 
1440
     // Since the message is encoded in UTF8 it must
1440
     // Since the message is encoded in UTF8 it must
1441
     // only be cut on a character boundary.
1441
     // only be cut on a character boundary.
1473
     va_start(args, FTOP(fmt));
1473
     va_start(args, FTOP(fmt));
1474
     vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, FTOP(fmt), args);
1474
     vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, FTOP(fmt), args);
1475
     va_end(args);
1475
     va_end(args);
1476
+
1477
+    TERN_(HOST_STATUS_NOTIFICATIONS, hostui.notify(status_message));
1478
+
1476
     finish_status(level > 0);
1479
     finish_status(level > 0);
1477
   }
1480
   }
1478
 
1481
 

+ 0
- 1
Marlin/src/module/printcounter.cpp View File

43
 
43
 
44
 #if PRINTCOUNTER_SYNC
44
 #if PRINTCOUNTER_SYNC
45
   #include "../module/planner.h"
45
   #include "../module/planner.h"
46
-  #warning "To prevent step loss, motion will pause for PRINTCOUNTER auto-save."
47
 #endif
46
 #endif
48
 
47
 
49
 // Service intervals
48
 // Service intervals

+ 20
- 3
Marlin/src/module/settings.cpp View File

80
   #include "../lcd/e3v2/jyersui/dwin.h"
80
   #include "../lcd/e3v2/jyersui/dwin.h"
81
 #endif
81
 #endif
82
 
82
 
83
+#if ENABLED(HOST_PROMPT_SUPPORT)
84
+  #include "../feature/host_actions.h"
85
+#endif
86
+
83
 #if HAS_SERVOS
87
 #if HAS_SERVOS
84
   #include "servo.h"
88
   #include "servo.h"
85
 #endif
89
 #endif
652
 #define DEBUG_OUT EITHER(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE)
656
 #define DEBUG_OUT EITHER(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE)
653
 #include "../core/debug_out.h"
657
 #include "../core/debug_out.h"
654
 
658
 
659
+#if BOTH(EEPROM_CHITCHAT, HOST_PROMPT_SUPPORT)
660
+  #define HOST_EEPROM_CHITCHAT 1
661
+#endif
662
+
655
 #if ENABLED(EEPROM_SETTINGS)
663
 #if ENABLED(EEPROM_SETTINGS)
656
 
664
 
657
   #define EEPROM_ASSERT(TST,ERR)  do{ if (!(TST)) { SERIAL_ERROR_MSG(ERR); eeprom_error = true; } }while(0)
665
   #define EEPROM_ASSERT(TST,ERR)  do{ if (!(TST)) { SERIAL_ERROR_MSG(ERR); eeprom_error = true; } }while(0)
1554
         store_mesh(ubl.storage_slot);
1562
         store_mesh(ubl.storage_slot);
1555
     #endif
1563
     #endif
1556
 
1564
 
1557
-    if (!eeprom_error) LCD_MESSAGE(MSG_SETTINGS_STORED);
1565
+    if (!eeprom_error) {
1566
+      LCD_MESSAGE(MSG_SETTINGS_STORED);
1567
+      TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_SETTINGS_STORED)));
1568
+    }
1558
 
1569
 
1559
     TERN_(EXTENSIBLE_UI, ExtUI::onConfigurationStoreWritten(!eeprom_error));
1570
     TERN_(EXTENSIBLE_UI, ExtUI::onConfigurationStoreWritten(!eeprom_error));
1560
 
1571
 
1578
       }
1589
       }
1579
       DEBUG_ECHO_MSG("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")");
1590
       DEBUG_ECHO_MSG("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")");
1580
       TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_ERR_EEPROM_VERSION));
1591
       TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_ERR_EEPROM_VERSION));
1592
+      TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_ERR_EEPROM_VERSION)));
1581
 
1593
 
1582
       IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_version());
1594
       IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_version());
1583
       eeprom_error = true;
1595
       eeprom_error = true;
2468
         eeprom_error = true;
2480
         eeprom_error = true;
2469
         DEBUG_ERROR_MSG("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!");
2481
         DEBUG_ERROR_MSG("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!");
2470
         TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_ERR_EEPROM_CRC));
2482
         TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_ERR_EEPROM_CRC));
2483
+        TERN_(HOST_EEPROM_CHITCHAT, hostui.notify(GET_TEXT_F(MSG_ERR_EEPROM_CRC)));
2471
         IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_crc());
2484
         IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_crc());
2472
       }
2485
       }
2473
       else if (!validating) {
2486
       else if (!validating) {
2474
         DEBUG_ECHO_START();
2487
         DEBUG_ECHO_START();
2475
         DEBUG_ECHO(version);
2488
         DEBUG_ECHO(version);
2476
         DEBUG_ECHOLNPGM(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET), " bytes; crc ", (uint32_t)working_crc, ")");
2489
         DEBUG_ECHOLNPGM(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET), " bytes; crc ", (uint32_t)working_crc, ")");
2490
+        TERN_(HOST_EEPROM_CHITCHAT, hostui.notify(F("Stored settings retrieved")));
2477
       }
2491
       }
2478
 
2492
 
2479
       if (!validating && !eeprom_error) postprocess();
2493
       if (!validating && !eeprom_error) postprocess();
2783
     #endif
2797
     #endif
2784
   #endif
2798
   #endif
2785
 
2799
 
2786
-  TERN_(EXTENSIBLE_UI, ExtUI::onFactoryReset());
2787
   TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_SetDataDefaults());
2800
   TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_SetDataDefaults());
2788
   TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Reset_Settings());
2801
   TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Reset_Settings());
2789
 
2802
 
3142
 
3155
 
3143
   postprocess();
3156
   postprocess();
3144
 
3157
 
3145
-  DEBUG_ECHO_MSG("Hardcoded Default Settings Loaded");
3158
+  FSTR_P const hdsl = F("Hardcoded Default Settings Loaded");
3159
+  TERN_(HOST_EEPROM_CHITCHAT, hostui.notify(hdsl));
3160
+  DEBUG_ECHO_START(); DEBUG_ECHOLNF(hdsl);
3161
+
3162
+  TERN_(EXTENSIBLE_UI, ExtUI::onFactoryReset());
3146
 }
3163
 }
3147
 
3164
 
3148
 #if DISABLED(DISABLE_M503)
3165
 #if DISABLED(DISABLE_M503)

+ 4
- 0
Marlin/src/module/temperature.cpp View File

629
       SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
629
       SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
630
       TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
630
       TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
631
       TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_TEMP_TOO_HIGH));
631
       TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_TEMP_TOO_HIGH));
632
+      TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)));
632
       return;
633
       return;
633
     }
634
     }
634
 
635
 
719
         SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
720
         SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
720
         TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
721
         TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
721
         TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_TEMP_TOO_HIGH));
722
         TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_TEMP_TOO_HIGH));
723
+        TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)));
722
         break;
724
         break;
723
       }
725
       }
724
 
726
 
756
         TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0));
758
         TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0));
757
         TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_TUNING_TIMEOUT));
759
         TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_TUNING_TIMEOUT));
758
         TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT));
760
         TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT));
761
+        TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TIMEOUT)));
759
         SERIAL_ECHOLNPGM(STR_PID_TIMEOUT);
762
         SERIAL_ECHOLNPGM(STR_PID_TIMEOUT);
760
         break;
763
         break;
761
       }
764
       }
762
 
765
 
763
       if (cycles > ncycles && cycles > 2) {
766
       if (cycles > ncycles && cycles > 2) {
764
         SERIAL_ECHOLNPGM(STR_PID_AUTOTUNE_FINISHED);
767
         SERIAL_ECHOLNPGM(STR_PID_AUTOTUNE_FINISHED);
768
+        TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE)));
765
 
769
 
766
         #if EITHER(PIDTEMPBED, PIDTEMPCHAMBER)
770
         #if EITHER(PIDTEMPBED, PIDTEMPCHAMBER)
767
           FSTR_P const estring = GHV(F("chamber"), F("bed"), FPSTR(NUL_STR));
771
           FSTR_P const estring = GHV(F("chamber"), F("bed"), FPSTR(NUL_STR));

+ 1
- 1
buildroot/tests/rambo View File

115
         FAN_MIN_PWM 50 FAN_KICKSTART_TIME 100 \
115
         FAN_MIN_PWM 50 FAN_KICKSTART_TIME 100 \
116
         XY_FREQUENCY_LIMIT 15
116
         XY_FREQUENCY_LIMIT 15
117
 opt_enable COREYX USE_XMAX_PLUG MIXING_EXTRUDER GRADIENT_MIX \
117
 opt_enable COREYX USE_XMAX_PLUG MIXING_EXTRUDER GRADIENT_MIX \
118
-           BABYSTEPPING BABYSTEP_DISPLAY_TOTAL FILAMENT_LCD_DISPLAY FILAMENT_WIDTH_SENSOR \
118
+           BABYSTEPPING BABYSTEP_DISPLAY_TOTAL FILAMENT_LCD_DISPLAY \
119
            REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER MENU_ADDAUTOSTART SDSUPPORT SDCARD_SORT_ALPHA \
119
            REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER MENU_ADDAUTOSTART SDSUPPORT SDCARD_SORT_ALPHA \
120
            ENDSTOP_NOISE_THRESHOLD FAN_SOFT_PWM \
120
            ENDSTOP_NOISE_THRESHOLD FAN_SOFT_PWM \
121
            FIX_MOUNTED_PROBE PROBING_ESTEPPERS_OFF PROBE_OFFSET_WIZARD \
121
            FIX_MOUNTED_PROBE PROBING_ESTEPPERS_OFF PROBE_OFFSET_WIZARD \

Loading…
Cancel
Save