Просмотр исходного кода

ExtUI homing / leveling additions

Scott Lahteine 3 лет назад
Родитель
Сommit
889695b6ba

+ 8
- 0
Marlin/src/MarlinCore.cpp Просмотреть файл

77
   #include "lcd/dwin/e3v2/rotary_encoder.h"
77
   #include "lcd/dwin/e3v2/rotary_encoder.h"
78
 #endif
78
 #endif
79
 
79
 
80
+#if ENABLED(EXTENSIBLE_UI)
81
+  #include "lcd/extui/ui_api.h"
82
+#endif
83
+
80
 #if HAS_ETHERNET
84
 #if HAS_ETHERNET
81
   #include "feature/ethernet.h"
85
   #include "feature/ethernet.h"
82
 #endif
86
 #endif
360
   ENABLE_AXIS_Y();
364
   ENABLE_AXIS_Y();
361
   ENABLE_AXIS_Z();
365
   ENABLE_AXIS_Z();
362
   enable_e_steppers();
366
   enable_e_steppers();
367
+
368
+  TERN_(EXTENSIBLE_UI, ExtUI::onSteppersEnabled());
363
 }
369
 }
364
 
370
 
365
 void disable_e_steppers() {
371
 void disable_e_steppers() {
379
   DISABLE_AXIS_Y();
385
   DISABLE_AXIS_Y();
380
   DISABLE_AXIS_Z();
386
   DISABLE_AXIS_Z();
381
   disable_e_steppers();
387
   disable_e_steppers();
388
+
389
+  TERN_(EXTENSIBLE_UI, ExtUI::onSteppersDisabled());
382
 }
390
 }
383
 
391
 
384
 #if ENABLED(G29_RETRY_AND_RECOVER)
392
 #if ENABLED(G29_RETRY_AND_RECOVER)

+ 2
- 0
Marlin/src/gcode/bedlevel/abl/G29.cpp Просмотреть файл

177
     if (DISABLED(PROBE_MANUALLY) && seenQ) G29_RETURN(false);
177
     if (DISABLED(PROBE_MANUALLY) && seenQ) G29_RETURN(false);
178
   #endif
178
   #endif
179
 
179
 
180
+  TERN_(EXTENSIBLE_UI, ExtUI::onMeshLevelingStart());
181
+
180
   const bool seenA = TERN0(PROBE_MANUALLY, parser.seen('A')),
182
   const bool seenA = TERN0(PROBE_MANUALLY, parser.seen('A')),
181
          no_action = seenA || seenQ,
183
          no_action = seenA || seenQ,
182
               faux = ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(PROBE_MANUALLY) ? parser.boolval('C') : no_action;
184
               faux = ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(PROBE_MANUALLY) ? parser.boolval('C') : no_action;

+ 8
- 0
Marlin/src/gcode/calibrate/G28.cpp Просмотреть файл

50
   #include "../../lcd/dwin/e3v2/dwin.h"
50
   #include "../../lcd/dwin/e3v2/dwin.h"
51
 #endif
51
 #endif
52
 
52
 
53
+#if ENABLED(EXTENSIBLE_UI)
54
+  #include "../../lcd/extui/ui_api.h"
55
+#endif
56
+
53
 #if HAS_L64XX                         // set L6470 absolute position registers to counts
57
 #if HAS_L64XX                         // set L6470 absolute position registers to counts
54
   #include "../../libs/L64XX/L64XX_Marlin.h"
58
   #include "../../libs/L64XX/L64XX_Marlin.h"
55
 #endif
59
 #endif
209
 
213
 
210
   TERN_(DWIN_CREALITY_LCD, HMI_flag.home_flag = true);
214
   TERN_(DWIN_CREALITY_LCD, HMI_flag.home_flag = true);
211
 
215
 
216
+  TERN_(EXTENSIBLE_UI, ExtUI::onHomingStart());
217
+
212
   #if ENABLED(DUAL_X_CARRIAGE)
