Fix and update DGUS displays (#17072)

2.0.x
George Fu 5 years ago committed by GitHub
parent 23c5701178
commit 201c991cfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -356,11 +356,12 @@
#endif
#endif
// Extensible UI serial touch screens. (See src/lcd/extensible_ui)
// Aliases for LCD features
#if ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY)
#define HAS_DGUS_LCD 1
#endif
// Extensible UI serial touch screens. (See src/lcd/extensible_ui)
#if ANY(HAS_DGUS_LCD, MALYAN_LCD, TOUCH_UI_FTDI_EVE)
#define IS_EXTUI
#define EXTENSIBLE_UI

@ -179,6 +179,15 @@ void DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable
}
}
// Send the current print progress to the display.
void DGUSScreenVariableHandler::DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var) {
//DEBUG_ECHOPAIR(" DGUSLCD_SendPrintProgressToDisplay ", var.VP);
uint16_t tmp = ExtUI::getProgress_percent();
//DEBUG_ECHOLNPAIR(" data ", tmp);
uint16_t data_to_send = swap16(tmp);
dgusdisplay.WriteVariable(var.VP, data_to_send);
}
// Send the current print time to the display.
// It is using a hex display for that: It expects BSD coded data in the format xxyyzz
void DGUSScreenVariableHandler::DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var) {
@ -465,7 +474,7 @@ void DGUSScreenVariableHandler::ScreenConfirmedOK(DGUS_VP_Variable &var, void *v
const uint16_t* DGUSLCD_FindScreenVPMapList(uint8_t screen) {
const uint16_t *ret;
const struct VPMapping *map = VPMap;
while (ret = (uint16_t*) pgm_read_word(&(map->VPList))) {
while (ret = (uint16_t*) pgm_read_ptr(&(map->VPList))) {
if (pgm_read_byte(&(map->screen)) == screen) return ret;
map++;
}
@ -846,8 +855,8 @@ void DGUSScreenVariableHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable
void DGUSScreenVariableHandler::HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleProbeOffsetZChanged");
uint16_t value = swap16(*(uint16_t*)val_ptr)/100;
ExtUI::setZOffset_mm(value);
const float offset = float(swap16(*(uint16_t*)val_ptr)) / 100.0f;
ExtUI::setZOffset_mm(offset);
ScreenHandler.skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
}
@ -1307,11 +1316,8 @@ void DGUSDisplay::ProcessRx() {
//DEBUG_ECHOPAIR(" vp=", vp, " dlen=", dlen);
DGUS_VP_Variable ramcopy;
if (populate_VPVar(vp, &ramcopy)) {
if (!(dlen == ramcopy.size || (dlen == 2 && ramcopy.size == 1)))
DEBUG_ECHOLNPGM("SIZE MISMATCH");
else if (ramcopy.set_by_display_handler) {
if (ramcopy.set_by_display_handler)
ramcopy.set_by_display_handler(ramcopy, &tmp[3]);
}
else
DEBUG_ECHOLNPGM(" VPVar found, no handler.");
}

@ -26,6 +26,9 @@
#include "../../../../inc/MarlinConfigPre.h"
#include "../../../../MarlinCore.h"
#if HAS_BED_PROBE
#include "../../../../module/probe.h"
#endif
#include "DGUSVPVariable.h"
enum DGUSLCD_Screens : uint8_t;
@ -140,8 +143,10 @@ public:
// Hook for PID autotune
static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr);
#endif
#if HAS_BED_PROBE
// Hook for "Change probe offset z"
static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr);
#endif
#if ENABLED(BABYSTEPPING)
// Hook for live z adjust action
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
@ -210,6 +215,7 @@ public:
static void DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var);
static void DGUSLCD_SendTemperaturePID(DGUS_VP_Variable &var);
static void DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable &var);
static void DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var);
static void DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var);
#if ENABLED(PRINTCOUNTER)
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);

@ -213,6 +213,7 @@ const uint16_t VPList_SDPrintTune[] PROGMEM = {
VP_T_Bed_Is, VP_T_Bed_Set,
#endif
VP_Feedrate_Percentage,
VP_SD_Print_ProbeOffsetZ,
0x0000
};
@ -279,6 +280,13 @@ const uint16_t VPList_FLCPrinting[] PROGMEM = {
0x0000
};
const uint16_t VPList_Z_Offset[] PROGMEM = {
#if HOTENDS >= 1
VP_SD_Print_ProbeOffsetZ,
#endif
0x0000
};
const struct VPMapping VPMap[] PROGMEM = {
{ DGUSLCD_SCREEN_BOOT, VPList_Boot },
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
@ -297,6 +305,7 @@ const struct VPMapping VPMap[] PROGMEM = {
{ DGUSLCD_SCREEN_WAITING, VPList_PIDTuningWaiting },
{ DGUSLCD_SCREEN_FLC_PREHEAT, VPList_FLCPreheat },
{ DGUSLCD_SCREEN_FLC_PRINTING, VPList_FLCPrinting },
{ DGUSLCD_SCREEN_Z_OFFSET, VPList_Z_Offset },
{ DGUSLCD_SCREEN_STEPPERMM, VPList_StepPerMM },
{ DGUSLCD_SCREEN_PID_E, VPList_PIDE0 },
{ DGUSLCD_SCREEN_PID_BED, VPList_PIDBED },
@ -418,9 +427,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
VPHELPER(VP_ZPos, &current_position.z, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
// Print Progress
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
VPHELPER(VP_PrintProgress_Percentage, &ui.progress_override, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
#endif
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintProgressToDisplay ),
// Print Time
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintTimeToDisplay),

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

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

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

Loading…
Cancel
Save