Browse Source

Fix and update DGUS displays (#17072)

George Fu 4 years ago
parent
commit
201c991cfa
No account linked to committer's email address

+ 1
- 1
Marlin/Configuration_adv.h View File

@@ -1288,7 +1288,7 @@
1288 1288
 // Additional options for DGUS / DWIN displays
1289 1289
 //
1290 1290
 #if HAS_DGUS_LCD
1291
-  #define DGUS_SERIAL_PORT 2
1291
+  #define DGUS_SERIAL_PORT 3
1292 1292
   #define DGUS_BAUDRATE 115200
1293 1293
 
1294 1294
   #define DGUS_RX_BUFFER_SIZE 128

+ 2
- 1
Marlin/src/inc/Conditionals_LCD.h View File

@@ -356,11 +356,12 @@
356 356
   #endif
357 357
 #endif
358 358
 
359
-// Extensible UI serial touch screens. (See src/lcd/extensible_ui)
359
+// Aliases for LCD features
360 360
 #if ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY)
361 361
   #define HAS_DGUS_LCD 1
362 362
 #endif
363 363
 
364
+// Extensible UI serial touch screens. (See src/lcd/extensible_ui)
364 365
 #if ANY(HAS_DGUS_LCD, MALYAN_LCD, TOUCH_UI_FTDI_EVE)
365 366
   #define IS_EXTUI
366 367
   #define EXTENSIBLE_UI

+ 14
- 8
Marlin/src/lcd/extensible_ui/lib/dgus/DGUSDisplay.cpp View File

@@ -179,6 +179,15 @@ void DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable
179 179
   }
180 180
 }
181 181
 
182
+// Send the current print progress to the display.
183
+void DGUSScreenVariableHandler::DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var) {
184
+  //DEBUG_ECHOPAIR(" DGUSLCD_SendPrintProgressToDisplay ", var.VP);
185
+  uint16_t tmp = ExtUI::getProgress_percent();
186
+  //DEBUG_ECHOLNPAIR(" data ", tmp);
187
+  uint16_t data_to_send = swap16(tmp);
188
+  dgusdisplay.WriteVariable(var.VP, data_to_send);
189
+}
190
+
182 191
 // Send the current print time to the display.
183 192
 // It is using a hex display for that: It expects BSD coded data in the format xxyyzz
184 193
 void DGUSScreenVariableHandler::DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var) {
@@ -465,7 +474,7 @@ void DGUSScreenVariableHandler::ScreenConfirmedOK(DGUS_VP_Variable &var, void *v
465 474
 const uint16_t* DGUSLCD_FindScreenVPMapList(uint8_t screen) {
466 475
   const uint16_t *ret;
467 476
   const struct VPMapping *map = VPMap;
468
-  while (ret = (uint16_t*) pgm_read_word(&(map->VPList))) {
477
+  while (ret = (uint16_t*) pgm_read_ptr(&(map->VPList))) {
469 478
     if (pgm_read_byte(&(map->screen)) == screen) return ret;
470 479
     map++;
471 480
   }
@@ -846,8 +855,8 @@ void DGUSScreenVariableHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable
846 855
 void DGUSScreenVariableHandler::HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr) {
847 856
   DEBUG_ECHOLNPGM("HandleProbeOffsetZChanged");
848 857
 
849
-  uint16_t value = swap16(*(uint16_t*)val_ptr)/100;
850
-  ExtUI::setZOffset_mm(value);
858
+  const float offset = float(swap16(*(uint16_t*)val_ptr)) / 100.0f;
859
+  ExtUI::setZOffset_mm(offset);
851 860
   ScreenHandler.skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
852 861
   return;
853 862
 }
@@ -858,7 +867,7 @@ void DGUSScreenVariableHandler::HandleProbeOffsetZChanged(DGUS_VP_Variable &var,
858 867
 
859 868
     int16_t flag = swap16(*(uint16_t*)val_ptr);
860 869
     int16_t steps = flag ? -20 : 20;
861
-    ExtUI::smartAdjustAxis_steps(steps,ExtUI::axis_t::Z,true);
870
+    ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true);
862 871
     ScreenHandler.ForceCompleteUpdate();
863 872
     return;
864 873
   }
@@ -1307,11 +1316,8 @@ void DGUSDisplay::ProcessRx() {
1307 1316
           //DEBUG_ECHOPAIR(" vp=", vp, " dlen=", dlen);
1308 1317
           DGUS_VP_Variable ramcopy;
1309 1318
           if (populate_VPVar(vp, &ramcopy)) {
1310
-            if (!(dlen == ramcopy.size || (dlen == 2 && ramcopy.size == 1)))
1311
-              DEBUG_ECHOLNPGM("SIZE MISMATCH");
1312
-            else if (ramcopy.set_by_display_handler) {
1319
+            if (ramcopy.set_by_display_handler)
1313 1320
               ramcopy.set_by_display_handler(ramcopy, &tmp[3]);
1314
-            }
1315 1321
             else
1316 1322
               DEBUG_ECHOLNPGM(" VPVar found, no handler.");
1317 1323
           }

+ 8
- 2
Marlin/src/lcd/extensible_ui/lib/dgus/DGUSDisplay.h View File

@@ -26,6 +26,9 @@
26 26
 #include "../../../../inc/MarlinConfigPre.h"
27 27
 
28 28
 #include "../../../../MarlinCore.h"
29
+#if HAS_BED_PROBE
30
+  #include "../../../../module/probe.h"
31
+#endif
29 32
 #include "DGUSVPVariable.h"
30 33
 
31 34
 enum DGUSLCD_Screens : uint8_t;
@@ -140,8 +143,10 @@ public:
140 143
     // Hook for PID autotune
141 144
     static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr);
142 145
   #endif
143
-  // Hook for "Change probe offset z"
144
-  static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr);
146
+  #if HAS_BED_PROBE
147
+    // Hook for "Change probe offset z"
148
+    static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr);
149
+  #endif
145 150
   #if ENABLED(BABYSTEPPING)
