Skip to content

Commit 623c6b7

Browse files
committed
πŸ§‘β€πŸ’» Add ExtUI::onLevelingDone, match DWIN to ExtUI
1 parent 5bbb345 commit 623c6b7

File tree

19 files changed

+94
-71
lines changed

19 files changed

+94
-71
lines changed

β€ŽMarlin/src/feature/bedlevel/ubl/ubl_G29.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,7 @@ void unified_bed_leveling::restore_ubl_active_state_and_leave() {
12191219
}
12201220
#endif
12211221
set_bed_leveling_enabled(ubl_state_at_invocation);
1222+
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
12221223
}
12231224

12241225
mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {

β€ŽMarlin/src/gcode/bedlevel/abl/G29.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -419,12 +419,13 @@ G29_TYPE GcodeSuite::G29() {
419419

420420
planner.synchronize();
421421

422+
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart());
423+
422424
#if ENABLED(AUTO_BED_LEVELING_3POINT)
423425
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> 3-point Leveling");
424426
points[0].z = points[1].z = points[2].z = 0; // Probe at 3 arbitrary points
425427
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
426-
TERN_(EXTENSIBLE_UI, ExtUI::onMeshLevelingStart());
427-
TERN_(DWIN_LCD_PROUI, DWIN_MeshLevelingStart());
428+
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_LevelingStart());
428429
#endif
429430

430431
if (!faux) {
@@ -577,6 +578,7 @@ G29_TYPE GcodeSuite::G29() {
577578
SERIAL_ECHOLNPGM("Grid probing done.");
578579
// Re-enable software endstops, if needed
579580
SET_SOFT_ENDSTOP_LOOSE(false);
581+
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
580582
}
581583

582584
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
@@ -606,6 +608,8 @@ G29_TYPE GcodeSuite::G29() {
606608
abl.reenable = false;
607609
}
608610

611+
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
612+
609613
}
610614

611615
#endif // AUTO_BED_LEVELING_3POINT
@@ -899,7 +903,7 @@ G29_TYPE GcodeSuite::G29() {
899903
process_subcommands_now(F(Z_PROBE_END_SCRIPT));
900904
#endif
901905

902-
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_CompletedLeveling());
906+
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_LevelingDone());
903907

904908
TERN_(HAS_MULTI_HOTEND, if (abl.tool_index != 0) tool_change(abl.tool_index));
905909

β€ŽMarlin/src/gcode/bedlevel/mbl/G29.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ void GcodeSuite::G29() {
104104
mbl_probe_index = 0;
105105
if (!ui.wait_for_move) {
106106
queue.inject(parser.seen_test('N') ? F("G28" TERN(CAN_SET_LEVELING_AFTER_G28, "L0", "") "\nG29S2") : F("G29S2"));
107-
TERN_(EXTENSIBLE_UI, ExtUI::onMeshLevelingStart());
108-
TERN_(DWIN_LCD_PROUI, DWIN_MeshLevelingStart());
107+
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart());
108+
TERN_(DWIN_LCD_PROUI, DWIN_LevelingStart());
109109
return;
110110
}
111111
state = MeshNext;
@@ -168,6 +168,7 @@ void GcodeSuite::G29() {
168168
#endif
169169

170170
TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
171+
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
171172
}
172173
break;
173174

β€ŽMarlin/src/gcode/calibrate/G28.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ void GcodeSuite::G28() {
239239
set_and_report_grblstate(M_HOMING);
240240
#endif
241241

242-
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_StartHoming());
242+
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_HomingStart());
243243
TERN_(EXTENSIBLE_UI, ExtUI::onHomingStart());
244244

245245
planner.synchronize(); // Wait for planner moves to finish!
@@ -552,8 +552,8 @@ void GcodeSuite::G28() {
552552

553553
ui.refresh();
554554

555-
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_CompletedHoming());
556-
TERN_(EXTENSIBLE_UI, ExtUI::onHomingComplete());
555+
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_HomingDone());
556+
TERN_(EXTENSIBLE_UI, ExtUI::onHomingDone());
557557

558558
report_current_position();
559559

