|
@@ -100,37 +100,37 @@ void DGUSScreenHandler::Loop() {
|
100
|
100
|
if (new_screen != DGUS_Screen::BOOT) {
|
101
|
101
|
const DGUS_Screen screen = new_screen;
|
102
|
102
|
new_screen = DGUS_Screen::BOOT;
|
103
|
|
-
|
104
|
|
- if (current_screen == screen) {
|
|
103
|
+ if (current_screen == screen)
|
105
|
104
|
TriggerFullUpdate();
|
106
|
|
- }
|
107
|
|
- else {
|
|
105
|
+ else
|
108
|
106
|
MoveToScreen(screen);
|
109
|
|
- }
|
110
|
107
|
return;
|
111
|
108
|
}
|
112
|
109
|
|
113
|
110
|
if (!booted && ELAPSED(ms, 3000)) {
|
114
|
111
|
booted = true;
|
115
|
112
|
|
116
|
|
- if (current_screen == DGUS_Screen::BOOT) {
|
|
113
|
+ dgus_display.ReadVersions();
|
|
114
|
+
|
|
115
|
+ if (current_screen == DGUS_Screen::BOOT)
|
117
|
116
|
MoveToScreen(DGUS_Screen::HOME);
|
118
|
|
- }
|
|
117
|
+
|
119
|
118
|
return;
|
120
|
119
|
}
|
121
|
120
|
|
122
|
121
|
if (ELAPSED(ms, next_event_ms) || full_update) {
|
123
|
122
|
next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS;
|
124
|
123
|
|
125
|
|
- if (!SendScreenVPData(current_screen, full_update)) {
|
|
124
|
+ if (!SendScreenVPData(current_screen, full_update))
|
126
|
125
|
DEBUG_ECHOLNPGM("SendScreenVPData failed");
|
127
|
|
- }
|
|
126
|
+
|
128
|
127
|
return;
|
129
|
128
|
}
|
130
|
129
|
|
131
|
130
|
if (current_screen == DGUS_Screen::WAIT
|
132
|
131
|
&& ((wait_continue && !wait_for_user)
|
133
|
|
- || (!wait_continue && IsPrinterIdle()))) {
|
|
132
|
+ || (!wait_continue && IsPrinterIdle()))
|
|
133
|
+ ) {
|
134
|
134
|
MoveToScreen(wait_return_screen, true);
|
135
|
135
|
return;
|
136
|
136
|
}
|
|
@@ -151,7 +151,6 @@ void DGUSScreenHandler::Loop() {
|
151
|
151
|
|
152
|
152
|
if (eeprom_save > 0 && ELAPSED(ms, eeprom_save) && IsPrinterIdle()) {
|
153
|
153
|
eeprom_save = 0;
|
154
|
|
-
|
155
|
154
|
queue.enqueue_now_P(DGUS_CMD_EEPROM_SAVE);
|
156
|
155
|
return;
|
157
|
156
|
}
|
|
@@ -187,7 +186,6 @@ void DGUSScreenHandler::SettingsReset() {
|
187
|
186
|
|
188
|
187
|
if (!settings_ready) {
|
189
|
188
|
settings_ready = true;
|
190
|
|
-
|
191
|
189
|
Ready();
|
192
|
190
|
}
|
193
|
191
|
|
|
@@ -225,9 +223,8 @@ void DGUSScreenHandler::LoadSettings(const char *buff) {
|
225
|
223
|
}
|
226
|
224
|
|
227
|
225
|
void DGUSScreenHandler::ConfigurationStoreWritten(bool success) {
|
228
|
|
- if (!success) {
|
|
226
|
+ if (!success)
|
229
|
227
|
SetStatusMessage(F("EEPROM write failed"));
|
230
|
|
- }
|
231
|
228
|
}
|
232
|
229
|
|
233
|
230
|
void DGUSScreenHandler::ConfigurationStoreRead(bool success) {
|
|
@@ -236,7 +233,6 @@ void DGUSScreenHandler::ConfigurationStoreRead(bool success) {
|
236
|
233
|
}
|
237
|
234
|
else if (!settings_ready) {
|
238
|
235
|
settings_ready = true;
|
239
|
|
-
|
240
|
236
|
Ready();
|
241
|
237
|
}
|
242
|
238
|
}
|
|
@@ -245,33 +241,25 @@ void DGUSScreenHandler::PlayTone(const uint16_t frequency, const uint16_t durati
|
245
|
241
|
UNUSED(duration);
|
246
|
242
|
|
247
|
243
|
if (frequency >= 1 && frequency <= 255) {
|
248
|
|
- if (duration >= 1 && duration <= 255) {
|
|
244
|
+ if (duration >= 1 && duration <= 255)
|
249
|
245
|
dgus_display.PlaySound((uint8_t)frequency, (uint8_t)duration);
|
250
|
|
- }
|
251
|
|
- else {
|
|
246
|
+ else
|
252
|
247
|
dgus_display.PlaySound((uint8_t)frequency);
|
253
|
|
- }
|
254
|
248
|
}
|
255
|
249
|
}
|
256
|
250
|
|
257
|
251
|
void DGUSScreenHandler::MeshUpdate(const int8_t xpos, const int8_t ypos) {
|
258
|
252
|
if (current_screen != DGUS_Screen::LEVELING_PROBING) {
|
259
|
|
- if (current_screen == DGUS_Screen::LEVELING_AUTOMATIC) {
|
|
253
|
+ if (current_screen == DGUS_Screen::LEVELING_AUTOMATIC)
|
260
|
254
|
TriggerFullUpdate();
|
261
|
|
- }
|
262
|
|
-
|
263
|
255
|
return;
|
264
|
256
|
}
|
265
|
257
|
|
266
|
258
|
uint8_t point = ypos * GRID_MAX_POINTS_X + xpos;
|
267
|
259
|
probing_icons[point < 16 ? 0 : 1] |= (1U << (point % 16));
|
268
|
260
|
|
269
|
|
- if (xpos >= GRID_MAX_POINTS_X - 1
|
270
|
|
- && ypos >= GRID_MAX_POINTS_Y - 1
|
271
|
|
- && !ExtUI::getMeshValid()) {
|
272
|
|
- probing_icons[0] = 0;
|
273
|
|
- probing_icons[1] = 0;
|
274
|
|
- }
|
|
261
|
+ if (xpos >= GRID_MAX_POINTS_X - 1 && ypos >= GRID_MAX_POINTS_Y - 1 && !ExtUI::getMeshValid())
|
|
262
|
+ probing_icons[0] = probing_icons[1] = 0;
|
275
|
263
|
|
276
|
264
|
TriggerFullUpdate();
|
277
|
265
|
}
|
|
@@ -282,15 +270,12 @@ void DGUSScreenHandler::PrintTimerStarted() {
|
282
|
270
|
|
283
|
271
|
void DGUSScreenHandler::PrintTimerPaused() {
|
284
|
272
|
dgus_display.PlaySound(3);
|
285
|
|
-
|
286
|
273
|
TriggerFullUpdate();
|
287
|
274
|
}
|
288
|
275
|
|
289
|
276
|
void DGUSScreenHandler::PrintTimerStopped() {
|
290
|
|
- if (current_screen != DGUS_Screen::PRINT_STATUS
|
291
|
|
- && current_screen != DGUS_Screen::PRINT_ADJUST) {
|
|
277
|
+ if (current_screen != DGUS_Screen::PRINT_STATUS && current_screen != DGUS_Screen::PRINT_ADJUST)
|
292
|
278
|
return;
|
293
|
|
- }
|
294
|
279
|
|
295
|
280
|
dgus_display.PlaySound(3);
|
296
|
281
|
|
|
@@ -309,23 +294,19 @@ void DGUSScreenHandler::FilamentRunout(const ExtUI::extruder_t extruder) {
|
309
|
294
|
#if ENABLED(SDSUPPORT)
|
310
|
295
|
|
311
|
296
|
void DGUSScreenHandler::SDCardInserted() {
|
312
|
|
- if (current_screen == DGUS_Screen::HOME) {
|
|
297
|
+ if (current_screen == DGUS_Screen::HOME)
|
313
|
298
|
TriggerScreenChange(DGUS_Screen::PRINT);
|
314
|
|
- }
|
315
|
299
|
}
|
316
|
300
|
|
317
|
301
|
void DGUSScreenHandler::SDCardRemoved() {
|
318
|
|
- if (current_screen == DGUS_Screen::PRINT) {
|
|
302
|
+ if (current_screen == DGUS_Screen::PRINT)
|
319
|
303
|
TriggerScreenChange(DGUS_Screen::HOME);
|
320
|
|
- }
|
321
|
304
|
}
|
322
|
305
|
|
323
|
306
|
void DGUSScreenHandler::SDCardError() {
|
324
|
307
|
SetStatusMessage(GET_TEXT_F(MSG_MEDIA_READ_ERROR));
|
325
|
|
-
|
326
|
|
- if (current_screen == DGUS_Screen::PRINT) {
|
|
308
|
+ if (current_screen == DGUS_Screen::PRINT)
|
327
|
309
|
TriggerScreenChange(DGUS_Screen::HOME);
|
328
|
|
- }
|
329
|
310
|
}
|
330
|
311
|
|
331
|
312
|
#endif // SDSUPPORT
|