218
   #if ENABLED(DUAL_X_CARRIAGE)
213
     bool IDEX_saved_duplication_state = extruder_duplication_enabled;
219
     bool IDEX_saved_duplication_state = extruder_duplication_enabled;
214
     DualXMode IDEX_saved_mode = dual_x_carriage_mode;
220
     DualXMode IDEX_saved_mode = dual_x_carriage_mode;
462
 
468
 
463
   TERN_(DWIN_CREALITY_LCD, DWIN_CompletedHoming());
469
   TERN_(DWIN_CREALITY_LCD, DWIN_CompletedHoming());
464
 
470
 
471
+  TERN_(EXTENSIBLE_UI, ExtUI::onHomingComplete());
472
+
465
   report_current_position();
473
   report_current_position();
466
 
474
 
467
   if (ENABLED(NANODLP_Z_SYNC) && (doZ || ENABLED(NANODLP_ALL_AXIS)))
475
   if (ENABLED(NANODLP_Z_SYNC) && (doZ || ENABLED(NANODLP_ALL_AXIS)))

+ 2
- 0
Marlin/src/gcode/sd/M1001.cpp Просмотреть файл

96
     queue.inject_P(PSTR(SD_FINISHED_RELEASECOMMAND));
96
     queue.inject_P(PSTR(SD_FINISHED_RELEASECOMMAND));
97
   #endif
97
   #endif
98
 
98
 
99
+  TERN_(EXTENSIBLE_UI, ExtUI::onPrintFinished());
100
+
99
   // Re-select the last printed file in the UI
101
   // Re-select the last printed file in the UI
100
   TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());
102
   TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());
101
 }
103
 }

+ 9
- 0
Marlin/src/lcd/extui/anycubic_chiron_lcd.cpp Просмотреть файл

62
   void onUserConfirmRequired(const char * const msg) { Chiron.ConfirmationRequest(msg);     }
62
   void onUserConfirmRequired(const char * const msg) { Chiron.ConfirmationRequest(msg);     }
63
   void onStatusChanged(const char * const msg)       { Chiron.StatusChange(msg);            }
63
   void onStatusChanged(const char * const msg)       { Chiron.StatusChange(msg);            }
64
 
64
 
65
+  void onHomingStart() {}
66
+  void onHomingComplete() {}
67
+  void onPrintFinished() {}
68
+
65
   void onFactoryReset() {}
69
   void onFactoryReset() {}
66
 
70
 
67
   void onStoreSettings(char *buff) {
71
   void onStoreSettings(char *buff) {
95
   }
99
   }
96
 
100
 
97
   #if HAS_MESH
101
   #if HAS_MESH
102
+    void onMeshLevelingStart() {}
103
+
98
     void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
104
     void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
99
       // Called when any mesh points are updated
105
       // Called when any mesh points are updated
100
       //SERIAL_ECHOLNPAIR("onMeshUpdate() x:", xpos, " y:", ypos, " z:", zval);
106
       //SERIAL_ECHOLNPAIR("onMeshUpdate() x:", xpos, " y:", ypos, " z:", zval);
116
       // Called for temperature PID tuning result
122
       // Called for temperature PID tuning result
117
     }
123
     }
118
   #endif
124
   #endif
125
+
126
+  void onSteppersDisabled() {}
127
+  void onSteppersEnabled()  {}
119
 }
128
 }
120
 
129
 
121
 #endif // ANYCUBIC_LCD_CHIRON
130
 #endif // ANYCUBIC_LCD_CHIRON

+ 16
- 3
Marlin/src/lcd/extui/anycubic_i3mega_lcd.cpp Просмотреть файл

52
   void onFilamentRunout(const extruder_t extruder)   { AnycubicTFT.OnFilamentRunout(); }
52
   void onFilamentRunout(const extruder_t extruder)   { AnycubicTFT.OnFilamentRunout(); }
53
   void onUserConfirmRequired(const char * const msg) { AnycubicTFT.OnUserConfirmRequired(msg); }
