DGUS updates (#17260)

This commit is contained in:
George Fu 2020-03-24 07:00:22 +08:00 committed by GitHub
parent cd4060a99c
commit e3ebbe25e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 6 deletions

View file

@ -30,10 +30,6 @@
#error "More than 2 hotends not implemented on the Display UI design." #error "More than 2 hotends not implemented on the Display UI design."
#endif #endif
#include "DGUSDisplay.h"
#include "DGUSVPVariable.h"
#include "DGUSDisplayDef.h"
#include "../../ui_api.h" #include "../../ui_api.h"
#include "../../../../MarlinCore.h" #include "../../../../MarlinCore.h"
@ -48,6 +44,10 @@
#include "../../../../feature/powerloss.h" #include "../../../../feature/powerloss.h"
#endif #endif
#include "DGUSDisplay.h"
#include "DGUSVPVariable.h"
#include "DGUSDisplayDef.h"
// Preamble... 2 Bytes, usually 0x5A 0xA5, but configurable // Preamble... 2 Bytes, usually 0x5A 0xA5, but configurable
constexpr uint8_t DGUS_HEADER1 = 0x5A; constexpr uint8_t DGUS_HEADER1 = 0x5A;
constexpr uint8_t DGUS_HEADER2 = 0xA5; constexpr uint8_t DGUS_HEADER2 = 0xA5;
@ -855,7 +855,7 @@ void DGUSScreenVariableHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable
void DGUSScreenVariableHandler::HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenVariableHandler::HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleProbeOffsetZChanged"); DEBUG_ECHOLNPGM("HandleProbeOffsetZChanged");
const float offset = float(swap16(*(uint16_t*)val_ptr)) / 100.0f; const float offset = float(int16_t(swap16(*(uint16_t*)val_ptr))) / 100.0f;
ExtUI::setZOffset_mm(offset); ExtUI::setZOffset_mm(offset);
ScreenHandler.skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel ScreenHandler.skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return; return;

View file

@ -283,6 +283,13 @@ const uint16_t VPList_FLCPrinting[] PROGMEM = {
0x0000 0x0000
}; };
const uint16_t VPList_Z_Offset[] PROGMEM = {
#if HOTENDS >= 1
VP_SD_Print_ProbeOffsetZ,
#endif
0x0000
};
const struct VPMapping VPMap[] PROGMEM = { const struct VPMapping VPMap[] PROGMEM = {
{ DGUSLCD_SCREEN_BOOT, VPList_Boot }, { DGUSLCD_SCREEN_BOOT, VPList_Boot },
{ DGUSLCD_SCREEN_MAIN, VPList_Main }, { DGUSLCD_SCREEN_MAIN, VPList_Main },
@ -291,6 +298,7 @@ const struct VPMapping VPMap[] PROGMEM = {
{ DGUSLCD_SCREEN_STATUS2, VPList_Status2 }, { DGUSLCD_SCREEN_STATUS2, VPList_Status2 },
{ DGUSLCD_SCREEN_PREHEAT, VPList_Preheat }, { DGUSLCD_SCREEN_PREHEAT, VPList_Preheat },
{ DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove }, { DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove },
{ DGUSLCD_SCREEN_Z_OFFSET, VPList_Z_Offset },
{ DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude }, { DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
{ DGUSLCD_SCREEN_FILAMENT_HEATING, VPList_Filament_heating }, { DGUSLCD_SCREEN_FILAMENT_HEATING, VPList_Filament_heating },
{ DGUSLCD_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload }, { DGUSLCD_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload },
@ -361,7 +369,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
#if HOTENDS >= 1 #if HOTENDS >= 1
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<0>), VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<0>),
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay), VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_Flowrate_E0, nullptr, DGUSScreenVariableHandler::HandleFlowRateChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay), VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], DGUSScreenVariableHandler::HandleFlowRateChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_EPos, &destination.e, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>), VPHELPER(VP_EPos, &destination.e, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
VPHELPER(VP_MOVE_E0, nullptr, &DGUSScreenVariableHandler::HandleManualExtrude, nullptr), VPHELPER(VP_MOVE_E0, nullptr, &DGUSScreenVariableHandler::HandleManualExtrude, nullptr),
VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, &DGUSScreenVariableHandler::HandleHeaterControl, nullptr), VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, &DGUSScreenVariableHandler::HandleHeaterControl, nullptr),

View file

@ -35,6 +35,7 @@ enum DGUSLCD_Screens : uint8_t {
DGUSLCD_SCREEN_FILAMENT_LOADING = 76, DGUSLCD_SCREEN_FILAMENT_LOADING = 76,
DGUSLCD_SCREEN_FILAMENT_UNLOADING = 82, DGUSLCD_SCREEN_FILAMENT_UNLOADING = 82,
DGUSLCD_SCREEN_MANUALEXTRUDE = 84, DGUSLCD_SCREEN_MANUALEXTRUDE = 84,
DGUSLCD_SCREEN_Z_OFFSET = 88,
DGUSLCD_SCREEN_SDFILELIST = 3, DGUSLCD_SCREEN_SDFILELIST = 3,
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 7, DGUSLCD_SCREEN_SDPRINTMANIPULATION = 7,
DGUSLCD_SCREEN_SDPRINTTUNE = 9, DGUSLCD_SCREEN_SDPRINTTUNE = 9,