浏览代码

🐛 Fix DGUS_Reloaded G-code execution (#23592)

Lars 3 年前
父节点
当前提交
8badf2d71f
没有帐户链接到提交者的电子邮件

+ 6
- 1
Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp 查看文件

57
 void DGUSDisplay::Init() {
57
 void DGUSDisplay::Init() {
58
   LCD_SERIAL.begin(LCD_BAUDRATE);
58
   LCD_SERIAL.begin(LCD_BAUDRATE);
59
 
59
 
60
-  Read(DGUS_VERSION, 1);
60
+  ReadVersions();
61
 }
61
 }
62
 
62
 
63
 void DGUSDisplay::Read(uint16_t addr, uint8_t size) {
63
 void DGUSDisplay::Read(uint16_t addr, uint8_t size) {
158
   }
158
   }
159
 }
159
 }
160
 
160
 
161
+void DGUSDisplay::ReadVersions() {
162
+  if (gui_version != 0 && os_version != 0) return;
163
+  Read(DGUS_VERSION, 1);
164
+}
165
+
161
 void DGUSDisplay::SwitchScreen(DGUS_Screen screen) {
166
 void DGUSDisplay::SwitchScreen(DGUS_Screen screen) {
162
   DEBUG_ECHOLNPGM("SwitchScreen ", (uint8_t)screen);
167
   DEBUG_ECHOLNPGM("SwitchScreen ", (uint8_t)screen);
163
   const uint8_t command[] = { 0x5A, 0x01, 0x00, (uint8_t)screen };
168
   const uint8_t command[] = { 0x5A, 0x01, 0x00, (uint8_t)screen };

+ 3
- 0
Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h 查看文件

69
   // Until now I did not need to actively read from the display. That's why there is no ReadVariable
69
   // Until now I did not need to actively read from the display. That's why there is no ReadVariable
70
   // (I extensively use the auto upload of the display)
70
   // (I extensively use the auto upload of the display)
71
 
71
 
72
+  // Read GUI and OS version from screen
73
+  static void ReadVersions();
74
+
72
   // Force display into another screen.
75
   // Force display into another screen.
73
   static void SwitchScreen(DGUS_Screen screen);
76
   static void SwitchScreen(DGUS_Screen screen);
74
   // Play sounds using the display speaker.
77
   // Play sounds using the display speaker.

+ 20
- 39
Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp 查看文件

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

正在加载...
取消
保存