53
   void onUserConfirmRequired(const char * const msg) { AnycubicTFT.OnUserConfirmRequired(msg); }
54
   void onStatusChanged(const char * const msg) {}
54
   void onStatusChanged(const char * const msg) {}
55
+
56
+  void onHomingStart() {}
57
+  void onHomingComplete() {}
58
+  void onPrintFinished() {}
59
+
55
   void onFactoryReset() {}
60
   void onFactoryReset() {}
56
 
61
 
57
   void onStoreSettings(char *buff) {
62
   void onStoreSettings(char *buff) {
84
     // whether successful or not.
89
     // whether successful or not.
85
   }
90
   }
86
 
91
 
87
-  void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
88
-    // Called when any mesh points are updated
89
-  }
92
+  #if HAS_MESH
93
+
94
+    void onMeshLevelingStart() {}
95
+
96
+    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
97
+      // Called when any mesh points are updated
98
+    }
99
+  #endif
90
 
100
 
91
   #if ENABLED(POWER_LOSS_RECOVERY)
101
   #if ENABLED(POWER_LOSS_RECOVERY)
92
     void onPowerLossResume() {
102
     void onPowerLossResume() {
99
       // Called for temperature PID tuning result
109
       // Called for temperature PID tuning result
100
     }
110
     }
101
   #endif
111
   #endif
112
+
113
+  void onSteppersDisabled() {}
114
+  void onSteppersEnabled()  {}
102
 }
115
 }
103
 
116
 
104
 #endif // ANYCUBIC_LCD_I3MEGA
117
 #endif // ANYCUBIC_LCD_I3MEGA

+ 10
- 0
Marlin/src/lcd/extui/dgus_lcd.cpp Просмотреть файл

76
 
76
 
77
   void onStatusChanged(const char * const msg) { ScreenHandler.setstatusmessage(msg); }
77
   void onStatusChanged(const char * const msg) { ScreenHandler.setstatusmessage(msg); }
78
 
78
 
79
+  void onHomingStart() {}
80
+  void onHomingComplete() {}
81
+  void onPrintFinished() {}
82
+
79
   void onFactoryReset() {}
83
   void onFactoryReset() {}
84
+
80
   void onStoreSettings(char *buff) {
85
   void onStoreSettings(char *buff) {
81
     // Called when saving to EEPROM (i.e. M500). If the ExtUI needs
86
     // Called when saving to EEPROM (i.e. M500). If the ExtUI needs
82
     // permanent data to be stored, it can write up to eeprom_data_size bytes
87
     // permanent data to be stored, it can write up to eeprom_data_size bytes
108
   }
113
   }
109
 
114
 
110
   #if HAS_MESH
115
   #if HAS_MESH
116
+    void onMeshLevelingStart() {}
117
+
111
     void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
118
     void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
112
       // Called when any mesh points are updated
119
       // Called when any mesh points are updated
113
     }
120
     }
146
     }
153
     }
147
   #endif
154
   #endif
148
 
155
 
156
+  void onSteppersDisabled() {}
157
+  void onSteppersEnabled()  {}
149
 }
158
 }
159
+
150
 #endif // HAS_DGUS_LCD
160
 #endif // HAS_DGUS_LCD

+ 13
- 3
Marlin/src/lcd/extui/example.cpp Просмотреть файл

47
   }
47
   }
48
   void onIdle() {}
48
   void onIdle() {}
49
   void onPrinterKilled(PGM_P const error, PGM_P const component) {}
49
   void onPrinterKilled(PGM_P const error, PGM_P const component) {}
50
-  void onMediaInserted() {};
51
-  void onMediaError() {};
52
-  void onMediaRemoved() {};
50
+  void onMediaInserted() {}
51
+  void onMediaError() {}
52
+  void onMediaRemoved() {}
53
   void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
53
   void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
54
   void onPrintTimerStarted() {}
54
   void onPrintTimerStarted() {}
55
   void onPrintTimerPaused() {}
55
   void onPrintTimerPaused() {}