146 151
     // Hook for live z adjust action
147 152
     static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
@@ -210,6 +215,7 @@ public:
210 215
   static void DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var);
211 216
   static void DGUSLCD_SendTemperaturePID(DGUS_VP_Variable &var);
212 217
   static void DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable &var);
218
+  static void DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var);
213 219
   static void DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var);
214 220
   #if ENABLED(PRINTCOUNTER)
215 221
     static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);

+ 10
- 3
Marlin/src/lcd/extensible_ui/lib/dgus/DGUSDisplayDefinitionFYSETC.cpp View File

@@ -213,6 +213,7 @@ const uint16_t VPList_SDPrintTune[] PROGMEM = {
213 213
     VP_T_Bed_Is, VP_T_Bed_Set,
214 214
   #endif
215 215
   VP_Feedrate_Percentage,
216
+  VP_SD_Print_ProbeOffsetZ,
216 217
   0x0000
217 218
 };
218 219
 
@@ -279,6 +280,13 @@ const uint16_t VPList_FLCPrinting[] PROGMEM = {
279 280
   0x0000
280 281
 };
281 282
 
283
+const uint16_t VPList_Z_Offset[] PROGMEM = {
284
+  #if HOTENDS >= 1
285
+    VP_SD_Print_ProbeOffsetZ,
286
+  #endif
287
+  0x0000
288
+};
289
+
282 290
 const struct VPMapping VPMap[] PROGMEM = {
283 291
   { DGUSLCD_SCREEN_BOOT, VPList_Boot },
284 292
   { DGUSLCD_SCREEN_MAIN, VPList_Main },
@@ -297,6 +305,7 @@ const struct VPMapping VPMap[] PROGMEM = {
297 305
   { DGUSLCD_SCREEN_WAITING, VPList_PIDTuningWaiting },
298 306
   { DGUSLCD_SCREEN_FLC_PREHEAT, VPList_FLCPreheat },
299 307
   { DGUSLCD_SCREEN_FLC_PRINTING, VPList_FLCPrinting },
308
+  { DGUSLCD_SCREEN_Z_OFFSET, VPList_Z_Offset },
300 309
   { DGUSLCD_SCREEN_STEPPERMM, VPList_StepPerMM },
301 310
   { DGUSLCD_SCREEN_PID_E, VPList_PIDE0 },
302 311
   { DGUSLCD_SCREEN_PID_BED, VPList_PIDBED },
@@ -418,9 +427,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
418 427
   VPHELPER(VP_ZPos, &current_position.z, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
419 428
 
420 429
   // Print Progress
421
-  #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
422
-    VPHELPER(VP_PrintProgress_Percentage, &ui.progress_override, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
423
-  #endif
430
+  VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintProgressToDisplay ),
424 431
 
425 432
   // Print Time
426 433
   VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintTimeToDisplay),

+ 6
- 5
Marlin/src/lcd/extensible_ui/lib/dgus/DGUSDisplayDefinitionFYSETC.h View File

@@ -43,7 +43,8 @@ enum DGUSLCD_Screens : uint8_t {
43 43
   DGUSLCD_SCREEN_STEPPERMM           = 212,
44 44
   DGUSLCD_SCREEN_PID_E               = 214,
45 45
   DGUSLCD_SCREEN_PID_BED             = 218,
46
-  DGUSLCD_SCREEN_INFOS               =  30,
46
+  DGUSLCD_SCREEN_Z_OFFSET            = 222,
47
+  DGUSLCD_SCREEN_INFOS               =  36,
47 48
   DGUSLCD_SCREEN_CONFIRM             = 240,
48 49
   DGUSLCD_SCREEN_KILL                = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
49 50
   DGUSLCD_SCREEN_WAITING             = 251,
@@ -121,8 +122,8 @@ constexpr uint16_t VP_POWER_LOSS_RECOVERY = 0x2180;
121 122
 // Fan Control Buttons , switch between "off" and "on"
122 123
 constexpr uint16_t VP_FAN0_CONTROL = 0x2200;
123 124
 constexpr uint16_t VP_FAN1_CONTROL = 0x2202;
124
-//constexpr uint16_t VP_FAN2_CONTROL = 0x2204;
125
-//constexpr uint16_t VP_FAN3_CONTROL = 0x2206;
125
+constexpr uint16_t VP_FAN2_CONTROL = 0x2204;
126
+constexpr uint16_t VP_FAN3_CONTROL = 0x2206;
126 127
 
127 128
 // Heater Control Buttons , triged between "cool down" and "heat PLA" state
128 129
 constexpr uint16_t VP_E0_CONTROL = 0x2210;
@@ -240,8 +241,8 @@ constexpr uint16_t VP_SD_Print_Filename = 0x32C0;
240 241
 // Fan status
241 242
 constexpr uint16_t VP_FAN0_STATUS = 0x3300;
242 243
 constexpr uint16_t VP_FAN1_STATUS = 0x3302;
243
-//constexpr uint16_t VP_FAN2_STATUS = 0x3304;
244
-//constexpr uint16_t VP_FAN3_STATUS = 0x3306;
244
+constexpr uint16_t VP_FAN2_STATUS = 0x3304;
245
+constexpr uint16_t VP_FAN3_STATUS = 0x3306;
245 246
 
246 247
 // Heater status
247 248
 constexpr uint16_t VP_E0_STATUS = 0x3310;

+ 1
- 3
Marlin/src/lcd/extensible_ui/lib/dgus/DGUSDisplayDefinitionHIPRECY.cpp View File

@@ -418,9 +418,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
418 418
   VPHELPER(VP_ZPos, &current_position.z, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
419 419
 
420 420
   // Print Progress
421
-  #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
422
-    VPHELPER(VP_PrintProgress_Percentage, &ui.progress_override, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay ),
423
-  #endif
421
+  VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintProgressToDisplay ),
424 422
 
425 423
   // Print Time
426 424
   VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintTimeToDisplay ),

+ 1
- 3
Marlin/src/lcd/extensible_ui/lib/dgus/DGUSDisplayDefinitionOrigin.cpp View File

@@ -250,9 +250,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
250 250
   VPHELPER(VP_ZPos, &current_position.z, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
251 251
 
252 252
   // Print Progress
253
-  #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
254
-    VPHELPER(VP_PrintProgress_Percentage, &ui.progress_override, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay ),
255
-  #endif
253
+  VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintProgressToDisplay ),
256 254
 
257 255
   // Print Time
258 256
   VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintTimeToDisplay ),

Loading…
Cancel
Save