β€ŽMarlin/src/gcode/sd/M1001.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void GcodeSuite::M1001() {
108108
process_subcommands_now(F(SD_FINISHED_RELEASECOMMAND));
109109
#endif
110110

111-
TERN_(EXTENSIBLE_UI, ExtUI::onPrintFinished());
111+
TERN_(EXTENSIBLE_UI, ExtUI::onPrintDone());
112112
TERN_(DWIN_LCD_PROUI, DWIN_Print_Finished());
113113

114114
// Re-select the last printed file in the UI

β€ŽMarlin/src/lcd/e3v2/creality/dwin.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -4281,7 +4281,7 @@ void DWIN_HandleScreen() {
42814281
}
42824282
}
42834283

4284-
void DWIN_CompletedHoming() {
4284+
void DWIN_HomingDone() {
42854285
HMI_flag.home_flag = false;
42864286
dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z);
42874287
if (checkkey == Last_Prepare) {
@@ -4297,7 +4297,7 @@ void DWIN_CompletedHoming() {
42974297
}
42984298
}
42994299

4300-
void DWIN_CompletedLeveling() {
4300+
void DWIN_LevelingDone() {
43014301
if (checkkey == Leveling) Goto_MainMenu();
43024302
}
43034303

β€ŽMarlin/src/lcd/e3v2/creality/dwin.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ void DWIN_HandleScreen();
243243
void DWIN_StatusChanged(const char * const cstr=nullptr);
244244
void DWIN_StatusChanged(FSTR_P const fstr);
245245

246-
inline void DWIN_StartHoming() { HMI_flag.home_flag = true; }
246+
inline void DWIN_HomingStart() { HMI_flag.home_flag = true; }
247247

248-
void DWIN_CompletedHoming();
249-
void DWIN_CompletedLeveling();
248+
void DWIN_HomingDone();
249+
void DWIN_LevelingDone();

β€ŽMarlin/src/lcd/e3v2/proui/dwin.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1542,20 +1542,20 @@ void HMI_SaveProcessID(const uint8_t id) {
15421542
}
15431543
}
15441544

1545-
void DWIN_StartHoming() {
1545+
void DWIN_HomingStart() {
15461546
HMI_flag.home_flag = true;
15471547
HMI_SaveProcessID(Homing);
15481548
Title.ShowCaption(GET_TEXT_F(MSG_HOMING));
15491549
DWIN_Show_Popup(ICON_BLTouch, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT));
15501550
}
15511551

1552-
void DWIN_CompletedHoming() {
1552+
void DWIN_HomingDone() {
15531553
HMI_flag.home_flag = false;
15541554
dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z);
15551555
if (HMI_flag.abort_action) DWIN_Print_Aborted(); else HMI_ReturnScreen();
15561556
}
15571557

1558-
void DWIN_MeshLevelingStart() {
1558+
void DWIN_LevelingStart() {
15591559
#if HAS_ONESTEP_LEVELING
15601560
HMI_SaveProcessID(Leveling);
15611561
Title.ShowCaption(GET_TEXT_F(MSG_BED_LEVELING));
@@ -1565,7 +1565,7 @@ void DWIN_MeshLevelingStart() {
15651565
#endif
15661566
}
15671567

1568-
void DWIN_CompletedLeveling() {
1568+
void DWIN_LevelingDone() {
15691569
TERN_(HAS_ONESTEP_LEVELING, if (planner.leveling_active) Goto_MeshViewer());
15701570
}
15711571

β€ŽMarlin/src/lcd/e3v2/proui/dwin.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,13 @@ void update_variable();
142142
void DWIN_InitScreen();
143143
void DWIN_HandleScreen();
144144
void DWIN_CheckStatusMessage();
145-
void DWIN_StartHoming();
146-
void DWIN_CompletedHoming();
145+
void DWIN_HomingStart();
146+
void DWIN_HomingDone();
147147
#if HAS_MESH
148148
void DWIN_MeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval);
149149
#endif
150-
void DWIN_MeshLevelingStart();
151-
void DWIN_CompletedLeveling();
150+
void DWIN_LevelingStart();
151+
void DWIN_LevelingDone();
152152
void DWIN_PidTuning(pidresult_t result);
153153
void DWIN_Print_Started(const bool sd=false);
154154
void DWIN_Print_Pause();

β€ŽMarlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,16 @@ namespace ExtUI {
5757

5858
void onPrintTimerStarted() { Chiron.TimerEvent(AC_timer_started); }
5959
void onPrintTimerPaused() { Chiron.TimerEvent(AC_timer_paused); }
60-
void onPrintTimerStopped() { Chiron.TimerEvent(AC_timer_stopped); }
60+
void onPrintTimerStopped() { Chiron.TimerEvent(AC_timer_stopped); }
61+
void onPrintDone() {}
62+
6163
void onFilamentRunout(const extruder_t) { Chiron.FilamentRunout(); }
64+
6265
void onUserConfirmRequired(const char * const msg) { Chiron.ConfirmationRequest(msg); }
6366
void onStatusChanged(const char * const msg) { Chiron.StatusChange(msg); }
6467

6568
void onHomingStart() {}
66-
void onHomingComplete() {}
67-
void onPrintFinished() {}
69+
void onHomingDone() {}
6870

6971
void onFactoryReset() {}
7072

@@ -103,7 +105,8 @@ namespace ExtUI {
103105
}
104106

105107
#if HAS_MESH
106-
void onMeshLevelingStart() {}
108+
void onLevelingStart() {}
109+
void onLevelingDone() {}
107110

108111
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
109112
// Called when any mesh points are updated

β€ŽMarlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp

+27-21
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,23 @@ void ChironTFT::Startup() {
8686
TFTSer.begin(115200);
8787

8888
// wait for the TFT panel to initialise and finish the animation
89-
delay_ms(250);
89+
safe_delay(1000);
9090

9191
// There are different panels for the Chiron with slightly different commands
9292
// So we need to know what we are working with.
93-
9493
// Panel type can be defined otherwise detect it automatically
95-
if (panel_type == AC_panel_unknown) DetectPanelType();
94+
switch (panel_type) {
95+
case AC_panel_new:
96+
SERIAL_ECHOLNF(AC_msg_new_panel_set);
97+
break;
98+
case AC_panel_standard:
99+
SERIAL_ECHOLNF(AC_msg_old_panel_set);
100+
break;
101+
default:
102+
SERIAL_ECHOLNF(AC_msg_auto_panel_detection);
103+
DetectPanelType();
104+
break;
105+
}
96106

97107
// Signal Board has reset
98108
SendtoTFTLN(AC_msg_main_board_has_reset);
@@ -358,15 +368,14 @@ bool ChironTFT::ReadTFTCommand() {
358368
}
359369

360370
int8_t ChironTFT::FindToken(char c) {
361-
int8_t pos = 0;
362-
do {
371+
for (int8_t pos = 0; pos < command_len; pos++) {
363372
if (panel_command[pos] == c) {
364373
#if ACDEBUG(AC_INFO)
365374
SERIAL_ECHOLNPGM("Tpos:", pos, " ", c);
366375
#endif
367376
return pos;
368377
}
369-
} while (++pos < command_len);
378+
}
370379
#if ACDEBUG(AC_INFO)
371380
SERIAL_ECHOLNPGM("Not found: ", c);
372381
#endif
@@ -623,18 +632,18 @@ void ChironTFT::PanelAction(uint8_t req) {
623632
SelectFile();
624633
break;
625634

626-
case 14: { // A14 Start Printing
635+
case 14: // A14 Start Printing
627636
// Allows printer to restart the job if we don't want to recover
628637
if (printer_state == AC_printer_resuming_from_power_outage) {
629638
injectCommands(F("M1000 C")); // Cancel recovery
630639
printer_state = AC_printer_idle;
631640
}
632641
#if ACDebugLevel >= 1
633-
SERIAL_ECHOLNPAIR_F("Print: ", selectedfile);
642+
SERIAL_ECHOLNPGM("Print: ", selectedfile);
634643
#endif
635644
printFile(selectedfile);
636645
SendtoTFTLN(AC_msg_print_from_sd_card);
637-
} break;
646+
break;
638647

639648
case 15: // A15 Resuming from outage
640649
if (printer_state == AC_printer_resuming_from_power_outage) {
@@ -801,25 +810,22 @@ void ChironTFT::PanelProcess(uint8_t req) {
801810
}
802811
} break;
803812

804-
case 30: { // A30 Auto leveling
813+
case 30: // A30 Auto leveling
805814
if (FindToken('S') != -1) { // Start probing New panel adds spaces..
806815
// Ignore request if printing
807816
if (isPrinting())
808817
SendtoTFTLN(AC_msg_probing_not_allowed); // forbid auto leveling
809818
else {
810-
811-
812819
SendtoTFTLN(AC_msg_start_probing);
813820
injectCommands(F("G28\nG29"));
814821
printer_state = AC_printer_probing;
815822
}
816823
}
817-
else {
824+
else
818825
SendtoTFTLN(AC_msg_start_probing); // Just enter levelling menu
819-
}
820-
} break;
826+
break;
821827

822-
case 31: { // A31 Adjust all Probe Points
828+
case 31: // A31 Adjust all Probe Points
823829
// The tokens can occur in different places on the new panel so we need to find it.
824830

825831
if (FindToken('C') != -1) { // Restore and apply original offsets
@@ -907,18 +913,18 @@ void ChironTFT::PanelProcess(uint8_t req) {
907913
}
908914
}
909915
}
910-
} break;
916+
break;
911917

912-
case 32: { // A32 clean leveling beep flag
918+
case 32: // A32 clean leveling beep flag
913919
// Ignore request if printing
914920
//if (isPrinting()) break;
915921
//injectCommands(F("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000"));
916922
//TFTSer.println();
917-
} break;
923+
break;
918924

919925
// A33 firmware info request see PanelInfo()
920926

921-
case 34: { // A34 Adjust single mesh point A34 C/S X1 Y1 V123
927+
case 34: // A34 Adjust single mesh point A34 C/S X1 Y1 V123
922928
if (panel_command[3] == 'C') { // Restore original offsets
923929
injectCommands(F("M501\nM420 S1"));
924930
selectedmeshpoint.x = selectedmeshpoint.y = 99;
@@ -950,7 +956,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
950956
}
951957
}
952958
}
953-
} break;
959+
break;
954960

955961
case 36: // A36 Auto leveling for new TFT bet that was a typo in the panel code!
956962
SendtoTFTLN(AC_msg_start_probing);

β€ŽMarlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ namespace ExtUI {
5454
void onStatusChanged(const char * const msg) {}
5555

5656
void onHomingStart() {}
57-
void onHomingComplete() {}
58-
void onPrintFinished() {}
57+
void onHomingDone() {}
58+
void onPrintDone() {}
5959

6060
void onFactoryReset() {}
6161

@@ -95,7 +95,8 @@ namespace ExtUI {
9595

9696
#if HAS_MESH
9797

98-
void onMeshLevelingStart() {}
98+
void onLevelingStart() {}
99+
void onLevelingDone() {}
99100

100101
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
101102
// Called when any mesh points are updated

β€ŽMarlin/src/lcd/extui/dgus/dgus_extui.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ namespace ExtUI {
7373
void onStatusChanged(const char * const msg) { ScreenHandler.setstatusmessage(msg); }
7474

7575
void onHomingStart() {}
76-
void onHomingComplete() {}
77-
void onPrintFinished() {}
76+
void onHomingDone() {}
77+
void onPrintDone() {}
7878

7979
void onFactoryReset() {}
8080

@@ -113,7 +113,8 @@ namespace ExtUI {
113113
}
114114

115115
#if HAS_MESH
116-
void onMeshLevelingStart() {}
116+
void onLevelingStart() {}
117+
void onLevelingDone() {}
117118

118119
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
119120
// Called when any mesh points are updated

β€ŽMarlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ namespace ExtUI {
8383
}
8484

8585
void onHomingStart() {}
86-
void onHomingComplete() {}
87-
void onPrintFinished() {}
86+
void onHomingDone() {}
87+
void onPrintDone() {}
8888

8989
void onFactoryReset() {
9090
dgus_screen_handler.SettingsReset();
@@ -109,7 +109,8 @@ namespace ExtUI {
109109
}
110110

111111
#if HAS_MESH
112-
void onMeshLevelingStart() {}
112+
void onLevelingStart() {}
113+
void onLevelingDone() {}
113114

114115
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
115116
dgus_screen_handler.MeshUpdate(xpos, ypos);

0 commit comments

Comments
Β (0)