57
   void onFilamentRunout(const extruder_t extruder) {}
57
   void onFilamentRunout(const extruder_t extruder) {}
58
   void onUserConfirmRequired(const char * const msg) {}
58
   void onUserConfirmRequired(const char * const msg) {}
59
   void onStatusChanged(const char * const msg) {}
59
   void onStatusChanged(const char * const msg) {}
60
+
61
+  void onHomingStart() {}
62
+  void onHomingComplete() {}
63
+  void onPrintFinished() {}
64
+
60
   void onFactoryReset() {}
65
   void onFactoryReset() {}
61
 
66
 
62
   void onStoreSettings(char *buff) {
67
   void onStoreSettings(char *buff) {
90
   }
95
   }
91
 
96
 
92
   #if HAS_MESH
97
   #if HAS_MESH
98
+    void onMeshLevelingStart() {}
99
+
93
     void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
100
     void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
94
       // Called when any mesh points are updated
101
       // Called when any mesh points are updated
95
     }
102
     }
110
       // Called for temperature PID tuning result
117
       // Called for temperature PID tuning result
111
     }
118
     }
112
   #endif
119
   #endif
120
+
121
+  void onSteppersDisabled() {}
122
+  void onSteppersEnabled()  {}
113
 }
123
 }
114
 
124
 
115
 #endif // EXTUI_EXAMPLE && EXTENSIBLE_UI
125
 #endif // EXTUI_EXAMPLE && EXTENSIBLE_UI

+ 11
- 2
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp Просмотреть файл

87
     InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FINISHED);
87
     InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FINISHED);
88
   }
88
   }
89
 
89
 
90
-  void onPrintTimerPaused() {
91
-  }
90
+  void onPrintTimerPaused() {}
91
+
92
+  void onPrintFinished() {}
92
 
93
 
93
   void onFilamentRunout(const extruder_t extruder) {
94
   void onFilamentRunout(const extruder_t extruder) {
94
     char lcd_msg[30];
95
     char lcd_msg[30];
97
     InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FAILED, FTDI::PLAY_SYNCHRONOUS);
98
     InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FAILED, FTDI::PLAY_SYNCHRONOUS);
98
   }
99
   }
99
 
100
 
101
+  void onHomingStart() {}
102
+  void onHomingComplete() {}
103
+
100
   void onFactoryReset() {
104
   void onFactoryReset() {
101
     InterfaceSettingsScreen::defaultSettings();
105
     InterfaceSettingsScreen::defaultSettings();
102
   }
106
   }
134
   }
138
   }
135
 
139
 
136
   #if HAS_LEVELING && HAS_MESH
140
   #if HAS_LEVELING && HAS_MESH
141
+    void onMeshLevelingStart() {}
142
+
137
     void onMeshUpdate(const int8_t x, const int8_t y, const float val) {
143
     void onMeshUpdate(const int8_t x, const int8_t y, const float val) {
138
       BedMeshScreen::onMeshUpdate(x, y, val);
144
       BedMeshScreen::onMeshUpdate(x, y, val);
139
     }
145
     }
170
       GOTO_SCREEN(StatusScreen);
176
       GOTO_SCREEN(StatusScreen);
171
     }
177
     }
172
   #endif // HAS_PID_HEATING
178
   #endif // HAS_PID_HEATING
179
+
180
+  void onSteppersDisabled() {}
181
+  void onSteppersEnabled()  {}
173
 }
182
 }
174
 
183
 
175
 #endif // TOUCH_UI_FTDI_EVE
184
 #endif // TOUCH_UI_FTDI_EVE

+ 10
- 3
Marlin/src/lcd/extui/malyan_lcd.cpp Просмотреть файл

511
 
511
 
512
   // Not needed for Malyan LCD
512
   // Not needed for Malyan LCD
513
   void onStatusChanged(const char * const) {}
513
   void onStatusChanged(const char * const) {}
514
-  void onMediaInserted() {};
515
-  void onMediaError() {};
516
-  void onMediaRemoved() {};
514
+  void onMediaInserted() {}
515
+  void onMediaError() {}
516
+  void onMediaRemoved() {}
517
   void onPlayTone(const uint16_t, const uint16_t) {}
517
   void onPlayTone(const uint16_t, const uint16_t) {}
518
   void onFilamentRunout(const extruder_t extruder) {}
518
   void onFilamentRunout(const extruder_t extruder) {}
519
   void onUserConfirmRequired(const char * const) {}
519
   void onUserConfirmRequired(const char * const) {}
520
+  void onHomingStart() {}
521
+  void onHomingComplete() {}
522
+  void onPrintFinished() {}
520
   void onFactoryReset() {}
523
   void onFactoryReset() {}
521
   void onStoreSettings(char*) {}
524
   void onStoreSettings(char*) {}
522
   void onLoadSettings(const char*) {}
525
   void onLoadSettings(const char*) {}
524
   void onConfigurationStoreRead(bool) {}
527
   void onConfigurationStoreRead(bool) {}
525
 
528
 
526
   #if HAS_MESH
529
   #if HAS_MESH
530
+    void onMeshLevelingStart() {}
527
     void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {}
531
     void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {}
528
     void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) {}
532
     void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) {}
529
   #endif
533
   #endif
531
   #if ENABLED(POWER_LOSS_RECOVERY)
535
   #if ENABLED(POWER_LOSS_RECOVERY)
532
     void onPowerLossResume() {}
536
     void onPowerLossResume() {}
533
   #endif
537
   #endif
538
+
539
+  void onSteppersDisabled() {}
540
+  void onSteppersEnabled()  {}
534
 }
541
 }
535
 
542
 
536
 #endif // MALYAN_LCD
543
 #endif // MALYAN_LCD

+ 6
- 0
Marlin/src/lcd/extui/ui_api.h Просмотреть файл

140
       bed_mesh_t& getMeshArray();
140
       bed_mesh_t& getMeshArray();
141
       float getMeshPoint(const xy_uint8_t &pos);
141
       float getMeshPoint(const xy_uint8_t &pos);
142
       void setMeshPoint(const xy_uint8_t &pos, const float zval);
142
       void setMeshPoint(const xy_uint8_t &pos, const float zval);
143
+      void onMeshLevelingStart();
143
       void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval);
144
       void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval);
144
       inline void onMeshUpdate(const xy_int8_t &pos, const float zval) { onMeshUpdate(pos.x, pos.y, zval); }
145
       inline void onMeshUpdate(const xy_int8_t &pos, const float zval) { onMeshUpdate(pos.x, pos.y, zval); }
145
 
146
 
344
   void onPrintTimerStarted();
345
   void onPrintTimerStarted();
345
   void onPrintTimerPaused();
346
   void onPrintTimerPaused();
346
   void onPrintTimerStopped();
347
   void onPrintTimerStopped();
348
+  void onPrintFinished();
347
   void onFilamentRunout(const extruder_t extruder);
349
   void onFilamentRunout(const extruder_t extruder);
348
   void onUserConfirmRequired(const char * const msg);
350
   void onUserConfirmRequired(const char * const msg);
349
   void onUserConfirmRequired_P(PGM_P const pstr);
351
   void onUserConfirmRequired_P(PGM_P const pstr);
350
   void onStatusChanged(const char * const msg);
352
   void onStatusChanged(const char * const msg);
351
   void onStatusChanged_P(PGM_P const pstr);
353
   void onStatusChanged_P(PGM_P const pstr);
354
+  void onHomingStart();
355
+  void onHomingComplete();
356
+  void onSteppersDisabled();
357
+  void onSteppersEnabled();
352
   void onFactoryReset();
358
   void onFactoryReset();
353
   void onStoreSettings(char *);
359
   void onStoreSettings(char *);
354
   void onLoadSettings(const char *);
360
   void onLoadSettings(const char *);

Загрузка…
Отмена
Сохранить