mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-29 23:07:42 +00:00
🎨 Lowercase method / data member names (#25914)
This commit is contained in:
parent
e45eddfd6c
commit
bc385122e9
@ -393,7 +393,7 @@ void startOrResumeJob() {
|
||||
if (queue.enqueue_one(F("M1001"))) { // Keep trying until it gets queued
|
||||
marlin_state = MF_RUNNING; // Signal to stop trying
|
||||
TERN_(PASSWORD_AFTER_SD_PRINT_END, password.lock_machine());
|
||||
TERN_(DGUS_LCD_UI_MKS, ScreenHandler.SDPrintingFinished());
|
||||
TERN_(DGUS_LCD_UI_MKS, screen.sdPrintingFinished());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ namespace Anycubic {
|
||||
tftSendLn(AC_msg_ready);
|
||||
}
|
||||
|
||||
void DgusTFT::ParamInit() {
|
||||
void DgusTFT::paramInit() {
|
||||
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_ECHOLNPGM("DgusTFT::ParamInit()");
|
||||
@ -668,7 +668,7 @@ namespace Anycubic {
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
|
||||
void DgusTFT::PowerLoss() {
|
||||
void DgusTFT::powerLoss() {
|
||||
// On: 5A A5 05 82 00 82 00 00
|
||||
// Off: 5A A5 05 82 00 82 00 64
|
||||
uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, 0x00, 0x82, 0x00, uint8_t(recovery.enabled ? 0x00 : 0x64) };
|
||||
@ -681,12 +681,12 @@ namespace Anycubic {
|
||||
|
||||
#endif // POWER_LOSS_RECOVERY
|
||||
|
||||
void DgusTFT::HomingStart() {
|
||||
void DgusTFT::homingStart() {
|
||||
if (!isPrintingFromMedia())
|
||||
ChangePageOfTFT(PAGE_CHS_HOMING);
|
||||
}
|
||||
|
||||
void DgusTFT::HomingComplete() {
|
||||
void DgusTFT::homingComplete() {
|
||||
if (lcd_info.language == ENG && page_index_last > 120)
|
||||
page_index_last -= 120;
|
||||
|
||||
@ -720,17 +720,17 @@ namespace Anycubic {
|
||||
TFTSer.println();
|
||||
}
|
||||
|
||||
void DgusTFT::SendValueToTFT(const uint16_t value, const uint16_t address) {
|
||||
void DgusTFT::sendValueToTFT(const uint16_t value, const uint16_t address) {
|
||||
uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF), uint8_t(value >> 8), uint8_t(value & 0xFF) };
|
||||
LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]);
|
||||
}
|
||||
|
||||
void DgusTFT::RequestValueFromTFT(const uint16_t address) {
|
||||
void DgusTFT::requestValueFromTFT(const uint16_t address) {
|
||||
uint8_t data[] = { 0x5A, 0xA5, 0x04, 0x83, uint8_t(address >> 8), uint8_t(address & 0xFF), 0x01 };
|
||||
LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]);
|
||||
}
|
||||
|
||||
void DgusTFT::SendTxtToTFT(const char *pdata, const uint16_t address) {
|
||||
void DgusTFT::sendTxtToTFT(const char *pdata, const uint16_t address) {
|
||||
uint8_t data_len = strlen(pdata);
|
||||
uint8_t data[] = { 0x5A, 0xA5, uint8_t(data_len + 5), 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF) };
|
||||
LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]);
|
||||
@ -738,17 +738,17 @@ namespace Anycubic {
|
||||
TFTSer.write(0xFF); TFTSer.write(0xFF);
|
||||
}
|
||||
|
||||
void DgusTFT::SendColorToTFT(const uint16_t color, const uint16_t address) {
|
||||
void DgusTFT::sendColorToTFT(const uint16_t color, const uint16_t address) {
|
||||
uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF), uint8_t(color >> 8), uint8_t(color & 0xFF) };
|
||||
LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]);
|
||||
}
|
||||
|
||||
void DgusTFT::SendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address) {
|
||||
void DgusTFT::sendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address) {
|
||||
uint8_t data[] = { 0x5A, 0xA5, 0x04, 0x83, uint8_t(address >> 8), uint8_t(address & 0xFF), number };
|
||||
LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]);
|
||||
}
|
||||
|
||||
void DgusTFT::ChangePageOfTFT(const uint16_t page_index, const bool no_send/*=false*/) {
|
||||
void DgusTFT::changePageOfTFT(const uint16_t page_index, const bool no_send/*=false*/) {
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_ECHOLNPGM("ChangePageOfTFT: ", page_index);
|
||||
#endif
|
||||
@ -789,7 +789,7 @@ namespace Anycubic {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DgusTFT::FakeChangePageOfTFT(const uint16_t page_index) {
|
||||
void DgusTFT::fakeChangePageOfTFT(const uint16_t page_index) {
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
if (page_index_saved != page_index_now)
|
||||
DEBUG_ECHOLNPGM("FakeChangePageOfTFT: ", page_index);
|
||||
@ -797,7 +797,7 @@ namespace Anycubic {
|
||||
ChangePageOfTFT(page_index, true);
|
||||
}
|
||||
|
||||
void DgusTFT::LcdAudioSet(const bool audio_on) {
|
||||
void DgusTFT::lcdAudioSet(const bool audio_on) {
|
||||
// On: 5A A5 07 82 00 80 5A 00 00 1A
|
||||
// Off: 5A A5 07 82 00 80 5A 00 00 12
|
||||
uint8_t data[] = { 0x5A, 0xA5, 0x07, 0x82, 0x00, 0x80, 0x5A, 0x00, 0x00, uint8_t(audio_on ? 0x1A : 0x12) };
|
||||
|
@ -357,7 +357,7 @@ namespace Anycubic {
|
||||
static uint16_t page_index_now;
|
||||
|
||||
static void startup();
|
||||
static void ParamInit();
|
||||
static void paramInit();
|
||||
static void idleLoop();
|
||||
static void printerKilled(FSTR_P,FSTR_P);
|
||||
static void mediaEvent(media_event_t);
|
||||
@ -365,10 +365,10 @@ namespace Anycubic {
|
||||
static void filamentRunout();
|
||||
static void confirmationRequest(const char * const);
|
||||
static void statusChange(const char * const);
|
||||
static void PowerLoss();
|
||||
static void powerLoss();
|
||||
static void powerLossRecovery();
|
||||
static void HomingStart();
|
||||
static void HomingComplete();
|
||||
static void homingStart();
|
||||
static void homingComplete();
|
||||
|
||||
static void set_descript_color(const uint16_t color, const uint8_t index=lcd_txtbox_index);
|
||||
static void set_language(language_t);
|
||||
@ -462,14 +462,14 @@ namespace Anycubic {
|
||||
static void panelAction(uint8_t);
|
||||
static void panelProcess(uint8_t);
|
||||
|
||||
static void SendValueToTFT(const uint16_t value, const uint16_t address);
|
||||
static void RequestValueFromTFT(const uint16_t address);
|
||||
static void SendTxtToTFT(const char *pdata, const uint16_t address);
|
||||
static void SendColorToTFT(const uint16_t color, const uint16_t address);
|
||||
static void SendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address);
|
||||
static void ChangePageOfTFT(const uint16_t page_index, const bool no_send=false);
|
||||
static void FakeChangePageOfTFT(const uint16_t page_index);
|
||||
static void LcdAudioSet(const bool audio_on);
|
||||
static void sendValueToTFT(const uint16_t value, const uint16_t address);
|
||||
static void requestValueFromTFT(const uint16_t address);
|
||||
static void sendTxtToTFT(const char *pdata, const uint16_t address);
|
||||
static void sendColorToTFT(const uint16_t color, const uint16_t address);
|
||||
static void sendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address);
|
||||
static void changePageOfTFT(const uint16_t page_index, const bool no_send=false);
|
||||
static void fakeChangePageOfTFT(const uint16_t page_index);
|
||||
static void lcdAudioSet(const bool audio_on);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -44,9 +44,9 @@
|
||||
#include "DGUSVPVariable.h"
|
||||
#include "DGUSDisplayDef.h"
|
||||
|
||||
DGUSDisplay dgusdisplay;
|
||||
DGUSDisplay dgus;
|
||||
|
||||
#ifdef DEBUG_DGUSLCD_COMM
|
||||
#ifdef DEBUG_DGUS_COMM
|
||||
#define DEBUGLCDCOMM_ECHOPGM DEBUG_ECHOPGM
|
||||
#else
|
||||
#define DEBUGLCDCOMM_ECHOPGM(...) NOOP
|
||||
@ -63,7 +63,7 @@ constexpr uint8_t DGUS_CMD_READVAR = 0x83;
|
||||
bool dguslcd_local_debug; // = false;
|
||||
#endif
|
||||
|
||||
void DGUSDisplay::InitDisplay() {
|
||||
void DGUSDisplay::initDisplay() {
|
||||
#ifndef LCD_BAUDRATE
|
||||
#define LCD_BAUDRATE 115200
|
||||
#endif
|
||||
@ -73,13 +73,13 @@ void DGUSDisplay::InitDisplay() {
|
||||
TERN_(DGUS_LCD_UI_MKS, delay(LOGO_TIME_DELAY)); // Show the logo for a little while
|
||||
}
|
||||
|
||||
RequestScreen(TERN(SHOW_BOOTSCREEN, DGUSLCD_SCREEN_BOOT, DGUSLCD_SCREEN_MAIN));
|
||||
requestScreen(TERN(SHOW_BOOTSCREEN, DGUS_SCREEN_BOOT, DGUS_SCREEN_MAIN));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, const void *values, uint8_t valueslen, bool isstr) {
|
||||
void DGUSDisplay::writeVariable(uint16_t adr, const void *values, uint8_t valueslen, bool isstr) {
|
||||
const char* myvalues = static_cast<const char*>(values);
|
||||
bool strend = !myvalues;
|
||||
WriteHeader(adr, DGUS_CMD_WRITEVAR, valueslen);
|
||||
writeHeader(adr, DGUS_CMD_WRITEVAR, valueslen);
|
||||
while (valueslen--) {
|
||||
char x;
|
||||
if (!strend) x = *myvalues++;
|
||||
@ -91,25 +91,25 @@ void DGUSDisplay::WriteVariable(uint16_t adr, const void *values, uint8_t values
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, uint16_t value) {
|
||||
void DGUSDisplay::writeVariable(uint16_t adr, uint16_t value) {
|
||||
value = (value & 0xFFU) << 8U | (value >> 8U);
|
||||
WriteVariable(adr, static_cast<const void*>(&value), sizeof(uint16_t));
|
||||
writeVariable(adr, static_cast<const void*>(&value), sizeof(uint16_t));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, int16_t value) {
|
||||
void DGUSDisplay::writeVariable(uint16_t adr, int16_t value) {
|
||||
value = (value & 0xFFU) << 8U | (value >> 8U);
|
||||
WriteVariable(adr, static_cast<const void*>(&value), sizeof(uint16_t));
|
||||
writeVariable(adr, static_cast<const void*>(&value), sizeof(uint16_t));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, uint8_t value) {
|
||||
WriteVariable(adr, static_cast<const void*>(&value), sizeof(uint8_t));
|
||||
void DGUSDisplay::writeVariable(uint16_t adr, uint8_t value) {
|
||||
writeVariable(adr, static_cast<const void*>(&value), sizeof(uint8_t));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, int8_t value) {
|
||||
WriteVariable(adr, static_cast<const void*>(&value), sizeof(int8_t));
|
||||
void DGUSDisplay::writeVariable(uint16_t adr, int8_t value) {
|
||||
writeVariable(adr, static_cast<const void*>(&value), sizeof(int8_t));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, long value) {
|
||||
void DGUSDisplay::writeVariable(uint16_t adr, long value) {
|
||||
union { long l; char lb[4]; } endian;
|
||||
char tmp[4];
|
||||
endian.l = value;
|
||||
@ -117,13 +117,13 @@ void DGUSDisplay::WriteVariable(uint16_t adr, long value) {
|
||||
tmp[1] = endian.lb[2];
|
||||
tmp[2] = endian.lb[1];
|
||||
tmp[3] = endian.lb[0];
|
||||
WriteVariable(adr, static_cast<const void*>(&tmp), sizeof(long));
|
||||
writeVariable(adr, static_cast<const void*>(&tmp), sizeof(long));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariablePGM(uint16_t adr, const void *values, uint8_t valueslen, bool isstr) {
|
||||
void DGUSDisplay::writeVariablePGM(uint16_t adr, const void *values, uint8_t valueslen, bool isstr) {
|
||||
const char* myvalues = static_cast<const char*>(values);
|
||||
bool strend = !myvalues;
|
||||
WriteHeader(adr, DGUS_CMD_WRITEVAR, valueslen);
|
||||
writeHeader(adr, DGUS_CMD_WRITEVAR, valueslen);
|
||||
while (valueslen--) {
|
||||
char x;
|
||||
if (!strend) x = pgm_read_byte(myvalues++);
|
||||
@ -135,7 +135,7 @@ void DGUSDisplay::WriteVariablePGM(uint16_t adr, const void *values, uint8_t val
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSDisplay::ProcessRx() {
|
||||
void DGUSDisplay::processRx() {
|
||||
|
||||
#if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
|
||||
if (!LCD_SERIAL.available() && LCD_SERIAL.buffer_overruns()) {
|
||||
@ -174,8 +174,8 @@ void DGUSDisplay::ProcessRx() {
|
||||
case DGUS_WAIT_TELEGRAM: // wait for complete datagram to arrive.
|
||||
if (LCD_SERIAL.available() < rx_datagram_len) return;
|
||||
|
||||
Initialized = true; // We've talked to it, so we defined it as initialized.
|
||||
uint8_t command = LCD_SERIAL.read();
|
||||
initialized = true; // We've talked to it, so we defined it as initialized.
|
||||
const uint8_t command = LCD_SERIAL.read();
|
||||
|
||||
//DEBUGLCDCOMM_ECHOPGM("# ", command);
|
||||
|
||||
@ -220,9 +220,9 @@ void DGUSDisplay::ProcessRx() {
|
||||
}
|
||||
}
|
||||
|
||||
size_t DGUSDisplay::GetFreeTxBuffer() { return LCD_SERIAL_TX_BUFFER_FREE(); }
|
||||
size_t DGUSDisplay::getFreeTxBuffer() { return LCD_SERIAL_TX_BUFFER_FREE(); }
|
||||
|
||||
void DGUSDisplay::WriteHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen) {
|
||||
void DGUSDisplay::writeHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen) {
|
||||
LCD_SERIAL.write(DGUS_HEADER1);
|
||||
LCD_SERIAL.write(DGUS_HEADER2);
|
||||
LCD_SERIAL.write(payloadlen + 3);
|
||||
@ -231,29 +231,29 @@ void DGUSDisplay::WriteHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen) {
|
||||
LCD_SERIAL.write(adr & 0xFF);
|
||||
}
|
||||
|
||||
void DGUSDisplay::WritePGM(const char str[], uint8_t len) {
|
||||
void DGUSDisplay::writePGM(const char str[], uint8_t len) {
|
||||
while (len--) LCD_SERIAL.write(pgm_read_byte(str++));
|
||||
}
|
||||
|
||||
void DGUSDisplay::loop() {
|
||||
// Protect against recursion. ProcessRx() may indirectly call idle() when injecting G-code commands.
|
||||
// Protect against recursion. processRx() may indirectly call idle() when injecting G-code commands.
|
||||
if (!no_reentrance) {
|
||||
no_reentrance = true;
|
||||
ProcessRx();
|
||||
processRx();
|
||||
no_reentrance = false;
|
||||
}
|
||||
}
|
||||
|
||||
rx_datagram_state_t DGUSDisplay::rx_datagram_state = DGUS_IDLE;
|
||||
uint8_t DGUSDisplay::rx_datagram_len = 0;
|
||||
bool DGUSDisplay::Initialized = false,
|
||||
bool DGUSDisplay::initialized = false,
|
||||
DGUSDisplay::no_reentrance = false;
|
||||
|
||||
// A SW memory barrier, to ensure GCC does not overoptimize loops
|
||||
#define sw_barrier() asm volatile("": : :"memory");
|
||||
|
||||
bool populate_VPVar(const uint16_t VP, DGUS_VP_Variable * const ramcopy) {
|
||||
const DGUS_VP_Variable *pvp = DGUSLCD_FindVPVar(VP);
|
||||
const DGUS_VP_Variable *pvp = findVPVar(VP);
|
||||
if (!pvp) return false;
|
||||
memcpy_P(ramcopy, pvp, sizeof(DGUS_VP_Variable));
|
||||
return true;
|
||||
|
@ -30,14 +30,14 @@
|
||||
#include <stdlib.h> // size_t
|
||||
|
||||
//#define DEBUG_DGUSLCD
|
||||
//#define DEBUG_DGUSLCD_COMM
|
||||
//#define DEBUG_DGUS_COMM
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
#include "../../../module/probe.h"
|
||||
#endif
|
||||
#include "DGUSVPVariable.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
enum DGUS_ScreenID : uint8_t;
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_DGUSLCD)
|
||||
#include "../../../core/debug_out.h"
|
||||
@ -57,25 +57,25 @@ public:
|
||||
|
||||
DGUSDisplay() = default;
|
||||
|
||||
static void InitDisplay();
|
||||
static void initDisplay();
|
||||
|
||||
// Variable access.
|
||||
static void WriteVariable(uint16_t adr, const void *values, uint8_t valueslen, bool isstr=false);
|
||||
static void WriteVariablePGM(uint16_t adr, const void *values, uint8_t valueslen, bool isstr=false);
|
||||
static void WriteVariable(uint16_t adr, int16_t value);
|
||||
static void WriteVariable(uint16_t adr, uint16_t value);
|
||||
static void WriteVariable(uint16_t adr, uint8_t value);
|
||||
static void WriteVariable(uint16_t adr, int8_t value);
|
||||
static void WriteVariable(uint16_t adr, long value);
|
||||
static void writeVariable(uint16_t adr, const void *values, uint8_t valueslen, bool isstr=false);
|
||||
static void writeVariablePGM(uint16_t adr, const void *values, uint8_t valueslen, bool isstr=false);
|
||||
static void writeVariable(uint16_t adr, int16_t value);
|
||||
static void writeVariable(uint16_t adr, uint16_t value);
|
||||
static void writeVariable(uint16_t adr, uint8_t value);
|
||||
static void writeVariable(uint16_t adr, int8_t value);
|
||||
static void writeVariable(uint16_t adr, long value);
|
||||
|
||||
// Utility functions for bridging ui_api and dbus
|
||||
template<typename T, float(*Getter)(const T), T selector, typename WireType=uint16_t>
|
||||
static void SetVariable(DGUS_VP_Variable &var) {
|
||||
WriteVariable(var.VP, (WireType)Getter(selector));
|
||||
static void setVariable(DGUS_VP_Variable &var) {
|
||||
writeVariable(var.VP, (WireType)Getter(selector));
|
||||
}
|
||||
|
||||
template<typename T, void(*Setter)(const float V, const T), T selector>
|
||||
static void GetVariable(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
static void getVariable(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t newvalue = swap16(*(uint16_t*)val_ptr);
|
||||
Setter(newvalue, selector);
|
||||
}
|
||||
@ -86,39 +86,39 @@ public:
|
||||
// Force display into another screen.
|
||||
// (And trigger update of containing VPs)
|
||||
// (to implement a pop up message, which may not be nested)
|
||||
static void RequestScreen(DGUSLCD_Screens screen);
|
||||
static void requestScreen(const DGUS_ScreenID screenID);
|
||||
|
||||
// Periodic tasks, eg. Rx-Queue handling.
|
||||
static void loop();
|
||||
|
||||
public:
|
||||
// Helper for users of this class to estimate if an interaction would be blocking.
|
||||
static size_t GetFreeTxBuffer();
|
||||
static size_t getFreeTxBuffer();
|
||||
|
||||
// Checks two things: Can we confirm the presence of the display and has we initialized it.
|
||||
// (both boils down that the display answered to our chatting)
|
||||
static bool isInitialized() { return Initialized; }
|
||||
static bool isInitialized() { return initialized; }
|
||||
|
||||
private:
|
||||
static void WriteHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen);
|
||||
static void WritePGM(const char str[], uint8_t len);
|
||||
static void ProcessRx();
|
||||
static void writeHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen);
|
||||
static void writePGM(const char str[], uint8_t len);
|
||||
static void processRx();
|
||||
|
||||
static rx_datagram_state_t rx_datagram_state;
|
||||
static uint8_t rx_datagram_len;
|
||||
static bool Initialized, no_reentrance;
|
||||
static bool initialized, no_reentrance;
|
||||
};
|
||||
|
||||
extern DGUSDisplay dgusdisplay;
|
||||
extern DGUSDisplay dgus;
|
||||
|
||||
// compile-time x^y
|
||||
constexpr float cpow(const float x, const int y) { return y == 0 ? 1.0 : x * cpow(x, y - 1); }
|
||||
|
||||
///
|
||||
const uint16_t* DGUSLCD_FindScreenVPMapList(uint8_t screen);
|
||||
const uint16_t* findScreenVPMapList(uint8_t screen);
|
||||
|
||||
/// Find the flash address of a DGUS_VP_Variable for the VP.
|
||||
const DGUS_VP_Variable* DGUSLCD_FindVPVar(const uint16_t vp);
|
||||
const DGUS_VP_Variable* findVPVar(const uint16_t vp);
|
||||
|
||||
/// Helper to populate a DGUS_VP_Variable for a given VP. Return false if not found.
|
||||
bool populate_VPVar(const uint16_t VP, DGUS_VP_Variable * const ramcopy);
|
||||
|
@ -40,15 +40,15 @@
|
||||
#include "../../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
DGUSScreenHandlerClass ScreenHandler;
|
||||
DGUSScreenHandlerClass screen;
|
||||
|
||||
uint16_t DGUSScreenHandler::ConfirmVP;
|
||||
uint16_t DGUSScreenHandler::confirmVP;
|
||||
|
||||
DGUSLCD_Screens DGUSScreenHandler::current_screen;
|
||||
DGUSLCD_Screens DGUSScreenHandler::past_screens[NUM_PAST_SCREENS];
|
||||
DGUS_ScreenID DGUSScreenHandler::current_screenID;
|
||||
DGUS_ScreenID DGUSScreenHandler::past_screenIDs[NUM_PAST_SCREENS];
|
||||
uint8_t DGUSScreenHandler::update_ptr;
|
||||
uint16_t DGUSScreenHandler::skipVP;
|
||||
bool DGUSScreenHandler::ScreenComplete;
|
||||
bool DGUSScreenHandler::screenComplete;
|
||||
|
||||
void (*DGUSScreenHandler::confirm_action_cb)() = nullptr;
|
||||
|
||||
@ -62,42 +62,42 @@ void (*DGUSScreenHandler::confirm_action_cb)() = nullptr;
|
||||
filament_data_t filament_data;
|
||||
#endif
|
||||
|
||||
void DGUSScreenHandler::sendinfoscreen(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool l4inflash) {
|
||||
void DGUSScreenHandler::sendInfoScreen(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool l4inflash) {
|
||||
DGUS_VP_Variable ramcopy;
|
||||
if (populate_VPVar(VP_MSGSTR1, &ramcopy)) {
|
||||
ramcopy.memadr = (void*) line1;
|
||||
l1inflash ? DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::DGUSLCD_SendStringToDisplay(ramcopy);
|
||||
l1inflash ? DGUSScreenHandler::sendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::sendStringToDisplay(ramcopy);
|
||||
}
|
||||
if (populate_VPVar(VP_MSGSTR2, &ramcopy)) {
|
||||
ramcopy.memadr = (void*) line2;
|
||||
l2inflash ? DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::DGUSLCD_SendStringToDisplay(ramcopy);
|
||||
l2inflash ? DGUSScreenHandler::sendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::sendStringToDisplay(ramcopy);
|
||||
}
|
||||
if (populate_VPVar(VP_MSGSTR3, &ramcopy)) {
|
||||
ramcopy.memadr = (void*) line3;
|
||||
l3inflash ? DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::DGUSLCD_SendStringToDisplay(ramcopy);
|
||||
l3inflash ? DGUSScreenHandler::sendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::sendStringToDisplay(ramcopy);
|
||||
}
|
||||
#ifdef VP_MSGSTR4
|
||||
if (populate_VPVar(VP_MSGSTR4, &ramcopy)) {
|
||||
ramcopy.memadr = (void*) line4;
|
||||
l4inflash ? DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::DGUSLCD_SendStringToDisplay(ramcopy);
|
||||
l4inflash ? DGUSScreenHandler::sendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::sendStringToDisplay(ramcopy);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleUserConfirmationPopUp(uint16_t VP, PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1, bool l2, bool l3, bool l4) {
|
||||
if (current_screen == DGUSLCD_SCREEN_CONFIRM) // Already showing a pop up, so we need to cancel that first.
|
||||
PopToOldScreen();
|
||||
void DGUSScreenHandler::handleUserConfirmationPopUp(uint16_t VP, PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1, bool l2, bool l3, bool l4) {
|
||||
if (current_screenID == DGUS_SCREEN_CONFIRM) // Already showing a pop up, so we need to cancel that first.
|
||||
popToOldScreen();
|
||||
|
||||
ConfirmVP = VP;
|
||||
sendinfoscreen(line1, line2, line3, line4, l1, l2, l3, l4);
|
||||
GotoScreen(DGUSLCD_SCREEN_CONFIRM);
|
||||
confirmVP = VP;
|
||||
sendInfoScreen(line1, line2, line3, line4, l1, l2, l3, l4);
|
||||
gotoScreen(DGUS_SCREEN_CONFIRM);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::setstatusmessage(const char *msg) {
|
||||
void DGUSScreenHandler::setStatusMessage(const char *msg) {
|
||||
DGUS_VP_Variable ramcopy;
|
||||
if (populate_VPVar(VP_M117, &ramcopy)) {
|
||||
ramcopy.memadr = (void*) msg;
|
||||
DGUSLCD_SendStringToDisplay(ramcopy);
|
||||
sendStringToDisplay(ramcopy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,46 +105,46 @@ void DGUSScreenHandler::setstatusmessagePGM(PGM_P const msg) {
|
||||
DGUS_VP_Variable ramcopy;
|
||||
if (populate_VPVar(VP_M117, &ramcopy)) {
|
||||
ramcopy.memadr = (void*) msg;
|
||||
DGUSLCD_SendStringToDisplayPGM(ramcopy);
|
||||
sendStringToDisplayPGM(ramcopy);
|
||||
}
|
||||
}
|
||||
|
||||
// Send an 8 bit or 16 bit value to the display.
|
||||
void DGUSScreenHandler::DGUSLCD_SendWordValueToDisplay(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::sendWordValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
if (var.size > 1)
|
||||
dgusdisplay.WriteVariable(var.VP, *(int16_t*)var.memadr);
|
||||
dgus.writeVariable(var.VP, *(int16_t*)var.memadr);
|
||||
else
|
||||
dgusdisplay.WriteVariable(var.VP, *(int8_t*)var.memadr);
|
||||
dgus.writeVariable(var.VP, *(int8_t*)var.memadr);
|
||||
}
|
||||
}
|
||||
|
||||
// Send an uint8_t between 0 and 255 to the display, but scale to a percentage (0..100)
|
||||
void DGUSScreenHandler::DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::sendPercentageToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
uint16_t tmp = *(uint8_t *) var.memadr + 1; // +1 -> avoid rounding issues for the display.
|
||||
tmp = map(tmp, 0, 255, 0, 100);
|
||||
dgusdisplay.WriteVariable(var.VP, tmp);
|
||||
dgus.writeVariable(var.VP, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
// Send the current print progress to the display.
|
||||
void DGUSScreenHandler::DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::sendPrintProgressToDisplay(DGUS_VP_Variable &var) {
|
||||
uint16_t tmp = ExtUI::getProgress_percent();
|
||||
dgusdisplay.WriteVariable(var.VP, tmp);
|
||||
dgus.writeVariable(var.VP, tmp);
|
||||
}
|
||||
|
||||
// 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 DGUSScreenHandler::DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::sendPrintTimeToDisplay(DGUS_VP_Variable &var) {
|
||||
duration_t elapsed = print_job_timer.duration();
|
||||
char buf[32];
|
||||
elapsed.toString(buf);
|
||||
dgusdisplay.WriteVariable(VP_PrintTime, buf, var.size, true);
|
||||
dgus.writeVariable(VP_PrintTime, buf, var.size, true);
|
||||
}
|
||||
|
||||
// Send an uint8_t between 0 and 100 to a variable scale to 0..255
|
||||
void DGUSScreenHandler::DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::percentageToUint8(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (var.memadr) {
|
||||
const uint16_t value = BE16_P(val_ptr);
|
||||
*(uint8_t*)var.memadr = map(constrain(value, 0, 100), 0, 100, 0, 255);
|
||||
@ -154,21 +154,21 @@ void DGUSScreenHandler::DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *v
|
||||
// Sends a (RAM located) string to the DGUS Display
|
||||
// (Note: The DGUS Display does not clear after the \0, you have to
|
||||
// overwrite the remainings with spaces.// var.size has the display buffer size!
|
||||
void DGUSScreenHandler::DGUSLCD_SendStringToDisplay(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::sendStringToDisplay(DGUS_VP_Variable &var) {
|
||||
char *tmp = (char*) var.memadr;
|
||||
dgusdisplay.WriteVariable(var.VP, tmp, var.size, true);
|
||||
dgus.writeVariable(var.VP, tmp, var.size, true);
|
||||
}
|
||||
|
||||
// Sends a (flash located) string to the DGUS Display
|
||||
// (Note: The DGUS Display does not clear after the \0, you have to
|
||||
// overwrite the remainings with spaces.// var.size has the display buffer size!
|
||||
void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::sendStringToDisplayPGM(DGUS_VP_Variable &var) {
|
||||
char *tmp = (char*) var.memadr;
|
||||
dgusdisplay.WriteVariablePGM(var.VP, tmp, var.size, true);
|
||||
dgus.writeVariablePGM(var.VP, tmp, var.size, true);
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::DGUSLCD_SendTemperaturePID(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::sendTemperaturePID(DGUS_VP_Variable &var) {
|
||||
float value = *(float *)var.memadr;
|
||||
value /= 10;
|
||||
float valuesend = 0;
|
||||
@ -198,7 +198,7 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) {
|
||||
endian.i = valuesend;
|
||||
tmp[0] = endian.lb[1];
|
||||
tmp[1] = endian.lb[0];
|
||||
dgusdisplay.WriteVariable(var.VP, tmp, 2);
|
||||
dgus.writeVariable(var.VP, tmp, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -206,19 +206,19 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) {
|
||||
|
||||
// Send the accumulate print time to the display.
|
||||
// It is using a hex display for that: It expects BSD coded data in the format xxyyzz
|
||||
void DGUSScreenHandler::DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::sendPrintAccTimeToDisplay(DGUS_VP_Variable &var) {
|
||||
printStatistics state = print_job_timer.getStats();
|
||||
char buf[22];
|
||||
duration_t elapsed = state.printTime;
|
||||
elapsed.toString(buf);
|
||||
dgusdisplay.WriteVariable(VP_PrintAccTime, buf, var.size, true);
|
||||
dgus.writeVariable(VP_PrintAccTime, buf, var.size, true);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::sendPrintsTotalToDisplay(DGUS_VP_Variable &var) {
|
||||
printStatistics state = print_job_timer.getStats();
|
||||
char buf[10];
|
||||
sprintf_P(buf, PSTR("%u"), state.totalPrints);
|
||||
dgusdisplay.WriteVariable(VP_PrintsTotal, buf, var.size, true);
|
||||
dgus.writeVariable(VP_PrintsTotal, buf, var.size, true);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -226,33 +226,33 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) {
|
||||
// Send fan status value to the display.
|
||||
#if HAS_FAN
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::sendFanStatusToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
uint16_t data_to_send = 0;
|
||||
if (*(uint8_t *) var.memadr) data_to_send = 1;
|
||||
dgusdisplay.WriteVariable(var.VP, data_to_send);
|
||||
dgus.writeVariable(var.VP, data_to_send);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Send heater status value to the display.
|
||||
void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::sendHeaterStatusToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
uint16_t data_to_send = 0;
|
||||
if (*(int16_t *) var.memadr) data_to_send = 1;
|
||||
dgusdisplay.WriteVariable(var.VP, data_to_send);
|
||||
dgus.writeVariable(var.VP, data_to_send);
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SendWaitingStatusToDisplay(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::sendWaitingStatusToDisplay(DGUS_VP_Variable &var) {
|
||||
// In FYSETC UI design there are 10 statuses to loop
|
||||
static uint16_t period = 0;
|
||||
static uint16_t index = 0;
|
||||
if (period++ > DGUS_UI_WAITING_STATUS_PERIOD) {
|
||||
dgusdisplay.WriteVariable(var.VP, index);
|
||||
dgus.writeVariable(var.VP, index);
|
||||
if (++index >= DGUS_UI_WAITING_STATUS) index = 0;
|
||||
period = 0;
|
||||
}
|
||||
@ -262,11 +262,11 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var)
|
||||
|
||||
#if HAS_MEDIA
|
||||
|
||||
void DGUSScreenHandler::ScreenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::screenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
// default action executed when there is a SD card, but not printing
|
||||
if (ExtUI::isMediaInserted() && !ExtUI::isPrintingFromMedia()) {
|
||||
ScreenChangeHook(var, val_ptr);
|
||||
dgusdisplay.RequestScreen(current_screen);
|
||||
screenChangeHook(var, val_ptr);
|
||||
dgus.requestScreen(current_screenID);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -274,22 +274,22 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var)
|
||||
// This should host e.g a print pause / print abort / print resume dialog.
|
||||
// This concept allows to recycle this hook for other file
|
||||
if (ExtUI::isPrintingFromMedia() && !card.flag.abort_sd_printing) {
|
||||
GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
|
||||
gotoScreen(DGUS_SCREEN_SDPRINTMANIPULATION);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't let the user in the dark why there is no reaction.
|
||||
if (!ExtUI::isMediaInserted()) {
|
||||
setstatusmessage(GET_TEXT_F(MSG_NO_MEDIA));
|
||||
setStatusMessage(GET_TEXT_F(MSG_NO_MEDIA));
|
||||
return;
|
||||
}
|
||||
if (card.flag.abort_sd_printing) {
|
||||
setstatusmessage(GET_TEXT_F(MSG_MEDIA_ABORTING));
|
||||
setStatusMessage(GET_TEXT_F(MSG_MEDIA_ABORTING));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable& var, void *val_ptr) {
|
||||
void DGUSScreenHandler::sdScrollFilelist(DGUS_VP_Variable& var, void *val_ptr) {
|
||||
auto old_top = top_file;
|
||||
const int16_t scroll = (int16_t)BE16_P(val_ptr);
|
||||
if (scroll) {
|
||||
@ -306,38 +306,38 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var)
|
||||
else if (!filelist.isAtRootDir()) {
|
||||
IF_DISABLED(DGUS_LCD_UI_MKS, filelist.upDir());
|
||||
top_file = 0;
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
}
|
||||
|
||||
if (old_top != top_file) ForceCompleteUpdate();
|
||||
if (old_top != top_file) forceCompleteUpdate();
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::sdReallyAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
ExtUI::stopPrint();
|
||||
GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
gotoScreen(DGUS_SCREEN_MAIN);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_PrintTune(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::sdPrintTune(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes.
|
||||
GotoScreen(DGUSLCD_SCREEN_SDPRINTTUNE);
|
||||
gotoScreen(DGUS_SCREEN_SDPRINTTUNE);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardError() {
|
||||
DGUSScreenHandler::SDCardRemoved();
|
||||
sendinfoscreen(F("NOTICE"), nullptr, F("SD card error"), nullptr, true, true, true, true);
|
||||
SetupConfirmAction(nullptr);
|
||||
GotoScreen(DGUSLCD_SCREEN_POPUP);
|
||||
void DGUSScreenHandler::sdCardError() {
|
||||
DGUSScreenHandler::sdCardRemoved();
|
||||
sendInfoScreen(F("NOTICE"), nullptr, F("SD card error"), nullptr, true, true, true, true);
|
||||
setupConfirmAction(nullptr);
|
||||
gotoScreen(DGUS_SCREEN_POPUP);
|
||||
}
|
||||
|
||||
#endif // HAS_MEDIA
|
||||
|
||||
void DGUSScreenHandler::ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::screenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DGUS_VP_Variable ramcopy;
|
||||
if (!populate_VPVar(ConfirmVP, &ramcopy)) return;
|
||||
if (!populate_VPVar(confirmVP, &ramcopy)) return;
|
||||
if (ramcopy.set_by_display_handler) ramcopy.set_by_display_handler(ramcopy, val_ptr);
|
||||
}
|
||||
|
||||
const uint16_t* DGUSLCD_FindScreenVPMapList(uint8_t screen) {
|
||||
const uint16_t* findScreenVPMapList(uint8_t screen) {
|
||||
const uint16_t *ret;
|
||||
const struct VPMapping *map = VPMap;
|
||||
while ((ret = (uint16_t*) pgm_read_ptr(&(map->VPList)))) {
|
||||
@ -347,7 +347,7 @@ const uint16_t* DGUSLCD_FindScreenVPMapList(uint8_t screen) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const DGUS_VP_Variable* DGUSLCD_FindVPVar(const uint16_t vp) {
|
||||
const DGUS_VP_Variable* findVPVar(const uint16_t vp) {
|
||||
const DGUS_VP_Variable *ret = ListOfVP;
|
||||
do {
|
||||
const uint16_t vpcheck = pgm_read_word(&(ret->VP));
|
||||
@ -359,19 +359,19 @@ const DGUS_VP_Variable* DGUSLCD_FindVPVar(const uint16_t vp) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::ScreenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::screenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!ExtUI::isPrinting()) {
|
||||
ScreenChangeHook(var, val_ptr);
|
||||
dgusdisplay.RequestScreen(current_screen);
|
||||
screenChangeHook(var, val_ptr);
|
||||
dgus.requestScreen(current_screenID);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
thermalManager.disable_all_heaters();
|
||||
ForceCompleteUpdate(); // hint to send all data.
|
||||
forceCompleteUpdate(); // hint to send all data.
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
celsius_t newvalue = BE16_P(val_ptr);
|
||||
celsius_t acceptedvalue;
|
||||
|
||||
@ -405,7 +405,7 @@ void DGUSScreenHandler::HandleTemperatureChanged(DGUS_VP_Variable &var, void *va
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#if HAS_EXTRUDERS
|
||||
const uint16_t newvalue = BE16_P(val_ptr);
|
||||
uint8_t target_extruder;
|
||||
@ -424,7 +424,7 @@ void DGUSScreenHandler::HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_p
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleManualExtrude(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
const int16_t movevalue = BE16_P(val_ptr);
|
||||
float target = movevalue * 0.01f;
|
||||
ExtUI::extruder_t target_extruder;
|
||||
@ -445,17 +445,17 @@ void DGUSScreenHandler::HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
void DGUSScreenHandler::HandleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
*(uint16_t*)var.memadr = BE16_P(val_ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
void DGUSScreenHandler::HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
const int16_t lock = BE16_P(val_ptr);
|
||||
queue.enqueue_one_now(lock ? F("M18") : F("M17"));
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleSettings(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleSettings(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
const uint16_t value = BE16_P(val_ptr);
|
||||
switch (value) {
|
||||
default: break;
|
||||
@ -469,7 +469,7 @@ void DGUSScreenHandler::HandleSettings(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
const uint16_t value_raw = BE16_P(val_ptr);
|
||||
const float value = (float)value_raw / 10;
|
||||
ExtUI::axis_t axis;
|
||||
@ -483,7 +483,7 @@ void DGUSScreenHandler::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
const uint16_t value_raw = BE16_P(val_ptr);
|
||||
const float value = (float)value_raw / 10;
|
||||
ExtUI::extruder_t extruder;
|
||||
@ -501,7 +501,7 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
char buf[32] = {0};
|
||||
|
||||
switch (var.VP) {
|
||||
@ -528,14 +528,14 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
sendinfoscreen(F("PID is autotuning"), F("please wait"), NUL_STR, NUL_STR, true, true, true, true);
|
||||
GotoScreen(DGUSLCD_SCREEN_WAITING);
|
||||
sendInfoScreen(F("PID is autotuning"), F("please wait"), NUL_STR, NUL_STR, true, true, true, true);
|
||||
gotoScreen(DGUS_SCREEN_WAITING);
|
||||
#endif
|
||||
}
|
||||
#endif // HAS_PID_HEATING
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
void DGUSScreenHandler::HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
const float offset = float(int16_t(BE16_P(val_ptr))) / 100.0f;
|
||||
ExtUI::setZOffset_mm(offset);
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
@ -544,12 +544,12 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo
|
||||
#endif
|
||||
|
||||
#if HAS_FAN
|
||||
void DGUSScreenHandler::HandleFanControl(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleFanControl(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
*(uint8_t*)var.memadr = *(uint8_t*)var.memadr > 0 ? 0 : 255;
|
||||
}
|
||||
#endif
|
||||
|
||||
void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleHeaterControl(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint8_t preheat_temp = 0;
|
||||
switch (var.VP) {
|
||||
#if HAS_HOTEND
|
||||
@ -576,7 +576,7 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr
|
||||
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
|
||||
void DGUSScreenHandler::HandlePreheat(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handlePreheat(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
const uint16_t preheat_option = BE16_P(val_ptr);
|
||||
switch (preheat_option) {
|
||||
default:
|
||||
@ -592,48 +592,48 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr
|
||||
}
|
||||
|
||||
// Go to the preheat screen to show the heating progress
|
||||
GotoScreen(DGUSLCD_SCREEN_PREHEAT);
|
||||
gotoScreen(DGUS_SCREEN_PREHEAT);
|
||||
}
|
||||
|
||||
#endif // DGUS_PREHEAT_UI
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
|
||||
void DGUSScreenHandler::HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t value = BE16_P(val_ptr);
|
||||
if (value) {
|
||||
queue.inject(F("M1000"));
|
||||
dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), 32, true);
|
||||
GotoScreen(PLR_SCREEN_RECOVER);
|
||||
dgus.writeVariable(VP_SD_Print_Filename, filelist.filename(), 32, true);
|
||||
gotoScreen(PLR_SCREEN_RECOVER);
|
||||
}
|
||||
else {
|
||||
recovery.cancel();
|
||||
GotoScreen(PLR_SCREEN_CANCEL);
|
||||
gotoScreen(PLR_SCREEN_CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void DGUSScreenHandler::UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup) {
|
||||
void DGUSScreenHandler::updateNewScreen(const DGUS_ScreenID screenID, const bool popup) {
|
||||
if (!popup) {
|
||||
memmove(&past_screens[1], &past_screens[0], sizeof(past_screens) - 1);
|
||||
past_screens[0] = current_screen;
|
||||
memmove(&past_screenIDs[1], &past_screenIDs[0], sizeof(past_screenIDs) - 1);
|
||||
past_screenIDs[0] = current_screenID;
|
||||
}
|
||||
current_screen = newscreen;
|
||||
current_screenID = screenID;
|
||||
skipVP = 0;
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::PopToOldScreen() {
|
||||
GotoScreen(past_screens[0], true);
|
||||
memmove(&past_screens[0], &past_screens[1], sizeof(past_screens) - 1);
|
||||
past_screens[sizeof(past_screens) - 1] = DGUSLCD_SCREEN_MAIN;
|
||||
void DGUSScreenHandler::popToOldScreen() {
|
||||
gotoScreen(past_screenIDs[0], true);
|
||||
memmove(&past_screenIDs[0], &past_screenIDs[1], sizeof(past_screenIDs) - 1);
|
||||
past_screenIDs[sizeof(past_screenIDs) - 1] = DGUS_SCREEN_MAIN;
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::UpdateScreenVPData() {
|
||||
const uint16_t *VPList = DGUSLCD_FindScreenVPMapList(current_screen);
|
||||
void DGUSScreenHandler::updateScreenVPData() {
|
||||
const uint16_t *VPList = findScreenVPMapList(current_screenID);
|
||||
if (!VPList) {
|
||||
ScreenComplete = true;
|
||||
screenComplete = true;
|
||||
return; // nothing to do, likely a bug or boring screen.
|
||||
}
|
||||
|
||||
@ -645,7 +645,7 @@ void DGUSScreenHandler::UpdateScreenVPData() {
|
||||
uint16_t VP = pgm_read_word(VPList);
|
||||
if (!VP) {
|
||||
update_ptr = 0;
|
||||
ScreenComplete = true;
|
||||
screenComplete = true;
|
||||
return; // Screen completed.
|
||||
}
|
||||
|
||||
@ -656,12 +656,12 @@ void DGUSScreenHandler::UpdateScreenVPData() {
|
||||
uint8_t expected_tx = 6 + rcpy.size; // expected overhead is 6 bytes + payload.
|
||||
// Send the VP to the display, but try to avoid overrunning the Tx Buffer.
|
||||
// But send at least one VP, to avoid getting stalled.
|
||||
if (rcpy.send_to_display_handler && (!sent_one || expected_tx <= dgusdisplay.GetFreeTxBuffer())) {
|
||||
if (rcpy.send_to_display_handler && (!sent_one || expected_tx <= dgus.getFreeTxBuffer())) {
|
||||
sent_one = true;
|
||||
rcpy.send_to_display_handler(rcpy);
|
||||
}
|
||||
else {
|
||||
ScreenComplete = false;
|
||||
screenComplete = false;
|
||||
return; // please call again!
|
||||
}
|
||||
}
|
||||
@ -669,14 +669,14 @@ void DGUSScreenHandler::UpdateScreenVPData() {
|
||||
} while (++update_ptr, ++VPList, true);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::GotoScreen(DGUSLCD_Screens screen, bool ispopup) {
|
||||
dgusdisplay.RequestScreen(screen);
|
||||
UpdateNewScreen(screen, ispopup);
|
||||
void DGUSScreenHandler::gotoScreen(const DGUS_ScreenID screenID, const bool popup/*=false*/) {
|
||||
dgus.requestScreen(screenID);
|
||||
updateNewScreen(screenID, popup);
|
||||
}
|
||||
|
||||
void DGUSDisplay::RequestScreen(DGUSLCD_Screens screen) {
|
||||
const unsigned char gotoscreen[] = { 0x5A, 0x01, (unsigned char) (screen >> 8U), (unsigned char) (screen & 0xFFU) };
|
||||
WriteVariable(0x84, gotoscreen, sizeof(gotoscreen));
|
||||
void DGUSDisplay::requestScreen(const DGUS_ScreenID screenID) {
|
||||
const unsigned char gotoscreen[] = { 0x5A, 0x01, (unsigned char) (screenID >> 8U), (unsigned char) (screenID & 0xFFU) };
|
||||
writeVariable(0x84, gotoscreen, sizeof(gotoscreen));
|
||||
}
|
||||
|
||||
#endif // HAS_DGUS_LCD_CLASSIC
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include "hiprecy/DGUSScreenHandler.h"
|
||||
#endif
|
||||
|
||||
extern DGUSScreenHandlerClass ScreenHandler;
|
||||
extern DGUSScreenHandlerClass screen;
|
||||
|
||||
// Helper to define a DGUS_VP_Variable for common use-cases.
|
||||
#define VPHELPER(VPADR, VPADRVAR, RXFPTR, TXFPTR) { \
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
enum DGUS_ScreenID : uint8_t;
|
||||
|
||||
class DGUSScreenHandler {
|
||||
public:
|
||||
@ -37,150 +37,150 @@ public:
|
||||
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifying whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
static void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash);
|
||||
static void sendInfoScreen(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
static void sendInfoScreen(FSTR_P const line1, FSTR_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendInfoScreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash);
|
||||
}
|
||||
static void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash);
|
||||
static void sendInfoScreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendInfoScreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash);
|
||||
}
|
||||
|
||||
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
static void handleUserConfirmationPopUp(uint16_t confirmVP, PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
// "M117" Message -- msg is a RAM ptr.
|
||||
static void setstatusmessage(const char *msg);
|
||||
static void setStatusMessage(const char *msg);
|
||||
// The same for messages from Flash
|
||||
static void setstatusmessagePGM(PGM_P const msg);
|
||||
static void setstatusmessage(FSTR_P const fmsg) { setstatusmessagePGM(FTOP(fmsg)); }
|
||||
static void setStatusMessage(FSTR_P const fmsg) { setstatusmessagePGM(FTOP(fmsg)); }
|
||||
// Callback for VP "Display wants to change screen on idle printer"
|
||||
static void ScreenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void screenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Callback for VP "Screen has been changed"
|
||||
static void ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void screenChangeHook(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Callback for VP "All Heaters Off"
|
||||
static void HandleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change this temperature"
|
||||
static void HandleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change Flowrate"
|
||||
static void HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
// Hook for manual move option
|
||||
static void HandleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
// Hook for manual move.
|
||||
static void HandleManualMove(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleManualMove(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for manual extrude.
|
||||
static void HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleManualExtrude(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for motor lock and unlook
|
||||
static void HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Hook for power loss recovery.
|
||||
static void HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
// Hook for settings
|
||||
static void HandleSettings(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleSettings(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
// Hook for "Change this temperature PID para"
|
||||
static void HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for PID autotune
|
||||
static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
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);
|
||||
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);
|
||||
static void handleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
// Hook for fan control
|
||||
static void HandleFanControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleFanControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
// Hook for heater control
|
||||
static void HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleHeaterControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
// Hook for preheat
|
||||
static void HandlePreheat(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handlePreheat(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
// Hook for filament load and unload filament option
|
||||
static void HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleFilamentOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for filament load and unload
|
||||
static void HandleFilamentLoadUnload(DGUS_VP_Variable &var);
|
||||
static void handleFilamentLoadUnload(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
#if HAS_MEDIA
|
||||
// Callback for VP "Display wants to change screen when there is a SD card"
|
||||
static void ScreenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void screenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Scroll buttons on the file listing screen.
|
||||
static void DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void sdScrollFilelist(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// File touched.
|
||||
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void sdFileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// start print after confirmation received.
|
||||
static void DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void sdStartPrint(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the pause, resume or abort button.
|
||||
static void DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void sdResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User confirmed the abort action
|
||||
static void DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void sdReallyAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the tune button
|
||||
static void DGUSLCD_SD_PrintTune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void sdPrintTune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Send a single filename to the display.
|
||||
static void DGUSLCD_SD_SendFilename(DGUS_VP_Variable &var);
|
||||
static void sdSendFilename(DGUS_VP_Variable &var);
|
||||
// Marlin informed us that a new SD has been inserted.
|
||||
static void SDCardInserted();
|
||||
static void sdCardInserted();
|
||||
// Marlin informed us that the SD Card has been removed().
|
||||
static void SDCardRemoved();
|
||||
static void sdCardRemoved();
|
||||
// Marlin informed us about a bad SD Card.
|
||||
static void SDCardError();
|
||||
static void sdCardError();
|
||||
#endif
|
||||
|
||||
// OK Button on the Confirm screen.
|
||||
static void ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void screenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Update data after going to a new screen (by display or by GotoScreen)
|
||||
// Update data after going to a new screen (by display or by gotoScreen)
|
||||
// remember to store the last-displayed screen so it can be restored.
|
||||
// (e.g., for popup messages)
|
||||
static void UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup=false);
|
||||
static void updateNewScreen(const DGUS_ScreenID screenID, const bool popup=false);
|
||||
|
||||
// Recall the remembered screen.
|
||||
static void PopToOldScreen();
|
||||
static void popToOldScreen();
|
||||
|
||||
// Make the display show the screen and update all VPs in it.
|
||||
static void GotoScreen(DGUSLCD_Screens screen, bool ispopup = false);
|
||||
static void gotoScreen(const DGUS_ScreenID screenID, const bool popup=false);
|
||||
|
||||
static void UpdateScreenVPData();
|
||||
static void updateScreenVPData();
|
||||
|
||||
// Helpers to convert and transfer data to the display.
|
||||
static void DGUSLCD_SendWordValueToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplay(DGUS_VP_Variable &var);
|
||||
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);
|
||||
static void sendWordValueToDisplay(DGUS_VP_Variable &var);
|
||||
static void sendStringToDisplay(DGUS_VP_Variable &var);
|
||||
static void sendStringToDisplayPGM(DGUS_VP_Variable &var);
|
||||
static void sendTemperaturePID(DGUS_VP_Variable &var);
|
||||
static void sendPercentageToDisplay(DGUS_VP_Variable &var);
|
||||
static void sendPrintProgressToDisplay(DGUS_VP_Variable &var);
|
||||
static void sendPrintTimeToDisplay(DGUS_VP_Variable &var);
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var);
|
||||
static void sendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void sendPrintsTotalToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var);
|
||||
static void sendFanStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var);
|
||||
static void sendHeaterStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
static void DGUSLCD_SendWaitingStatusToDisplay(DGUS_VP_Variable &var);
|
||||
static void sendWaitingStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
// Send a value from 0..100 to a variable with a range from 0..255
|
||||
static void DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void percentageToUint8(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
template<typename T>
|
||||
static void DGUSLCD_SetValueDirectly(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
static void setValueDirectly(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!var.memadr) return;
|
||||
union { unsigned char tmp[sizeof(T)]; T t; } x;
|
||||
unsigned char *ptr = (unsigned char*)val_ptr;
|
||||
@ -192,11 +192,11 @@ public:
|
||||
// Display will get a 4-byte integer scaled to the number of digits:
|
||||
// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<uint16_t decimals>
|
||||
static void DGUSLCD_SendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) {
|
||||
static void sendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (long)f);
|
||||
dgus.writeVariable(var.VP, (long)f);
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,34 +204,34 @@ public:
|
||||
// Display will get a 2-byte integer scaled to the number of digits:
|
||||
// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<uint16_t decimals>
|
||||
static void DGUSLCD_SendFloatAsIntValueToDisplay(DGUS_VP_Variable &var) {
|
||||
static void sendFloatAsIntValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
DEBUG_ECHOLNPAIR_F(" >> ", f, 6);
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (int16_t)f);
|
||||
dgus.writeVariable(var.VP, (int16_t)f);
|
||||
}
|
||||
}
|
||||
|
||||
// Force an update of all VP on the current screen.
|
||||
static void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
static void forceCompleteUpdate() { update_ptr = 0; screenComplete = false; }
|
||||
// Has all VPs sent to the screen
|
||||
static bool IsScreenComplete() { return ScreenComplete; }
|
||||
static bool isScreenComplete() { return screenComplete; }
|
||||
|
||||
static DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
static DGUS_ScreenID getCurrentScreen() { return current_screenID; }
|
||||
|
||||
static void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
static void setupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
protected:
|
||||
static DGUSLCD_Screens current_screen; //< currently on screen
|
||||
static DGUS_ScreenID current_screenID; //< currently on screen
|
||||
static constexpr uint8_t NUM_PAST_SCREENS = 4;
|
||||
static DGUSLCD_Screens past_screens[NUM_PAST_SCREENS]; //< LIFO with past screens for the "back" button.
|
||||
static DGUS_ScreenID past_screenIDs[NUM_PAST_SCREENS]; //< LIFO with past screens for the "back" button.
|
||||
|
||||
static uint8_t update_ptr; //< Last sent entry in the VPList for the actual screen.
|
||||
static uint16_t skipVP; //< When updating the screen data, skip this one, because the user is interacting with it.
|
||||
static bool ScreenComplete; //< All VPs sent to screen?
|
||||
static bool screenComplete; //< All VPs sent to screen?
|
||||
|
||||
static uint16_t ConfirmVP; //< context for confirm screen (VP that will be emulated-sent on "OK").
|
||||
static uint16_t confirmVP; //< context for confirm screen (VP that will be emulated-sent on "OK").
|
||||
|
||||
#if HAS_MEDIA
|
||||
static int16_t top_file; //< file on top of file chooser
|
||||
|
@ -36,21 +36,21 @@
|
||||
namespace ExtUI {
|
||||
|
||||
void onStartup() {
|
||||
dgusdisplay.InitDisplay();
|
||||
ScreenHandler.UpdateScreenVPData();
|
||||
dgus.initDisplay();
|
||||
screen.updateScreenVPData();
|
||||
}
|
||||
|
||||
void onIdle() { ScreenHandler.loop(); }
|
||||
void onIdle() { screen.loop(); }
|
||||
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const) {
|
||||
ScreenHandler.sendinfoscreen(GET_TEXT_F(MSG_HALTED), error, FPSTR(NUL_STR), GET_TEXT_F(MSG_PLEASE_RESET), true, true, true, true);
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_KILL);
|
||||
while (!ScreenHandler.loop()); // Wait while anything is left to be sent
|
||||
screen.sendInfoScreen(GET_TEXT_F(MSG_HALTED), error, FPSTR(NUL_STR), GET_TEXT_F(MSG_PLEASE_RESET), true, true, true, true);
|
||||
screen.gotoScreen(DGUS_SCREEN_KILL);
|
||||
while (!screen.loop()); // Wait while anything is left to be sent
|
||||
}
|
||||
|
||||
void onMediaInserted() { TERN_(HAS_MEDIA, ScreenHandler.SDCardInserted()); }
|
||||
void onMediaError() { TERN_(HAS_MEDIA, ScreenHandler.SDCardError()); }
|
||||
void onMediaRemoved() { TERN_(HAS_MEDIA, ScreenHandler.SDCardRemoved()); }
|
||||
void onMediaInserted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); }
|
||||
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
|
||||
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
|
||||
|
||||
void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
|
||||
void onPrintTimerStarted() {}
|
||||
@ -60,17 +60,17 @@ namespace ExtUI {
|
||||
|
||||
void onUserConfirmRequired(const char * const msg) {
|
||||
if (msg) {
|
||||
ScreenHandler.sendinfoscreen(F("Please confirm."), nullptr, msg, nullptr, true, true, false, true);
|
||||
ScreenHandler.SetupConfirmAction(setUserConfirmed);
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP);
|
||||
screen.sendInfoScreen(F("Please confirm."), nullptr, msg, nullptr, true, true, false, true);
|
||||
screen.setupConfirmAction(setUserConfirmed);
|
||||
screen.gotoScreen(DGUS_SCREEN_POPUP);
|
||||
}
|
||||
else if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_POPUP) {
|
||||
ScreenHandler.SetupConfirmAction(nullptr);
|
||||
ScreenHandler.PopToOldScreen();
|
||||
else if (screen.getCurrentScreen() == DGUS_SCREEN_POPUP) {
|
||||
screen.setupConfirmAction(nullptr);
|
||||
screen.popToOldScreen();
|
||||
}
|
||||
}
|
||||
|
||||
void onStatusChanged(const char * const msg) { ScreenHandler.setstatusmessage(msg); }
|
||||
void onStatusChanged(const char * const msg) { screen.setStatusMessage(msg); }
|
||||
|
||||
void onHomingStart() {}
|
||||
void onHomingDone() {}
|
||||
@ -136,7 +136,7 @@ namespace ExtUI {
|
||||
}
|
||||
void onPowerLossResume() {
|
||||
// Called on resume from power-loss
|
||||
IF_DISABLED(DGUS_LCD_UI_MKS, ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POWER_LOSS));
|
||||
IF_DISABLED(DGUS_LCD_UI_MKS, screen.gotoScreen(DGUS_SCREEN_POWER_LOSS));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -145,22 +145,22 @@ namespace ExtUI {
|
||||
// Called for temperature PID tuning result
|
||||
switch (rst) {
|
||||
case PID_STARTED:
|
||||
ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_AUTOTUNE));
|
||||
screen.setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE));
|
||||
break;
|
||||
case PID_BAD_HEATER_ID:
|
||||
ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_BAD_HEATER_ID));
|
||||
screen.setStatusMessage(GET_TEXT_F(MSG_PID_BAD_HEATER_ID));
|
||||
break;
|
||||
case PID_TEMP_TOO_HIGH:
|
||||
ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH));
|
||||
screen.setStatusMessage(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH));
|
||||
break;
|
||||
case PID_TUNING_TIMEOUT:
|
||||
ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_TIMEOUT));
|
||||
screen.setStatusMessage(GET_TEXT_F(MSG_PID_TIMEOUT));
|
||||
break;
|
||||
case PID_DONE:
|
||||
ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE));
|
||||
screen.setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE));
|
||||
break;
|
||||
}
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
screen.gotoScreen(DGUS_SCREEN_MAIN);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -289,28 +289,28 @@ const uint16_t VPList_Z_Offset[] PROGMEM = {
|
||||
};
|
||||
|
||||
const struct VPMapping VPMap[] PROGMEM = {
|
||||
{ DGUSLCD_SCREEN_BOOT, VPList_Boot },
|
||||
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
|
||||
{ DGUSLCD_SCREEN_TEMPERATURE, VPList_Temp },
|
||||
{ DGUSLCD_SCREEN_STATUS, VPList_Status },
|
||||
{ DGUSLCD_SCREEN_STATUS2, VPList_Status2 },
|
||||
{ DGUSLCD_SCREEN_PREHEAT, VPList_Preheat },
|
||||
{ DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove },
|
||||
{ DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
|
||||
{ DGUSLCD_SCREEN_FILAMENT_HEATING, VPList_Filament_heating },
|
||||
{ DGUSLCD_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload },
|
||||
{ DGUSLCD_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload },
|
||||
{ DGUSLCD_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation },
|
||||
{ DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList },
|
||||
{ DGUSLCD_SCREEN_SDPRINTTUNE, VPList_SDPrintTune },
|
||||
{ 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 },
|
||||
{ DGUSLCD_SCREEN_INFOS, VPList_Infos },
|
||||
{ DGUS_SCREEN_BOOT, VPList_Boot },
|
||||
{ DGUS_SCREEN_MAIN, VPList_Main },
|
||||
{ DGUS_SCREEN_TEMPERATURE, VPList_Temp },
|
||||
{ DGUS_SCREEN_STATUS, VPList_Status },
|
||||
{ DGUS_SCREEN_STATUS2, VPList_Status2 },
|
||||
{ DGUS_SCREEN_PREHEAT, VPList_Preheat },
|
||||
{ DGUS_SCREEN_MANUALMOVE, VPList_ManualMove },
|
||||
{ DGUS_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
|
||||
{ DGUS_SCREEN_FILAMENT_HEATING, VPList_Filament_heating },
|
||||
{ DGUS_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload },
|
||||
{ DGUS_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload },
|
||||
{ DGUS_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation },
|
||||
{ DGUS_SCREEN_SDFILELIST, VPList_SDFileList },
|
||||
{ DGUS_SCREEN_SDPRINTTUNE, VPList_SDPrintTune },
|
||||
{ DGUS_SCREEN_WAITING, VPList_PIDTuningWaiting },
|
||||
{ DGUS_SCREEN_FLC_PREHEAT, VPList_FLCPreheat },
|
||||
{ DGUS_SCREEN_FLC_PRINTING, VPList_FLCPrinting },
|
||||
{ DGUS_SCREEN_Z_OFFSET, VPList_Z_Offset },
|
||||
{ DGUS_SCREEN_STEPPERMM, VPList_StepPerMM },
|
||||
{ DGUS_SCREEN_PID_E, VPList_PIDE0 },
|
||||
{ DGUS_SCREEN_PID_BED, VPList_PIDBED },
|
||||
{ DGUS_SCREEN_INFOS, VPList_Infos },
|
||||
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
|
||||
};
|
||||
|
||||
@ -318,159 +318,159 @@ const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
|
||||
|
||||
const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
// Helper to detect touch events
|
||||
VPHELPER(VP_SCREENCHANGE, nullptr, ScreenHandler.ScreenChangeHook, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_ASK, nullptr, ScreenHandler.ScreenChangeHookIfIdle, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE, nullptr, screen.screenChangeHook, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_ASK, nullptr, screen.screenChangeHookIfIdle, nullptr),
|
||||
#if HAS_MEDIA
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, ScreenHandler.ScreenChangeHookIfSD, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, screen.screenChangeHookIfSD, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr),
|
||||
VPHELPER(VP_CONFIRMED, nullptr, screen.screenConfirmedOK, nullptr),
|
||||
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, ScreenHandler.HandleAllHeatersOff, nullptr),
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, screen.handleAllHeatersOff, nullptr),
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_OPTION, &distanceToMove, ScreenHandler.HandleManualMoveOption, nullptr),
|
||||
VPHELPER(VP_MOVE_OPTION, &distanceToMove, screen.handleManualMoveOption, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_X, &distanceToMove, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, &distanceToMove, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, &distanceToMove, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, &distanceToMove, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_X, &distanceToMove, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, &distanceToMove, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, &distanceToMove, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, &distanceToMove, screen.handleManualMove, nullptr),
|
||||
#else
|
||||
VPHELPER(VP_MOVE_X, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_X, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, screen.handleManualMove, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, ScreenHandler.HandleMotorLockUnlock, nullptr),
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, screen.handleMotorLockUnlock, nullptr),
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, ScreenHandler.HandlePowerLossRecovery, nullptr),
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, screen.handlePowerLossRecovery, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_SETTINGS, nullptr, ScreenHandler.HandleSettings, nullptr),
|
||||
VPHELPER(VP_SETTINGS, nullptr, screen.handleSettings, nullptr),
|
||||
#if ENABLED(SINGLE_Z_CALIBRATION)
|
||||
VPHELPER(VP_Z_CALIBRATE, nullptr, ScreenHandler.HandleZCalibration, nullptr),
|
||||
VPHELPER(VP_Z_CALIBRATE, nullptr, screen.handleZCalibration, nullptr),
|
||||
#endif
|
||||
|
||||
#if ENABLED(FIRST_LAYER_CAL)
|
||||
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, ScreenHandler.HandleFirstLayerCal, nullptr),
|
||||
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, screen.handleFirstLayerCal, nullptr),
|
||||
#endif
|
||||
|
||||
{ .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
// M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr
|
||||
{ .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay },
|
||||
{ .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay },
|
||||
|
||||
// Temperature Data
|
||||
#if HAS_HOTEND
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_EPos, &destination.e, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_MOVE_E0, nullptr, ScreenHandler.HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], screen.handleFlowRateChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_EPos, &destination.e, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_MOVE_E0, nullptr, screen.handleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, screen.handleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, screen.sendHeaterStatusToDisplay),
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, ScreenHandler.HandlePreheat, nullptr),
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, screen.handlePreheat, nullptr),
|
||||
#endif
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, screen.handlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, ScreenHandler.HandleFilamentOption, ScreenHandler.HandleFilamentLoadUnload),
|
||||
VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, screen.handleFilamentOption, screen.handleFilamentLoadUnload),
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_MULTI_HOTEND
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E1, &planner.flow_percentage[ExtUI::extruder_t::E1], ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), // ERROR: Flow is per-extruder, not per-hotend
|
||||
VPHELPER(VP_MOVE_E1, nullptr, ScreenHandler.HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E1, &planner.flow_percentage[ExtUI::extruder_t::E1], screen.handleFlowRateChanged, screen.sendWordValueToDisplay), // ERROR: Flow is per-extruder, not per-hotend
|
||||
VPHELPER(VP_MOVE_E1, nullptr, screen.handleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, screen.handleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, screen.sendHeaterStatusToDisplay),
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, screen.handlePIDAutotune, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_E1_FILAMENT_LOAD_UNLOAD, nullptr, ScreenHandler.HandleFilamentOption, ScreenHandler.HandleFilamentLoadUnload),
|
||||
VPHELPER(VP_E1_FILAMENT_LOAD_UNLOAD, nullptr, screen.handleFilamentOption, screen.handleFilamentLoadUnload),
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, screen.handleHeaterControl, nullptr),
|
||||
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, screen.sendHeaterStatusToDisplay),
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, screen.handlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Fan Data
|
||||
#if HAS_FAN
|
||||
#define FAN_VPHELPER(N) \
|
||||
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], ScreenHandler.DGUSLCD_PercentageToUint8, ScreenHandler.DGUSLCD_SendPercentageToDisplay), \
|
||||
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], ScreenHandler.HandleFanControl, nullptr), \
|
||||
VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, ScreenHandler.DGUSLCD_SendFanStatusToDisplay),
|
||||
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], screen.percentageToUint8, screen.sendPercentageToDisplay), \
|
||||
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], screen.handleFanControl, nullptr), \
|
||||
VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, screen.sendFanStatusToDisplay),
|
||||
REPEAT(FAN_COUNT, FAN_VPHELPER)
|
||||
#endif
|
||||
|
||||
// Feedrate
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, screen.setValueDirectly<int16_t>, screen.sendWordValueToDisplay),
|
||||
|
||||
// Position Data
|
||||
VPHELPER(VP_XPos, ¤t_position.x, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_YPos, ¤t_position.y, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_XPos, ¤t_position.x, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_YPos, ¤t_position.y, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
|
||||
// Print Progress
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay),
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, screen.sendPrintProgressToDisplay),
|
||||
|
||||
// Print Time
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, screen.sendPrintTimeToDisplay),
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintAccTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintsTotalToDisplay),
|
||||
VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, screen.sendPrintAccTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, screen.sendPrintsTotalToDisplay),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
#if HAS_EXTRUDERS
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// SDCard File listing.
|
||||
#if HAS_MEDIA
|
||||
VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr),
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr),
|
||||
VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr),
|
||||
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER(VP_SD_ResumePauseAbort, nullptr, ScreenHandler.DGUSLCD_SD_ResumePauseAbort, nullptr),
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr),
|
||||
VPHELPER(VP_SD_ScrollEvent, nullptr, screen.sdScrollFilelist, nullptr),
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, screen.sdFileSelected, nullptr),
|
||||
VPHELPER(VP_SD_FileSelectConfirm, nullptr, screen.sdStartPrint, nullptr),
|
||||
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER(VP_SD_ResumePauseAbort, nullptr, screen.sdResumePauseAbort, nullptr),
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, screen.sdReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, screen.sdPrintTune, nullptr),
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, ScreenHandler.HandleProbeOffsetZChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, screen.handleProbeOffsetZChanged, screen.sendFloatAsIntValueToDisplay<2>),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, nullptr),
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, screen.handleLiveAdjustZ, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, ScreenHandler.DGUSLCD_SendWaitingStatusToDisplay),
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, screen.sendWaitingStatusToDisplay),
|
||||
#endif
|
||||
|
||||
// Messages for the User, shared by the popup and the kill screen. They can't be autouploaded as we do not buffer content.
|
||||
{ .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
@ -23,35 +23,35 @@
|
||||
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t {
|
||||
DGUSLCD_SCREEN_BOOT = 0,
|
||||
DGUSLCD_SCREEN_MAIN = 1,
|
||||
DGUSLCD_SCREEN_STATUS = 1,
|
||||
DGUSLCD_SCREEN_STATUS2 = 1,
|
||||
DGUSLCD_SCREEN_TEMPERATURE = 10,
|
||||
DGUSLCD_SCREEN_PREHEAT = 18,
|
||||
DGUSLCD_SCREEN_POWER_LOSS = 100,
|
||||
DGUSLCD_SCREEN_MANUALMOVE = 192,
|
||||
DGUSLCD_SCREEN_UTILITY = 120,
|
||||
DGUSLCD_SCREEN_FILAMENT_HEATING = 146,
|
||||
DGUSLCD_SCREEN_FILAMENT_LOADING = 148,
|
||||
DGUSLCD_SCREEN_FILAMENT_UNLOADING = 158,
|
||||
DGUSLCD_SCREEN_MANUALEXTRUDE = 160,
|
||||
DGUSLCD_SCREEN_SDFILELIST = 71,
|
||||
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 73,
|
||||
DGUSLCD_SCREEN_SDPRINTTUNE = 75,
|
||||
DGUSLCD_SCREEN_FLC_PREHEAT = 94,
|
||||
DGUSLCD_SCREEN_FLC_PRINTING = 96,
|
||||
DGUSLCD_SCREEN_STEPPERMM = 212,
|
||||
DGUSLCD_SCREEN_PID_E = 214,
|
||||
DGUSLCD_SCREEN_PID_BED = 218,
|
||||
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,
|
||||
DGUSLCD_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUSLCD_SCREEN_UNUSED = 255
|
||||
enum DGUS_ScreenID : uint8_t {
|
||||
DGUS_SCREEN_BOOT = 0,
|
||||
DGUS_SCREEN_MAIN = 1,
|
||||
DGUS_SCREEN_STATUS = 1,
|
||||
DGUS_SCREEN_STATUS2 = 1,
|
||||
DGUS_SCREEN_TEMPERATURE = 10,
|
||||
DGUS_SCREEN_PREHEAT = 18,
|
||||
DGUS_SCREEN_POWER_LOSS = 100,
|
||||
DGUS_SCREEN_MANUALMOVE = 192,
|
||||
DGUS_SCREEN_UTILITY = 120,
|
||||
DGUS_SCREEN_FILAMENT_HEATING = 146,
|
||||
DGUS_SCREEN_FILAMENT_LOADING = 148,
|
||||
DGUS_SCREEN_FILAMENT_UNLOADING = 158,
|
||||
DGUS_SCREEN_MANUALEXTRUDE = 160,
|
||||
DGUS_SCREEN_SDFILELIST = 71,
|
||||
DGUS_SCREEN_SDPRINTMANIPULATION = 73,
|
||||
DGUS_SCREEN_SDPRINTTUNE = 75,
|
||||
DGUS_SCREEN_FLC_PREHEAT = 94,
|
||||
DGUS_SCREEN_FLC_PRINTING = 96,
|
||||
DGUS_SCREEN_STEPPERMM = 212,
|
||||
DGUS_SCREEN_PID_E = 214,
|
||||
DGUS_SCREEN_PID_BED = 218,
|
||||
DGUS_SCREEN_Z_OFFSET = 222,
|
||||
DGUS_SCREEN_INFOS = 36,
|
||||
DGUS_SCREEN_CONFIRM = 240,
|
||||
DGUS_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
|
||||
DGUS_SCREEN_WAITING = 251,
|
||||
DGUS_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUS_SCREEN_UNUSED = 255
|
||||
};
|
||||
|
||||
// Display Memory layout used (T5UID)
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
extern ExtUI::FileList filelist;
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::sdFileSelected(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file;
|
||||
if (touched_nr > filelist.count()) return;
|
||||
if (!filelist.seek(touched_nr)) return;
|
||||
@ -52,28 +52,28 @@
|
||||
if (filelist.isDir()) {
|
||||
filelist.changeDir(filelist.filename());
|
||||
top_file = 0;
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_PRINT_FILENAME)
|
||||
// Send print filename
|
||||
dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true);
|
||||
dgus.writeVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true);
|
||||
#endif
|
||||
|
||||
// Setup Confirmation screen
|
||||
file_to_print = touched_nr;
|
||||
|
||||
HandleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true);
|
||||
handleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::sdStartPrint(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!filelist.seek(file_to_print)) return;
|
||||
ExtUI::printFile(filelist.shortFilename());
|
||||
GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
|
||||
gotoScreen(DGUS_SCREEN_SDPRINTMANIPULATION);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::sdResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
|
||||
if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes.
|
||||
switch (swap16(*(uint16_t*)val_ptr)) {
|
||||
@ -85,19 +85,19 @@
|
||||
|
||||
case 1: // Pause
|
||||
|
||||
GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
|
||||
gotoScreen(DGUS_SCREEN_SDPRINTMANIPULATION);
|
||||
if (!ExtUI::isPrintingFromMediaPaused()) {
|
||||
ExtUI::pausePrint();
|
||||
//ExtUI::mks_pausePrint();
|
||||
}
|
||||
break;
|
||||
case 2: // Abort
|
||||
HandleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true);
|
||||
handleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_SendFilename(DGUS_VP_Variable& var) {
|
||||
void DGUSScreenHandler::sdSendFilename(DGUS_VP_Variable& var) {
|
||||
uint16_t target_line = (var.VP - VP_SD_FileName0) / VP_SD_FileName_LEN;
|
||||
if (target_line > DGUS_SD_FILESPERSCREEN) return;
|
||||
char tmpfilename[VP_SD_FileName_LEN + 1] = "";
|
||||
@ -106,49 +106,49 @@
|
||||
if (filelist.seek(top_file + target_line)) {
|
||||
snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s%c"), filelist.filename(), filelist.isDir() ? '/' : 0); // snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s"), filelist.filename());
|
||||
}
|
||||
DGUSLCD_SendStringToDisplay(var);
|
||||
sendStringToDisplay(var);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardInserted() {
|
||||
void DGUSScreenHandler::sdCardInserted() {
|
||||
top_file = 0;
|
||||
filelist.refresh();
|
||||
auto cs = getCurrentScreen();
|
||||
if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS)
|
||||
GotoScreen(DGUSLCD_SCREEN_SDFILELIST);
|
||||
if (cs == DGUS_SCREEN_MAIN || cs == DGUS_SCREEN_STATUS)
|
||||
gotoScreen(DGUS_SCREEN_SDFILELIST);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardRemoved() {
|
||||
if (current_screen == DGUSLCD_SCREEN_SDFILELIST
|
||||
|| (current_screen == DGUSLCD_SCREEN_CONFIRM && (ConfirmVP == VP_SD_AbortPrintConfirmed || ConfirmVP == VP_SD_FileSelectConfirm))
|
||||
|| current_screen == DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
) GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
void DGUSScreenHandler::sdCardRemoved() {
|
||||
if (current_screenID == DGUS_SCREEN_SDFILELIST
|
||||
|| (current_screenID == DGUS_SCREEN_CONFIRM && (confirmVP == VP_SD_AbortPrintConfirmed || confirmVP == VP_SD_FileSelectConfirm))
|
||||
|| current_screenID == DGUS_SCREEN_SDPRINTMANIPULATION
|
||||
) gotoScreen(DGUS_SCREEN_MAIN);
|
||||
}
|
||||
|
||||
#endif // HAS_MEDIA
|
||||
|
||||
void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::screenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint8_t *tmp = (uint8_t*)val_ptr;
|
||||
|
||||
// The keycode in target is coded as <from-frame><to-frame>, so 0x0100A means
|
||||
// from screen 1 (main) to 10 (temperature). DGUSLCD_SCREEN_POPUP is special,
|
||||
// from screen 1 (main) to 10 (temperature). DGUS_SCREEN_POPUP is special,
|
||||
// meaning "return to previous screen"
|
||||
DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1];
|
||||
DGUS_ScreenID target = (DGUS_ScreenID)tmp[1];
|
||||
|
||||
if (target == DGUSLCD_SCREEN_POPUP) {
|
||||
if (target == DGUS_SCREEN_POPUP) {
|
||||
// Special handling for popup is to return to previous menu
|
||||
if (current_screen == DGUSLCD_SCREEN_POPUP && confirm_action_cb) confirm_action_cb();
|
||||
PopToOldScreen();
|
||||
if (current_screenID == DGUS_SCREEN_POPUP && confirm_action_cb) confirm_action_cb();
|
||||
popToOldScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateNewScreen(target);
|
||||
updateNewScreen(target);
|
||||
|
||||
#ifdef DEBUG_DGUSLCD
|
||||
if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target);
|
||||
if (!findScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
if (movevalue) {
|
||||
@ -196,7 +196,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
char buf[6] = "G28 X";
|
||||
buf[4] = axiscode;
|
||||
queue.enqueue_one_now(buf);
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@ -219,14 +219,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!old_relative_mode) queue.enqueue_now(F("G90"));
|
||||
}
|
||||
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
|
||||
cannotmove:
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
|
||||
float value = (float)rawvalue / 10;
|
||||
float newvalue = 0;
|
||||
@ -257,17 +257,17 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#endif // HAS_PID_HEATING
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
int16_t flag = swap16(*(uint16_t*)val_ptr),
|
||||
steps = flag ? -20 : 20;
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true);
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint8_t e_temp = 0;
|
||||
filament_data.heated = false;
|
||||
uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
|
||||
@ -315,7 +315,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1);
|
||||
#endif
|
||||
#endif
|
||||
GotoScreen(DGUSLCD_SCREEN_UTILITY);
|
||||
gotoScreen(DGUS_SCREEN_UTILITY);
|
||||
}
|
||||
else { // Go to the preheat screen to show the heating progress
|
||||
switch (var.VP) {
|
||||
@ -333,11 +333,11 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_HEATING);
|
||||
gotoScreen(DGUS_SCREEN_FILAMENT_HEATING);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::handleFilamentLoadUnload(DGUS_VP_Variable &var) {
|
||||
if (filament_data.action <= 0) return;
|
||||
|
||||
// If we close to the target temperature, we can start load or unload the filament
|
||||
@ -347,14 +347,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
|
||||
if (filament_data.action == 1) { // load filament
|
||||
if (!filament_data.heated) {
|
||||
//GotoScreen(DGUSLCD_SCREEN_FILAMENT_LOADING);
|
||||
//gotoScreen(DGUS_SCREEN_FILAMENT_LOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue;
|
||||
}
|
||||
else { // unload filament
|
||||
if (!filament_data.heated) {
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_UNLOADING);
|
||||
gotoScreen(DGUS_SCREEN_FILAMENT_UNLOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
// Before unloading extrude to prevent jamming
|
||||
@ -372,14 +372,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#endif // DGUS_FILAMENT_LOADUNLOAD
|
||||
|
||||
bool DGUSScreenHandler::loop() {
|
||||
dgusdisplay.loop();
|
||||
dgus.loop();
|
||||
|
||||
const millis_t ms = millis();
|
||||
static millis_t next_event_ms = 0;
|
||||
|
||||
if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) {
|
||||
if (!isScreenComplete() || ELAPSED(ms, next_event_ms)) {
|
||||
next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS;
|
||||
UpdateScreenVPData();
|
||||
updateScreenVPData();
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
@ -390,11 +390,11 @@ bool DGUSScreenHandler::loop() {
|
||||
|
||||
if (!booted && ELAPSED(ms, BOOTSCREEN_TIMEOUT)) {
|
||||
booted = true;
|
||||
GotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUSLCD_SCREEN_POWER_LOSS : DGUSLCD_SCREEN_MAIN);
|
||||
gotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUS_SCREEN_POWER_LOSS : DGUS_SCREEN_MAIN);
|
||||
}
|
||||
#endif
|
||||
|
||||
return IsScreenComplete();
|
||||
return isScreenComplete();
|
||||
}
|
||||
|
||||
#endif // DGUS_LCD_UI_FYSETC
|
||||
|
@ -26,6 +26,6 @@
|
||||
typedef DGUSScreenHandler DGUSScreenHandlerClass;
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#define PLR_SCREEN_RECOVER DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
#define PLR_SCREEN_CANCEL DGUSLCD_SCREEN_STATUS
|
||||
#define PLR_SCREEN_RECOVER DGUS_SCREEN_SDPRINTMANIPULATION
|
||||
#define PLR_SCREEN_CANCEL DGUS_SCREEN_STATUS
|
||||
#endif
|
||||
|
@ -286,28 +286,28 @@ const uint16_t VPList_Z_Offset[] PROGMEM = {
|
||||
};
|
||||
|
||||
const struct VPMapping VPMap[] PROGMEM = {
|
||||
{ DGUSLCD_SCREEN_BOOT, VPList_Boot },
|
||||
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
|
||||
{ DGUSLCD_SCREEN_TEMPERATURE, VPList_Temp },
|
||||
{ DGUSLCD_SCREEN_STATUS, VPList_Status },
|
||||
{ DGUSLCD_SCREEN_STATUS2, VPList_Status2 },
|
||||
{ DGUSLCD_SCREEN_PREHEAT, VPList_Preheat },
|
||||
{ DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove },
|
||||
{ DGUSLCD_SCREEN_Z_OFFSET, VPList_Z_Offset },
|
||||
{ DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
|
||||
{ DGUSLCD_SCREEN_FILAMENT_HEATING, VPList_Filament_heating },
|
||||
{ DGUSLCD_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload },
|
||||
{ DGUSLCD_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload },
|
||||
{ DGUSLCD_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation },
|
||||
{ DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList },
|
||||
{ DGUSLCD_SCREEN_SDPRINTTUNE, VPList_SDPrintTune },
|
||||
{ DGUSLCD_SCREEN_WAITING, VPList_PIDTuningWaiting },
|
||||
{ DGUSLCD_SCREEN_FLC_PREHEAT, VPList_FLCPreheat },
|
||||
{ DGUSLCD_SCREEN_FLC_PRINTING, VPList_FLCPrinting },
|
||||
{ DGUSLCD_SCREEN_STEPPERMM, VPList_StepPerMM },
|
||||
{ DGUSLCD_SCREEN_PID_E, VPList_PIDE0 },
|
||||
{ DGUSLCD_SCREEN_PID_BED, VPList_PIDBED },
|
||||
{ DGUSLCD_SCREEN_INFOS, VPList_Infos },
|
||||
{ DGUS_SCREEN_BOOT, VPList_Boot },
|
||||
{ DGUS_SCREEN_MAIN, VPList_Main },
|
||||
{ DGUS_SCREEN_TEMPERATURE, VPList_Temp },
|
||||
{ DGUS_SCREEN_STATUS, VPList_Status },
|
||||
{ DGUS_SCREEN_STATUS2, VPList_Status2 },
|
||||
{ DGUS_SCREEN_PREHEAT, VPList_Preheat },
|
||||
{ DGUS_SCREEN_MANUALMOVE, VPList_ManualMove },
|
||||
{ DGUS_SCREEN_Z_OFFSET, VPList_Z_Offset },
|
||||
{ DGUS_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
|
||||
{ DGUS_SCREEN_FILAMENT_HEATING, VPList_Filament_heating },
|
||||
{ DGUS_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload },
|
||||
{ DGUS_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload },
|
||||
{ DGUS_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation },
|
||||
{ DGUS_SCREEN_SDFILELIST, VPList_SDFileList },
|
||||
{ DGUS_SCREEN_SDPRINTTUNE, VPList_SDPrintTune },
|
||||
{ DGUS_SCREEN_WAITING, VPList_PIDTuningWaiting },
|
||||
{ DGUS_SCREEN_FLC_PREHEAT, VPList_FLCPreheat },
|
||||
{ DGUS_SCREEN_FLC_PRINTING, VPList_FLCPrinting },
|
||||
{ DGUS_SCREEN_STEPPERMM, VPList_StepPerMM },
|
||||
{ DGUS_SCREEN_PID_E, VPList_PIDE0 },
|
||||
{ DGUS_SCREEN_PID_BED, VPList_PIDBED },
|
||||
{ DGUS_SCREEN_INFOS, VPList_Infos },
|
||||
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
|
||||
};
|
||||
|
||||
@ -315,155 +315,155 @@ const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
|
||||
|
||||
const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
// Helper to detect touch events
|
||||
VPHELPER(VP_SCREENCHANGE, nullptr, ScreenHandler.ScreenChangeHook, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_ASK, nullptr, ScreenHandler.ScreenChangeHookIfIdle, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE, nullptr, screen.screenChangeHook, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_ASK, nullptr, screen.screenChangeHookIfIdle, nullptr),
|
||||
#if HAS_MEDIA
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, ScreenHandler.ScreenChangeHookIfSD, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, screen.screenChangeHookIfSD, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr),
|
||||
VPHELPER(VP_CONFIRMED, nullptr, screen.screenConfirmedOK, nullptr),
|
||||
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, ScreenHandler.HandleAllHeatersOff, nullptr),
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, screen.handleAllHeatersOff, nullptr),
|
||||
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_OPTION, &distanceToMove, ScreenHandler.HandleManualMoveOption, nullptr),
|
||||
VPHELPER(VP_MOVE_OPTION, &distanceToMove, screen.handleManualMoveOption, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_X, &distanceToMove, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, &distanceToMove, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, &distanceToMove, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, &distanceToMove, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_X, &distanceToMove, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, &distanceToMove, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, &distanceToMove, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, &distanceToMove, screen.handleManualMove, nullptr),
|
||||
#else
|
||||
VPHELPER(VP_MOVE_X, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_X, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, screen.handleManualMove, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, ScreenHandler.HandleMotorLockUnlock, nullptr),
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, screen.handleMotorLockUnlock, nullptr),
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, ScreenHandler.HandlePowerLossRecovery, nullptr),
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, screen.handlePowerLossRecovery, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_SETTINGS, nullptr, ScreenHandler.HandleSettings, nullptr),
|
||||
VPHELPER(VP_SETTINGS, nullptr, screen.handleSettings, nullptr),
|
||||
#if ENABLED(SINGLE_Z_CALIBRATION)
|
||||
VPHELPER(VP_Z_CALIBRATE, nullptr, ScreenHandler.HandleZCalibration, nullptr),
|
||||
VPHELPER(VP_Z_CALIBRATE, nullptr, screen.handleZCalibration, nullptr),
|
||||
#endif
|
||||
#if ENABLED(FIRST_LAYER_CAL)
|
||||
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, ScreenHandler.HandleFirstLayerCal, nullptr),
|
||||
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, screen.handleFirstLayerCal, nullptr),
|
||||
#endif
|
||||
|
||||
{ .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
// M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr
|
||||
{ .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay },
|
||||
{ .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay },
|
||||
|
||||
// Temperature Data
|
||||
#if HAS_HOTEND
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_EPos, &destination.e, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_MOVE_E0, nullptr, ScreenHandler.HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], screen.handleFlowRateChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_EPos, &destination.e, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_MOVE_E0, nullptr, screen.handleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, screen.handleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, screen.sendHeaterStatusToDisplay),
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, ScreenHandler.HandlePreheat, nullptr),
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, screen.handlePreheat, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, ScreenHandler.HandleFilamentOption, ScreenHandler.HandleFilamentLoadUnload),
|
||||
VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, screen.handleFilamentOption, screen.handleFilamentLoadUnload),
|
||||
#endif
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, screen.handlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_MULTI_HOTEND
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E1, nullptr, ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_MOVE_E1, nullptr, ScreenHandler.HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E1, nullptr, screen.handleFlowRateChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_MOVE_E1, nullptr, screen.handleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, screen.handleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, screen.sendHeaterStatusToDisplay),
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, screen.handleHeaterControl, nullptr),
|
||||
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, screen.sendHeaterStatusToDisplay),
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, screen.handlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Fan Data
|
||||
#if HAS_FAN
|
||||
#define FAN_VPHELPER(N) \
|
||||
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], ScreenHandler.DGUSLCD_PercentageToUint8, ScreenHandler.DGUSLCD_SendPercentageToDisplay), \
|
||||
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], ScreenHandler.HandleFanControl, nullptr), \
|
||||
VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, ScreenHandler.DGUSLCD_SendFanStatusToDisplay),
|
||||
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], screen.percentageToUint8, screen.sendPercentageToDisplay), \
|
||||
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], screen.handleFanControl, nullptr), \
|
||||
VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, screen.sendFanStatusToDisplay),
|
||||
REPEAT(FAN_COUNT, FAN_VPHELPER)
|
||||
#endif
|
||||
|
||||
// Feedrate
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, screen.setValueDirectly<int16_t>, screen.sendWordValueToDisplay),
|
||||
|
||||
// Position Data
|
||||
VPHELPER(VP_XPos, ¤t_position.x, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_YPos, ¤t_position.y, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_XPos, ¤t_position.x, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_YPos, ¤t_position.y, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
|
||||
// Print Progress
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay),
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, screen.sendPrintProgressToDisplay),
|
||||
|
||||
// Print Time
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, screen.sendPrintTimeToDisplay),
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintAccTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintsTotalToDisplay),
|
||||
VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, screen.sendPrintAccTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, screen.sendPrintsTotalToDisplay),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
#if HAS_HOTEND
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
#if HAS_MULTI_HOTEND
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// SDCard File listing.
|
||||
#if HAS_MEDIA
|
||||
VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr),
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr),
|
||||
VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr),
|
||||
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER(VP_SD_ResumePauseAbort, nullptr, ScreenHandler.DGUSLCD_SD_ResumePauseAbort, nullptr),
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr),
|
||||
VPHELPER(VP_SD_ScrollEvent, nullptr, screen.sdScrollFilelist, nullptr),
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, screen.sdFileSelected, nullptr),
|
||||
VPHELPER(VP_SD_FileSelectConfirm, nullptr, screen.sdStartPrint, nullptr),
|
||||
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER(VP_SD_ResumePauseAbort, nullptr, screen.sdResumePauseAbort, nullptr),
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, screen.sdReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, screen.sdPrintTune, nullptr),
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, ScreenHandler.HandleProbeOffsetZChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, screen.handleProbeOffsetZChanged, screen.sendFloatAsIntValueToDisplay<2>),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, nullptr),
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, screen.handleLiveAdjustZ, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, ScreenHandler.DGUSLCD_SendWaitingStatusToDisplay),
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, screen.sendWaitingStatusToDisplay),
|
||||
#endif
|
||||
|
||||
// Messages for the User, shared by the popup and the kill screen. They can't be autouploaded as we do not buffer content.
|
||||
{ .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
@ -23,35 +23,35 @@
|
||||
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t {
|
||||
DGUSLCD_SCREEN_BOOT = 160,
|
||||
DGUSLCD_SCREEN_MAIN = 1,
|
||||
DGUSLCD_SCREEN_STATUS = 1,
|
||||
DGUSLCD_SCREEN_STATUS2 = 1,
|
||||
DGUSLCD_SCREEN_POWER_LOSS = 17,
|
||||
DGUSLCD_SCREEN_TEMPERATURE = 40,
|
||||
DGUSLCD_SCREEN_MANUALMOVE = 86,
|
||||
DGUSLCD_SCREEN_PREHEAT = 48,
|
||||
DGUSLCD_SCREEN_UTILITY = 70,
|
||||
DGUSLCD_SCREEN_FILAMENT_HEATING = 80,
|
||||
DGUSLCD_SCREEN_FILAMENT_LOADING = 76,
|
||||
DGUSLCD_SCREEN_FILAMENT_UNLOADING = 82,
|
||||
DGUSLCD_SCREEN_MANUALEXTRUDE = 84,
|
||||
DGUSLCD_SCREEN_Z_OFFSET = 88,
|
||||
DGUSLCD_SCREEN_SDFILELIST = 3,
|
||||
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 7,
|
||||
DGUSLCD_SCREEN_SDPRINTTUNE = 9,
|
||||
DGUSLCD_SCREEN_FLC_PREHEAT = 94,
|
||||
DGUSLCD_SCREEN_FLC_PRINTING = 96,
|
||||
DGUSLCD_SCREEN_STEPPERMM = 122,
|
||||
DGUSLCD_SCREEN_PID_E = 126,
|
||||
DGUSLCD_SCREEN_PID_BED = 128,
|
||||
DGUSLCD_SCREEN_INFOS = 131,
|
||||
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,
|
||||
DGUSLCD_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUSLCD_SCREEN_UNUSED = 255
|
||||
enum DGUS_ScreenID : uint8_t {
|
||||
DGUS_SCREEN_BOOT = 160,
|
||||
DGUS_SCREEN_MAIN = 1,
|
||||
DGUS_SCREEN_STATUS = 1,
|
||||
DGUS_SCREEN_STATUS2 = 1,
|
||||
DGUS_SCREEN_POWER_LOSS = 17,
|
||||
DGUS_SCREEN_TEMPERATURE = 40,
|
||||
DGUS_SCREEN_MANUALMOVE = 86,
|
||||
DGUS_SCREEN_PREHEAT = 48,
|
||||
DGUS_SCREEN_UTILITY = 70,
|
||||
DGUS_SCREEN_FILAMENT_HEATING = 80,
|
||||
DGUS_SCREEN_FILAMENT_LOADING = 76,
|
||||
DGUS_SCREEN_FILAMENT_UNLOADING = 82,
|
||||
DGUS_SCREEN_MANUALEXTRUDE = 84,
|
||||
DGUS_SCREEN_Z_OFFSET = 88,
|
||||
DGUS_SCREEN_SDFILELIST = 3,
|
||||
DGUS_SCREEN_SDPRINTMANIPULATION = 7,
|
||||
DGUS_SCREEN_SDPRINTTUNE = 9,
|
||||
DGUS_SCREEN_FLC_PREHEAT = 94,
|
||||
DGUS_SCREEN_FLC_PRINTING = 96,
|
||||
DGUS_SCREEN_STEPPERMM = 122,
|
||||
DGUS_SCREEN_PID_E = 126,
|
||||
DGUS_SCREEN_PID_BED = 128,
|
||||
DGUS_SCREEN_INFOS = 131,
|
||||
DGUS_SCREEN_CONFIRM = 240,
|
||||
DGUS_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
|
||||
DGUS_SCREEN_WAITING = 251,
|
||||
DGUS_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUS_SCREEN_UNUSED = 255
|
||||
};
|
||||
|
||||
// Display Memory layout used (T5UID)
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
extern ExtUI::FileList filelist;
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::sdFileSelected(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file;
|
||||
if (touched_nr > filelist.count()) return;
|
||||
if (!filelist.seek(touched_nr)) return;
|
||||
@ -52,28 +52,28 @@
|
||||
if (filelist.isDir()) {
|
||||
filelist.changeDir(filelist.filename());
|
||||
top_file = 0;
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_PRINT_FILENAME)
|
||||
// Send print filename
|
||||
dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true);
|
||||
dgus.writeVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true);
|
||||
#endif
|
||||
|
||||
// Setup Confirmation screen
|
||||
file_to_print = touched_nr;
|
||||
|
||||
HandleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true);
|
||||
handleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::sdStartPrint(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!filelist.seek(file_to_print)) return;
|
||||
ExtUI::printFile(filelist.shortFilename());
|
||||
GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
|
||||
gotoScreen(DGUS_SCREEN_SDPRINTMANIPULATION);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::sdResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
|
||||
if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes.
|
||||
switch (swap16(*(uint16_t*)val_ptr)) {
|
||||
@ -85,19 +85,19 @@
|
||||
|
||||
case 1: // Pause
|
||||
|
||||
GotoScreen(MKSLCD_SCREEN_PAUSE);
|
||||
gotoScreen(MKSLCD_SCREEN_PAUSE);
|
||||
if (!ExtUI::isPrintingFromMediaPaused()) {
|
||||
ExtUI::pausePrint();
|
||||
//ExtUI::mks_pausePrint();
|
||||
}
|
||||
break;
|
||||
case 2: // Abort
|
||||
HandleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true);
|
||||
handleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_SendFilename(DGUS_VP_Variable& var) {
|
||||
void DGUSScreenHandler::sdSendFilename(DGUS_VP_Variable& var) {
|
||||
uint16_t target_line = (var.VP - VP_SD_FileName0) / VP_SD_FileName_LEN;
|
||||
if (target_line > DGUS_SD_FILESPERSCREEN) return;
|
||||
char tmpfilename[VP_SD_FileName_LEN + 1] = "";
|
||||
@ -106,49 +106,49 @@
|
||||
if (filelist.seek(top_file + target_line)) {
|
||||
snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s%c"), filelist.filename(), filelist.isDir() ? '/' : 0); // snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s"), filelist.filename());
|
||||
}
|
||||
DGUSLCD_SendStringToDisplay(var);
|
||||
sendStringToDisplay(var);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardInserted() {
|
||||
void DGUSScreenHandler::sdCardInserted() {
|
||||
top_file = 0;
|
||||
filelist.refresh();
|
||||
auto cs = getCurrentScreen();
|
||||
if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS)
|
||||
GotoScreen(DGUSLCD_SCREEN_SDFILELIST);
|
||||
if (cs == DGUS_SCREEN_MAIN || cs == DGUS_SCREEN_STATUS)
|
||||
gotoScreen(DGUS_SCREEN_SDFILELIST);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardRemoved() {
|
||||
if (current_screen == DGUSLCD_SCREEN_SDFILELIST
|
||||
|| (current_screen == DGUSLCD_SCREEN_CONFIRM && (ConfirmVP == VP_SD_AbortPrintConfirmed || ConfirmVP == VP_SD_FileSelectConfirm))
|
||||
|| current_screen == DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
) GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
void DGUSScreenHandler::sdCardRemoved() {
|
||||
if (current_screenID == DGUS_SCREEN_SDFILELIST
|
||||
|| (current_screenID == DGUS_SCREEN_CONFIRM && (confirmVP == VP_SD_AbortPrintConfirmed || confirmVP == VP_SD_FileSelectConfirm))
|
||||
|| current_screenID == DGUS_SCREEN_SDPRINTMANIPULATION
|
||||
) gotoScreen(DGUS_SCREEN_MAIN);
|
||||
}
|
||||
|
||||
#endif // HAS_MEDIA
|
||||
|
||||
void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::screenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint8_t *tmp = (uint8_t*)val_ptr;
|
||||
|
||||
// The keycode in target is coded as <from-frame><to-frame>, so 0x0100A means
|
||||
// from screen 1 (main) to 10 (temperature). DGUSLCD_SCREEN_POPUP is special,
|
||||
// from screen 1 (main) to 10 (temperature). DGUS_SCREEN_POPUP is special,
|
||||
// meaning "return to previous screen"
|
||||
DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1];
|
||||
DGUS_ScreenID target = (DGUS_ScreenID)tmp[1];
|
||||
|
||||
if (target == DGUSLCD_SCREEN_POPUP) {
|
||||
if (target == DGUS_SCREEN_POPUP) {
|
||||
// Special handling for popup is to return to previous menu
|
||||
if (current_screen == DGUSLCD_SCREEN_POPUP && confirm_action_cb) confirm_action_cb();
|
||||
PopToOldScreen();
|
||||
if (current_screenID == DGUS_SCREEN_POPUP && confirm_action_cb) confirm_action_cb();
|
||||
popToOldScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateNewScreen(target);
|
||||
updateNewScreen(target);
|
||||
|
||||
#ifdef DEBUG_DGUSLCD
|
||||
if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target);
|
||||
if (!findScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
if (movevalue) {
|
||||
@ -196,7 +196,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
char buf[6] = "G28 X";
|
||||
buf[4] = axiscode;
|
||||
queue.enqueue_one_now(buf);
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@ -219,14 +219,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!old_relative_mode) queue.enqueue_now(F("G90"));
|
||||
}
|
||||
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
|
||||
cannotmove:
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
|
||||
float value = (float)rawvalue / 10;
|
||||
float newvalue = 0;
|
||||
@ -257,17 +257,17 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#endif // HAS_PID_HEATING
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
int16_t flag = swap16(*(uint16_t*)val_ptr),
|
||||
steps = flag ? -20 : 20;
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true);
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint8_t e_temp = 0;
|
||||
filament_data.heated = false;
|
||||
uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
|
||||
@ -315,7 +315,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1);
|
||||
#endif
|
||||
#endif
|
||||
GotoScreen(DGUSLCD_SCREEN_UTILITY);
|
||||
gotoScreen(DGUS_SCREEN_UTILITY);
|
||||
}
|
||||
else { // Go to the preheat screen to show the heating progress
|
||||
switch (var.VP) {
|
||||
@ -333,11 +333,11 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_HEATING);
|
||||
gotoScreen(DGUS_SCREEN_FILAMENT_HEATING);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::handleFilamentLoadUnload(DGUS_VP_Variable &var) {
|
||||
if (filament_data.action <= 0) return;
|
||||
|
||||
// If we close to the target temperature, we can start load or unload the filament
|
||||
@ -347,14 +347,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
|
||||
if (filament_data.action == 1) { // load filament
|
||||
if (!filament_data.heated) {
|
||||
//GotoScreen(DGUSLCD_SCREEN_FILAMENT_LOADING);
|
||||
//gotoScreen(DGUS_SCREEN_FILAMENT_LOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue;
|
||||
}
|
||||
else { // unload filament
|
||||
if (!filament_data.heated) {
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_UNLOADING);
|
||||
gotoScreen(DGUS_SCREEN_FILAMENT_UNLOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
// Before unloading extrude to prevent jamming
|
||||
@ -372,14 +372,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#endif // DGUS_FILAMENT_LOADUNLOAD
|
||||
|
||||
bool DGUSScreenHandler::loop() {
|
||||
dgusdisplay.loop();
|
||||
dgus.loop();
|
||||
|
||||
const millis_t ms = millis();
|
||||
static millis_t next_event_ms = 0;
|
||||
|
||||
if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) {
|
||||
if (!isScreenComplete() || ELAPSED(ms, next_event_ms)) {
|
||||
next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS;
|
||||
UpdateScreenVPData();
|
||||
updateScreenVPData();
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
@ -390,11 +390,11 @@ bool DGUSScreenHandler::loop() {
|
||||
|
||||
if (!booted && ELAPSED(ms, BOOTSCREEN_TIMEOUT)) {
|
||||
booted = true;
|
||||
GotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUSLCD_SCREEN_POWER_LOSS : DGUSLCD_SCREEN_MAIN);
|
||||
gotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUS_SCREEN_POWER_LOSS : DGUS_SCREEN_MAIN);
|
||||
}
|
||||
#endif
|
||||
|
||||
return IsScreenComplete();
|
||||
return isScreenComplete();
|
||||
}
|
||||
|
||||
#endif // DGUS_LCD_UI_HIPRECY
|
||||
|
@ -26,6 +26,6 @@
|
||||
typedef DGUSScreenHandler DGUSScreenHandlerClass;
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#define PLR_SCREEN_RECOVER DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
#define PLR_SCREEN_CANCEL DGUSLCD_SCREEN_STATUS
|
||||
#define PLR_SCREEN_RECOVER DGUS_SCREEN_SDPRINTMANIPULATION
|
||||
#define PLR_SCREEN_CANCEL DGUS_SCREEN_STATUS
|
||||
#endif
|
||||
|
@ -500,301 +500,301 @@ const char Updata_Time[] PROGMEM = STRING_DISTRIBUTION_DATE;
|
||||
|
||||
const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
// Helper to detect touch events
|
||||
VPHELPER(VP_SCREENCHANGE, nullptr, ScreenHandler.ScreenChangeHook, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_ASK, nullptr, ScreenHandler.ScreenChangeHookIfIdle, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE, nullptr, screen.screenChangeHook, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_ASK, nullptr, screen.screenChangeHookIfIdle, nullptr),
|
||||
#if HAS_MEDIA
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, ScreenHandler.ScreenChangeHookIfSD, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, screen.screenChangeHookIfSD, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr),
|
||||
VPHELPER(VP_CONFIRMED, nullptr, screen.screenConfirmedOK, nullptr),
|
||||
|
||||
// Back Button
|
||||
VPHELPER(VP_BACK_PAGE, nullptr, ScreenHandler.ScreenBackChange, nullptr),
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, ScreenHandler.HandleAllHeatersOff, nullptr),
|
||||
VPHELPER(VP_BACK_PAGE, nullptr, screen.screenBackChange, nullptr),
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, screen.handleAllHeatersOff, nullptr),
|
||||
|
||||
VPHELPER(VP_MOVE_X, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_X, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, screen.handleManualMove, nullptr),
|
||||
|
||||
VPHELPER(VP_X_HOME, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_Y_HOME, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_Z_HOME, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_X_HOME, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_Y_HOME, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_Z_HOME, nullptr, screen.handleManualMove, nullptr),
|
||||
|
||||
VPHELPER(VP_MOVE_DISTANCE, &manualMoveStep, ScreenHandler.GetManualMovestep, nullptr),
|
||||
VPHELPER(VP_MOVE_DISTANCE, &manualMoveStep, screen.getManualMovestep, nullptr),
|
||||
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_LEVEL_POINT, nullptr, ScreenHandler.ManualAssistLeveling, nullptr),
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_LEVEL_POINT, nullptr, screen.manualAssistLeveling, nullptr),
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, ScreenHandler.HandlePowerLossRecovery, nullptr),
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, screen.handlePowerLossRecovery, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_SETTINGS, nullptr, ScreenHandler.HandleSettings, nullptr),
|
||||
VPHELPER(VP_SETTINGS, nullptr, screen.handleSettings, nullptr),
|
||||
#if ENABLED(SINGLE_Z_CALIBRATION)
|
||||
VPHELPER(VP_Z_CALIBRATE, nullptr, ScreenHandler.HandleZCalibration, nullptr),
|
||||
VPHELPER(VP_Z_CALIBRATE, nullptr, screen.handleZCalibration, nullptr),
|
||||
#endif
|
||||
#if ENABLED(FIRST_LAYER_CAL)
|
||||
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, ScreenHandler.HandleFirstLayerCal, nullptr),
|
||||
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, screen.handleFirstLayerCal, nullptr),
|
||||
#endif
|
||||
{.VP = VP_MARLIN_VERSION, .memadr = (void *)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
{.VP = VP_MARLIN_VERSION, .memadr = (void *)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM},
|
||||
// M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr
|
||||
{.VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay},
|
||||
{.VP = VP_MKS_H43_VERSION, .memadr = (void *)H43Version, .size = VP_MKS_H43_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
{.VP = VP_MKS_H43_UpdataVERSION, .memadr = (void *)Updata_Time, .size = VP_MKS_H43_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
{.VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay},
|
||||
{.VP = VP_MKS_H43_VERSION, .memadr = (void *)H43Version, .size = VP_MKS_H43_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM},
|
||||
{.VP = VP_MKS_H43_UpdataVERSION, .memadr = (void *)Updata_Time, .size = VP_MKS_H43_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM},
|
||||
|
||||
// Temperature Data
|
||||
#if HAS_HOTEND
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_EPos, &destination.e, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_MOVE_E0, nullptr, ScreenHandler.HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], screen.handleFlowRateChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_EPos, &destination.e, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_MOVE_E0, nullptr, screen.handleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, screen.handleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, screen.sendHeaterStatusToDisplay),
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, ScreenHandler.HandlePreheat, nullptr),
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, screen.handlePreheat, nullptr),
|
||||
#endif
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, screen.handlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_LOAD_Filament, nullptr, ScreenHandler.FilamentLoad, nullptr),
|
||||
VPHELPER(VP_UNLOAD_Filament, nullptr, ScreenHandler.FilamentUnLoad, nullptr),
|
||||
VPHELPER(VP_Filament_distance, &distanceFilament, ScreenHandler.GetManualFilament, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Filament_speed, &filamentSpeed_mm_s, ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_LOAD_Filament, nullptr, screen.filamentLoad, nullptr),
|
||||
VPHELPER(VP_UNLOAD_Filament, nullptr, screen.filamentUnload, nullptr),
|
||||
VPHELPER(VP_Filament_distance, &distanceFilament, screen.getManualFilament, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Filament_speed, &filamentSpeed_mm_s, screen.getManualFilamentSpeed, screen.sendWordValueToDisplay),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_MULTI_HOTEND
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E1, &planner.flow_percentage[ExtUI::extruder_t::E1], ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_MOVE_E1, nullptr, ScreenHandler.HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E1, &planner.flow_percentage[ExtUI::extruder_t::E1], screen.handleFlowRateChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_MOVE_E1, nullptr, screen.handleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, screen.handleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, screen.sendHeaterStatusToDisplay),
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_Filament_distance, &distanceFilament, ScreenHandler.GetManualFilament, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Filament_speed, &filamentSpeed_mm_s, ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Filament_distance, &distanceFilament, screen.getManualFilament, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Filament_speed, &filamentSpeed_mm_s, screen.getManualFilamentSpeed, screen.sendWordValueToDisplay),
|
||||
#endif
|
||||
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, screen.handlePIDAutotune, nullptr),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_E1_FILAMENT_LOAD_UNLOAD, nullptr, ScreenHandler.HandleFilamentOption, ScreenHandler.HandleFilamentLoadUnload),
|
||||
VPHELPER(VP_E1_FILAMENT_LOAD_UNLOAD, nullptr, screen.handleFilamentOption, screen.handleFilamentLoadUnload),
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, screen.handleHeaterControl, nullptr),
|
||||
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, screen.sendHeaterStatusToDisplay),
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, screen.handlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Fan Data
|
||||
#if HAS_FAN
|
||||
#define FAN_VPHELPER(N) \
|
||||
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], ScreenHandler.DGUSLCD_SetUint8, ScreenHandler.DGUSLCD_SendFanToDisplay), \
|
||||
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], ScreenHandler.HandleFanControl, nullptr), \
|
||||
VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, ScreenHandler.DGUSLCD_SendFanStatusToDisplay),
|
||||
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], screen.setUint8, screen.sendFanToDisplay), \
|
||||
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], screen.handleFanControl, nullptr), \
|
||||
VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, screen.sendFanStatusToDisplay),
|
||||
REPEAT(FAN_COUNT, FAN_VPHELPER)
|
||||
#endif
|
||||
|
||||
// Feedrate
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, screen.setValueDirectly<int16_t>, screen.sendWordValueToDisplay),
|
||||
|
||||
// Position Data
|
||||
VPHELPER(VP_XPos, ¤t_position.x, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_YPos, ¤t_position.y, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_XPos, ¤t_position.x, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_YPos, ¤t_position.y, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
|
||||
// Level Point Set
|
||||
VPHELPER(VP_Level_Point_One_X, &mks_corner_offsets[0].x, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_One_Y, &mks_corner_offsets[0].y, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Two_X, &mks_corner_offsets[1].x, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Two_Y, &mks_corner_offsets[1].y, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Three_X, &mks_corner_offsets[2].x, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Three_Y, &mks_corner_offsets[2].y, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Four_X, &mks_corner_offsets[3].x, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Four_Y, &mks_corner_offsets[3].y, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Five_X, &mks_corner_offsets[4].x, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Five_Y, &mks_corner_offsets[4].y, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_One_X, &mks_corner_offsets[0].x, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_One_Y, &mks_corner_offsets[0].y, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Two_X, &mks_corner_offsets[1].x, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Two_Y, &mks_corner_offsets[1].y, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Three_X, &mks_corner_offsets[2].x, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Three_Y, &mks_corner_offsets[2].y, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Four_X, &mks_corner_offsets[3].x, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Four_Y, &mks_corner_offsets[3].y, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Five_X, &mks_corner_offsets[4].x, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Five_Y, &mks_corner_offsets[4].y, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay),
|
||||
|
||||
// Print Progress
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay),
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, screen.sendPrintProgressToDisplay),
|
||||
|
||||
// LCD Control
|
||||
VPHELPER(VP_LCD_BLK, &lcd_default_light, ScreenHandler.LCD_BLK_Adjust, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_LCD_BLK, &lcd_default_light, screen.lcdBLKAdjust, screen.sendWordValueToDisplay),
|
||||
|
||||
// SD File - Back
|
||||
VPHELPER(VP_SD_FileSelect_Back, nullptr, ScreenHandler.SD_FileBack, nullptr),
|
||||
VPHELPER(VP_SD_FileSelect_Back, nullptr, screen.sdFileBack, nullptr),
|
||||
|
||||
// Print Time
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, screen.sendPrintTimeToDisplay),
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintAccTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintsTotalToDisplay),
|
||||
VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, screen.sendPrintAccTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, screen.sendPrintsTotalToDisplay),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
|
||||
VPHELPER(VP_X_MAX_SPEED, &planner.settings.max_feedrate_mm_s[X_AXIS], ScreenHandler.HandleMaxSpeedChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Y_MAX_SPEED, &planner.settings.max_feedrate_mm_s[Y_AXIS], ScreenHandler.HandleMaxSpeedChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Z_MAX_SPEED, &planner.settings.max_feedrate_mm_s[Z_AXIS], ScreenHandler.HandleMaxSpeedChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_X_MAX_SPEED, &planner.settings.max_feedrate_mm_s[X_AXIS], screen.handleMaxSpeedChange, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Y_MAX_SPEED, &planner.settings.max_feedrate_mm_s[Y_AXIS], screen.handleMaxSpeedChange, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Z_MAX_SPEED, &planner.settings.max_feedrate_mm_s[Z_AXIS], screen.handleMaxSpeedChange, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
|
||||
#if HAS_HOTEND
|
||||
VPHELPER(VP_E0_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E_AXIS_N(0)], ScreenHandler.HandleExtruderMaxSpeedChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_E0_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E_AXIS_N(0)], screen.handleExtruderMaxSpeedChange, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
#if HAS_MULTI_HOTEND
|
||||
VPHELPER(VP_E1_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E_AXIS_N(1)], ScreenHandler.HandleExtruderMaxSpeedChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_E1_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E_AXIS_N(1)], screen.handleExtruderMaxSpeedChange, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_X_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[X_AXIS], ScreenHandler.HandleMaxAccChange, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Y_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[Y_AXIS], ScreenHandler.HandleMaxAccChange, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Z_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[Z_AXIS], ScreenHandler.HandleMaxAccChange, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_X_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[X_AXIS], screen.handleMaxAccChange, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Y_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[Y_AXIS], screen.handleMaxAccChange, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Z_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[Z_AXIS], screen.handleMaxAccChange, screen.sendWordValueToDisplay),
|
||||
|
||||
#if HAS_HOTEND
|
||||
VPHELPER(VP_E0_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(0)], ScreenHandler.HandleExtruderAccChange, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_E0_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(0)], screen.handleExtruderAccChange, screen.sendWordValueToDisplay),
|
||||
#if HAS_MULTI_HOTEND
|
||||
VPHELPER(VP_E1_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)], ScreenHandler.HandleExtruderAccChange, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_E1_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)], screen.handleExtruderAccChange, screen.sendWordValueToDisplay),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_TRAVEL_SPEED, (uint16_t *)&planner.settings.travel_acceleration, ScreenHandler.HandleTravelAccChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_FEEDRATE_MIN_SPEED, (uint16_t *)&planner.settings.min_feedrate_mm_s, ScreenHandler.HandleFeedRateMinChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_T_F_SPEED, (uint16_t *)&planner.settings.min_travel_feedrate_mm_s, ScreenHandler.HandleMin_T_F, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_ACC_SPEED, (uint16_t *)&planner.settings.acceleration, ScreenHandler.HandleAccChange, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_TRAVEL_SPEED, (uint16_t *)&planner.settings.travel_acceleration, screen.handleTravelAccChange, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_FEEDRATE_MIN_SPEED, (uint16_t *)&planner.settings.min_feedrate_mm_s, screen.handleFeedRateMinChange, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_T_F_SPEED, (uint16_t *)&planner.settings.min_travel_feedrate_mm_s, screen.handleMin_T_F, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_ACC_SPEED, (uint16_t *)&planner.settings.acceleration, screen.handleAccChange, screen.sendWordValueToDisplay),
|
||||
|
||||
VPHELPER(VP_X_PARK_POS, &mks_park_pos.x, ScreenHandler.GetParkPos, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Y_PARK_POS, &mks_park_pos.y, ScreenHandler.GetParkPos, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Z_PARK_POS, &mks_park_pos.z, ScreenHandler.GetParkPos, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_X_PARK_POS, &mks_park_pos.x, screen.getParkPos, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Y_PARK_POS, &mks_park_pos.y, screen.getParkPos, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Z_PARK_POS, &mks_park_pos.z, screen.getParkPos, screen.sendWordValueToDisplay),
|
||||
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
VPHELPER(VP_MIN_EX_T, &thermalManager.extrude_min_temp, ScreenHandler.HandleGetExMinTemp, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_MIN_EX_T, &thermalManager.extrude_min_temp, screen.handleGetExMinTemp, screen.sendWordValueToDisplay),
|
||||
#endif
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING) // TMC SENSORLESS Setting
|
||||
#if X_HAS_STEALTHCHOP
|
||||
VPHELPER(VP_TMC_X_STEP, &tmc_step.x, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
VPHELPER(VP_TMC_X_STEP, &tmc_step.x, screen.tmcChangeConfig, screen.sendTMCStepValue),
|
||||
#endif
|
||||
#if Y_HAS_STEALTHCHOP
|
||||
VPHELPER(VP_TMC_Y_STEP, &tmc_step.y, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
VPHELPER(VP_TMC_Y_STEP, &tmc_step.y, screen.tmcChangeConfig, screen.sendTMCStepValue),
|
||||
#endif
|
||||
#if Z_HAS_STEALTHCHOP
|
||||
VPHELPER(VP_TMC_Z_STEP, &tmc_step.z, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
VPHELPER(VP_TMC_Z_STEP, &tmc_step.z, screen.tmcChangeConfig, screen.sendTMCStepValue),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_TRINAMIC_CONFIG // TMC Current Setting
|
||||
#if AXIS_IS_TMC(X)
|
||||
VPHELPER(VP_TMC_X_Current, &stepperX.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_TMC_X_Current, &stepperX.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y)
|
||||
VPHELPER(VP_TMC_Y_Current, &stepperY.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_TMC_Y_Current, &stepperY.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z)
|
||||
VPHELPER(VP_TMC_Z_Current, &stepperZ.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_TMC_Z_Current, &stepperZ.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E0)
|
||||
VPHELPER(VP_TMC_E0_Current, &stepperE0.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_TMC_E0_Current, &stepperE0.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E1)
|
||||
VPHELPER(VP_TMC_E1_Current, &stepperE1.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_TMC_E1_Current, &stepperE1.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(X2)
|
||||
VPHELPER(VP_TMC_X1_Current, &stepperX2.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_TMC_X1_Current, &stepperX2.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
VPHELPER(VP_TMC_Y1_Current, &stepperY2.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_TMC_Y1_Current, &stepperY2.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
VPHELPER(VP_TMC_Z1_Current, &stepperZ2.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_TMC_Z1_Current, &stepperZ2.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_EEPROM_CTRL, nullptr, ScreenHandler.EEPROM_CTRL, nullptr),
|
||||
VPHELPER(VP_LEVEL_BUTTON, nullptr, ScreenHandler.Level_Ctrl, nullptr),
|
||||
VPHELPER(VP_LANGUAGE_CHANGE, nullptr, ScreenHandler.LanguageChange, nullptr),
|
||||
VPHELPER(VP_EEPROM_CTRL, nullptr, screen.eepromControl, nullptr),
|
||||
VPHELPER(VP_LEVEL_BUTTON, nullptr, screen.levelControl, nullptr),
|
||||
VPHELPER(VP_LANGUAGE_CHANGE, nullptr, screen.languageChange, nullptr),
|
||||
|
||||
//VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, nullptr),
|
||||
//VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, screen.handleLiveAdjustZ, nullptr),
|
||||
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ_Confirm, nullptr, ScreenHandler.ZoffsetConfirm, nullptr),
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ_Confirm, nullptr, screen.zOffsetConfirm, nullptr),
|
||||
|
||||
VPHELPER(VP_ZOffset_Distance,nullptr ,ScreenHandler.GetZoffsetDistance, nullptr),
|
||||
VPHELPER(VP_MESH_LEVEL_ADJUST, nullptr, ScreenHandler.MeshLevelDistanceConfig, nullptr),
|
||||
VPHELPER(VP_MESH_LEVEL_POINT,nullptr, ScreenHandler.MeshLevel,nullptr),
|
||||
VPHELPER(VP_ZOffset_Distance,nullptr ,screen.getZoffsetDistance, nullptr),
|
||||
VPHELPER(VP_MESH_LEVEL_ADJUST, nullptr, screen.meshLevelDistanceConfig, nullptr),
|
||||
VPHELPER(VP_MESH_LEVEL_POINT,nullptr, screen.meshLevel, nullptr),
|
||||
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
VPHELPER(VP_Min_EX_T_E, &thermalManager.extrude_min_temp, ScreenHandler.GetMinExtrudeTemp, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Min_EX_T_E, &thermalManager.extrude_min_temp, screen.getMinExtrudeTemp, screen.sendWordValueToDisplay),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_AutoTurnOffSw, nullptr, ScreenHandler.GetTurnOffCtrl, nullptr),
|
||||
VPHELPER(VP_AutoTurnOffSw, nullptr, screen.getTurnOffCtrl, nullptr),
|
||||
|
||||
#if HAS_HOTEND
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
#if HAS_MULTI_HOTEND
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<0>),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// SDCard File listing
|
||||
|
||||
#if HAS_MEDIA
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr),
|
||||
VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr),
|
||||
VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr),
|
||||
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName5, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName6, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName7, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName8, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName9, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER(VP_SD_ResumePauseAbort, nullptr, ScreenHandler.DGUSLCD_SD_ResumePauseAbort, nullptr),
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr),
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, screen.sdFileSelected, nullptr),
|
||||
VPHELPER(VP_SD_ScrollEvent, nullptr, screen.sdScrollFilelist, nullptr),
|
||||
VPHELPER(VP_SD_FileSelectConfirm, nullptr, screen.sdStartPrint, nullptr),
|
||||
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName5, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName6, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName7, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName8, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName9, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER(VP_SD_ResumePauseAbort, nullptr, screen.sdResumePauseAbort, nullptr),
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, screen.sdReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, screen.sdPrintTune, nullptr),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
VPHELPER(VP_ZOffset_DE_DIS, &z_offset_add, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, screen.handleLiveAdjustZ, screen.sendFloatAsIntValueToDisplay<2>),
|
||||
VPHELPER(VP_ZOffset_DE_DIS, &z_offset_add, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
#endif
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_OFFSET_X, &probe.offset.x, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_OFFSET_Y, &probe.offset.y, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_OFFSET_Z, &probe.offset.z, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_OFFSET_X, &probe.offset.x, screen.getOffsetValue,screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_OFFSET_Y, &probe.offset.y, screen.getOffsetValue,screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_OFFSET_Z, &probe.offset.z, screen.getOffsetValue,screen.sendFloatAsLongValueToDisplay<2>),
|
||||
#endif
|
||||
#else
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.PrintReturn, nullptr),
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, screen.printReturn, nullptr),
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, ScreenHandler.DGUSLCD_SendWaitingStatusToDisplay),
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, screen.sendWaitingStatusToDisplay),
|
||||
#endif
|
||||
|
||||
// Messages for the User, shared by the popup and the kill screen. They can't be autouploaded as we do not buffer content.
|
||||
//{.VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
//{.VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
//{.VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
//{.VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
//{.VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM},
|
||||
//{.VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM},
|
||||
//{.VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM},
|
||||
//{.VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM},
|
||||
|
||||
{.VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay_Language},
|
||||
{.VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay_Language},
|
||||
{.VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay_Language},
|
||||
{.VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay_Language},
|
||||
{.VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay_Language},
|
||||
{.VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay_Language},
|
||||
{.VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay_Language},
|
||||
{.VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay_Language},
|
||||
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
@ -124,21 +124,21 @@ typedef struct {
|
||||
|
||||
extern NOZZLE_PARK_DEF nozzle_park_mks;
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t {
|
||||
enum DGUS_ScreenID : uint8_t {
|
||||
#if ENABLED(USE_MKS_GREEN_UI)
|
||||
|
||||
DGUSLCD_SCREEN_BOOT = 33,
|
||||
DGUSLCD_SCREEN_MAIN = 60,
|
||||
DGUSLCD_SCREEN_STATUS = 60,
|
||||
DGUSLCD_SCREEN_STATUS2 = 60,
|
||||
DGUSLCD_SCREEN_PREHEAT = 18,
|
||||
DGUSLCD_SCREEN_POWER_LOSS = 100,
|
||||
DGUSLCD_SCREEN_MANUALMOVE = 192,
|
||||
DGUSLCD_SCREEN_UTILITY = 120,
|
||||
DGUSLCD_SCREEN_FILAMENT_UNLOADING = 158,
|
||||
DGUSLCD_SCREEN_SDFILELIST = 15,
|
||||
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 15,
|
||||
DGUSLCD_SCREEN_SDPRINTTUNE = 17,
|
||||
DGUS_SCREEN_BOOT = 33,
|
||||
DGUS_SCREEN_MAIN = 60,
|
||||
DGUS_SCREEN_STATUS = 60,
|
||||
DGUS_SCREEN_STATUS2 = 60,
|
||||
DGUS_SCREEN_PREHEAT = 18,
|
||||
DGUS_SCREEN_POWER_LOSS = 100,
|
||||
DGUS_SCREEN_MANUALMOVE = 192,
|
||||
DGUS_SCREEN_UTILITY = 120,
|
||||
DGUS_SCREEN_FILAMENT_UNLOADING = 158,
|
||||
DGUS_SCREEN_SDFILELIST = 15,
|
||||
DGUS_SCREEN_SDPRINTMANIPULATION = 15,
|
||||
DGUS_SCREEN_SDPRINTTUNE = 17,
|
||||
|
||||
MKSLCD_SCREEN_BOOT = 33,
|
||||
MKSLCD_SCREEN_HOME = 60, // MKS main page
|
||||
@ -178,19 +178,19 @@ enum DGUSLCD_Screens : uint8_t {
|
||||
|
||||
#else
|
||||
|
||||
DGUSLCD_SCREEN_BOOT = 120,
|
||||
DGUSLCD_SCREEN_MAIN = 1,
|
||||
DGUS_SCREEN_BOOT = 120,
|
||||
DGUS_SCREEN_MAIN = 1,
|
||||
|
||||
DGUSLCD_SCREEN_STATUS = 1,
|
||||
DGUSLCD_SCREEN_STATUS2 = 1,
|
||||
DGUSLCD_SCREEN_PREHEAT = 18,
|
||||
DGUSLCD_SCREEN_POWER_LOSS = 100,
|
||||
DGUSLCD_SCREEN_MANUALMOVE = 192,
|
||||
DGUSLCD_SCREEN_UTILITY = 120,
|
||||
DGUSLCD_SCREEN_FILAMENT_UNLOADING = 158,
|
||||
DGUSLCD_SCREEN_SDFILELIST = 15,
|
||||
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 15,
|
||||
DGUSLCD_SCREEN_SDPRINTTUNE = 17,
|
||||
DGUS_SCREEN_STATUS = 1,
|
||||
DGUS_SCREEN_STATUS2 = 1,
|
||||
DGUS_SCREEN_PREHEAT = 18,
|
||||
DGUS_SCREEN_POWER_LOSS = 100,
|
||||
DGUS_SCREEN_MANUALMOVE = 192,
|
||||
DGUS_SCREEN_UTILITY = 120,
|
||||
DGUS_SCREEN_FILAMENT_UNLOADING = 158,
|
||||
DGUS_SCREEN_SDFILELIST = 15,
|
||||
DGUS_SCREEN_SDPRINTMANIPULATION = 15,
|
||||
DGUS_SCREEN_SDPRINTTUNE = 17,
|
||||
|
||||
MKSLCD_SCREEN_BOOT = 0,
|
||||
MKSLCD_SCREEN_HOME = 1, // MKS main page
|
||||
@ -234,11 +234,11 @@ enum DGUSLCD_Screens : uint8_t {
|
||||
|
||||
#endif
|
||||
|
||||
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,
|
||||
DGUSLCD_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUSLCD_SCREEN_UNUSED = 255
|
||||
DGUS_SCREEN_CONFIRM = 240,
|
||||
DGUS_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
|
||||
DGUS_SCREEN_WAITING = 251,
|
||||
DGUS_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUS_SCREEN_UNUSED = 255
|
||||
};
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -23,7 +23,7 @@
|
||||
|
||||
#include "../DGUSScreenHandlerBase.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
enum DGUS_ScreenID : uint8_t;
|
||||
|
||||
class DGUSScreenHandlerMKS : public DGUSScreenHandler {
|
||||
public:
|
||||
@ -32,72 +32,72 @@ public:
|
||||
#if 0
|
||||
static void sendinfoscreen_ch(const uint16_t *line1, const uint16_t *line2, const uint16_t *line3, const uint16_t *line4);
|
||||
static void sendinfoscreen_en(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4);
|
||||
static void sendinfoscreen(const void *line1, const void *line2, const void *line3, const void *line4, uint16_t language);
|
||||
static void sendInfoScreen(const void *line1, const void *line2, const void *line3, const void *line4, uint16_t language);
|
||||
#endif
|
||||
|
||||
static void ScreenBackChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void screenBackChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
static void EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void LanguageChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetOffsetValue(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void Level_Ctrl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void MeshLevel(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void MeshLevelDistanceConfig(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void ManualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void ZoffsetConfirm(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void Z_offset_select(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetManualMovestep(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetParkPos(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void eepromControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void languageChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void getOffsetValue(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void levelControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void meshLevel(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void meshLevelDistanceConfig(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void manualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void zOffsetConfirm(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void zOffsetSelect(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void getManualMovestep(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void getZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void getMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void getParkPos(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
static void HandleGetExMinTemp(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleGetExMinTemp(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
static void DGUS_LanguageDisplay(uint8_t var);
|
||||
static void TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void LanguagePInit();
|
||||
static void DGUS_Runout_Idle();
|
||||
static void DGUS_RunoutInit();
|
||||
static void DGUS_ExtrudeLoadInit();
|
||||
static void LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void SD_FileBack(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void languageDisplay(uint8_t var);
|
||||
static void tmcChangeConfig(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void getTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void languagePInit();
|
||||
static void runoutIdle();
|
||||
static void runoutInit();
|
||||
static void extrudeLoadInit();
|
||||
static void lcdBLKAdjust(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void sdFileBack(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
static void HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleExtruderMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleAccChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleMaxAccChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleExtruderAccChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleChangeLevelPoint(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleTravelAccChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleFeedRateMinChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleMin_T_F(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleExtruderMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleAccChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleMaxAccChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleExtruderAccChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleChangeLevelPoint(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleTravelAccChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleFeedRateMinChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void handleMin_T_F(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
static void FilamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir);
|
||||
static void FilamentLoad(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetManualFilament(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void filamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir);
|
||||
static void filamentLoad(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void filamentUnload(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void getManualFilament(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void getManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
#if HAS_MEDIA
|
||||
// Marlin informed us about SD print completion.
|
||||
static void SDPrintingFinished();
|
||||
static void sdPrintingFinished();
|
||||
#else
|
||||
static void PrintReturn(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void printReturn(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
static void DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendBabyStepToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendFanToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendGbkToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplay_Language(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var);
|
||||
static void sendPrintTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void sendBabyStepToDisplay(DGUS_VP_Variable &var);
|
||||
static void sendFanToDisplay(DGUS_VP_Variable &var);
|
||||
static void sendGbkToDisplay(DGUS_VP_Variable &var);
|
||||
static void sendStringToDisplay_Language(DGUS_VP_Variable &var);
|
||||
static void sendTMCStepValue(DGUS_VP_Variable &var);
|
||||
|
||||
static void DGUSLCD_SetUint8(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void setUint8(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
static bool loop();
|
||||
};
|
||||
|
@ -108,17 +108,17 @@ const uint16_t VPList_SDFileList[] PROGMEM = { VP_SD_FileName0, VP_SD_
|
||||
const uint16_t VPList_SD_PrintManipulation[] PROGMEM = { VP_PrintProgress_Percentage, VP_PrintTime, 0x0000 };
|
||||
|
||||
const struct VPMapping VPMap[] PROGMEM = {
|
||||
{ DGUSLCD_SCREEN_BOOT, VPList_Boot },
|
||||
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
|
||||
{ DGUSLCD_SCREEN_TEMPERATURE, VPList_Temp },
|
||||
{ DGUSLCD_SCREEN_STATUS, VPList_Status },
|
||||
{ DGUSLCD_SCREEN_STATUS2, VPList_Status2 },
|
||||
{ DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove },
|
||||
{ DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
|
||||
{ DGUSLCD_SCREEN_FANANDFEEDRATE, VPList_FanAndFeedrate },
|
||||
{ DGUSLCD_SCREEN_FLOWRATES, VPList_SD_FlowRates },
|
||||
{ DGUSLCD_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation },
|
||||
{ DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList },
|
||||
{ DGUS_SCREEN_BOOT, VPList_Boot },
|
||||
{ DGUS_SCREEN_MAIN, VPList_Main },
|
||||
{ DGUS_SCREEN_TEMPERATURE, VPList_Temp },
|
||||
{ DGUS_SCREEN_STATUS, VPList_Status },
|
||||
{ DGUS_SCREEN_STATUS2, VPList_Status2 },
|
||||
{ DGUS_SCREEN_MANUALMOVE, VPList_ManualMove },
|
||||
{ DGUS_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
|
||||
{ DGUS_SCREEN_FANANDFEEDRATE, VPList_FanAndFeedrate },
|
||||
{ DGUS_SCREEN_FLOWRATES, VPList_SD_FlowRates },
|
||||
{ DGUS_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation },
|
||||
{ DGUS_SCREEN_SDFILELIST, VPList_SDFileList },
|
||||
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
|
||||
};
|
||||
|
||||
@ -126,152 +126,152 @@ const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
|
||||
|
||||
const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
// Helper to detect touch events
|
||||
VPHELPER(VP_SCREENCHANGE, nullptr, ScreenHandler.ScreenChangeHook, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_ASK, nullptr, ScreenHandler.ScreenChangeHookIfIdle, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE, nullptr, screen.screenChangeHook, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_ASK, nullptr, screen.screenChangeHookIfIdle, nullptr),
|
||||
#if HAS_MEDIA
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, ScreenHandler.ScreenChangeHookIfSD, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, screen.screenChangeHookIfSD, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr),
|
||||
VPHELPER(VP_CONFIRMED, nullptr, screen.screenConfirmedOK, nullptr),
|
||||
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, ScreenHandler.HandleAllHeatersOff, nullptr),
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, screen.handleAllHeatersOff, nullptr),
|
||||
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_OPTION, &distanceToMove, ScreenHandler.HandleManualMoveOption, nullptr),
|
||||
VPHELPER(VP_MOVE_OPTION, &distanceToMove, screen.handleManualMoveOption, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_X, &distanceToMove, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, &distanceToMove, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, &distanceToMove, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, &distanceToMove, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_X, &distanceToMove, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, &distanceToMove, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, &distanceToMove, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, &distanceToMove, screen.handleManualMove, nullptr),
|
||||
#else
|
||||
VPHELPER(VP_MOVE_X, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_X, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, screen.handleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, screen.handleManualMove, nullptr),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, ScreenHandler.HandleMotorLockUnlock, nullptr),
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, screen.handleMotorLockUnlock, nullptr),
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, ScreenHandler.HandlePowerLossRecovery, nullptr),
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, screen.handlePowerLossRecovery, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_SETTINGS, nullptr, ScreenHandler.HandleSettings, nullptr),
|
||||
VPHELPER(VP_SETTINGS, nullptr, screen.handleSettings, nullptr),
|
||||
|
||||
{ .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
// M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr
|
||||
{ .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay },
|
||||
{ .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay },
|
||||
|
||||
// Temperature Data
|
||||
#if HAS_HOTEND
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleTemperatureChanged, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E0, nullptr, ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_EPos, &destination.e, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_MOVE_E0, nullptr, ScreenHandler.HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, screen.handleTemperatureChanged, &screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E0, nullptr, screen.handleFlowRateChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_EPos, &destination.e, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_MOVE_E0, nullptr, screen.handleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, screen.handleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, screen.sendHeaterStatusToDisplay),
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, ScreenHandler.HandlePreheat, nullptr),
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, screen.handlePreheat, nullptr),
|
||||
#endif
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, screen.handlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, ScreenHandler.HandleFilamentOption, ScreenHandler.HandleFilamentLoadUnload),
|
||||
VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, screen.handleFilamentOption, screen.handleFilamentLoadUnload),
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_MULTI_HOTEND
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E1, nullptr, ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_MOVE_E1, nullptr, ScreenHandler.HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E1, nullptr, screen.handleFlowRateChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_MOVE_E1, nullptr, screen.handleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, screen.handleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, screen.sendHeaterStatusToDisplay),
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, screen.handlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay),
|
||||
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, screen.handleHeaterControl, nullptr),
|
||||
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, screen.sendHeaterStatusToDisplay),
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Fan Data
|
||||
#if HAS_FAN
|
||||
#define FAN_VPHELPER(N) \
|
||||
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], ScreenHandler.DGUSLCD_PercentageToUint8, ScreenHandler.DGUSLCD_SendPercentageToDisplay), \
|
||||
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], ScreenHandler.HandleFanControl, nullptr), \
|
||||
VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, ScreenHandler.DGUSLCD_SendFanStatusToDisplay),
|
||||
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], screen.percentageToUint8, screen.sendPercentageToDisplay), \
|
||||
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], screen.handleFanControl, nullptr), \
|
||||
VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, screen.sendFanStatusToDisplay),
|
||||
REPEAT(FAN_COUNT, FAN_VPHELPER)
|
||||
#endif
|
||||
|
||||
// Feedrate
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, screen.setValueDirectly<int16_t>, screen.sendWordValueToDisplay),
|
||||
|
||||
// Position Data
|
||||
VPHELPER(VP_XPos, ¤t_position.x, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_YPos, ¤t_position.y, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_XPos, ¤t_position.x, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_YPos, ¤t_position.y, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, screen.sendFloatAsLongValueToDisplay<2>),
|
||||
|
||||
// Print Progress
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay),
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, screen.sendPrintProgressToDisplay),
|
||||
|
||||
// Print Time
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, screen.sendPrintTimeToDisplay),
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintAccTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintsTotalToDisplay),
|
||||
VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, screen.sendPrintAccTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, screen.sendPrintsTotalToDisplay),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
#if HAS_HOTEND
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
#if HAS_MULTI_HOTEND
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// SDCard File listing.
|
||||
#if HAS_MEDIA
|
||||
VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr),
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr),
|
||||
VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr),
|
||||
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER(VP_SD_ResumePauseAbort, nullptr, ScreenHandler.DGUSLCD_SD_ResumePauseAbort, nullptr),
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr),
|
||||
VPHELPER(VP_SD_ScrollEvent, nullptr, screen.sdScrollFilelist, nullptr),
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, screen.sdFileSelected, nullptr),
|
||||
VPHELPER(VP_SD_FileSelectConfirm, nullptr, screen.sdStartPrint, nullptr),
|
||||
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename),
|
||||
VPHELPER(VP_SD_ResumePauseAbort, nullptr, screen.sdResumePauseAbort, nullptr),
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, screen.sdReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, screen.sdPrintTune, nullptr),
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, ScreenHandler.HandleProbeOffsetZChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, screen.handleProbeOffsetZChanged, screen.sendFloatAsIntValueToDisplay<2>),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, nullptr),
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, screen.handleLiveAdjustZ, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, ScreenHandler.DGUSLCD_SendWaitingStatusToDisplay),
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, screen.sendWaitingStatusToDisplay),
|
||||
#endif
|
||||
|
||||
// Messages for the User, shared by the popup and the kill screen. They can't be autouploaded as we do not buffer content.
|
||||
{ .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM },
|
||||
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
@ -23,30 +23,30 @@
|
||||
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t {
|
||||
DGUSLCD_SCREEN_BOOT = 0,
|
||||
DGUSLCD_SCREEN_MAIN = 10,
|
||||
DGUSLCD_SCREEN_TEMPERATURE = 20,
|
||||
DGUSLCD_SCREEN_STATUS = 30,
|
||||
DGUSLCD_SCREEN_STATUS2 = 32,
|
||||
DGUSLCD_SCREEN_MANUALMOVE = 40,
|
||||
DGUSLCD_SCREEN_MANUALEXTRUDE = 42,
|
||||
DGUSLCD_SCREEN_FANANDFEEDRATE = 44,
|
||||
DGUSLCD_SCREEN_FLOWRATES = 46,
|
||||
DGUSLCD_SCREEN_SDFILELIST = 50,
|
||||
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 52,
|
||||
DGUSLCD_SCREEN_POWER_LOSS = 100,
|
||||
DGUSLCD_SCREEN_PREHEAT = 120,
|
||||
DGUSLCD_SCREEN_UTILITY = 110,
|
||||
DGUSLCD_SCREEN_FILAMENT_HEATING = 146,
|
||||
DGUSLCD_SCREEN_FILAMENT_LOADING = 148,
|
||||
DGUSLCD_SCREEN_FILAMENT_UNLOADING = 158,
|
||||
DGUSLCD_SCREEN_SDPRINTTUNE = 170,
|
||||
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,
|
||||
DGUSLCD_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUSLCD_SCREEN_UNUSED = 255
|
||||
enum DGUS_ScreenID : uint8_t {
|
||||
DGUS_SCREEN_BOOT = 0,
|
||||
DGUS_SCREEN_MAIN = 10,
|
||||
DGUS_SCREEN_TEMPERATURE = 20,
|
||||
DGUS_SCREEN_STATUS = 30,
|
||||
DGUS_SCREEN_STATUS2 = 32,
|
||||
DGUS_SCREEN_MANUALMOVE = 40,
|
||||
DGUS_SCREEN_MANUALEXTRUDE = 42,
|
||||
DGUS_SCREEN_FANANDFEEDRATE = 44,
|
||||
DGUS_SCREEN_FLOWRATES = 46,
|
||||
DGUS_SCREEN_SDFILELIST = 50,
|
||||
DGUS_SCREEN_SDPRINTMANIPULATION = 52,
|
||||
DGUS_SCREEN_POWER_LOSS = 100,
|
||||
DGUS_SCREEN_PREHEAT = 120,
|
||||
DGUS_SCREEN_UTILITY = 110,
|
||||
DGUS_SCREEN_FILAMENT_HEATING = 146,
|
||||
DGUS_SCREEN_FILAMENT_LOADING = 148,
|
||||
DGUS_SCREEN_FILAMENT_UNLOADING = 158,
|
||||
DGUS_SCREEN_SDPRINTTUNE = 170,
|
||||
DGUS_SCREEN_CONFIRM = 240,
|
||||
DGUS_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
|
||||
DGUS_SCREEN_WAITING = 251,
|
||||
DGUS_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUS_SCREEN_UNUSED = 255
|
||||
};
|
||||
|
||||
// Display Memory layout used (T5UID)
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
extern ExtUI::FileList filelist;
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::sdFileSelected(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file;
|
||||
if (touched_nr > filelist.count()) return;
|
||||
if (!filelist.seek(touched_nr)) return;
|
||||
@ -52,28 +52,28 @@
|
||||
if (filelist.isDir()) {
|
||||
filelist.changeDir(filelist.filename());
|
||||
top_file = 0;
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_PRINT_FILENAME)
|
||||
// Send print filename
|
||||
dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true);
|
||||
dgus.writeVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true);
|
||||
#endif
|
||||
|
||||
// Setup Confirmation screen
|
||||
file_to_print = touched_nr;
|
||||
|
||||
HandleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true);
|
||||
handleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::sdStartPrint(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!filelist.seek(file_to_print)) return;
|
||||
ExtUI::printFile(filelist.shortFilename());
|
||||
GotoScreen(DGUSLCD_SCREEN_STATUS);
|
||||
gotoScreen(DGUS_SCREEN_STATUS);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::sdResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
|
||||
if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes.
|
||||
switch (swap16(*(uint16_t*)val_ptr)) {
|
||||
@ -85,19 +85,19 @@
|
||||
|
||||
case 1: // Pause
|
||||
|
||||
GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
|
||||
gotoScreen(DGUS_SCREEN_SDPRINTMANIPULATION);
|
||||
if (!ExtUI::isPrintingFromMediaPaused()) {
|
||||
ExtUI::pausePrint();
|
||||
//ExtUI::mks_pausePrint();
|
||||
}
|
||||
break;
|
||||
case 2: // Abort
|
||||
HandleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true);
|
||||
handleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_SendFilename(DGUS_VP_Variable& var) {
|
||||
void DGUSScreenHandler::sdSendFilename(DGUS_VP_Variable& var) {
|
||||
uint16_t target_line = (var.VP - VP_SD_FileName0) / VP_SD_FileName_LEN;
|
||||
if (target_line > DGUS_SD_FILESPERSCREEN) return;
|
||||
char tmpfilename[VP_SD_FileName_LEN + 1] = "";
|
||||
@ -106,49 +106,49 @@
|
||||
if (filelist.seek(top_file + target_line)) {
|
||||
snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s%c"), filelist.filename(), filelist.isDir() ? '/' : 0); // snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s"), filelist.filename());
|
||||
}
|
||||
DGUSLCD_SendStringToDisplay(var);
|
||||
sendStringToDisplay(var);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardInserted() {
|
||||
void DGUSScreenHandler::sdCardInserted() {
|
||||
top_file = 0;
|
||||
filelist.refresh();
|
||||
auto cs = getCurrentScreen();
|
||||
if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS)
|
||||
GotoScreen(DGUSLCD_SCREEN_SDFILELIST);
|
||||
if (cs == DGUS_SCREEN_MAIN || cs == DGUS_SCREEN_STATUS)
|
||||
gotoScreen(DGUS_SCREEN_SDFILELIST);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardRemoved() {
|
||||
if (current_screen == DGUSLCD_SCREEN_SDFILELIST
|
||||
|| (current_screen == DGUSLCD_SCREEN_CONFIRM && (ConfirmVP == VP_SD_AbortPrintConfirmed || ConfirmVP == VP_SD_FileSelectConfirm))
|
||||
|| current_screen == DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
) GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
void DGUSScreenHandler::sdCardRemoved() {
|
||||
if (current_screenID == DGUS_SCREEN_SDFILELIST
|
||||
|| (current_screenID == DGUS_SCREEN_CONFIRM && (confirmVP == VP_SD_AbortPrintConfirmed || confirmVP == VP_SD_FileSelectConfirm))
|
||||
|| current_screenID == DGUS_SCREEN_SDPRINTMANIPULATION
|
||||
) gotoScreen(DGUS_SCREEN_MAIN);
|
||||
}
|
||||
|
||||
#endif // HAS_MEDIA
|
||||
|
||||
void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::screenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint8_t *tmp = (uint8_t*)val_ptr;
|
||||
|
||||
// The keycode in target is coded as <from-frame><to-frame>, so 0x0100A means
|
||||
// from screen 1 (main) to 10 (temperature). DGUSLCD_SCREEN_POPUP is special,
|
||||
// from screen 1 (main) to 10 (temperature). DGUS_SCREEN_POPUP is special,
|
||||
// meaning "return to previous screen"
|
||||
DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1];
|
||||
DGUS_ScreenID target = (DGUS_ScreenID)tmp[1];
|
||||
|
||||
if (target == DGUSLCD_SCREEN_POPUP) {
|
||||
if (target == DGUS_SCREEN_POPUP) {
|
||||
// Special handling for popup is to return to previous menu
|
||||
if (current_screen == DGUSLCD_SCREEN_POPUP && confirm_action_cb) confirm_action_cb();
|
||||
PopToOldScreen();
|
||||
if (current_screenID == DGUS_SCREEN_POPUP && confirm_action_cb) confirm_action_cb();
|
||||
popToOldScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateNewScreen(target);
|
||||
updateNewScreen(target);
|
||||
|
||||
#ifdef DEBUG_DGUSLCD
|
||||
if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target);
|
||||
if (!findScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
if (movevalue) {
|
||||
@ -196,7 +196,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
char buf[6] = "G28 X";
|
||||
buf[4] = axiscode;
|
||||
queue.enqueue_one_now(buf);
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@ -219,14 +219,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!old_relative_mode) queue.enqueue_now(F("G90"));
|
||||
}
|
||||
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
|
||||
cannotmove:
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
|
||||
float value = (float)rawvalue / 10;
|
||||
float newvalue = 0;
|
||||
@ -257,17 +257,17 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#endif // HAS_PID_HEATING
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
int16_t flag = swap16(*(uint16_t*)val_ptr),
|
||||
steps = flag ? -20 : 20;
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true);
|
||||
ForceCompleteUpdate();
|
||||
forceCompleteUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
void DGUSScreenHandler::handleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint8_t e_temp = 0;
|
||||
filament_data.heated = false;
|
||||
uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
|
||||
@ -315,7 +315,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1);
|
||||
#endif
|
||||
#endif
|
||||
GotoScreen(DGUSLCD_SCREEN_UTILITY);
|
||||
gotoScreen(DGUS_SCREEN_UTILITY);
|
||||
}
|
||||
else { // Go to the preheat screen to show the heating progress
|
||||
switch (var.VP) {
|
||||
@ -333,11 +333,11 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_HEATING);
|
||||
gotoScreen(DGUS_SCREEN_FILAMENT_HEATING);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::handleFilamentLoadUnload(DGUS_VP_Variable &var) {
|
||||
if (filament_data.action <= 0) return;
|
||||
|
||||
// If we close to the target temperature, we can start load or unload the filament
|
||||
@ -347,14 +347,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
|
||||
if (filament_data.action == 1) { // load filament
|
||||
if (!filament_data.heated) {
|
||||
//GotoScreen(DGUSLCD_SCREEN_FILAMENT_LOADING);
|
||||
//gotoScreen(DGUS_SCREEN_FILAMENT_LOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue;
|
||||
}
|
||||
else { // unload filament
|
||||
if (!filament_data.heated) {
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_UNLOADING);
|
||||
gotoScreen(DGUS_SCREEN_FILAMENT_UNLOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
// Before unloading extrude to prevent jamming
|
||||
@ -372,14 +372,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#endif // DGUS_FILAMENT_LOADUNLOAD
|
||||
|
||||
bool DGUSScreenHandler::loop() {
|
||||
dgusdisplay.loop();
|
||||
dgus.loop();
|
||||
|
||||
const millis_t ms = millis();
|
||||
static millis_t next_event_ms = 0;
|
||||
|
||||
if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) {
|
||||
if (!isScreenComplete() || ELAPSED(ms, next_event_ms)) {
|
||||
next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS;
|
||||
UpdateScreenVPData();
|
||||
updateScreenVPData();
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
@ -390,11 +390,11 @@ bool DGUSScreenHandler::loop() {
|
||||
|
||||
if (!booted && ELAPSED(ms, BOOTSCREEN_TIMEOUT)) {
|
||||
booted = true;
|
||||
GotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUSLCD_SCREEN_POWER_LOSS : DGUSLCD_SCREEN_MAIN);
|
||||
gotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUS_SCREEN_POWER_LOSS : DGUS_SCREEN_MAIN);
|
||||
}
|
||||
#endif
|
||||
|
||||
return IsScreenComplete();
|
||||
return isScreenComplete();
|
||||
}
|
||||
|
||||
#endif // DGUS_LCD_UI_ORIGIN
|
||||
|
@ -26,6 +26,6 @@
|
||||
typedef DGUSScreenHandler DGUSScreenHandlerClass;
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#define PLR_SCREEN_RECOVER DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
#define PLR_SCREEN_CANCEL DGUSLCD_SCREEN_STATUS
|
||||
#define PLR_SCREEN_RECOVER DGUS_SCREEN_SDPRINTMANIPULATION
|
||||
#define PLR_SCREEN_CANCEL DGUS_SCREEN_STATUS
|
||||
#endif
|
||||
|
@ -50,26 +50,26 @@ uint8_t DGUSDisplay::rx_datagram_len = 0;
|
||||
|
||||
bool DGUSDisplay::initialized = false;
|
||||
|
||||
void DGUSDisplay::Loop() {
|
||||
ProcessRx();
|
||||
void DGUSDisplay::loop() {
|
||||
processRx();
|
||||
}
|
||||
|
||||
void DGUSDisplay::Init() {
|
||||
void DGUSDisplay::init() {
|
||||
LCD_SERIAL.begin(LCD_BAUDRATE);
|
||||
|
||||
ReadVersions();
|
||||
readVersions();
|
||||
}
|
||||
|
||||
void DGUSDisplay::Read(uint16_t addr, uint8_t size) {
|
||||
WriteHeader(addr, DGUS_READVAR, size);
|
||||
void DGUSDisplay::read(uint16_t addr, uint8_t size) {
|
||||
writeHeader(addr, DGUS_READVAR, size);
|
||||
|
||||
LCD_SERIAL.write(size);
|
||||
}
|
||||
|
||||
void DGUSDisplay::Write(uint16_t addr, const void* data_ptr, uint8_t size) {
|
||||
void DGUSDisplay::write(uint16_t addr, const void* data_ptr, uint8_t size) {
|
||||
if (!data_ptr) return;
|
||||
|
||||
WriteHeader(addr, DGUS_WRITEVAR, size);
|
||||
writeHeader(addr, DGUS_WRITEVAR, size);
|
||||
|
||||
const char* data = static_cast<const char*>(data_ptr);
|
||||
|
||||
@ -78,10 +78,10 @@ void DGUSDisplay::Write(uint16_t addr, const void* data_ptr, uint8_t size) {
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteString(uint16_t addr, const void* data_ptr, uint8_t size, bool left, bool right, bool use_space) {
|
||||
void DGUSDisplay::writeString(uint16_t addr, const void* data_ptr, uint8_t size, bool left, bool right, bool use_space) {
|
||||
if (!data_ptr) return;
|
||||
|
||||
WriteHeader(addr, DGUS_WRITEVAR, size);
|
||||
writeHeader(addr, DGUS_WRITEVAR, size);
|
||||
|
||||
const char* data = static_cast<const char*>(data_ptr);
|
||||
size_t len = strlen(data);
|
||||
@ -118,10 +118,10 @@ void DGUSDisplay::WriteString(uint16_t addr, const void* data_ptr, uint8_t size,
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteStringPGM(uint16_t addr, const void* data_ptr, uint8_t size, bool left, bool right, bool use_space) {
|
||||
void DGUSDisplay::writeStringPGM(uint16_t addr, const void* data_ptr, uint8_t size, bool left, bool right, bool use_space) {
|
||||
if (!data_ptr) return;
|
||||
|
||||
WriteHeader(addr, DGUS_WRITEVAR, size);
|
||||
writeHeader(addr, DGUS_WRITEVAR, size);
|
||||
|
||||
const char* data = static_cast<const char*>(data_ptr);
|
||||
size_t len = strlen_P(data);
|
||||
@ -151,61 +151,61 @@ void DGUSDisplay::WriteStringPGM(uint16_t addr, const void* data_ptr, uint8_t si
|
||||
while (right_spaces--) LCD_SERIAL.write(use_space ? ' ' : '\0');
|
||||
}
|
||||
|
||||
void DGUSDisplay::ReadVersions() {
|
||||
void DGUSDisplay::readVersions() {
|
||||
if (gui_version != 0 && os_version != 0) return;
|
||||
Read(DGUS_VERSION, 1);
|
||||
read(DGUS_VERSION, 1);
|
||||
}
|
||||
|
||||
void DGUSDisplay::SwitchScreen(DGUS_Screen screen) {
|
||||
const uint8_t command[] = { 0x5A, 0x01, 0x00, (uint8_t)screen };
|
||||
Write(0x84, command, sizeof(command));
|
||||
void DGUSDisplay::switchScreen(const DGUS_ScreenID screenID) {
|
||||
const uint8_t command[] = { 0x5A, 0x01, 0x00, (uint8_t)screenID };
|
||||
write(0x84, command, sizeof(command));
|
||||
}
|
||||
|
||||
void DGUSDisplay::PlaySound(uint8_t start, uint8_t len, uint8_t volume) {
|
||||
void DGUSDisplay::playSound(uint8_t start, uint8_t len, uint8_t volume) {
|
||||
if (volume == 0) volume = DGUSDisplay::volume;
|
||||
if (volume == 0) return;
|
||||
const uint8_t command[] = { start, len, volume, 0x00 };
|
||||
Write(0xA0, command, sizeof(command));
|
||||
write(0xA0, command, sizeof(command));
|
||||
}
|
||||
|
||||
void DGUSDisplay::EnableControl(DGUS_Screen screen, DGUS_ControlType type, DGUS_Control control) {
|
||||
const uint8_t command[] = { 0x5A, 0xA5, 0x00, (uint8_t)screen, (uint8_t)control, type, 0x00, 0x01 };
|
||||
Write(0xB0, command, sizeof(command));
|
||||
void DGUSDisplay::enableControl(const DGUS_ScreenID screenID, DGUS_ControlType type, DGUS_Control control) {
|
||||
const uint8_t command[] = { 0x5A, 0xA5, 0x00, (uint8_t)screenID, (uint8_t)control, type, 0x00, 0x01 };
|
||||
write(0xB0, command, sizeof(command));
|
||||
|
||||
FlushTx();
|
||||
flushTx();
|
||||
delay(50);
|
||||
}
|
||||
|
||||
void DGUSDisplay::DisableControl(DGUS_Screen screen, DGUS_ControlType type, DGUS_Control control) {
|
||||
const uint8_t command[] = { 0x5A, 0xA5, 0x00, (uint8_t)screen, (uint8_t)control, type, 0x00, 0x00 };
|
||||
Write(0xB0, command, sizeof(command));
|
||||
void DGUSDisplay::disableControl(const DGUS_ScreenID screenID, DGUS_ControlType type, DGUS_Control control) {
|
||||
const uint8_t command[] = { 0x5A, 0xA5, 0x00, (uint8_t)screenID, (uint8_t)control, type, 0x00, 0x00 };
|
||||
write(0xB0, command, sizeof(command));
|
||||
|
||||
FlushTx();
|
||||
flushTx();
|
||||
delay(50);
|
||||
}
|
||||
|
||||
uint8_t DGUSDisplay::GetBrightness() {
|
||||
uint8_t DGUSDisplay::getBrightness() {
|
||||
return brightness;
|
||||
}
|
||||
|
||||
uint8_t DGUSDisplay::GetVolume() {
|
||||
uint8_t DGUSDisplay::getVolume() {
|
||||
return map_precise(volume, 0, 255, 0, 100);
|
||||
}
|
||||
|
||||
void DGUSDisplay::SetBrightness(uint8_t new_brightness) {
|
||||
void DGUSDisplay::setBrightness(uint8_t new_brightness) {
|
||||
brightness = constrain(new_brightness, 0, 100);
|
||||
new_brightness = map_precise(brightness, 0, 100, 5, 100);
|
||||
const uint8_t command[] = { new_brightness, new_brightness };
|
||||
Write(0x82, command, sizeof(command));
|
||||
write(0x82, command, sizeof(command));
|
||||
}
|
||||
|
||||
void DGUSDisplay::SetVolume(uint8_t new_volume) {
|
||||
void DGUSDisplay::setVolume(uint8_t new_volume) {
|
||||
volume = map_precise(constrain(new_volume, 0, 100), 0, 100, 0, 255);
|
||||
const uint8_t command[] = { volume, 0x00 };
|
||||
Write(0xA1, command, sizeof(command));
|
||||
write(0xA1, command, sizeof(command));
|
||||
}
|
||||
|
||||
void DGUSDisplay::ProcessRx() {
|
||||
void DGUSDisplay::processRx() {
|
||||
|
||||
#if ENABLED(LCD_SERIAL_STATS_RX_BUFFER_OVERRUNS)
|
||||
if (!LCD_SERIAL.available() && LCD_SERIAL.buffer_overruns()) {
|
||||
@ -274,7 +274,7 @@ void DGUSDisplay::ProcessRx() {
|
||||
}
|
||||
|
||||
DGUS_VP vp;
|
||||
if (!DGUS_PopulateVP((DGUS_Addr)addr, &vp)) {
|
||||
if (!populateVP((DGUS_Addr)addr, &vp)) {
|
||||
rx_datagram_state = DGUS_IDLE;
|
||||
break;
|
||||
}
|
||||
@ -332,7 +332,7 @@ void DGUSDisplay::ProcessRx() {
|
||||
}
|
||||
}
|
||||
|
||||
size_t DGUSDisplay::GetFreeTxBuffer() {
|
||||
size_t DGUSDisplay::getFreeTxBuffer() {
|
||||
return (
|
||||
#ifdef LCD_SERIAL_GET_TX_BUFFER_FREE
|
||||
LCD_SERIAL_GET_TX_BUFFER_FREE()
|
||||
@ -342,7 +342,7 @@ size_t DGUSDisplay::GetFreeTxBuffer() {
|
||||
);
|
||||
}
|
||||
|
||||
void DGUSDisplay::FlushTx() {
|
||||
void DGUSDisplay::flushTx() {
|
||||
#ifdef ARDUINO_ARCH_STM32
|
||||
LCD_SERIAL.flush();
|
||||
#else
|
||||
@ -350,7 +350,7 @@ void DGUSDisplay::FlushTx() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteHeader(uint16_t addr, uint8_t command, uint8_t len) {
|
||||
void DGUSDisplay::writeHeader(uint16_t addr, uint8_t command, uint8_t len) {
|
||||
LCD_SERIAL.write(DGUS_HEADER1);
|
||||
LCD_SERIAL.write(DGUS_HEADER2);
|
||||
LCD_SERIAL.write(len + 3);
|
||||
@ -359,7 +359,7 @@ void DGUSDisplay::WriteHeader(uint16_t addr, uint8_t command, uint8_t len) {
|
||||
LCD_SERIAL.write(addr & 0xFF);
|
||||
}
|
||||
|
||||
bool DGUS_PopulateVP(const DGUS_Addr addr, DGUS_VP * const buffer) {
|
||||
bool populateVP(const DGUS_Addr addr, DGUS_VP * const buffer) {
|
||||
const DGUS_VP *ret = vp_list;
|
||||
|
||||
do {
|
||||
|
@ -26,7 +26,7 @@
|
||||
* Updated for STM32G0B1RE by Protomosh in 2022.
|
||||
*/
|
||||
|
||||
#include "config/DGUS_Screen.h"
|
||||
#include "config/DGUS_ScreenID.h"
|
||||
#include "config/DGUS_Control.h"
|
||||
#include "definition/DGUS_VP.h"
|
||||
|
||||
@ -58,58 +58,58 @@ public:
|
||||
|
||||
DGUSDisplay() = default;
|
||||
|
||||
static void Init();
|
||||
static void init();
|
||||
|
||||
static void Read(uint16_t addr, uint8_t size);
|
||||
static void Write(uint16_t addr, const void* data_ptr, uint8_t size);
|
||||
static void read(uint16_t addr, uint8_t size);
|
||||
static void write(uint16_t addr, const void* data_ptr, uint8_t size);
|
||||
|
||||
static void WriteString(uint16_t addr, const void* data_ptr, uint8_t size, bool left=true, bool right=false, bool use_space=true);
|
||||
static void WriteStringPGM(uint16_t addr, const void* data_ptr, uint8_t size, bool left=true, bool right=false, bool use_space=true);
|
||||
static void WriteString(uint16_t addr, FSTR_P const fstr, uint8_t size, bool left=true, bool right=false, bool use_space=true) {
|
||||
WriteStringPGM(addr, FTOP(fstr), size, left, right, use_space);
|
||||
static void writeString(uint16_t addr, const void* data_ptr, uint8_t size, bool left=true, bool right=false, bool use_space=true);
|
||||
static void writeStringPGM(uint16_t addr, const void* data_ptr, uint8_t size, bool left=true, bool right=false, bool use_space=true);
|
||||
static void writeString(uint16_t addr, FSTR_P const fstr, uint8_t size, bool left=true, bool right=false, bool use_space=true) {
|
||||
writeStringPGM(addr, FTOP(fstr), size, left, right, use_space);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static void Write(uint16_t addr, T data) {
|
||||
Write(addr, static_cast<const void*>(&data), sizeof(T));
|
||||
static void write(uint16_t addr, T data) {
|
||||
write(addr, static_cast<const void*>(&data), sizeof(T));
|
||||
}
|
||||
|
||||
// Until now I did not need to actively read from the display. That's why there is no ReadVariable
|
||||
// (I extensively use the auto upload of the display)
|
||||
|
||||
// Read GUI and OS version from screen
|
||||
static void ReadVersions();
|
||||
static void readVersions();
|
||||
|
||||
// Force display into another screen.
|
||||
static void SwitchScreen(DGUS_Screen screen);
|
||||
static void switchScreen(const DGUS_ScreenID screenID);
|
||||
// Play sounds using the display speaker.
|
||||
// start: position at which the sound was stored on the display.
|
||||
// len: how many sounds to play. Sounds will play consecutively from start to start+len-1.
|
||||
// volume: playback volume. 0 keeps the current volume.
|
||||
static void PlaySound(uint8_t start, uint8_t len=1, uint8_t volume=0);
|
||||
static void playSound(uint8_t start, uint8_t len=1, uint8_t volume=0);
|
||||
// Enable/disable a specific touch control.
|
||||
// type: control type.
|
||||
// control: index of the control on the page (set during screen development).
|
||||
static void EnableControl(DGUS_Screen screen, DGUS_ControlType type, DGUS_Control control);
|
||||
static void DisableControl(DGUS_Screen screen, DGUS_ControlType type, DGUS_Control control);
|
||||
static void enableControl(const DGUS_ScreenID screenID, DGUS_ControlType type, DGUS_Control control);
|
||||
static void disableControl(const DGUS_ScreenID screenID, DGUS_ControlType type, DGUS_Control control);
|
||||
|
||||
static uint8_t GetBrightness();
|
||||
static uint8_t GetVolume();
|
||||
static uint8_t getBrightness();
|
||||
static uint8_t getVolume();
|
||||
|
||||
// Set the display brightness/volume, ranging 0 - 100
|
||||
static void SetBrightness(uint8_t brightness);
|
||||
static void SetVolume(uint8_t volume);
|
||||
static void setBrightness(uint8_t brightness);
|
||||
static void setVolume(uint8_t volume);
|
||||
|
||||
// Periodic tasks, eg. Rx-Queue handling.
|
||||
static void Loop();
|
||||
static void loop();
|
||||
|
||||
// Helper for users of this class to estimate if an interaction would be blocking.
|
||||
static size_t GetFreeTxBuffer();
|
||||
static void FlushTx();
|
||||
static size_t getFreeTxBuffer();
|
||||
static void flushTx();
|
||||
|
||||
// Checks two things: Can we confirm the presence of the display and has we initialized it.
|
||||
// (both boils down that the display answered to our chatting)
|
||||
static bool IsInitialized() {
|
||||
static bool isInitialized() {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ public:
|
||||
static uint8_t os_version;
|
||||
|
||||
template<typename T>
|
||||
static T SwapBytes(const T value) {
|
||||
static T swapBytes(const T value) {
|
||||
union {
|
||||
T val;
|
||||
char byte[sizeof(T)];
|
||||
@ -129,12 +129,12 @@ public:
|
||||
}
|
||||
|
||||
template<typename T_in, typename T_out, uint8_t decimals>
|
||||
T_out FromFixedPoint(const T_in value) {
|
||||
T_out fromFixedPoint(const T_in value) {
|
||||
return (T_out)((float)value / POW(10, decimals));
|
||||
}
|
||||
|
||||
template<typename T_in, typename T_out, uint8_t decimals>
|
||||
T_out ToFixedPoint(const T_in value) {
|
||||
T_out toFixedPoint(const T_in value) {
|
||||
return (T_out)LROUND((float)value * POW(10, decimals));
|
||||
}
|
||||
|
||||
@ -160,8 +160,8 @@ private:
|
||||
DGUS_VERSION = 0x000F // OS/GUI version
|
||||
};
|
||||
|
||||
static void WriteHeader(uint16_t addr, uint8_t command, uint8_t len);
|
||||
static void ProcessRx();
|
||||
static void writeHeader(uint16_t addr, uint8_t command, uint8_t len);
|
||||
static void processRx();
|
||||
|
||||
static uint8_t volume;
|
||||
static uint8_t brightness;
|
||||
@ -172,11 +172,11 @@ private:
|
||||
static bool initialized;
|
||||
};
|
||||
|
||||
template<> inline uint16_t DGUSDisplay::SwapBytes(const uint16_t value) {
|
||||
template<> inline uint16_t DGUSDisplay::swapBytes(const uint16_t value) {
|
||||
return ((value << 8) | (value >> 8));
|
||||
}
|
||||
|
||||
extern DGUSDisplay dgus_display;
|
||||
extern DGUSDisplay dgus;
|
||||
|
||||
/// Helper to populate a DGUS_VP for a given VP. Return false if not found.
|
||||
extern bool DGUS_PopulateVP(const DGUS_Addr addr, DGUS_VP * const buffer);
|
||||
extern bool populateVP(const DGUS_Addr addr, DGUS_VP * const buffer);
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "DGUSRxHandler.h"
|
||||
|
||||
#include "DGUSScreenHandler.h"
|
||||
#include "config/DGUS_Screen.h"
|
||||
#include "config/DGUS_ScreenID.h"
|
||||
|
||||
#include "../ui_api.h"
|
||||
#include "../../../core/language.h"
|
||||
@ -42,73 +42,73 @@
|
||||
#include "../../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) {
|
||||
const DGUS_Screen screen = (DGUS_Screen)((uint8_t*)data_ptr)[1];
|
||||
void DGUSRxHandler::screenChange(DGUS_VP &vp, void *data_ptr) {
|
||||
const DGUS_ScreenID screenID = (DGUS_ScreenID)((uint8_t*)data_ptr)[1];
|
||||
|
||||
if (vp.addr == DGUS_Addr::SCREENCHANGE_SD) {
|
||||
#if HAS_MEDIA
|
||||
IF_DISABLED(HAS_SD_DETECT, card.mount());
|
||||
|
||||
if (!ExtUI::isMediaInserted()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_NO_MEDIA));
|
||||
screen.setStatusMessage(GET_TEXT_F(MSG_NO_MEDIA));
|
||||
return;
|
||||
}
|
||||
|
||||
card.cdroot();
|
||||
#else
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_NO_MEDIA));
|
||||
screen.setStatusMessage(GET_TEXT_F(MSG_NO_MEDIA));
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (vp.addr == DGUS_Addr::SCREENCHANGE_Idle
|
||||
&& (ExtUI::isPrinting() || ExtUI::isPrintingPaused())) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_NOT_WHILE_PRINTING));
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_NOT_WHILE_PRINTING));
|
||||
return;
|
||||
}
|
||||
|
||||
if (vp.addr == DGUS_Addr::SCREENCHANGE_Printing
|
||||
&& (!ExtUI::isPrinting() && !ExtUI::isPrintingPaused())) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_NOT_WHILE_IDLE));
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_NOT_WHILE_IDLE));
|
||||
return;
|
||||
}
|
||||
|
||||
dgus_screen_handler.TriggerScreenChange(screen);
|
||||
screen.triggerScreenChange(screenID);
|
||||
}
|
||||
|
||||
#if HAS_MEDIA
|
||||
void DGUSRxHandler::Scroll(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::scroll(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Scroll scroll = (DGUS_Data::Scroll)((uint8_t*)data_ptr)[1];
|
||||
|
||||
switch (scroll) {
|
||||
case DGUS_Data::Scroll::GO_BACK:
|
||||
if (dgus_screen_handler.filelist.isAtRootDir()) {
|
||||
if (screen.filelist.isAtRootDir()) {
|
||||
return;
|
||||
}
|
||||
|
||||
dgus_screen_handler.filelist_offset = 0;
|
||||
dgus_screen_handler.filelist_selected = -1;
|
||||
dgus_screen_handler.filelist.upDir();
|
||||
screen.filelist_offset = 0;
|
||||
screen.filelist_selected = -1;
|
||||
screen.filelist.upDir();
|
||||
break;
|
||||
case DGUS_Data::Scroll::UP:
|
||||
if (dgus_screen_handler.filelist_offset < 1) {
|
||||
if (screen.filelist_offset < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
--dgus_screen_handler.filelist_offset;
|
||||
--screen.filelist_offset;
|
||||
break;
|
||||
case DGUS_Data::Scroll::DOWN:
|
||||
if (dgus_screen_handler.filelist_offset + 1 + DGUS_FILE_COUNT > dgus_screen_handler.filelist.count()) {
|
||||
if (screen.filelist_offset + 1 + DGUS_FILE_COUNT > screen.filelist.count()) {
|
||||
return;
|
||||
}
|
||||
|
||||
++dgus_screen_handler.filelist_offset;
|
||||
++screen.filelist_offset;
|
||||
break;
|
||||
}
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::selectFile(DGUS_VP &vp, void *data_ptr) {
|
||||
@ -116,47 +116,47 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) {
|
||||
|
||||
const uint8_t index = ((uint8_t*)data_ptr)[1];
|
||||
|
||||
if (!dgus_screen_handler.filelist.seek(dgus_screen_handler.filelist_offset + index)) {
|
||||
if (!screen.filelist.seek(screen.filelist_offset + index)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dgus_screen_handler.filelist.isDir()) {
|
||||
dgus_screen_handler.filelist_offset = 0;
|
||||
dgus_screen_handler.filelist_selected = -1;
|
||||
dgus_screen_handler.filelist.changeDir(dgus_screen_handler.filelist.filename());
|
||||
if (screen.filelist.isDir()) {
|
||||
screen.filelist_offset = 0;
|
||||
screen.filelist_selected = -1;
|
||||
screen.filelist.changeDir(screen.filelist.filename());
|
||||
}
|
||||
else {
|
||||
dgus_screen_handler.filelist_selected = dgus_screen_handler.filelist_offset + index;
|
||||
screen.filelist_selected = screen.filelist_offset + index;
|
||||
}
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::PrintFile(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::printFile(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
UNUSED(data_ptr);
|
||||
|
||||
if (dgus_screen_handler.filelist_selected < 0) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_NO_FILE_SELECTED));
|
||||
if (screen.filelist_selected < 0) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_NO_FILE_SELECTED));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dgus_screen_handler.filelist.seek(dgus_screen_handler.filelist_selected)
|
||||
|| dgus_screen_handler.filelist.isDir()) {
|
||||
if (!screen.filelist.seek(screen.filelist_selected)
|
||||
|| screen.filelist.isDir()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
ExtUI::printFile(dgus_screen_handler.filelist.shortFilename());
|
||||
dgus_screen_handler.TriggerScreenChange(DGUS_Screen::PRINT_STATUS);
|
||||
ExtUI::printFile(screen.filelist.shortFilename());
|
||||
screen.triggerScreenChange(DGUS_ScreenID::PRINT_STATUS);
|
||||
}
|
||||
#endif // HAS_MEDIA
|
||||
|
||||
void DGUSRxHandler::PrintAbort(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::printAbort(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1];
|
||||
@ -166,14 +166,14 @@ void DGUSRxHandler::PrintAbort(DGUS_VP &vp, void *data_ptr) {
|
||||
}
|
||||
|
||||
if (!ExtUI::isPrinting() && !ExtUI::isPrintingPaused()) {
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
ExtUI::stopPrint();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::PrintPause(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::printPause(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1];
|
||||
@ -183,14 +183,14 @@ void DGUSRxHandler::PrintPause(DGUS_VP &vp, void *data_ptr) {
|
||||
}
|
||||
|
||||
if (!ExtUI::isPrinting()) {
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
ExtUI::pausePrint();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::PrintResume(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::printResume(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1];
|
||||
@ -200,29 +200,29 @@ void DGUSRxHandler::PrintResume(DGUS_VP &vp, void *data_ptr) {
|
||||
}
|
||||
|
||||
if (!ExtUI::isPrintingPaused()) {
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
ExtUI::resumePrint();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::Feedrate(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::feedrate(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const int16_t feedrate = BE16_P(data_ptr);
|
||||
|
||||
ExtUI::setFeedrate_percent(feedrate);
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::Flowrate(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::flowrate(DGUS_VP &vp, void *data_ptr) {
|
||||
const int16_t flowrate = BE16_P(data_ptr);
|
||||
|
||||
switch (vp.addr) {
|
||||
@ -240,24 +240,24 @@ void DGUSRxHandler::Flowrate(DGUS_VP &vp, void *data_ptr) {
|
||||
#endif
|
||||
}
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::BabystepSet(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::babystepSet(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const int16_t data = BE16_P(data_ptr);
|
||||
const float offset = dgus_display.FromFixedPoint<int16_t, float, 2>(data);
|
||||
const float offset = dgus.fromFixedPoint<int16_t, float, 2>(data);
|
||||
|
||||
const int16_t steps = ExtUI::mmToWholeSteps(offset - ExtUI::getZOffset_mm(), ExtUI::Z);
|
||||
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::Z, true);
|
||||
|
||||
dgus_screen_handler.TriggerEEPROMSave();
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerEEPROMSave();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::Babystep(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::babystep(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Adjust adjust = (DGUS_Data::Adjust)((uint8_t*)data_ptr)[1];
|
||||
@ -275,11 +275,11 @@ void DGUSRxHandler::Babystep(DGUS_VP &vp, void *data_ptr) {
|
||||
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::Z, true);
|
||||
|
||||
dgus_screen_handler.TriggerEEPROMSave();
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerEEPROMSave();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::TempPreset(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::tempPreset(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::TempPreset preset = (DGUS_Data::TempPreset)((uint8_t*)data_ptr)[1];
|
||||
@ -311,10 +311,10 @@ void DGUSRxHandler::TempPreset(DGUS_VP &vp, void *data_ptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::TempTarget(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::tempTarget(DGUS_VP &vp, void *data_ptr) {
|
||||
const int16_t temp = BE16_P(data_ptr);
|
||||
|
||||
switch (vp.addr) {
|
||||
@ -332,10 +332,10 @@ void DGUSRxHandler::TempTarget(DGUS_VP &vp, void *data_ptr) {
|
||||
#endif
|
||||
}
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::TempCool(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::tempCool(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Heater heater = (DGUS_Data::Heater)BE16_P(data_ptr);
|
||||
@ -362,12 +362,12 @@ void DGUSRxHandler::TempCool(DGUS_VP &vp, void *data_ptr) {
|
||||
#endif
|
||||
}
|
||||
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_COOLING));
|
||||
screen.setStatusMessage(GET_TEXT_F(MSG_COOLING));
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::Steppers(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::steppers(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Control control = (DGUS_Data::Control)((uint8_t*)data_ptr)[1];
|
||||
@ -381,50 +381,50 @@ void DGUSRxHandler::Steppers(DGUS_VP &vp, void *data_ptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::ZOffset(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::zOffset(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
if (TERN0(NO_MOTION_BEFORE_HOMING, !ExtUI::isAxisPositionKnown(ExtUI::Z))) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
const int16_t data = BE16_P(data_ptr);
|
||||
const float offset = dgus_display.FromFixedPoint<int16_t, float, 2>(data);
|
||||
const float offset = dgus.fromFixedPoint<int16_t, float, 2>(data);
|
||||
|
||||
const int16_t steps = ExtUI::mmToWholeSteps(offset - ExtUI::getZOffset_mm(), ExtUI::Z);
|
||||
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::Z, true);
|
||||
|
||||
dgus_screen_handler.TriggerEEPROMSave();
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerEEPROMSave();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::ZOffsetStep(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::zOffsetStep(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
if (TERN0(NO_MOTION_BEFORE_HOMING, !ExtUI::isAxisPositionKnown(ExtUI::Z))) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
const DGUS_Data::Adjust adjust = (DGUS_Data::Adjust)((uint8_t*)data_ptr)[1];
|
||||
int16_t steps;
|
||||
|
||||
switch (dgus_screen_handler.offset_steps) {
|
||||
switch (screen.offset_steps) {
|
||||
default: return;
|
||||
case DGUS_Data::StepSize::MMP1:
|
||||
steps = ExtUI::mmToWholeSteps((adjust == DGUS_Data::Adjust::INCREMENT ? 0.1f : -0.1f), ExtUI::Z);
|
||||
@ -436,30 +436,30 @@ void DGUSRxHandler::ZOffsetStep(DGUS_VP &vp, void *data_ptr) {
|
||||
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::Z, true);
|
||||
|
||||
dgus_screen_handler.TriggerEEPROMSave();
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerEEPROMSave();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::ZOffsetSetStep(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::zOffsetSetStep(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::StepSize size = (DGUS_Data::StepSize)((uint8_t*)data_ptr)[1];
|
||||
|
||||
dgus_screen_handler.offset_steps = size;
|
||||
screen.offset_steps = size;
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::MoveToPoint(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::moveToPoint(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
if (!ExtUI::isPositionKnown()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -499,26 +499,26 @@ void DGUSRxHandler::MoveToPoint(DGUS_VP &vp, void *data_ptr) {
|
||||
ExtUI::setAxisPosition_mm(Z_MIN_POS + BED_TRAMMING_HEIGHT, ExtUI::Z);
|
||||
}
|
||||
|
||||
void DGUSRxHandler::Probe(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::probe(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
UNUSED(data_ptr);
|
||||
|
||||
#if ENABLED(MESH_BED_LEVELING)
|
||||
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_ABL_REQUIRED));
|
||||
screen.setStatusMessage(FPSTR(DGUS_MSG_ABL_REQUIRED));
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (!ExtUI::isPositionKnown()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
dgus_screen_handler.TriggerScreenChange(DGUS_Screen::LEVELING_PROBING);
|
||||
screen.triggerScreenChange(DGUS_ScreenID::LEVELING_PROBING);
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
queue.enqueue_now(F("G29P1\nG29P3\nG29P5C"));
|
||||
@ -528,22 +528,22 @@ void DGUSRxHandler::Probe(DGUS_VP &vp, void *data_ptr) {
|
||||
queue.enqueue_now(F("M500"));
|
||||
}
|
||||
|
||||
void DGUSRxHandler::DisableABL(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::disableABL(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
UNUSED(data_ptr);
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
ExtUI::setLevelingActive(false);
|
||||
|
||||
dgus_screen_handler.TriggerEEPROMSave();
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerEEPROMSave();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::FilamentSelect(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::filamentSelect(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Extruder extruder = (DGUS_Data::Extruder)BE16_P(data_ptr);
|
||||
@ -553,34 +553,34 @@ void DGUSRxHandler::FilamentSelect(DGUS_VP &vp, void *data_ptr) {
|
||||
case DGUS_Data::Extruder::CURRENT:
|
||||
case DGUS_Data::Extruder::E0:
|
||||
E_TERN_(case DGUS_Data::Extruder::E1:)
|
||||
dgus_screen_handler.filament_extruder = extruder;
|
||||
screen.filament_extruder = extruder;
|
||||
break;
|
||||
}
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::FilamentLength(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::filamentLength(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const uint16_t length = BE16_P(data_ptr);
|
||||
|
||||
dgus_screen_handler.filament_length = constrain(length, 0, EXTRUDE_MAXLENGTH);
|
||||
screen.filament_length = constrain(length, 0, EXTRUDE_MAXLENGTH);
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::FilamentMove(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::filamentMove(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
ExtUI::extruder_t extruder;
|
||||
|
||||
switch (dgus_screen_handler.filament_extruder) {
|
||||
switch (screen.filament_extruder) {
|
||||
default: return;
|
||||
case DGUS_Data::Extruder::CURRENT:
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
@ -598,7 +598,7 @@ void DGUSRxHandler::FilamentMove(DGUS_VP &vp, void *data_ptr) {
|
||||
}
|
||||
|
||||
if (ExtUI::getActualTemp_celsius(extruder) < (float)EXTRUDE_MINTEMP) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_TEMP_TOO_LOW));
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_TEMP_TOO_LOW));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -606,25 +606,25 @@ void DGUSRxHandler::FilamentMove(DGUS_VP &vp, void *data_ptr) {
|
||||
|
||||
switch (move) {
|
||||
case DGUS_Data::FilamentMove::RETRACT:
|
||||
UI_DECREMENT_BY(AxisPosition_mm, (float)dgus_screen_handler.filament_length, extruder);
|
||||
UI_DECREMENT_BY(AxisPosition_mm, (float)screen.filament_length, extruder);
|
||||
break;
|
||||
case DGUS_Data::FilamentMove::EXTRUDE:
|
||||
UI_INCREMENT_BY(AxisPosition_mm, (float)dgus_screen_handler.filament_length, extruder);
|
||||
UI_INCREMENT_BY(AxisPosition_mm, (float)screen.filament_length, extruder);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSRxHandler::Home(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::home(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
DGUS_Data::Axis axis = (DGUS_Data::Axis)((uint8_t*)data_ptr)[1];
|
||||
|
||||
dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), dgus_screen_handler.GetCurrentScreen());
|
||||
screen.showWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), screen.getCurrentScreen());
|
||||
|
||||
switch (axis) {
|
||||
case DGUS_Data::Axis::X_Y_Z:
|
||||
@ -639,9 +639,9 @@ void DGUSRxHandler::Home(DGUS_VP &vp, void *data_ptr) {
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSRxHandler::Move(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::move(DGUS_VP &vp, void *data_ptr) {
|
||||
const int16_t data = BE16_P(data_ptr);
|
||||
const float position = dgus_display.FromFixedPoint<int16_t, float, 1>(data);
|
||||
const float position = dgus.fromFixedPoint<int16_t, float, 1>(data);
|
||||
ExtUI::axis_t axis;
|
||||
|
||||
switch (vp.addr) {
|
||||
@ -652,20 +652,20 @@ void DGUSRxHandler::Move(DGUS_VP &vp, void *data_ptr) {
|
||||
}
|
||||
|
||||
if (TERN0(NO_MOTION_BEFORE_HOMING, !ExtUI::isAxisPositionKnown(axis))) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
|
||||
return;
|
||||
}
|
||||
|
||||
ExtUI::setAxisPosition_mm(position, axis);
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::MoveStep(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::moveStep(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
float offset;
|
||||
switch (dgus_screen_handler.move_steps) {
|
||||
switch (screen.move_steps) {
|
||||
default: return;
|
||||
case DGUS_Data::StepSize::MM10: offset = 10.0f; break;
|
||||
case DGUS_Data::StepSize::MM1: offset = 1.0f; break;
|
||||
@ -686,58 +686,58 @@ void DGUSRxHandler::MoveStep(DGUS_VP &vp, void *data_ptr) {
|
||||
}
|
||||
|
||||
if (TERN0(NO_MOTION_BEFORE_HOMING, !ExtUI::isAxisPositionKnown(axis))) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
|
||||
return;
|
||||
}
|
||||
|
||||
UI_INCREMENT_BY(AxisPosition_mm, offset, axis);
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::MoveSetStep(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::moveSetStep(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::StepSize size = (DGUS_Data::StepSize)((uint8_t*)data_ptr)[1];
|
||||
dgus_screen_handler.move_steps = size;
|
||||
screen.move_steps = size;
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::GcodeClear(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::gcodeClear(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
UNUSED(data_ptr);
|
||||
|
||||
ZERO(dgus_screen_handler.gcode);
|
||||
ZERO(screen.gcode);
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::GcodeExecute(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::gcodeExecute(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
UNUSED(data_ptr);
|
||||
|
||||
if (!strlen(dgus_screen_handler.gcode)) return;
|
||||
if (!strlen(screen.gcode)) return;
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_EXECUTING_COMMAND), DGUS_Screen::GCODE);
|
||||
screen.showWaitScreen(GET_TEXT_F(DGUS_MSG_EXECUTING_COMMAND), DGUS_ScreenID::GCODE);
|
||||
|
||||
queue.enqueue_one_now(dgus_screen_handler.gcode);
|
||||
queue.enqueue_one_now(screen.gcode);
|
||||
}
|
||||
|
||||
void DGUSRxHandler::ResetEEPROM(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::resetEEPROM(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1];
|
||||
|
||||
if (result != DGUS_Data::Popup::CONFIRMED) return;
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -745,7 +745,7 @@ void DGUSRxHandler::ResetEEPROM(DGUS_VP &vp, void *data_ptr) {
|
||||
queue.enqueue_now(F("M500"));
|
||||
}
|
||||
|
||||
void DGUSRxHandler::SettingsExtra(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::settingsExtra(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Extra extra = (DGUS_Data::Extra)((uint8_t*)data_ptr)[1];
|
||||
@ -754,25 +754,25 @@ void DGUSRxHandler::SettingsExtra(DGUS_VP &vp, void *data_ptr) {
|
||||
default: return;
|
||||
case DGUS_Data::Extra::BUTTON1:
|
||||
#if ENABLED(BLTOUCH)
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
queue.enqueue_now(F(DGUS_RESET_BLTOUCH));
|
||||
#else
|
||||
dgus_screen_handler.TriggerScreenChange(DGUS_Screen::INFOS);
|
||||
screen.triggerScreenChange(DGUS_ScreenID::INFOS);
|
||||
#endif
|
||||
break;
|
||||
#if ENABLED(BLTOUCH)
|
||||
case DGUS_Data::Extra::BUTTON2:
|
||||
dgus_screen_handler.TriggerScreenChange(DGUS_Screen::INFOS);
|
||||
screen.triggerScreenChange(DGUS_ScreenID::INFOS);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSRxHandler::PIDSelect(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::pidSelect(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Heater heater = (DGUS_Data::Heater)BE16_P(data_ptr);
|
||||
@ -780,34 +780,34 @@ void DGUSRxHandler::PIDSelect(DGUS_VP &vp, void *data_ptr) {
|
||||
switch (heater) {
|
||||
default: return;
|
||||
case DGUS_Data::Heater::BED:
|
||||
dgus_screen_handler.pid_temp = DGUS_PLA_TEMP_BED;
|
||||
dgus_screen_handler.pid_heater = heater;
|
||||
screen.pid_temp = DGUS_PLA_TEMP_BED;
|
||||
screen.pid_heater = heater;
|
||||
break;
|
||||
case DGUS_Data::Heater::H0:
|
||||
#if HAS_MULTI_HOTEND
|
||||
case DGUS_Data::Heater::H1:
|
||||
#endif
|
||||
dgus_screen_handler.pid_temp = DGUS_PLA_TEMP_HOTEND;
|
||||
dgus_screen_handler.pid_heater = heater;
|
||||
screen.pid_temp = DGUS_PLA_TEMP_HOTEND;
|
||||
screen.pid_heater = heater;
|
||||
break;
|
||||
}
|
||||
|
||||
dgus_screen_handler.pid_cycles = 5;
|
||||
screen.pid_cycles = 5;
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::PIDSetTemp(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::pidSetTemp(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t temp = BE16_P(data_ptr);
|
||||
|
||||
switch (dgus_screen_handler.pid_heater) {
|
||||
switch (screen.pid_heater) {
|
||||
default: return;
|
||||
case DGUS_Data::Heater::BED:
|
||||
temp = constrain(temp, BED_MINTEMP, BED_MAX_TARGET);
|
||||
@ -822,31 +822,31 @@ void DGUSRxHandler::PIDSetTemp(DGUS_VP &vp, void *data_ptr) {
|
||||
#endif
|
||||
}
|
||||
|
||||
dgus_screen_handler.pid_temp = temp;
|
||||
screen.pid_temp = temp;
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::pidRun(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
UNUSED(data_ptr);
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
heater_id_t heater;
|
||||
uint8_t cycles = constrain(dgus_screen_handler.pid_cycles, 3, 10);
|
||||
uint8_t cycles = constrain(screen.pid_cycles, 3, 10);
|
||||
|
||||
switch (dgus_screen_handler.pid_heater) {
|
||||
switch (screen.pid_heater) {
|
||||
default: return;
|
||||
case DGUS_Data::Heater::BED:
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
heater = H_BED;
|
||||
break;
|
||||
#else
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BED_PID_DISABLED));
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BED_PID_DISABLED));
|
||||
return;
|
||||
#endif
|
||||
case DGUS_Data::Heater::H0:
|
||||
@ -854,7 +854,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
|
||||
heater = H_E0;
|
||||
break;
|
||||
#else
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_PID_DISABLED));
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_PID_DISABLED));
|
||||
return;
|
||||
#endif
|
||||
#if HAS_MULTI_HOTEND
|
||||
@ -863,23 +863,23 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
|
||||
heater = H_E1;
|
||||
break;
|
||||
#else
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_PID_DISABLED));
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_PID_DISABLED));
|
||||
return;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
char buffer[24];
|
||||
snprintf_P(buffer, sizeof(buffer), PSTR("M303C%dE%dS%dU1"), cycles, heater, dgus_screen_handler.pid_temp);
|
||||
snprintf_P(buffer, sizeof(buffer), PSTR("M303C%dE%dS%dU1"), cycles, heater, screen.pid_temp);
|
||||
|
||||
dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_PID_AUTOTUNING), DGUS_Screen::PID);
|
||||
screen.showWaitScreen(GET_TEXT_F(DGUS_MSG_PID_AUTOTUNING), DGUS_ScreenID::PID);
|
||||
|
||||
queue.enqueue_one_now(buffer);
|
||||
queue.enqueue_now(F("M500"));
|
||||
}
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void DGUSRxHandler::PowerLossAbort(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::powerLossAbort(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1];
|
||||
@ -888,17 +888,17 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
dgus_screen_handler.TriggerScreenChange(DGUS_Screen::HOME);
|
||||
screen.triggerScreenChange(DGUS_ScreenID::HOME);
|
||||
|
||||
queue.enqueue_now(F("M1000C"));
|
||||
}
|
||||
|
||||
void DGUSRxHandler::PowerLossResume(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::powerLossResume(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1];
|
||||
@ -907,23 +907,23 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!recovery.valid()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_INVALID_RECOVERY_DATA));
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_INVALID_RECOVERY_DATA));
|
||||
return;
|
||||
}
|
||||
|
||||
dgus_screen_handler.TriggerScreenChange(DGUS_Screen::PRINT_STATUS);
|
||||
screen.triggerScreenChange(DGUS_ScreenID::PRINT_STATUS);
|
||||
|
||||
queue.enqueue_now(F("M1000"));
|
||||
}
|
||||
#endif // POWER_LOSS_RECOVERY
|
||||
|
||||
void DGUSRxHandler::WaitAbort(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::waitAbort(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1];
|
||||
@ -933,25 +933,25 @@ void DGUSRxHandler::WaitAbort(DGUS_VP &vp, void *data_ptr) {
|
||||
}
|
||||
|
||||
if (!ExtUI::isPrintingPaused()) {
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
ExtUI::stopPrint();
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::WaitContinue(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::waitContinue(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
UNUSED(data_ptr);
|
||||
|
||||
ExtUI::setUserConfirmed();
|
||||
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::FanSpeed(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::fanSpeed(DGUS_VP &vp, void *data_ptr) {
|
||||
uint8_t speed = ((uint8_t*)data_ptr)[1];
|
||||
switch (vp.addr) {
|
||||
default: return;
|
||||
@ -961,36 +961,36 @@ void DGUSRxHandler::FanSpeed(DGUS_VP &vp, void *data_ptr) {
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSRxHandler::Volume(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::volume(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
uint8_t volume = ((uint8_t*)data_ptr)[1];
|
||||
dgus_display.SetVolume(volume);
|
||||
dgus.setVolume(volume);
|
||||
|
||||
dgus_screen_handler.TriggerEEPROMSave();
|
||||
screen.triggerEEPROMSave();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::Brightness(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::brightness(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
uint8_t brightness = ((uint8_t*)data_ptr)[1];
|
||||
dgus_display.SetBrightness(brightness);
|
||||
dgus.setBrightness(brightness);
|
||||
|
||||
dgus_screen_handler.TriggerEEPROMSave();
|
||||
screen.triggerEEPROMSave();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::Debug(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::debug(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
UNUSED(data_ptr);
|
||||
|
||||
++dgus_screen_handler.debug_count;
|
||||
++screen.debug_count;
|
||||
|
||||
if (dgus_screen_handler.debug_count >= 10) {
|
||||
dgus_screen_handler.TriggerScreenChange(DGUS_Screen::DEBUG);
|
||||
if (screen.debug_count >= 10) {
|
||||
screen.triggerScreenChange(DGUS_ScreenID::DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSRxHandler::StringToExtra(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::stringToExtra(DGUS_VP &vp, void *data_ptr) {
|
||||
if (!vp.size || !vp.extra) return;
|
||||
memcpy(vp.extra, data_ptr, vp.size);
|
||||
}
|
||||
|
@ -26,78 +26,78 @@
|
||||
|
||||
namespace DGUSRxHandler {
|
||||
|
||||
void ScreenChange(DGUS_VP &, void *);
|
||||
void screenChange(DGUS_VP &, void *);
|
||||
|
||||
#if HAS_MEDIA
|
||||
void Scroll(DGUS_VP &, void *);
|
||||
void scroll(DGUS_VP &, void *);
|
||||
void selectFile(DGUS_VP &, void *);
|
||||
void PrintFile(DGUS_VP &, void *);
|
||||
void printFile(DGUS_VP &, void *);
|
||||
#endif
|
||||
|
||||
void PrintAbort(DGUS_VP &, void *);
|
||||
void PrintPause(DGUS_VP &, void *);
|
||||
void PrintResume(DGUS_VP &, void *);
|
||||
void printAbort(DGUS_VP &, void *);
|
||||
void printPause(DGUS_VP &, void *);
|
||||
void printResume(DGUS_VP &, void *);
|
||||
|
||||
void Feedrate(DGUS_VP &, void *);
|
||||
void Flowrate(DGUS_VP &, void *);
|
||||
void BabystepSet(DGUS_VP &, void *);
|
||||
void Babystep(DGUS_VP &, void *);
|
||||
void feedrate(DGUS_VP &, void *);
|
||||
void flowrate(DGUS_VP &, void *);
|
||||
void babystepSet(DGUS_VP &, void *);
|
||||
void babystep(DGUS_VP &, void *);
|
||||
|
||||
void TempPreset(DGUS_VP &, void *);
|
||||
void TempTarget(DGUS_VP &, void *);
|
||||
void TempCool(DGUS_VP &, void *);
|
||||
void tempPreset(DGUS_VP &, void *);
|
||||
void tempTarget(DGUS_VP &, void *);
|
||||
void tempCool(DGUS_VP &, void *);
|
||||
|
||||
void Steppers(DGUS_VP &, void *);
|
||||
void steppers(DGUS_VP &, void *);
|
||||
|
||||
void ZOffset(DGUS_VP &, void *);
|
||||
void ZOffsetStep(DGUS_VP &, void *);
|
||||
void ZOffsetSetStep(DGUS_VP &, void *);
|
||||
void zOffset(DGUS_VP &, void *);
|
||||
void zOffsetStep(DGUS_VP &, void *);
|
||||
void zOffsetSetStep(DGUS_VP &, void *);
|
||||
|
||||
void MoveToPoint(DGUS_VP &, void *);
|
||||
void moveToPoint(DGUS_VP &, void *);
|
||||
|
||||
void Probe(DGUS_VP &, void *);
|
||||
void DisableABL(DGUS_VP &, void *);
|
||||
void probe(DGUS_VP &, void *);
|
||||
void disableABL(DGUS_VP &, void *);
|
||||
|
||||
void FilamentSelect(DGUS_VP &, void *);
|
||||
void FilamentLength(DGUS_VP &, void *);
|
||||
void FilamentMove(DGUS_VP &, void *);
|
||||
void filamentSelect(DGUS_VP &, void *);
|
||||
void filamentLength(DGUS_VP &, void *);
|
||||
void filamentMove(DGUS_VP &, void *);
|
||||
|
||||
void Home(DGUS_VP &, void *);
|
||||
void Move(DGUS_VP &, void *);
|
||||
void MoveStep(DGUS_VP &, void *);
|
||||
void MoveSetStep(DGUS_VP &, void *);
|
||||
void home(DGUS_VP &, void *);
|
||||
void move(DGUS_VP &, void *);
|
||||
void moveStep(DGUS_VP &, void *);
|
||||
void moveSetStep(DGUS_VP &, void *);
|
||||
|
||||
void GcodeClear(DGUS_VP &, void *);
|
||||
void GcodeExecute(DGUS_VP &, void *);
|
||||
void gcodeClear(DGUS_VP &, void *);
|
||||
void gcodeExecute(DGUS_VP &, void *);
|
||||
|
||||
void ResetEEPROM(DGUS_VP &, void *);
|
||||
void resetEEPROM(DGUS_VP &, void *);
|
||||
|
||||
void SettingsExtra(DGUS_VP &, void *);
|
||||
void settingsExtra(DGUS_VP &, void *);
|
||||
|
||||
void PIDSelect(DGUS_VP &, void *);
|
||||
void PIDSetTemp(DGUS_VP &, void *);
|
||||
void PIDRun(DGUS_VP &, void *);
|
||||
void pidSelect(DGUS_VP &, void *);
|
||||
void pidSetTemp(DGUS_VP &, void *);
|
||||
void pidRun(DGUS_VP &, void *);
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void PowerLossAbort(DGUS_VP &, void *);
|
||||
void PowerLossResume(DGUS_VP &, void *);
|
||||
void powerLossAbort(DGUS_VP &, void *);
|
||||
void powerLossResume(DGUS_VP &, void *);
|
||||
#endif
|
||||
|
||||
void WaitAbort(DGUS_VP &, void *);
|
||||
void WaitContinue(DGUS_VP &, void *);
|
||||
void waitAbort(DGUS_VP &, void *);
|
||||
void waitContinue(DGUS_VP &, void *);
|
||||
|
||||
void FanSpeed(DGUS_VP &, void *);
|
||||
void fanSpeed(DGUS_VP &, void *);
|
||||
|
||||
void Volume(DGUS_VP &, void *);
|
||||
void volume(DGUS_VP &, void *);
|
||||
|
||||
void Brightness(DGUS_VP &, void *);
|
||||
void brightness(DGUS_VP &, void *);
|
||||
|
||||
void Debug(DGUS_VP &, void *);
|
||||
void debug(DGUS_VP &, void *);
|
||||
|
||||
void StringToExtra(DGUS_VP &, void *);
|
||||
void stringToExtra(DGUS_VP &, void *);
|
||||
|
||||
template<typename T>
|
||||
void IntegerToExtra(DGUS_VP &vp, void *data_ptr) {
|
||||
void integerToExtra(DGUS_VP &vp, void *data_ptr) {
|
||||
if (!vp.size || !vp.extra) return;
|
||||
switch (vp.size) {
|
||||
default: return;
|
||||
@ -112,7 +112,7 @@ namespace DGUSRxHandler {
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
const uint32_t data = dgus_display.SwapBytes(*(uint32_t*)data_ptr);
|
||||
const uint32_t data = dgus.swapBytes(*(uint32_t*)data_ptr);
|
||||
*(T*)vp.extra = (T)data;
|
||||
break;
|
||||
}
|
||||
|
@ -57,11 +57,11 @@ uint8_t DGUSScreenHandler::pid_cycles = 5;
|
||||
bool DGUSScreenHandler::settings_ready = false;
|
||||
bool DGUSScreenHandler::booted = false;
|
||||
|
||||
DGUS_Screen DGUSScreenHandler::current_screen = DGUS_Screen::BOOT;
|
||||
DGUS_Screen DGUSScreenHandler::new_screen = DGUS_Screen::BOOT;
|
||||
DGUS_ScreenID DGUSScreenHandler::current_screenID = DGUS_ScreenID::BOOT;
|
||||
DGUS_ScreenID DGUSScreenHandler::new_screenID = DGUS_ScreenID::BOOT;
|
||||
bool DGUSScreenHandler::full_update = false;
|
||||
|
||||
DGUS_Screen DGUSScreenHandler::wait_return_screen = DGUS_Screen::HOME;
|
||||
DGUS_ScreenID DGUSScreenHandler::wait_return_screenID = DGUS_ScreenID::HOME;
|
||||
bool DGUSScreenHandler::wait_continue = false;
|
||||
|
||||
bool DGUSScreenHandler::leveling_active = false;
|
||||
@ -69,41 +69,41 @@ bool DGUSScreenHandler::leveling_active = false;
|
||||
millis_t DGUSScreenHandler::status_expire = 0;
|
||||
millis_t DGUSScreenHandler::eeprom_save = 0;
|
||||
|
||||
void DGUSScreenHandler::Init() {
|
||||
dgus_display.Init();
|
||||
void DGUSScreenHandler::init() {
|
||||
dgus.init();
|
||||
|
||||
MoveToScreen(DGUS_Screen::BOOT, true);
|
||||
moveToScreen(DGUS_ScreenID::BOOT, true);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::Ready() {
|
||||
dgus_display.PlaySound(1);
|
||||
void DGUSScreenHandler::ready() {
|
||||
dgus.playSound(1);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::Loop() {
|
||||
if (!settings_ready || current_screen == DGUS_Screen::KILL) {
|
||||
void DGUSScreenHandler::loop() {
|
||||
if (!settings_ready || current_screenID == DGUS_ScreenID::KILL) {
|
||||
return;
|
||||
}
|
||||
|
||||
const millis_t ms = ExtUI::safe_millis();
|
||||
static millis_t next_event_ms = 0;
|
||||
|
||||
if (new_screen != DGUS_Screen::BOOT) {
|
||||
const DGUS_Screen screen = new_screen;
|
||||
new_screen = DGUS_Screen::BOOT;
|
||||
if (current_screen == screen)
|
||||
TriggerFullUpdate();
|
||||
if (new_screenID != DGUS_ScreenID::BOOT) {
|
||||
const DGUS_ScreenID screenID = new_screenID;
|
||||
new_screenID = DGUS_ScreenID::BOOT;
|
||||
if (current_screenID == screenID)
|
||||
triggerFullUpdate();
|
||||
else
|
||||
MoveToScreen(screen);
|
||||
moveToScreen(screenID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!booted && ELAPSED(ms, 3000)) {
|
||||
booted = true;
|
||||
|
||||
dgus_display.ReadVersions();
|
||||
dgus.readVersions();
|
||||
|
||||
if (current_screen == DGUS_Screen::BOOT)
|
||||
MoveToScreen(DGUS_Screen::HOME);
|
||||
if (current_screenID == DGUS_ScreenID::BOOT)
|
||||
moveToScreen(DGUS_ScreenID::HOME);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -111,98 +111,98 @@ void DGUSScreenHandler::Loop() {
|
||||
if (ELAPSED(ms, next_event_ms) || full_update) {
|
||||
next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS;
|
||||
|
||||
if (!SendScreenVPData(current_screen, full_update))
|
||||
DEBUG_ECHOLNPGM("SendScreenVPData failed");
|
||||
if (!sendScreenVPData(current_screenID, full_update))
|
||||
DEBUG_ECHOLNPGM("sendScreenVPData failed");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (current_screen == DGUS_Screen::WAIT
|
||||
&& ((wait_continue && !wait_for_user) || (!wait_continue && IsPrinterIdle()))
|
||||
if (current_screenID == DGUS_ScreenID::WAIT
|
||||
&& ((wait_continue && !wait_for_user) || (!wait_continue && isPrinterIdle()))
|
||||
) {
|
||||
MoveToScreen(wait_return_screen, true);
|
||||
moveToScreen(wait_return_screenID, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (current_screen == DGUS_Screen::LEVELING_PROBING && IsPrinterIdle()) {
|
||||
dgus_display.PlaySound(3);
|
||||
if (current_screenID == DGUS_ScreenID::LEVELING_PROBING && isPrinterIdle()) {
|
||||
dgus.playSound(3);
|
||||
|
||||
SetStatusMessage(ExtUI::getLevelingIsValid() ? GET_TEXT_F(DGUS_MSG_PROBING_SUCCESS) : GET_TEXT_F(DGUS_MSG_PROBING_FAILED));
|
||||
setStatusMessage(ExtUI::getLevelingIsValid() ? GET_TEXT_F(DGUS_MSG_PROBING_SUCCESS) : GET_TEXT_F(DGUS_MSG_PROBING_FAILED));
|
||||
|
||||
MoveToScreen(DGUS_Screen::LEVELING_AUTOMATIC);
|
||||
moveToScreen(DGUS_ScreenID::LEVELING_AUTOMATIC);
|
||||
return;
|
||||
}
|
||||
|
||||
if (status_expire > 0 && ELAPSED(ms, status_expire)) {
|
||||
SetStatusMessage(FPSTR(NUL_STR), 0);
|
||||
setStatusMessage(FPSTR(NUL_STR), 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (eeprom_save > 0 && ELAPSED(ms, eeprom_save) && IsPrinterIdle()) {
|
||||
if (eeprom_save > 0 && ELAPSED(ms, eeprom_save) && isPrinterIdle()) {
|
||||
eeprom_save = 0;
|
||||
queue.enqueue_now(F("M500"));
|
||||
return;
|
||||
}
|
||||
|
||||
dgus_display.Loop();
|
||||
dgus.loop();
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::printerKilled(FSTR_P const error, FSTR_P const component) {
|
||||
SetMessageLine(error, 1);
|
||||
SetMessageLine(component, 2);
|
||||
SetMessageLinePGM(NUL_STR, 3);
|
||||
SetMessageLine(GET_TEXT_F(MSG_PLEASE_RESET), 4);
|
||||
setMessageLine(error, 1);
|
||||
setMessageLine(component, 2);
|
||||
setMessageLinePGM(NUL_STR, 3);
|
||||
setMessageLine(GET_TEXT_F(MSG_PLEASE_RESET), 4);
|
||||
|
||||
dgus_display.PlaySound(3, 1, 200);
|
||||
dgus.playSound(3, 1, 200);
|
||||
|
||||
MoveToScreen(DGUS_Screen::KILL, true);
|
||||
moveToScreen(DGUS_ScreenID::KILL, true);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::UserConfirmRequired(const char * const msg) {
|
||||
SetMessageLinePGM(NUL_STR, 1);
|
||||
SetMessageLine(msg, 2);
|
||||
SetMessageLinePGM(NUL_STR, 3);
|
||||
SetMessageLinePGM(NUL_STR, 4);
|
||||
void DGUSScreenHandler::userConfirmRequired(const char * const msg) {
|
||||
setMessageLinePGM(NUL_STR, 1);
|
||||
setMessageLine(msg, 2);
|
||||
setMessageLinePGM(NUL_STR, 3);
|
||||
setMessageLinePGM(NUL_STR, 4);
|
||||
|
||||
dgus_display.PlaySound(3);
|
||||
dgus.playSound(3);
|
||||
|
||||
ShowWaitScreen(current_screen, true);
|
||||
showWaitScreen(current_screenID, true);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SettingsReset() {
|
||||
dgus_display.SetVolume(DGUS_DEFAULT_VOLUME);
|
||||
dgus_display.SetBrightness(DGUS_DEFAULT_BRIGHTNESS);
|
||||
void DGUSScreenHandler::settingsReset() {
|
||||
dgus.setVolume(DGUS_DEFAULT_VOLUME);
|
||||
dgus.setBrightness(DGUS_DEFAULT_BRIGHTNESS);
|
||||
|
||||
if (!settings_ready) {
|
||||
settings_ready = true;
|
||||
Ready();
|
||||
ready();
|
||||
}
|
||||
|
||||
SetStatusMessage(GET_TEXT_F(DGUS_MSG_RESET_EEPROM));
|
||||
setStatusMessage(GET_TEXT_F(DGUS_MSG_RESET_EEPROM));
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::StoreSettings(char *buff) {
|
||||
void DGUSScreenHandler::storeSettings(char *buff) {
|
||||
eeprom_data_t data;
|
||||
|
||||
static_assert(sizeof(data) <= ExtUI::eeprom_data_size, "sizeof(eeprom_data_t) > eeprom_data_size.");
|
||||
|
||||
data.initialized = true;
|
||||
data.volume = dgus_display.GetVolume();
|
||||
data.brightness = dgus_display.GetBrightness();
|
||||
data.volume = dgus.getVolume();
|
||||
data.brightness = dgus.getBrightness();
|
||||
data.abl_okay = (ExtUI::getLevelingActive() && ExtUI::getLevelingIsValid());
|
||||
|
||||
memcpy(buff, &data, sizeof(data));
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::LoadSettings(const char *buff) {
|
||||
void DGUSScreenHandler::loadSettings(const char *buff) {
|
||||
eeprom_data_t data;
|
||||
|
||||
static_assert(sizeof(data) <= ExtUI::eeprom_data_size, "sizeof(eeprom_data_t) > eeprom_data_size.");
|
||||
|
||||
memcpy(&data, buff, sizeof(data));
|
||||
|
||||
dgus_display.SetVolume(data.initialized ? data.volume : DGUS_DEFAULT_VOLUME);
|
||||
dgus_display.SetBrightness(data.initialized ? data.brightness : DGUS_DEFAULT_BRIGHTNESS);
|
||||
dgus.setVolume(data.initialized ? data.volume : DGUS_DEFAULT_VOLUME);
|
||||
dgus.setBrightness(data.initialized ? data.brightness : DGUS_DEFAULT_BRIGHTNESS);
|
||||
|
||||
if (data.initialized) {
|
||||
leveling_active = (data.abl_okay && ExtUI::getLevelingIsValid());
|
||||
@ -210,36 +210,36 @@ void DGUSScreenHandler::LoadSettings(const char *buff) {
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::ConfigurationStoreWritten(bool success) {
|
||||
void DGUSScreenHandler::configurationStoreWritten(bool success) {
|
||||
if (!success)
|
||||
SetStatusMessage(GET_TEXT_F(DGUS_MSG_WRITE_EEPROM_FAILED));
|
||||
setStatusMessage(GET_TEXT_F(DGUS_MSG_WRITE_EEPROM_FAILED));
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::ConfigurationStoreRead(bool success) {
|
||||
void DGUSScreenHandler::configurationStoreRead(bool success) {
|
||||
if (!success) {
|
||||
SetStatusMessage(GET_TEXT_F(DGUS_MSG_READ_EEPROM_FAILED));
|
||||
setStatusMessage(GET_TEXT_F(DGUS_MSG_READ_EEPROM_FAILED));
|
||||
}
|
||||
else if (!settings_ready) {
|
||||
settings_ready = true;
|
||||
Ready();
|
||||
ready();
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::PlayTone(const uint16_t frequency, const uint16_t duration) {
|
||||
void DGUSScreenHandler::playTone(const uint16_t frequency, const uint16_t duration) {
|
||||
UNUSED(duration);
|
||||
|
||||
if (frequency >= 1 && frequency <= 255) {
|
||||
if (duration >= 1 && duration <= 255)
|
||||
dgus_display.PlaySound((uint8_t)frequency, (uint8_t)duration);
|
||||
dgus.playSound((uint8_t)frequency, (uint8_t)duration);
|
||||
else
|
||||
dgus_display.PlaySound((uint8_t)frequency);
|
||||
dgus.playSound((uint8_t)frequency);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::MeshUpdate(const int8_t xpos, const int8_t ypos) {
|
||||
if (current_screen != DGUS_Screen::LEVELING_PROBING) {
|
||||
if (current_screen == DGUS_Screen::LEVELING_AUTOMATIC)
|
||||
TriggerFullUpdate();
|
||||
void DGUSScreenHandler::meshUpdate(const int8_t xpos, const int8_t ypos) {
|
||||
if (current_screenID != DGUS_ScreenID::LEVELING_PROBING) {
|
||||
if (current_screenID == DGUS_ScreenID::LEVELING_AUTOMATIC)
|
||||
triggerFullUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -249,25 +249,25 @@ void DGUSScreenHandler::MeshUpdate(const int8_t xpos, const int8_t ypos) {
|
||||
if (xpos >= GRID_MAX_POINTS_X - 1 && ypos >= GRID_MAX_POINTS_Y - 1 && !ExtUI::getLevelingIsValid())
|
||||
probing_icons[0] = probing_icons[1] = 0;
|
||||
|
||||
TriggerFullUpdate();
|
||||
triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::PrintTimerStarted() {
|
||||
TriggerScreenChange(DGUS_Screen::PRINT_STATUS);
|
||||
void DGUSScreenHandler::printTimerStarted() {
|
||||
triggerScreenChange(DGUS_ScreenID::PRINT_STATUS);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::PrintTimerPaused() {
|
||||
dgus_display.PlaySound(3);
|
||||
TriggerFullUpdate();
|
||||
void DGUSScreenHandler::printTimerPaused() {
|
||||
dgus.playSound(3);
|
||||
triggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::PrintTimerStopped() {
|
||||
if (current_screen != DGUS_Screen::PRINT_STATUS && current_screen != DGUS_Screen::PRINT_ADJUST)
|
||||
void DGUSScreenHandler::printTimerStopped() {
|
||||
if (current_screenID != DGUS_ScreenID::PRINT_STATUS && current_screenID != DGUS_ScreenID::PRINT_ADJUST)
|
||||
return;
|
||||
|
||||
dgus_display.PlaySound(3);
|
||||
dgus.playSound(3);
|
||||
|
||||
TriggerScreenChange(DGUS_Screen::PRINT_FINISHED);
|
||||
triggerScreenChange(DGUS_ScreenID::PRINT_FINISHED);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::filamentRunout(const ExtUI::extruder_t extruder) {
|
||||
@ -275,161 +275,161 @@ void DGUSScreenHandler::filamentRunout(const ExtUI::extruder_t extruder) {
|
||||
|
||||
snprintf_P(buffer, sizeof(buffer), GET_TEXT(DGUS_MSG_FILAMENT_RUNOUT), extruder);
|
||||
|
||||
SetStatusMessage(buffer);
|
||||
setStatusMessage(buffer);
|
||||
|
||||
dgus_display.PlaySound(3);
|
||||
dgus.playSound(3);
|
||||
}
|
||||
|
||||
#if HAS_MEDIA
|
||||
|
||||
void DGUSScreenHandler::SDCardInserted() {
|
||||
if (current_screen == DGUS_Screen::HOME)
|
||||
TriggerScreenChange(DGUS_Screen::PRINT);
|
||||
void DGUSScreenHandler::sdCardInserted() {
|
||||
if (current_screenID == DGUS_ScreenID::HOME)
|
||||
triggerScreenChange(DGUS_ScreenID::PRINT);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardRemoved() {
|
||||
if (current_screen == DGUS_Screen::PRINT)
|
||||
TriggerScreenChange(DGUS_Screen::HOME);
|
||||
void DGUSScreenHandler::sdCardRemoved() {
|
||||
if (current_screenID == DGUS_ScreenID::PRINT)
|
||||
triggerScreenChange(DGUS_ScreenID::HOME);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardError() {
|
||||
SetStatusMessage(GET_TEXT_F(MSG_MEDIA_READ_ERROR));
|
||||
if (current_screen == DGUS_Screen::PRINT)
|
||||
TriggerScreenChange(DGUS_Screen::HOME);
|
||||
void DGUSScreenHandler::sdCardError() {
|
||||
setStatusMessage(GET_TEXT_F(MSG_MEDIA_READ_ERROR));
|
||||
if (current_screenID == DGUS_ScreenID::PRINT)
|
||||
triggerScreenChange(DGUS_ScreenID::HOME);
|
||||
}
|
||||
|
||||
#endif // HAS_MEDIA
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
|
||||
void DGUSScreenHandler::PowerLossResume() {
|
||||
MoveToScreen(DGUS_Screen::POWERLOSS, true);
|
||||
void DGUSScreenHandler::powerLossResume() {
|
||||
moveToScreen(DGUS_ScreenID::POWERLOSS, true);
|
||||
}
|
||||
|
||||
#endif // POWER_LOSS_RECOVERY
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
|
||||
void DGUSScreenHandler::PidTuning(const ExtUI::result_t rst) {
|
||||
void DGUSScreenHandler::pidTuning(const ExtUI::result_t rst) {
|
||||
switch (rst) {
|
||||
case ExtUI::PID_STARTED:
|
||||
SetStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE));
|
||||
setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE));
|
||||
break;
|
||||
case ExtUI::PID_BAD_HEATER_ID:
|
||||
SetStatusMessage(GET_TEXT_F(MSG_PID_BAD_HEATER_ID));
|
||||
setStatusMessage(GET_TEXT_F(MSG_PID_BAD_HEATER_ID));
|
||||
break;
|
||||
case ExtUI::PID_TEMP_TOO_HIGH:
|
||||
SetStatusMessage(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH));
|
||||
setStatusMessage(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH));
|
||||
break;
|
||||
case ExtUI::PID_TUNING_TIMEOUT:
|
||||
SetStatusMessage(GET_TEXT_F(MSG_PID_TIMEOUT));
|
||||
setStatusMessage(GET_TEXT_F(MSG_PID_TIMEOUT));
|
||||
break;
|
||||
case ExtUI::PID_DONE:
|
||||
SetStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE));
|
||||
setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
dgus_display.PlaySound(3);
|
||||
dgus.playSound(3);
|
||||
}
|
||||
|
||||
#endif // HAS_PID_HEATING
|
||||
|
||||
void DGUSScreenHandler::SetMessageLine(const char * const msg, const uint8_t line) {
|
||||
void DGUSScreenHandler::setMessageLine(const char * const msg, const uint8_t line) {
|
||||
switch (line) {
|
||||
default: return;
|
||||
case 1:
|
||||
dgus_display.WriteString((uint16_t)DGUS_Addr::MESSAGE_Line1, msg, DGUS_LINE_LEN, true, true);
|
||||
dgus.writeString((uint16_t)DGUS_Addr::MESSAGE_Line1, msg, DGUS_LINE_LEN, true, true);
|
||||
break;
|
||||
case 2:
|
||||
dgus_display.WriteString((uint16_t)DGUS_Addr::MESSAGE_Line2, msg, DGUS_LINE_LEN, true, true);
|
||||
dgus.writeString((uint16_t)DGUS_Addr::MESSAGE_Line2, msg, DGUS_LINE_LEN, true, true);
|
||||
break;
|
||||
case 3:
|
||||
dgus_display.WriteString((uint16_t)DGUS_Addr::MESSAGE_Line3, msg, DGUS_LINE_LEN, true, true);
|
||||
dgus.writeString((uint16_t)DGUS_Addr::MESSAGE_Line3, msg, DGUS_LINE_LEN, true, true);
|
||||
break;
|
||||
case 4:
|
||||
dgus_display.WriteString((uint16_t)DGUS_Addr::MESSAGE_Line4, msg, DGUS_LINE_LEN, true, true);
|
||||
dgus.writeString((uint16_t)DGUS_Addr::MESSAGE_Line4, msg, DGUS_LINE_LEN, true, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SetMessageLinePGM(PGM_P const msg, const uint8_t line) {
|
||||
void DGUSScreenHandler::setMessageLinePGM(PGM_P const msg, const uint8_t line) {
|
||||
switch (line) {
|
||||
default: return;
|
||||
case 1:
|
||||
dgus_display.WriteStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line1, msg, DGUS_LINE_LEN, true, true);
|
||||
dgus.writeStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line1, msg, DGUS_LINE_LEN, true, true);
|
||||
break;
|
||||
case 2:
|
||||
dgus_display.WriteStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line2, msg, DGUS_LINE_LEN, true, true);
|
||||
dgus.writeStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line2, msg, DGUS_LINE_LEN, true, true);
|
||||
break;
|
||||
case 3:
|
||||
dgus_display.WriteStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line3, msg, DGUS_LINE_LEN, true, true);
|
||||
dgus.writeStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line3, msg, DGUS_LINE_LEN, true, true);
|
||||
break;
|
||||
case 4:
|
||||
dgus_display.WriteStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line4, msg, DGUS_LINE_LEN, true, true);
|
||||
dgus.writeStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line4, msg, DGUS_LINE_LEN, true, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SetStatusMessage(const char* msg, const millis_t duration) {
|
||||
dgus_display.WriteString((uint16_t)DGUS_Addr::MESSAGE_Status, msg, DGUS_STATUS_LEN, false, true);
|
||||
void DGUSScreenHandler::setStatusMessage(const char* msg, const millis_t duration) {
|
||||
dgus.writeString((uint16_t)DGUS_Addr::MESSAGE_Status, msg, DGUS_STATUS_LEN, false, true);
|
||||
|
||||
status_expire = (duration > 0 ? ExtUI::safe_millis() + duration : 0);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SetStatusMessage(FSTR_P const fmsg, const millis_t duration) {
|
||||
dgus_display.WriteString((uint16_t)DGUS_Addr::MESSAGE_Status, fmsg, DGUS_STATUS_LEN, false, true);
|
||||
void DGUSScreenHandler::setStatusMessage(FSTR_P const fmsg, const millis_t duration) {
|
||||
dgus.writeString((uint16_t)DGUS_Addr::MESSAGE_Status, fmsg, DGUS_STATUS_LEN, false, true);
|
||||
|
||||
status_expire = (duration > 0 ? ExtUI::safe_millis() + duration : 0);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::ShowWaitScreen(const DGUS_Screen return_screen, const bool has_continue/*=false*/) {
|
||||
if (return_screen != DGUS_Screen::WAIT) {
|
||||
wait_return_screen = return_screen;
|
||||
void DGUSScreenHandler::showWaitScreen(const DGUS_ScreenID return_screenID, const bool has_continue/*=false*/) {
|
||||
if (return_screenID != DGUS_ScreenID::WAIT) {
|
||||
wait_return_screenID = return_screenID;
|
||||
}
|
||||
wait_continue = has_continue;
|
||||
|
||||
TriggerScreenChange(DGUS_Screen::WAIT);
|
||||
triggerScreenChange(DGUS_ScreenID::WAIT);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::ShowWaitScreen(FSTR_P const msg, const DGUS_Screen return_screen, const bool has_continue/*=false*/) {
|
||||
SetMessageLinePGM(NUL_STR, 1);
|
||||
SetMessageLine(msg, 2);
|
||||
SetMessageLinePGM(NUL_STR, 3);
|
||||
SetMessageLinePGM(NUL_STR, 4);
|
||||
ShowWaitScreen(return_screen, has_continue);
|
||||
void DGUSScreenHandler::showWaitScreen(FSTR_P const msg, const DGUS_ScreenID return_screenID, const bool has_continue/*=false*/) {
|
||||
setMessageLinePGM(NUL_STR, 1);
|
||||
setMessageLine(msg, 2);
|
||||
setMessageLinePGM(NUL_STR, 3);
|
||||
setMessageLinePGM(NUL_STR, 4);
|
||||
showWaitScreen(return_screenID, has_continue);
|
||||
}
|
||||
|
||||
DGUS_Screen DGUSScreenHandler::GetCurrentScreen() {
|
||||
return current_screen;
|
||||
DGUS_ScreenID DGUSScreenHandler::getCurrentScreen() {
|
||||
return current_screenID;
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::TriggerScreenChange(DGUS_Screen screen) {
|
||||
new_screen = screen;
|
||||
void DGUSScreenHandler::triggerScreenChange(const DGUS_ScreenID screenID) {
|
||||
new_screenID = screenID;
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::TriggerFullUpdate() {
|
||||
void DGUSScreenHandler::triggerFullUpdate() {
|
||||
full_update = true;
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::TriggerEEPROMSave() {
|
||||
void DGUSScreenHandler::triggerEEPROMSave() {
|
||||
eeprom_save = ExtUI::safe_millis() + 500;
|
||||
}
|
||||
|
||||
bool DGUSScreenHandler::IsPrinterIdle() {
|
||||
bool DGUSScreenHandler::isPrinterIdle() {
|
||||
return (!ExtUI::commandsInQueue()
|
||||
&& !ExtUI::isMoving());
|
||||
}
|
||||
|
||||
const DGUS_Addr* DGUSScreenHandler::FindScreenAddrList(DGUS_Screen screen) {
|
||||
const DGUS_Addr* DGUSScreenHandler::findScreenAddrList(const DGUS_ScreenID screenID) {
|
||||
DGUS_ScreenAddrList list;
|
||||
const DGUS_ScreenAddrList *map = screen_addr_list_map;
|
||||
|
||||
do {
|
||||
memcpy_P(&list, map, sizeof(*map));
|
||||
if (!list.addr_list) break;
|
||||
if (list.screen == screen) {
|
||||
if (list.screenID == screenID) {
|
||||
return list.addr_list;
|
||||
}
|
||||
} while (++map);
|
||||
@ -437,14 +437,14 @@ const DGUS_Addr* DGUSScreenHandler::FindScreenAddrList(DGUS_Screen screen) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool DGUSScreenHandler::CallScreenSetup(DGUS_Screen screen) {
|
||||
bool DGUSScreenHandler::callScreenSetup(const DGUS_ScreenID screenID) {
|
||||
DGUS_ScreenSetup setup;
|
||||
const DGUS_ScreenSetup *list = screen_setup_list;
|
||||
|
||||
do {
|
||||
memcpy_P(&setup, list, sizeof(*list));
|
||||
if (!setup.setup_fn) break;
|
||||
if (setup.screen == screen) {
|
||||
if (setup.screenID == screenID) {
|
||||
return setup.setup_fn();
|
||||
}
|
||||
} while (++list);
|
||||
@ -452,14 +452,14 @@ bool DGUSScreenHandler::CallScreenSetup(DGUS_Screen screen) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::MoveToScreen(DGUS_Screen screen, bool abort_wait) {
|
||||
if (current_screen == DGUS_Screen::KILL) {
|
||||
void DGUSScreenHandler::moveToScreen(const DGUS_ScreenID screenID, bool abort_wait) {
|
||||
if (current_screenID == DGUS_ScreenID::KILL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (current_screen == DGUS_Screen::WAIT) {
|
||||
if (screen != DGUS_Screen::WAIT) {
|
||||
wait_return_screen = screen;
|
||||
if (current_screenID == DGUS_ScreenID::WAIT) {
|
||||
if (screenID != DGUS_ScreenID::WAIT) {
|
||||
wait_return_screenID = screenID;
|
||||
}
|
||||
|
||||
if (!abort_wait) return;
|
||||
@ -469,18 +469,18 @@ void DGUSScreenHandler::MoveToScreen(DGUS_Screen screen, bool abort_wait) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!CallScreenSetup(screen)) return;
|
||||
if (!callScreenSetup(screenID)) return;
|
||||
|
||||
if (!SendScreenVPData(screen, true)) return;
|
||||
if (!sendScreenVPData(screenID, true)) return;
|
||||
|
||||
current_screen = screen;
|
||||
dgus_display.SwitchScreen(current_screen);
|
||||
current_screenID = screenID;
|
||||
dgus.switchScreen(current_screenID);
|
||||
}
|
||||
|
||||
bool DGUSScreenHandler::SendScreenVPData(DGUS_Screen screen, bool complete_update) {
|
||||
bool DGUSScreenHandler::sendScreenVPData(const DGUS_ScreenID screenID, bool complete_update) {
|
||||
if (complete_update) full_update = false;
|
||||
|
||||
const DGUS_Addr *list = FindScreenAddrList(screen);
|
||||
const DGUS_Addr *list = findScreenAddrList(screenID);
|
||||
|
||||
while (true) {
|
||||
if (!list) return true; // Nothing left to send
|
||||
@ -489,17 +489,17 @@ bool DGUSScreenHandler::SendScreenVPData(DGUS_Screen screen, bool complete_updat
|
||||
if (!addr) return true; // Nothing left to send
|
||||
|
||||
DGUS_VP vp;
|
||||
if (!DGUS_PopulateVP((DGUS_Addr)addr, &vp)) continue; // Invalid VP
|
||||
if (!populateVP((DGUS_Addr)addr, &vp)) continue; // Invalid VP
|
||||
if (!vp.tx_handler) continue; // Nothing to send
|
||||
if (!complete_update && !(vp.flags & VPFLAG_AUTOUPLOAD)) continue; // Unnecessary VP
|
||||
|
||||
uint8_t expected_tx = 6 + vp.size; // 6 bytes header + payload.
|
||||
const millis_t try_until = ExtUI::safe_millis() + 1000;
|
||||
|
||||
while (expected_tx > dgus_display.GetFreeTxBuffer()) {
|
||||
while (expected_tx > dgus.getFreeTxBuffer()) {
|
||||
if (ELAPSED(ExtUI::safe_millis(), try_until)) return false; // Stop trying after 1 second
|
||||
|
||||
dgus_display.FlushTx(); // Flush the TX buffer
|
||||
dgus.flushTx(); // Flush the TX buffer
|
||||
delay(50);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "config/DGUS_Addr.h"
|
||||
#include "config/DGUS_Data.h"
|
||||
#include "config/DGUS_Screen.h"
|
||||
#include "config/DGUS_ScreenID.h"
|
||||
#include "config/DGUS_Constants.h"
|
||||
|
||||
#include "../ui_api.h"
|
||||
@ -33,59 +33,59 @@ class DGUSScreenHandler {
|
||||
public:
|
||||
DGUSScreenHandler() = default;
|
||||
|
||||
static void Init();
|
||||
static void Ready();
|
||||
static void Loop();
|
||||
static void init();
|
||||
static void ready();
|
||||
static void loop();
|
||||
|
||||
static void printerKilled(FSTR_P const error, FSTR_P const component);
|
||||
static void UserConfirmRequired(const char * const msg);
|
||||
static void SettingsReset();
|
||||
static void StoreSettings(char *buff);
|
||||
static void LoadSettings(const char *buff);
|
||||
static void ConfigurationStoreWritten(bool success);
|
||||
static void ConfigurationStoreRead(bool success);
|
||||
static void userConfirmRequired(const char * const msg);
|
||||
static void settingsReset();
|
||||
static void storeSettings(char *buff);
|
||||
static void loadSettings(const char *buff);
|
||||
static void configurationStoreWritten(bool success);
|
||||
static void configurationStoreRead(bool success);
|
||||
|
||||
static void PlayTone(const uint16_t frequency, const uint16_t duration);
|
||||
static void MeshUpdate(const int8_t xpos, const int8_t ypos);
|
||||
static void PrintTimerStarted();
|
||||
static void PrintTimerPaused();
|
||||
static void PrintTimerStopped();
|
||||
static void playTone(const uint16_t frequency, const uint16_t duration);
|
||||
static void meshUpdate(const int8_t xpos, const int8_t ypos);
|
||||
static void printTimerStarted();
|
||||
static void printTimerPaused();
|
||||
static void printTimerStopped();
|
||||
static void filamentRunout(const ExtUI::extruder_t extruder);
|
||||
|
||||
#if HAS_MEDIA
|
||||
/// Marlin informed us that a new SD has been inserted.
|
||||
static void SDCardInserted();
|
||||
static void sdCardInserted();
|
||||
/// Marlin informed us that the SD Card has been removed().
|
||||
static void SDCardRemoved();
|
||||
static void sdCardRemoved();
|
||||
/// Marlin informed us about a bad SD Card.
|
||||
static void SDCardError();
|
||||
static void sdCardError();
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
static void PowerLossResume();
|
||||
static void powerLossResume();
|
||||
#endif
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
static void PidTuning(const ExtUI::result_t rst);
|
||||
static void pidTuning(const ExtUI::result_t rst);
|
||||
#endif
|
||||
|
||||
static void SetMessageLine(const char * const msg, const uint8_t line);
|
||||
static void SetMessageLinePGM(PGM_P const msg, const uint8_t line);
|
||||
static void SetMessageLine(FSTR_P const msg, const uint8_t line) { SetMessageLinePGM(FTOP(msg), line); }
|
||||
static void setMessageLine(const char * const msg, const uint8_t line);
|
||||
static void setMessageLinePGM(PGM_P const msg, const uint8_t line);
|
||||
static void setMessageLine(FSTR_P const msg, const uint8_t line) { setMessageLinePGM(FTOP(msg), line); }
|
||||
|
||||
static void SetStatusMessage(const char* msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS);
|
||||
static void SetStatusMessage(FSTR_P const msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS);
|
||||
static void setStatusMessage(const char* msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS);
|
||||
static void setStatusMessage(FSTR_P const msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS);
|
||||
|
||||
static void ShowWaitScreen(const DGUS_Screen return_screen, const bool has_continue=false);
|
||||
static void ShowWaitScreen(FSTR_P const msg, const DGUS_Screen return_screen, const bool has_continue=false);
|
||||
static void showWaitScreen(const DGUS_ScreenID return_screenID, const bool has_continue=false);
|
||||
static void showWaitScreen(FSTR_P const msg, const DGUS_ScreenID return_screenID, const bool has_continue=false);
|
||||
|
||||
static DGUS_Screen GetCurrentScreen();
|
||||
static void TriggerScreenChange(DGUS_Screen screen);
|
||||
static void TriggerFullUpdate();
|
||||
static DGUS_ScreenID getCurrentScreen();
|
||||
static void triggerScreenChange(const DGUS_ScreenID screenID);
|
||||
static void triggerFullUpdate();
|
||||
|
||||
static void TriggerEEPROMSave();
|
||||
static void triggerEEPROMSave();
|
||||
|
||||
static bool IsPrinterIdle();
|
||||
static bool isPrinterIdle();
|
||||
|
||||
static uint8_t debug_count;
|
||||
|
||||
@ -114,20 +114,20 @@ public:
|
||||
static bool leveling_active;
|
||||
|
||||
private:
|
||||
static const DGUS_Addr* FindScreenAddrList(DGUS_Screen screen);
|
||||
static bool CallScreenSetup(DGUS_Screen screen);
|
||||
static const DGUS_Addr* findScreenAddrList(const DGUS_ScreenID screenID);
|
||||
static bool callScreenSetup(const DGUS_ScreenID screenID);
|
||||
|
||||
static void MoveToScreen(DGUS_Screen screen, bool abort_wait=false);
|
||||
static bool SendScreenVPData(DGUS_Screen screen, bool complete_update);
|
||||
static void moveToScreen(const DGUS_ScreenID screenID, bool abort_wait=false);
|
||||
static bool sendScreenVPData(const DGUS_ScreenID screenID, bool complete_update);
|
||||
|
||||
static bool settings_ready;
|
||||
static bool booted;
|
||||
|
||||
static DGUS_Screen current_screen;
|
||||
static DGUS_Screen new_screen;
|
||||
static DGUS_ScreenID current_screenID;
|
||||
static DGUS_ScreenID new_screenID;
|
||||
static bool full_update;
|
||||
|
||||
static DGUS_Screen wait_return_screen;
|
||||
static DGUS_ScreenID wait_return_screenID;
|
||||
|
||||
static millis_t status_expire;
|
||||
static millis_t eeprom_save;
|
||||
@ -140,4 +140,4 @@ private:
|
||||
} eeprom_data_t;
|
||||
};
|
||||
|
||||
extern DGUSScreenHandler dgus_screen_handler;
|
||||
extern DGUSScreenHandler screen;
|
||||
|
@ -33,14 +33,14 @@
|
||||
|
||||
#if HAS_MEDIA
|
||||
bool DGUSSetupHandler::Print() {
|
||||
dgus_screen_handler.filelist.refresh();
|
||||
screen.filelist.refresh();
|
||||
|
||||
while (!dgus_screen_handler.filelist.isAtRootDir()) {
|
||||
dgus_screen_handler.filelist.upDir();
|
||||
while (!screen.filelist.isAtRootDir()) {
|
||||
screen.filelist.upDir();
|
||||
}
|
||||
|
||||
dgus_screen_handler.filelist_offset = 0;
|
||||
dgus_screen_handler.filelist_selected = -1;
|
||||
screen.filelist_offset = 0;
|
||||
screen.filelist_selected = -1;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -51,7 +51,7 @@ bool DGUSSetupHandler::PrintStatus() {
|
||||
return true;
|
||||
}
|
||||
|
||||
dgus_screen_handler.TriggerScreenChange(DGUS_Screen::PRINT_FINISHED);
|
||||
screen.triggerScreenChange(DGUS_ScreenID::PRINT_FINISHED);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -60,15 +60,15 @@ bool DGUSSetupHandler::PrintAdjust() {
|
||||
return true;
|
||||
}
|
||||
|
||||
dgus_screen_handler.TriggerScreenChange(DGUS_Screen::PRINT_FINISHED);
|
||||
screen.triggerScreenChange(DGUS_ScreenID::PRINT_FINISHED);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DGUSSetupHandler::LevelingMenu() {
|
||||
ExtUI::setLevelingActive(dgus_screen_handler.leveling_active);
|
||||
ExtUI::setLevelingActive(screen.leveling_active);
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ bool DGUSSetupHandler::LevelingMenu() {
|
||||
return true;
|
||||
}
|
||||
|
||||
dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_Screen::LEVELING_MENU);
|
||||
screen.showWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_ScreenID::LEVELING_MENU);
|
||||
|
||||
queue.enqueue_now(F("G28"));
|
||||
|
||||
@ -94,12 +94,12 @@ bool DGUSSetupHandler::LevelingManual() {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return false;
|
||||
}
|
||||
|
||||
dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_Screen::LEVELING_MANUAL);
|
||||
screen.showWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_ScreenID::LEVELING_MANUAL);
|
||||
|
||||
queue.enqueue_now(F("G28"));
|
||||
|
||||
@ -107,10 +107,10 @@ bool DGUSSetupHandler::LevelingManual() {
|
||||
}
|
||||
|
||||
bool DGUSSetupHandler::LevelingOffset() {
|
||||
dgus_screen_handler.offset_steps = DGUS_Data::StepSize::MMP1;
|
||||
screen.offset_steps = DGUS_Data::StepSize::MMP1;
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ bool DGUSSetupHandler::LevelingOffset() {
|
||||
return true;
|
||||
}
|
||||
|
||||
dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_Screen::LEVELING_OFFSET);
|
||||
screen.showWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_ScreenID::LEVELING_OFFSET);
|
||||
|
||||
queue.enqueue_now(F("G28"));
|
||||
|
||||
@ -137,7 +137,7 @@ bool DGUSSetupHandler::LevelingOffset() {
|
||||
|
||||
bool DGUSSetupHandler::LevelingAutomatic() {
|
||||
if (ExtUI::getLevelingIsValid()) {
|
||||
dgus_screen_handler.leveling_active = true;
|
||||
screen.leveling_active = true;
|
||||
|
||||
ExtUI::setLevelingActive(true);
|
||||
}
|
||||
@ -146,24 +146,24 @@ bool DGUSSetupHandler::LevelingAutomatic() {
|
||||
}
|
||||
|
||||
bool DGUSSetupHandler::LevelingProbing() {
|
||||
dgus_screen_handler.probing_icons[0] = 0;
|
||||
dgus_screen_handler.probing_icons[1] = 0;
|
||||
screen.probing_icons[0] = 0;
|
||||
screen.probing_icons[1] = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DGUSSetupHandler::Filament() {
|
||||
dgus_screen_handler.filament_extruder = DGUS_Data::Extruder::CURRENT;
|
||||
dgus_screen_handler.filament_length = DGUS_DEFAULT_FILAMENT_LEN;
|
||||
screen.filament_extruder = DGUS_Data::Extruder::CURRENT;
|
||||
screen.filament_length = DGUS_DEFAULT_FILAMENT_LEN;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DGUSSetupHandler::Move() {
|
||||
dgus_screen_handler.move_steps = DGUS_Data::StepSize::MM10;
|
||||
screen.move_steps = DGUS_Data::StepSize::MM10;
|
||||
|
||||
if (!dgus_screen_handler.IsPrinterIdle()) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
if (!screen.isPrinterIdle()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -171,10 +171,10 @@ bool DGUSSetupHandler::Move() {
|
||||
}
|
||||
|
||||
bool DGUSSetupHandler::Gcode() {
|
||||
ZERO(dgus_screen_handler.gcode);
|
||||
ZERO(screen.gcode);
|
||||
|
||||
if (dgus_display.gui_version < 0x30 || dgus_display.os_version < 0x21) {
|
||||
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_FW_OUTDATED));
|
||||
if (dgus.gui_version < 0x30 || dgus.os_version < 0x21) {
|
||||
screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_FW_OUTDATED));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -182,14 +182,14 @@ bool DGUSSetupHandler::Gcode() {
|
||||
}
|
||||
|
||||
bool DGUSSetupHandler::PID() {
|
||||
dgus_screen_handler.pid_heater = DGUS_Data::Heater::H0;
|
||||
dgus_screen_handler.pid_temp = DGUS_PLA_TEMP_HOTEND;
|
||||
screen.pid_heater = DGUS_Data::Heater::H0;
|
||||
screen.pid_temp = DGUS_PLA_TEMP_HOTEND;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DGUSSetupHandler::Infos() {
|
||||
dgus_screen_handler.debug_count = 0;
|
||||
screen.debug_count = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
#endif
|
||||
|
||||
#if HAS_MEDIA
|
||||
void DGUSTxHandler::SetFileControlState(int16_t file, bool state) {
|
||||
void DGUSTxHandler::setFileControlState(int16_t file, bool state) {
|
||||
DGUS_Control control;
|
||||
|
||||
switch (file) {
|
||||
@ -60,40 +60,40 @@
|
||||
}
|
||||
|
||||
if (state) {
|
||||
dgus_display.EnableControl(DGUS_Screen::PRINT,
|
||||
dgus.enableControl(DGUS_ScreenID::PRINT,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
control);
|
||||
}
|
||||
else {
|
||||
dgus_display.DisableControl(DGUS_Screen::PRINT,
|
||||
dgus.disableControl(DGUS_ScreenID::PRINT,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
control);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSTxHandler::FileType(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::fileType(DGUS_VP &vp) {
|
||||
// Batch send
|
||||
uint16_t data[DGUS_FILE_COUNT];
|
||||
|
||||
for (int16_t i = 0; i < DGUS_FILE_COUNT; i++) {
|
||||
if (!dgus_screen_handler.filelist.seek(dgus_screen_handler.filelist_offset + i)) {
|
||||
if (!screen.filelist.seek(screen.filelist_offset + i)) {
|
||||
data[i] = Swap16(DGUS_Data::SDType::NONE);
|
||||
|
||||
SetFileControlState(i, false);
|
||||
setFileControlState(i, false);
|
||||
continue;
|
||||
}
|
||||
|
||||
data[i] = dgus_screen_handler.filelist.isDir() ?
|
||||
data[i] = screen.filelist.isDir() ?
|
||||
Swap16(DGUS_Data::SDType::DIRECTORY)
|
||||
: Swap16(DGUS_Data::SDType::FILE);
|
||||
|
||||
SetFileControlState(i, true);
|
||||
setFileControlState(i, true);
|
||||
}
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, data, sizeof(*data) * DGUS_FILE_COUNT);
|
||||
dgus.write((uint16_t)vp.addr, data, sizeof(*data) * DGUS_FILE_COUNT);
|
||||
}
|
||||
|
||||
void DGUSTxHandler::FileName(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::fileName(DGUS_VP &vp) {
|
||||
uint8_t offset;
|
||||
|
||||
switch (vp.addr) {
|
||||
@ -115,84 +115,84 @@
|
||||
break;
|
||||
}
|
||||
|
||||
if (dgus_screen_handler.filelist.seek(dgus_screen_handler.filelist_offset + offset)) {
|
||||
dgus_display.WriteString((uint16_t)vp.addr, dgus_screen_handler.filelist.filename(), vp.size);
|
||||
if (screen.filelist.seek(screen.filelist_offset + offset)) {
|
||||
dgus.writeString((uint16_t)vp.addr, screen.filelist.filename(), vp.size);
|
||||
}
|
||||
else {
|
||||
dgus_display.WriteStringPGM((uint16_t)vp.addr, NUL_STR, vp.size);
|
||||
dgus.writeStringPGM((uint16_t)vp.addr, NUL_STR, vp.size);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSTxHandler::ScrollIcons(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::scrollIcons(DGUS_VP &vp) {
|
||||
uint16_t icons = 0;
|
||||
|
||||
if (!dgus_screen_handler.filelist.isAtRootDir()) {
|
||||
if (!screen.filelist.isAtRootDir()) {
|
||||
icons |= (uint16_t)DGUS_Data::ScrollIcon::GO_BACK;
|
||||
|
||||
dgus_display.EnableControl(DGUS_Screen::PRINT,
|
||||
dgus.enableControl(DGUS_ScreenID::PRINT,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
DGUS_Control::GO_BACK);
|
||||
}
|
||||
else {
|
||||
dgus_display.DisableControl(DGUS_Screen::PRINT,
|
||||
dgus.disableControl(DGUS_ScreenID::PRINT,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
DGUS_Control::GO_BACK);
|
||||
}
|
||||
|
||||
if (dgus_screen_handler.filelist_offset > 0) {
|
||||
if (screen.filelist_offset > 0) {
|
||||
icons |= (uint16_t)DGUS_Data::ScrollIcon::UP;
|
||||
|
||||
dgus_display.EnableControl(DGUS_Screen::PRINT,
|
||||
dgus.enableControl(DGUS_ScreenID::PRINT,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
DGUS_Control::SCROLL_UP);
|
||||
}
|
||||
else {
|
||||
dgus_display.DisableControl(DGUS_Screen::PRINT,
|
||||
dgus.disableControl(DGUS_ScreenID::PRINT,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
DGUS_Control::SCROLL_UP);
|
||||
}
|
||||
|
||||
if (dgus_screen_handler.filelist_offset + DGUS_FILE_COUNT < dgus_screen_handler.filelist.count()) {
|
||||
if (screen.filelist_offset + DGUS_FILE_COUNT < screen.filelist.count()) {
|
||||
icons |= (uint16_t)DGUS_Data::ScrollIcon::DOWN;
|
||||
|
||||
dgus_display.EnableControl(DGUS_Screen::PRINT,
|
||||
dgus.enableControl(DGUS_ScreenID::PRINT,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
DGUS_Control::SCROLL_DOWN);
|
||||
}
|
||||
else {
|
||||
dgus_display.DisableControl(DGUS_Screen::PRINT,
|
||||
dgus.disableControl(DGUS_ScreenID::PRINT,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
DGUS_Control::SCROLL_DOWN);
|
||||
}
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(icons));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(icons));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::SelectedFileName(DGUS_VP &vp) {
|
||||
if (dgus_screen_handler.filelist_selected < 0
|
||||
|| !dgus_screen_handler.filelist.seek(dgus_screen_handler.filelist_selected)) {
|
||||
dgus_display.WriteStringPGM((uint16_t)vp.addr, NUL_STR, vp.size);
|
||||
void DGUSTxHandler::selectedFileName(DGUS_VP &vp) {
|
||||
if (screen.filelist_selected < 0
|
||||
|| !screen.filelist.seek(screen.filelist_selected)) {
|
||||
dgus.writeStringPGM((uint16_t)vp.addr, NUL_STR, vp.size);
|
||||
return;
|
||||
}
|
||||
|
||||
dgus_display.WriteString((uint16_t)vp.addr, dgus_screen_handler.filelist.filename(), vp.size);
|
||||
dgus.writeString((uint16_t)vp.addr, screen.filelist.filename(), vp.size);
|
||||
}
|
||||
#endif // HAS_MEDIA
|
||||
|
||||
void DGUSTxHandler::PositionZ(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::zPosition(DGUS_VP &vp) {
|
||||
const float position = ExtUI::isAxisPositionKnown(ExtUI::Z) ? planner.get_axis_position_mm(Z_AXIS) : 0;
|
||||
const int32_t data = dgus_display.ToFixedPoint<float, int32_t, 2>(int32_t(position * 50.0f) / 50.0f); // Round to 0.02
|
||||
dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(data));
|
||||
const int32_t data = dgus.toFixedPoint<float, int32_t, 2>(int32_t(position * 50.0f) / 50.0f); // Round to 0.02
|
||||
dgus.write((uint16_t)vp.addr, dgus.swapBytes(data));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::Elapsed(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::elapsed(DGUS_VP &vp) {
|
||||
char buffer[21];
|
||||
duration_t(print_job_timer.duration()).toString(buffer);
|
||||
|
||||
dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size);
|
||||
dgus.writeString((uint16_t)vp.addr, buffer, vp.size);
|
||||
}
|
||||
|
||||
void DGUSTxHandler::Percent(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::percent(DGUS_VP &vp) {
|
||||
uint16_t progress;
|
||||
|
||||
switch (vp.addr) {
|
||||
@ -205,21 +205,21 @@ void DGUSTxHandler::Percent(DGUS_VP &vp) {
|
||||
break;
|
||||
}
|
||||
|
||||
dgus_display.Write((uint16_t)DGUS_Addr::STATUS_Percent, Swap16(progress));
|
||||
dgus.write((uint16_t)DGUS_Addr::STATUS_Percent, Swap16(progress));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::StatusIcons(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::statusIcons(DGUS_VP &vp) {
|
||||
uint16_t icons = 0;
|
||||
|
||||
if (ExtUI::isPrinting()) {
|
||||
icons |= (uint16_t)DGUS_Data::StatusIcon::PAUSE;
|
||||
|
||||
dgus_display.EnableControl(DGUS_Screen::PRINT_STATUS,
|
||||
dgus.enableControl(DGUS_ScreenID::PRINT_STATUS,
|
||||
DGUSDisplay::POPUP_WINDOW,
|
||||
DGUS_Control::PAUSE);
|
||||
}
|
||||
else {
|
||||
dgus_display.DisableControl(DGUS_Screen::PRINT_STATUS,
|
||||
dgus.disableControl(DGUS_ScreenID::PRINT_STATUS,
|
||||
DGUSDisplay::POPUP_WINDOW,
|
||||
DGUS_Control::PAUSE);
|
||||
}
|
||||
@ -227,20 +227,20 @@ void DGUSTxHandler::StatusIcons(DGUS_VP &vp) {
|
||||
if (ExtUI::isPrintingPaused()) {
|
||||
icons |= (uint16_t)DGUS_Data::StatusIcon::RESUME;
|
||||
|
||||
dgus_display.EnableControl(DGUS_Screen::PRINT_STATUS,
|
||||
dgus.enableControl(DGUS_ScreenID::PRINT_STATUS,
|
||||
DGUSDisplay::POPUP_WINDOW,
|
||||
DGUS_Control::RESUME);
|
||||
}
|
||||
else {
|
||||
dgus_display.DisableControl(DGUS_Screen::PRINT_STATUS,
|
||||
dgus.disableControl(DGUS_ScreenID::PRINT_STATUS,
|
||||
DGUSDisplay::POPUP_WINDOW,
|
||||
DGUS_Control::RESUME);
|
||||
}
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(icons));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(icons));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::Flowrate(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::flowrate(DGUS_VP &vp) {
|
||||
int16_t flowrate;
|
||||
|
||||
switch (vp.addr) {
|
||||
@ -258,10 +258,10 @@ void DGUSTxHandler::Flowrate(DGUS_VP &vp) {
|
||||
#endif
|
||||
}
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(flowrate));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(flowrate));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::TempMax(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::tempMax(DGUS_VP &vp) {
|
||||
uint16_t temp;
|
||||
|
||||
switch (vp.addr) {
|
||||
@ -279,15 +279,15 @@ void DGUSTxHandler::TempMax(DGUS_VP &vp) {
|
||||
#endif
|
||||
}
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(temp));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(temp));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::StepperStatus(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::stepperStatus(DGUS_VP &vp) {
|
||||
const bool motor_on = stepper.axis_enabled.bits & (_BV(NUM_AXES) - 1);
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(motor_on ? DGUS_Data::Status::ENABLED : DGUS_Data::Status::DISABLED));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(motor_on ? DGUS_Data::Status::ENABLED : DGUS_Data::Status::DISABLED));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::StepIcons(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::stepIcons(DGUS_VP &vp) {
|
||||
if (!vp.extra) return;
|
||||
uint16_t icons = 0;
|
||||
DGUS_Data::StepSize size = *(DGUS_Data::StepSize*)vp.extra;
|
||||
@ -307,31 +307,31 @@ void DGUSTxHandler::StepIcons(DGUS_VP &vp) {
|
||||
break;
|
||||
}
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(icons));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(icons));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::ABLDisableIcon(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::ablDisableIcon(DGUS_VP &vp) {
|
||||
uint16_t data;
|
||||
|
||||
if (ExtUI::getLevelingActive()) {
|
||||
data = (uint16_t)DGUS_Data::Status::ENABLED;
|
||||
|
||||
dgus_display.EnableControl(DGUS_Screen::LEVELING_AUTOMATIC,
|
||||
dgus.enableControl(DGUS_ScreenID::LEVELING_AUTOMATIC,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
DGUS_Control::DISABLE);
|
||||
}
|
||||
else {
|
||||
data = (uint16_t)DGUS_Data::Status::DISABLED;
|
||||
|
||||
dgus_display.DisableControl(DGUS_Screen::LEVELING_AUTOMATIC,
|
||||
dgus.disableControl(DGUS_ScreenID::LEVELING_AUTOMATIC,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
DGUS_Control::DISABLE);
|
||||
}
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(data));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(data));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::ABLGrid(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::ablGrid(DGUS_VP &vp) {
|
||||
// Batch send
|
||||
int16_t data[DGUS_LEVEL_GRID_SIZE];
|
||||
xy_uint8_t point;
|
||||
@ -340,17 +340,17 @@ void DGUSTxHandler::ABLGrid(DGUS_VP &vp) {
|
||||
for (int16_t i = 0; i < DGUS_LEVEL_GRID_SIZE; i++) {
|
||||
point.x = i % (GRID_MAX_POINTS_X);
|
||||
point.y = i / (GRID_MAX_POINTS_X);
|
||||
fixed = dgus_display.ToFixedPoint<float, int16_t, 3>(ExtUI::getMeshPoint(point));
|
||||
fixed = dgus.toFixedPoint<float, int16_t, 3>(ExtUI::getMeshPoint(point));
|
||||
data[i] = Swap16(fixed);
|
||||
}
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, data, sizeof(*data) * DGUS_LEVEL_GRID_SIZE);
|
||||
dgus.write((uint16_t)vp.addr, data, sizeof(*data) * DGUS_LEVEL_GRID_SIZE);
|
||||
}
|
||||
|
||||
void DGUSTxHandler::FilamentIcons(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::filamentIcons(DGUS_VP &vp) {
|
||||
uint16_t icons = 0;
|
||||
|
||||
switch (dgus_screen_handler.filament_extruder) {
|
||||
switch (screen.filament_extruder) {
|
||||
default: return;
|
||||
case DGUS_Data::Extruder::CURRENT:
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
@ -373,29 +373,29 @@ void DGUSTxHandler::FilamentIcons(DGUS_VP &vp) {
|
||||
break;
|
||||
}
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(icons));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(icons));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::BLTouch(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::blTouch(DGUS_VP &vp) {
|
||||
#if ENABLED(BLTOUCH)
|
||||
dgus_display.EnableControl(DGUS_Screen::SETTINGS_MENU2,
|
||||
dgus.enableControl(DGUS_ScreenID::SETTINGS_MENU2,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
DGUS_Control::EXTRA2);
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(DGUS_Data::Status::ENABLED));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(DGUS_Data::Status::ENABLED));
|
||||
#else
|
||||
dgus_display.DisableControl(DGUS_Screen::SETTINGS_MENU2,
|
||||
dgus.disableControl(DGUS_ScreenID::SETTINGS_MENU2,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
DGUS_Control::EXTRA2);
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(DGUS_Data::Status::DISABLED));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(DGUS_Data::Status::DISABLED));
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSTxHandler::PIDIcons(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::pidIcons(DGUS_VP &vp) {
|
||||
uint16_t icons = 0;
|
||||
|
||||
switch (dgus_screen_handler.pid_heater) {
|
||||
switch (screen.pid_heater) {
|
||||
default: return;
|
||||
case DGUS_Data::Heater::BED:
|
||||
icons |= (uint16_t)DGUS_Data::HeaterIcon::BED;
|
||||
@ -408,13 +408,13 @@ void DGUSTxHandler::PIDIcons(DGUS_VP &vp) {
|
||||
break;
|
||||
}
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(icons));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(icons));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::PIDKp(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::pidKp(DGUS_VP &vp) {
|
||||
float value;
|
||||
|
||||
switch (dgus_screen_handler.pid_heater) {
|
||||
switch (screen.pid_heater) {
|
||||
default: return;
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
case DGUS_Data::Heater::BED:
|
||||
@ -433,14 +433,14 @@ void DGUSTxHandler::PIDKp(DGUS_VP &vp) {
|
||||
#endif
|
||||
}
|
||||
|
||||
const int32_t data = dgus_display.ToFixedPoint<float, int32_t, 2>(value);
|
||||
dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(data));
|
||||
const int32_t data = dgus.toFixedPoint<float, int32_t, 2>(value);
|
||||
dgus.write((uint16_t)vp.addr, dgus.swapBytes(data));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::PIDKi(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::pidKi(DGUS_VP &vp) {
|
||||
float value;
|
||||
|
||||
switch (dgus_screen_handler.pid_heater) {
|
||||
switch (screen.pid_heater) {
|
||||
default: return;
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
case DGUS_Data::Heater::BED:
|
||||
@ -459,14 +459,14 @@ void DGUSTxHandler::PIDKi(DGUS_VP &vp) {
|
||||
#endif
|
||||
}
|
||||
|
||||
const int32_t data = dgus_display.ToFixedPoint<float, int32_t, 2>(value);
|
||||
dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(data));
|
||||
const int32_t data = dgus.toFixedPoint<float, int32_t, 2>(value);
|
||||
dgus.write((uint16_t)vp.addr, dgus.swapBytes(data));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::PIDKd(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::pidKd(DGUS_VP &vp) {
|
||||
float value;
|
||||
|
||||
switch (dgus_screen_handler.pid_heater) {
|
||||
switch (screen.pid_heater) {
|
||||
default: return;
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
case DGUS_Data::Heater::BED:
|
||||
@ -485,99 +485,99 @@ void DGUSTxHandler::PIDKd(DGUS_VP &vp) {
|
||||
#endif
|
||||
}
|
||||
|
||||
const int32_t data = dgus_display.ToFixedPoint<float, int32_t, 2>(value);
|
||||
dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(data));
|
||||
const int32_t data = dgus.toFixedPoint<float, int32_t, 2>(value);
|
||||
dgus.write((uint16_t)vp.addr, dgus.swapBytes(data));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::BuildVolume(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::buildVolume(DGUS_VP &vp) {
|
||||
char buffer[vp.size];
|
||||
snprintf_P(buffer, vp.size, PSTR("%dx%dx%d"), X_BED_SIZE, Y_BED_SIZE, (Z_MAX_POS - Z_MIN_POS));
|
||||
|
||||
dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size);
|
||||
dgus.writeString((uint16_t)vp.addr, buffer, vp.size);
|
||||
}
|
||||
|
||||
void DGUSTxHandler::TotalPrints(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::totalPrints(DGUS_VP &vp) {
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(print_job_timer.getStats().totalPrints));
|
||||
dgus.write((uint16_t)vp.addr, dgus.swapBytes(print_job_timer.getStats().totalPrints));
|
||||
#else
|
||||
UNUSED(vp);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSTxHandler::FinishedPrints(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::finishedPrints(DGUS_VP &vp) {
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(print_job_timer.getStats().finishedPrints));
|
||||
dgus.write((uint16_t)vp.addr, dgus.swapBytes(print_job_timer.getStats().finishedPrints));
|
||||
#else
|
||||
UNUSED(vp);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSTxHandler::PrintTime(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::printTime(DGUS_VP &vp) {
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
char buffer[21];
|
||||
ExtUI::getTotalPrintTime_str(buffer);
|
||||
|
||||
dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size);
|
||||
dgus.writeString((uint16_t)vp.addr, buffer, vp.size);
|
||||
#else
|
||||
dgus_display.WriteString((uint16_t)vp.addr, F("-"), vp.size);
|
||||
dgus.writeString((uint16_t)vp.addr, F("-"), vp.size);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSTxHandler::LongestPrint(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::longestPrint(DGUS_VP &vp) {
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
char buffer[21];
|
||||
ExtUI::getLongestPrint_str(buffer);
|
||||
|
||||
dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size);
|
||||
dgus.writeString((uint16_t)vp.addr, buffer, vp.size);
|
||||
#else
|
||||
dgus_display.WriteString((uint16_t)vp.addr, F("-"), vp.size);
|
||||
dgus.writeString((uint16_t)vp.addr, F("-"), vp.size);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSTxHandler::FilamentUsed(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::filamentUsed(DGUS_VP &vp) {
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
char buffer[21];
|
||||
ExtUI::getFilamentUsed_str(buffer);
|
||||
|
||||
dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size);
|
||||
dgus.writeString((uint16_t)vp.addr, buffer, vp.size);
|
||||
#else
|
||||
dgus_display.WriteString((uint16_t)vp.addr, F("-"), vp.size);
|
||||
dgus.writeString((uint16_t)vp.addr, F("-"), vp.size);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSTxHandler::WaitIcons(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::waitIcons(DGUS_VP &vp) {
|
||||
uint16_t icons = 0;
|
||||
|
||||
if (ExtUI::isPrintingPaused()) {
|
||||
icons |= (uint16_t)DGUS_Data::WaitIcon::ABORT;
|
||||
|
||||
dgus_display.EnableControl(DGUS_Screen::WAIT,
|
||||
dgus.enableControl(DGUS_ScreenID::WAIT,
|
||||
DGUSDisplay::POPUP_WINDOW,
|
||||
DGUS_Control::ABORT);
|
||||
}
|
||||
else {
|
||||
dgus_display.DisableControl(DGUS_Screen::WAIT,
|
||||
dgus.disableControl(DGUS_ScreenID::WAIT,
|
||||
DGUSDisplay::POPUP_WINDOW,
|
||||
DGUS_Control::ABORT);
|
||||
}
|
||||
|
||||
if (dgus_screen_handler.wait_continue) {
|
||||
if (screen.wait_continue) {
|
||||
icons |= (uint16_t)DGUS_Data::WaitIcon::CONTINUE;
|
||||
|
||||
dgus_display.EnableControl(DGUS_Screen::WAIT,
|
||||
dgus.enableControl(DGUS_ScreenID::WAIT,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
DGUS_Control::CONTINUE);
|
||||
}
|
||||
else {
|
||||
dgus_display.DisableControl(DGUS_Screen::WAIT,
|
||||
dgus.disableControl(DGUS_ScreenID::WAIT,
|
||||
DGUSDisplay::RETURN_KEY_CODE,
|
||||
DGUS_Control::CONTINUE);
|
||||
}
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(icons));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(icons));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::FanSpeed(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::fanSpeed(DGUS_VP &vp) {
|
||||
uint16_t fan_speed;
|
||||
|
||||
switch (vp.addr) {
|
||||
@ -585,31 +585,31 @@ void DGUSTxHandler::FanSpeed(DGUS_VP &vp) {
|
||||
case DGUS_Addr::FAN0_Speed: fan_speed = ExtUI::getTargetFan_percent(ExtUI::FAN0); break;
|
||||
}
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(fan_speed));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(fan_speed));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::Volume(DGUS_VP &vp) {
|
||||
const uint16_t volume = dgus_display.GetVolume();
|
||||
void DGUSTxHandler::volume(DGUS_VP &vp) {
|
||||
const uint16_t volume = dgus.getVolume();
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(volume));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(volume));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::Brightness(DGUS_VP &vp) {
|
||||
const uint16_t brightness = dgus_display.GetBrightness();
|
||||
void DGUSTxHandler::brightness(DGUS_VP &vp) {
|
||||
const uint16_t brightness = dgus.getBrightness();
|
||||
|
||||
dgus_display.Write((uint16_t)vp.addr, Swap16(brightness));
|
||||
dgus.write((uint16_t)vp.addr, Swap16(brightness));
|
||||
}
|
||||
|
||||
void DGUSTxHandler::ExtraToString(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::extraToString(DGUS_VP &vp) {
|
||||
if (!vp.size || !vp.extra) return;
|
||||
|
||||
dgus_display.WriteString((uint16_t)vp.addr, vp.extra, vp.size, true, false, false);
|
||||
dgus.writeString((uint16_t)vp.addr, vp.extra, vp.size, true, false, false);
|
||||
}
|
||||
|
||||
void DGUSTxHandler::ExtraPGMToString(DGUS_VP &vp) {
|
||||
void DGUSTxHandler::extraPGMToString(DGUS_VP &vp) {
|
||||
if (!vp.size || !vp.extra) return;
|
||||
|
||||
dgus_display.WriteStringPGM((uint16_t)vp.addr, vp.extra, vp.size, true, false, false);
|
||||
dgus.writeStringPGM((uint16_t)vp.addr, vp.extra, vp.size, true, false, false);
|
||||
}
|
||||
|
||||
#endif // DGUS_LCD_UI_RELOADED
|
||||
|
@ -29,97 +29,97 @@
|
||||
namespace DGUSTxHandler {
|
||||
|
||||
#if HAS_MEDIA
|
||||
void SetFileControlState(int16_t, bool);
|
||||
void FileType(DGUS_VP &);
|
||||
void FileName(DGUS_VP &);
|
||||
void ScrollIcons(DGUS_VP &);
|
||||
void SelectedFileName(DGUS_VP &);
|
||||
void setFileControlState(int16_t, bool);
|
||||
void fileType(DGUS_VP &);
|
||||
void fileName(DGUS_VP &);
|
||||
void scrollIcons(DGUS_VP &);
|
||||
void selectedFileName(DGUS_VP &);
|
||||
#endif
|
||||
|
||||
void PositionZ(DGUS_VP &);
|
||||
void Elapsed(DGUS_VP &);
|
||||
void Percent(DGUS_VP &);
|
||||
void StatusIcons(DGUS_VP &);
|
||||
void zPosition(DGUS_VP &);
|
||||
void elapsed(DGUS_VP &);
|
||||
void percent(DGUS_VP &);
|
||||
void statusIcons(DGUS_VP &);
|
||||
|
||||
void Flowrate(DGUS_VP &);
|
||||
void flowrate(DGUS_VP &);
|
||||
|
||||
void TempMax(DGUS_VP &);
|
||||
void tempMax(DGUS_VP &);
|
||||
|
||||
void StepperStatus(DGUS_VP &);
|
||||
void stepperStatus(DGUS_VP &);
|
||||
|
||||
void StepIcons(DGUS_VP &);
|
||||
void stepIcons(DGUS_VP &);
|
||||
|
||||
void ABLDisableIcon(DGUS_VP &);
|
||||
void ABLGrid(DGUS_VP &);
|
||||
void ablDisableIcon(DGUS_VP &);
|
||||
void ablGrid(DGUS_VP &);
|
||||
|
||||
void FilamentIcons(DGUS_VP &);
|
||||
void filamentIcons(DGUS_VP &);
|
||||
|
||||
void BLTouch(DGUS_VP &);
|
||||
void blTouch(DGUS_VP &);
|
||||
|
||||
void PIDIcons(DGUS_VP &);
|
||||
void PIDKp(DGUS_VP &);
|
||||
void PIDKi(DGUS_VP &);
|
||||
void PIDKd(DGUS_VP &);
|
||||
void pidIcons(DGUS_VP &);
|
||||
void pidKp(DGUS_VP &);
|
||||
void pidKi(DGUS_VP &);
|
||||
void pidKd(DGUS_VP &);
|
||||
|
||||
void BuildVolume(DGUS_VP &);
|
||||
void TotalPrints(DGUS_VP &);
|
||||
void FinishedPrints(DGUS_VP &);
|
||||
void PrintTime(DGUS_VP &);
|
||||
void LongestPrint(DGUS_VP &);
|
||||
void FilamentUsed(DGUS_VP &);
|
||||
void buildVolume(DGUS_VP &);
|
||||
void totalPrints(DGUS_VP &);
|
||||
void finishedPrints(DGUS_VP &);
|
||||
void printTime(DGUS_VP &);
|
||||
void longestPrint(DGUS_VP &);
|
||||
void filamentUsed(DGUS_VP &);
|
||||
|
||||
void WaitIcons(DGUS_VP &);
|
||||
void waitIcons(DGUS_VP &);
|
||||
|
||||
void FanSpeed(DGUS_VP &);
|
||||
void fanSpeed(DGUS_VP &);
|
||||
|
||||
void Volume(DGUS_VP &);
|
||||
void volume(DGUS_VP &);
|
||||
|
||||
void Brightness(DGUS_VP &);
|
||||
void brightness(DGUS_VP &);
|
||||
|
||||
void ExtraToString(DGUS_VP &);
|
||||
void ExtraPGMToString(DGUS_VP &);
|
||||
void extraToString(DGUS_VP &);
|
||||
void extraPGMToString(DGUS_VP &);
|
||||
|
||||
template<typename T>
|
||||
void ExtraToInteger(DGUS_VP &vp) {
|
||||
void extraToInteger(DGUS_VP &vp) {
|
||||
if (!vp.size || !vp.extra) return;
|
||||
switch (vp.size) {
|
||||
default: return;
|
||||
case 1: {
|
||||
const uint8_t data = uint8_t(*(T*)vp.extra);
|
||||
dgus_display.Write(uint16_t(vp.addr), data);
|
||||
dgus.write(uint16_t(vp.addr), data);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
const uint16_t data = uint16_t(*(T*)vp.extra);
|
||||
dgus_display.Write(uint16_t(vp.addr), Swap16(data));
|
||||
dgus.write(uint16_t(vp.addr), Swap16(data));
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
const uint32_t data = uint32_t(*(T*)vp.extra);
|
||||
dgus_display.Write(uint16_t(vp.addr), dgus_display.SwapBytes(data));
|
||||
dgus.write(uint16_t(vp.addr), dgus.swapBytes(data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint8_t decimals>
|
||||
void ExtraToFixedPoint(DGUS_VP &vp) {
|
||||
void extraToFixedPoint(DGUS_VP &vp) {
|
||||
if (!vp.size || !vp.extra) return;
|
||||
switch (vp.size) {
|
||||
default: return;
|
||||
case 1: {
|
||||
const uint8_t data = dgus_display.ToFixedPoint<T, uint8_t, decimals>(*(T*)vp.extra);
|
||||
dgus_display.Write(uint16_t(vp.addr), data);
|
||||
const uint8_t data = dgus.toFixedPoint<T, uint8_t, decimals>(*(T*)vp.extra);
|
||||
dgus.write(uint16_t(vp.addr), data);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
const uint16_t data = dgus_display.ToFixedPoint<T, uint16_t, decimals>(*(T*)vp.extra);
|
||||
dgus_display.Write(uint16_t(vp.addr), Swap16(data));
|
||||
const uint16_t data = dgus.toFixedPoint<T, uint16_t, decimals>(*(T*)vp.extra);
|
||||
dgus.write(uint16_t(vp.addr), Swap16(data));
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
const uint32_t data = dgus_display.ToFixedPoint<T, uint32_t, decimals>(*(T*)vp.extra);
|
||||
dgus_display.Write(uint16_t(vp.addr), dgus_display.SwapBytes(data));
|
||||
const uint32_t data = dgus.toFixedPoint<T, uint32_t, decimals>(*(T*)vp.extra);
|
||||
dgus.write(uint16_t(vp.addr), dgus.swapBytes(data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
enum class DGUS_Screen : uint8_t {
|
||||
enum class DGUS_ScreenID : uint8_t {
|
||||
BOOT = 0,
|
||||
HOME = 1,
|
||||
PRINT = 2,
|
@ -204,37 +204,35 @@ constexpr DGUS_Addr LIST_WAIT[] PROGMEM = {
|
||||
(DGUS_Addr)0
|
||||
};
|
||||
|
||||
#define MAP_HELPER(SCREEN, LIST) \
|
||||
{ .screen = SCREEN, \
|
||||
.addr_list = LIST }
|
||||
#define MAP_HELPER(SCREEN, LIST) { .screenID = SCREEN, .addr_list = LIST }
|
||||
|
||||
const struct DGUS_ScreenAddrList screen_addr_list_map[] PROGMEM = {
|
||||
MAP_HELPER(DGUS_Screen::HOME, LIST_HOME),
|
||||
MAP_HELPER(DGUS_ScreenID::HOME, LIST_HOME),
|
||||
#if HAS_MEDIA
|
||||
MAP_HELPER(DGUS_Screen::PRINT, LIST_PRINT),
|
||||
MAP_HELPER(DGUS_ScreenID::PRINT, LIST_PRINT),
|
||||
#endif
|
||||
MAP_HELPER(DGUS_Screen::PRINT_STATUS, LIST_PRINT_STATUS),
|
||||
MAP_HELPER(DGUS_Screen::PRINT_ADJUST, LIST_PRINT_ADJUST),
|
||||
MAP_HELPER(DGUS_Screen::PRINT_FINISHED, LIST_PRINT_FINISHED),
|
||||
MAP_HELPER(DGUS_Screen::TEMP_MENU, LIST_TEMP_MENU),
|
||||
MAP_HELPER(DGUS_Screen::TEMP_MANUAL, LIST_TEMP_MANUAL),
|
||||
MAP_HELPER(DGUS_Screen::FAN, LIST_FAN),
|
||||
MAP_HELPER(DGUS_Screen::SETTINGS_MENU, LIST_SETTINGS_MENU),
|
||||
MAP_HELPER(DGUS_Screen::LEVELING_OFFSET, LIST_LEVELING_OFFSET),
|
||||
MAP_HELPER(DGUS_Screen::LEVELING_MANUAL, LIST_LEVELING_MANUAL),
|
||||
MAP_HELPER(DGUS_Screen::LEVELING_AUTOMATIC, LIST_LEVELING_AUTOMATIC),
|
||||
MAP_HELPER(DGUS_Screen::LEVELING_PROBING, LIST_LEVELING_PROBING),
|
||||
MAP_HELPER(DGUS_Screen::FILAMENT, LIST_FILAMENT),
|
||||
MAP_HELPER(DGUS_Screen::MOVE, LIST_MOVE),
|
||||
MAP_HELPER(DGUS_Screen::GCODE, LIST_GCODE),
|
||||
MAP_HELPER(DGUS_Screen::SETTINGS_MENU2, LIST_SETTINGS_MENU2),
|
||||
MAP_HELPER(DGUS_Screen::PID, LIST_PID),
|
||||
MAP_HELPER(DGUS_Screen::VOLUME, LIST_VOLUME),
|
||||
MAP_HELPER(DGUS_Screen::BRIGHTNESS, LIST_BRIGHTNESS),
|
||||
MAP_HELPER(DGUS_Screen::INFOS, LIST_INFOS),
|
||||
MAP_HELPER(DGUS_Screen::WAIT, LIST_WAIT),
|
||||
MAP_HELPER(DGUS_ScreenID::PRINT_STATUS, LIST_PRINT_STATUS),
|
||||
MAP_HELPER(DGUS_ScreenID::PRINT_ADJUST, LIST_PRINT_ADJUST),
|
||||
MAP_HELPER(DGUS_ScreenID::PRINT_FINISHED, LIST_PRINT_FINISHED),
|
||||
MAP_HELPER(DGUS_ScreenID::TEMP_MENU, LIST_TEMP_MENU),
|
||||
MAP_HELPER(DGUS_ScreenID::TEMP_MANUAL, LIST_TEMP_MANUAL),
|
||||
MAP_HELPER(DGUS_ScreenID::FAN, LIST_FAN),
|
||||
MAP_HELPER(DGUS_ScreenID::SETTINGS_MENU, LIST_SETTINGS_MENU),
|
||||
MAP_HELPER(DGUS_ScreenID::LEVELING_OFFSET, LIST_LEVELING_OFFSET),
|
||||
MAP_HELPER(DGUS_ScreenID::LEVELING_MANUAL, LIST_LEVELING_MANUAL),
|
||||
MAP_HELPER(DGUS_ScreenID::LEVELING_AUTOMATIC, LIST_LEVELING_AUTOMATIC),
|
||||
MAP_HELPER(DGUS_ScreenID::LEVELING_PROBING, LIST_LEVELING_PROBING),
|
||||
MAP_HELPER(DGUS_ScreenID::FILAMENT, LIST_FILAMENT),
|
||||
MAP_HELPER(DGUS_ScreenID::MOVE, LIST_MOVE),
|
||||
MAP_HELPER(DGUS_ScreenID::GCODE, LIST_GCODE),
|
||||
MAP_HELPER(DGUS_ScreenID::SETTINGS_MENU2, LIST_SETTINGS_MENU2),
|
||||
MAP_HELPER(DGUS_ScreenID::PID, LIST_PID),
|
||||
MAP_HELPER(DGUS_ScreenID::VOLUME, LIST_VOLUME),
|
||||
MAP_HELPER(DGUS_ScreenID::BRIGHTNESS, LIST_BRIGHTNESS),
|
||||
MAP_HELPER(DGUS_ScreenID::INFOS, LIST_INFOS),
|
||||
MAP_HELPER(DGUS_ScreenID::WAIT, LIST_WAIT),
|
||||
|
||||
MAP_HELPER((DGUS_Screen)0, nullptr)
|
||||
MAP_HELPER((DGUS_ScreenID)0, nullptr)
|
||||
};
|
||||
|
||||
#endif // DGUS_LCD_UI_RELOADED
|
||||
|
@ -21,12 +21,12 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../config/DGUS_Screen.h"
|
||||
#include "../config/DGUS_ScreenID.h"
|
||||
#include "../config/DGUS_Addr.h"
|
||||
|
||||
struct DGUS_ScreenAddrList {
|
||||
DGUS_Screen screen;
|
||||
const DGUS_Addr *addr_list;
|
||||
DGUS_ScreenID screenID;
|
||||
const DGUS_Addr *addr_list;
|
||||
};
|
||||
|
||||
extern const struct DGUS_ScreenAddrList screen_addr_list_map[];
|
||||
|
@ -30,28 +30,26 @@
|
||||
|
||||
#include "../../ui_api.h"
|
||||
|
||||
#define SETUP_HELPER(SCREEN, SETUP) \
|
||||
{ .screen = SCREEN, \
|
||||
.setup_fn = SETUP }
|
||||
#define SETUP_HELPER(SCREEN, SETUP) { .screenID = SCREEN, .setup_fn = SETUP }
|
||||
|
||||
const struct DGUS_ScreenSetup screen_setup_list[] PROGMEM = {
|
||||
#if HAS_MEDIA
|
||||
SETUP_HELPER(DGUS_Screen::PRINT, &DGUSSetupHandler::Print),
|
||||
SETUP_HELPER(DGUS_ScreenID::PRINT, &DGUSSetupHandler::Print),
|
||||
#endif
|
||||
SETUP_HELPER(DGUS_Screen::PRINT_STATUS, &DGUSSetupHandler::PrintStatus),
|
||||
SETUP_HELPER(DGUS_Screen::PRINT_ADJUST, &DGUSSetupHandler::PrintAdjust),
|
||||
SETUP_HELPER(DGUS_Screen::LEVELING_MENU, &DGUSSetupHandler::LevelingMenu),
|
||||
SETUP_HELPER(DGUS_Screen::LEVELING_OFFSET, &DGUSSetupHandler::LevelingOffset),
|
||||
SETUP_HELPER(DGUS_Screen::LEVELING_MANUAL, &DGUSSetupHandler::LevelingManual),
|
||||
SETUP_HELPER(DGUS_Screen::LEVELING_AUTOMATIC, &DGUSSetupHandler::LevelingAutomatic),
|
||||
SETUP_HELPER(DGUS_Screen::LEVELING_PROBING, &DGUSSetupHandler::LevelingProbing),
|
||||
SETUP_HELPER(DGUS_Screen::FILAMENT, &DGUSSetupHandler::Filament),
|
||||
SETUP_HELPER(DGUS_Screen::MOVE, &DGUSSetupHandler::Move),
|
||||
SETUP_HELPER(DGUS_Screen::GCODE, &DGUSSetupHandler::Gcode),
|
||||
SETUP_HELPER(DGUS_Screen::PID, &DGUSSetupHandler::PID),
|
||||
SETUP_HELPER(DGUS_Screen::INFOS, &DGUSSetupHandler::Infos),
|
||||
SETUP_HELPER(DGUS_ScreenID::PRINT_STATUS, &DGUSSetupHandler::PrintStatus),
|
||||
SETUP_HELPER(DGUS_ScreenID::PRINT_ADJUST, &DGUSSetupHandler::PrintAdjust),
|
||||
SETUP_HELPER(DGUS_ScreenID::LEVELING_MENU, &DGUSSetupHandler::LevelingMenu),
|
||||
SETUP_HELPER(DGUS_ScreenID::LEVELING_OFFSET, &DGUSSetupHandler::LevelingOffset),
|
||||
SETUP_HELPER(DGUS_ScreenID::LEVELING_MANUAL, &DGUSSetupHandler::LevelingManual),
|
||||
SETUP_HELPER(DGUS_ScreenID::LEVELING_AUTOMATIC, &DGUSSetupHandler::LevelingAutomatic),
|
||||
SETUP_HELPER(DGUS_ScreenID::LEVELING_PROBING, &DGUSSetupHandler::LevelingProbing),
|
||||
SETUP_HELPER(DGUS_ScreenID::FILAMENT, &DGUSSetupHandler::Filament),
|
||||
SETUP_HELPER(DGUS_ScreenID::MOVE, &DGUSSetupHandler::Move),
|
||||
SETUP_HELPER(DGUS_ScreenID::GCODE, &DGUSSetupHandler::Gcode),
|
||||
SETUP_HELPER(DGUS_ScreenID::PID, &DGUSSetupHandler::PID),
|
||||
SETUP_HELPER(DGUS_ScreenID::INFOS, &DGUSSetupHandler::Infos),
|
||||
|
||||
SETUP_HELPER((DGUS_Screen)0, nullptr)
|
||||
SETUP_HELPER((DGUS_ScreenID)0, nullptr)
|
||||
};
|
||||
|
||||
#endif // DGUS_LCD_UI_RELOADED
|
||||
|
@ -21,10 +21,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../config/DGUS_Screen.h"
|
||||
#include "../config/DGUS_ScreenID.h"
|
||||
|
||||
struct DGUS_ScreenSetup {
|
||||
DGUS_Screen screen;
|
||||
DGUS_ScreenID screenID;
|
||||
bool (*setup_fn)(void);
|
||||
};
|
||||
|
||||
|
@ -75,248 +75,248 @@ const struct DGUS_VP vp_list[] PROGMEM = {
|
||||
|
||||
// READ-ONLY VARIABLES
|
||||
|
||||
VP_HELPER_RX(DGUS_Addr::SCREENCHANGE, &DGUSRxHandler::ScreenChange),
|
||||
VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_SD, &DGUSRxHandler::ScreenChange),
|
||||
VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_Idle, &DGUSRxHandler::ScreenChange),
|
||||
VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_Printing, &DGUSRxHandler::ScreenChange),
|
||||
VP_HELPER_RX(DGUS_Addr::SCREENCHANGE, &DGUSRxHandler::screenChange),
|
||||
VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_SD, &DGUSRxHandler::screenChange),
|
||||
VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_Idle, &DGUSRxHandler::screenChange),
|
||||
VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_Printing, &DGUSRxHandler::screenChange),
|
||||
|
||||
#if HAS_MEDIA
|
||||
VP_HELPER_RX(DGUS_Addr::SD_SelectFile, &DGUSRxHandler::selectFile),
|
||||
VP_HELPER_RX(DGUS_Addr::SD_Scroll, &DGUSRxHandler::Scroll),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::SD_Print, &DGUSRxHandler::PrintFile),
|
||||
VP_HELPER_RX(DGUS_Addr::SD_Scroll, &DGUSRxHandler::scroll),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::SD_Print, &DGUSRxHandler::printFile),
|
||||
#endif
|
||||
|
||||
VP_HELPER_RX(DGUS_Addr::STATUS_Abort, &DGUSRxHandler::PrintAbort),
|
||||
VP_HELPER_RX(DGUS_Addr::STATUS_Pause, &DGUSRxHandler::PrintPause),
|
||||
VP_HELPER_RX(DGUS_Addr::STATUS_Resume, &DGUSRxHandler::PrintResume),
|
||||
VP_HELPER_RX(DGUS_Addr::STATUS_Abort, &DGUSRxHandler::printAbort),
|
||||
VP_HELPER_RX(DGUS_Addr::STATUS_Pause, &DGUSRxHandler::printPause),
|
||||
VP_HELPER_RX(DGUS_Addr::STATUS_Resume, &DGUSRxHandler::printResume),
|
||||
|
||||
VP_HELPER_RX(DGUS_Addr::ADJUST_SetFeedrate, &DGUSRxHandler::Feedrate),
|
||||
VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_CUR, &DGUSRxHandler::Flowrate),
|
||||
VP_HELPER_RX(DGUS_Addr::ADJUST_SetFeedrate, &DGUSRxHandler::feedrate),
|
||||
VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_CUR, &DGUSRxHandler::flowrate),
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_E0, &DGUSRxHandler::Flowrate),
|
||||
VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_E1, &DGUSRxHandler::Flowrate),
|
||||
VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_E0, &DGUSRxHandler::flowrate),
|
||||
VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_E1, &DGUSRxHandler::flowrate),
|
||||
#endif
|
||||
VP_HELPER_RX(DGUS_Addr::ADJUST_SetBabystep, &DGUSRxHandler::BabystepSet),
|
||||
VP_HELPER_RX(DGUS_Addr::ADJUST_Babystep, &DGUSRxHandler::Babystep),
|
||||
VP_HELPER_RX(DGUS_Addr::ADJUST_SetBabystep, &DGUSRxHandler::babystepSet),
|
||||
VP_HELPER_RX(DGUS_Addr::ADJUST_Babystep, &DGUSRxHandler::babystep),
|
||||
|
||||
VP_HELPER_RX(DGUS_Addr::TEMP_Preset, &DGUSRxHandler::TempPreset),
|
||||
VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_Bed, &DGUSRxHandler::TempTarget),
|
||||
VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_H0, &DGUSRxHandler::TempTarget),
|
||||
VP_HELPER_RX(DGUS_Addr::TEMP_Preset, &DGUSRxHandler::tempPreset),
|
||||
VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_Bed, &DGUSRxHandler::tempTarget),
|
||||
VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_H0, &DGUSRxHandler::tempTarget),
|
||||
#if HAS_MULTI_HOTEND
|
||||
VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_H1, &DGUSRxHandler::TempTarget),
|
||||
VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_H1, &DGUSRxHandler::tempTarget),
|
||||
#endif
|
||||
VP_HELPER_RX(DGUS_Addr::TEMP_Cool, &DGUSRxHandler::TempCool),
|
||||
VP_HELPER_RX(DGUS_Addr::TEMP_Cool, &DGUSRxHandler::tempCool),
|
||||
|
||||
VP_HELPER_RX(DGUS_Addr::STEPPER_Control, &DGUSRxHandler::Steppers),
|
||||
VP_HELPER_RX(DGUS_Addr::STEPPER_Control, &DGUSRxHandler::steppers),
|
||||
|
||||
VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_Set, &DGUSRxHandler::ZOffset),
|
||||
VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_Step, &DGUSRxHandler::ZOffsetStep),
|
||||
VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_SetStep, &DGUSRxHandler::ZOffsetSetStep),
|
||||
VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_Set, &DGUSRxHandler::zOffset),
|
||||
VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_Step, &DGUSRxHandler::zOffsetStep),
|
||||
VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_SetStep, &DGUSRxHandler::zOffsetSetStep),
|
||||
|
||||
VP_HELPER_RX(DGUS_Addr::LEVEL_MANUAL_Point, &DGUSRxHandler::MoveToPoint),
|
||||
VP_HELPER_RX(DGUS_Addr::LEVEL_MANUAL_Point, &DGUSRxHandler::moveToPoint),
|
||||
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::LEVEL_AUTO_Probe, &DGUSRxHandler::Probe),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::LEVEL_AUTO_Disable, &DGUSRxHandler::DisableABL),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::LEVEL_AUTO_Probe, &DGUSRxHandler::probe),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::LEVEL_AUTO_Disable, &DGUSRxHandler::disableABL),
|
||||
|
||||
VP_HELPER_RX(DGUS_Addr::FILAMENT_Select, &DGUSRxHandler::FilamentSelect),
|
||||
VP_HELPER_RX(DGUS_Addr::FILAMENT_SetLength, &DGUSRxHandler::FilamentLength),
|
||||
VP_HELPER_RX(DGUS_Addr::FILAMENT_Move, &DGUSRxHandler::FilamentMove),
|
||||
VP_HELPER_RX(DGUS_Addr::FILAMENT_Select, &DGUSRxHandler::filamentSelect),
|
||||
VP_HELPER_RX(DGUS_Addr::FILAMENT_SetLength, &DGUSRxHandler::filamentLength),
|
||||
VP_HELPER_RX(DGUS_Addr::FILAMENT_Move, &DGUSRxHandler::filamentMove),
|
||||
|
||||
VP_HELPER_RX(DGUS_Addr::MOVE_Home, &DGUSRxHandler::Home),
|
||||
VP_HELPER_RX(DGUS_Addr::MOVE_SetX, &DGUSRxHandler::Move),
|
||||
VP_HELPER_RX(DGUS_Addr::MOVE_SetY, &DGUSRxHandler::Move),
|
||||
VP_HELPER_RX(DGUS_Addr::MOVE_SetZ, &DGUSRxHandler::Move),
|
||||
VP_HELPER_RX(DGUS_Addr::MOVE_Step, &DGUSRxHandler::MoveStep),
|
||||
VP_HELPER_RX(DGUS_Addr::MOVE_SetStep, &DGUSRxHandler::MoveSetStep),
|
||||
VP_HELPER_RX(DGUS_Addr::MOVE_Home, &DGUSRxHandler::home),
|
||||
VP_HELPER_RX(DGUS_Addr::MOVE_SetX, &DGUSRxHandler::move),
|
||||
VP_HELPER_RX(DGUS_Addr::MOVE_SetY, &DGUSRxHandler::move),
|
||||
VP_HELPER_RX(DGUS_Addr::MOVE_SetZ, &DGUSRxHandler::move),
|
||||
VP_HELPER_RX(DGUS_Addr::MOVE_Step, &DGUSRxHandler::moveStep),
|
||||
VP_HELPER_RX(DGUS_Addr::MOVE_SetStep, &DGUSRxHandler::moveSetStep),
|
||||
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::GCODE_Clear, &DGUSRxHandler::GcodeClear),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::GCODE_Execute, &DGUSRxHandler::GcodeExecute),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::GCODE_Clear, &DGUSRxHandler::gcodeClear),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::GCODE_Execute, &DGUSRxHandler::gcodeExecute),
|
||||
|
||||
VP_HELPER_RX(DGUS_Addr::EEPROM_Reset, &DGUSRxHandler::ResetEEPROM),
|
||||
VP_HELPER_RX(DGUS_Addr::EEPROM_Reset, &DGUSRxHandler::resetEEPROM),
|
||||
|
||||
VP_HELPER_RX(DGUS_Addr::SETTINGS2_Extra, &DGUSRxHandler::SettingsExtra),
|
||||
VP_HELPER_RX(DGUS_Addr::SETTINGS2_Extra, &DGUSRxHandler::settingsExtra),
|
||||
|
||||
VP_HELPER_RX(DGUS_Addr::PID_Select, &DGUSRxHandler::PIDSelect),
|
||||
VP_HELPER_RX(DGUS_Addr::PID_SetTemp, &DGUSRxHandler::PIDSetTemp),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::PID_Run, &DGUSRxHandler::PIDRun),
|
||||
VP_HELPER_RX(DGUS_Addr::PID_Select, &DGUSRxHandler::pidSelect),
|
||||
VP_HELPER_RX(DGUS_Addr::PID_SetTemp, &DGUSRxHandler::pidSetTemp),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::PID_Run, &DGUSRxHandler::pidRun),
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VP_HELPER_RX(DGUS_Addr::POWERLOSS_Abort, &DGUSRxHandler::PowerLossAbort),
|
||||
VP_HELPER_RX(DGUS_Addr::POWERLOSS_Resume, &DGUSRxHandler::PowerLossResume),
|
||||
VP_HELPER_RX(DGUS_Addr::POWERLOSS_Abort, &DGUSRxHandler::powerLossAbort),
|
||||
VP_HELPER_RX(DGUS_Addr::POWERLOSS_Resume, &DGUSRxHandler::powerLossResume),
|
||||
#endif
|
||||
|
||||
VP_HELPER_RX(DGUS_Addr::WAIT_Abort, &DGUSRxHandler::WaitAbort),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::WAIT_Continue, &DGUSRxHandler::WaitContinue),
|
||||
VP_HELPER_RX(DGUS_Addr::WAIT_Abort, &DGUSRxHandler::waitAbort),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::WAIT_Continue, &DGUSRxHandler::waitContinue),
|
||||
|
||||
// WRITE-ONLY VARIABLES
|
||||
|
||||
#if HAS_MEDIA
|
||||
VP_HELPER_TX(DGUS_Addr::SD_Type, &DGUSTxHandler::FileType),
|
||||
VP_HELPER_TX(DGUS_Addr::SD_Type, &DGUSTxHandler::fileType),
|
||||
VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName0,
|
||||
DGUS_FILENAME_LEN,
|
||||
&DGUSTxHandler::FileName),
|
||||
&DGUSTxHandler::fileName),
|
||||
VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName1,
|
||||
DGUS_FILENAME_LEN,
|
||||
&DGUSTxHandler::FileName),
|
||||
&DGUSTxHandler::fileName),
|
||||
VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName2,
|
||||
DGUS_FILENAME_LEN,
|
||||
&DGUSTxHandler::FileName),
|
||||
&DGUSTxHandler::fileName),
|
||||
VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName3,
|
||||
DGUS_FILENAME_LEN,
|
||||
&DGUSTxHandler::FileName),
|
||||
&DGUSTxHandler::fileName),
|
||||
VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName4,
|
||||
DGUS_FILENAME_LEN,
|
||||
&DGUSTxHandler::FileName),
|
||||
VP_HELPER_TX(DGUS_Addr::SD_ScrollIcons, &DGUSTxHandler::ScrollIcons),
|
||||
&DGUSTxHandler::fileName),
|
||||
VP_HELPER_TX(DGUS_Addr::SD_ScrollIcons, &DGUSTxHandler::scrollIcons),
|
||||
VP_HELPER_TX_SIZE(DGUS_Addr::SD_SelectedFileName,
|
||||
DGUS_FILENAME_LEN,
|
||||
&DGUSTxHandler::SelectedFileName),
|
||||
&DGUSTxHandler::selectedFileName),
|
||||
#endif
|
||||
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::STATUS_PositionZ,
|
||||
nullptr,
|
||||
&DGUSTxHandler::PositionZ),
|
||||
&DGUSTxHandler::zPosition),
|
||||
VP_HELPER(DGUS_Addr::STATUS_Elapsed,
|
||||
DGUS_ELAPSED_LEN,
|
||||
VPFLAG_AUTOUPLOAD,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&DGUSTxHandler::Elapsed),
|
||||
&DGUSTxHandler::elapsed),
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::STATUS_Percent,
|
||||
nullptr,
|
||||
&DGUSTxHandler::Percent),
|
||||
VP_HELPER_TX(DGUS_Addr::STATUS_Icons, &DGUSTxHandler::StatusIcons),
|
||||
&DGUSTxHandler::percent),
|
||||
VP_HELPER_TX(DGUS_Addr::STATUS_Icons, &DGUSTxHandler::statusIcons),
|
||||
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::ADJUST_Feedrate,
|
||||
&feedrate_percentage,
|
||||
&DGUSTxHandler::ExtraToInteger<int16_t>),
|
||||
&DGUSTxHandler::extraToInteger<int16_t>),
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::ADJUST_Flowrate_CUR,
|
||||
nullptr,
|
||||
&DGUSTxHandler::Flowrate),
|
||||
&DGUSTxHandler::flowrate),
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::ADJUST_Flowrate_E0,
|
||||
nullptr,
|
||||
&DGUSTxHandler::Flowrate),
|
||||
&DGUSTxHandler::flowrate),
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::ADJUST_Flowrate_E1,
|
||||
nullptr,
|
||||
&DGUSTxHandler::Flowrate),
|
||||
&DGUSTxHandler::flowrate),
|
||||
#endif
|
||||
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Current_Bed,
|
||||
&thermalManager.temp_bed.celsius,
|
||||
(&DGUSTxHandler::ExtraToFixedPoint<float, 1>)),
|
||||
(&DGUSTxHandler::extraToFixedPoint<float, 1>)),
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Target_Bed,
|
||||
&thermalManager.temp_bed.target,
|
||||
&DGUSTxHandler::ExtraToInteger<int16_t>),
|
||||
VP_HELPER_TX(DGUS_Addr::TEMP_Max_Bed, &DGUSTxHandler::TempMax),
|
||||
&DGUSTxHandler::extraToInteger<int16_t>),
|
||||
VP_HELPER_TX(DGUS_Addr::TEMP_Max_Bed, &DGUSTxHandler::tempMax),
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Current_H0,
|
||||
&thermalManager.temp_hotend[ExtUI::heater_t::H0].celsius,
|
||||
(&DGUSTxHandler::ExtraToFixedPoint<float, 1>)),
|
||||
(&DGUSTxHandler::extraToFixedPoint<float, 1>)),
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Target_H0,
|
||||
&thermalManager.temp_hotend[ExtUI::heater_t::H0].target,
|
||||
&DGUSTxHandler::ExtraToInteger<int16_t>),
|
||||
VP_HELPER_TX(DGUS_Addr::TEMP_Max_H0, &DGUSTxHandler::TempMax),
|
||||
&DGUSTxHandler::extraToInteger<int16_t>),
|
||||
VP_HELPER_TX(DGUS_Addr::TEMP_Max_H0, &DGUSTxHandler::tempMax),
|
||||
#if HAS_MULTI_HOTEND
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Current_H1,
|
||||
&thermalManager.temp_hotend[ExtUI::heater_t::H1].celsius,
|
||||
(&DGUSTxHandler::ExtraToFixedPoint<float, 1>)),
|
||||
(&DGUSTxHandler::extraToFixedPoint<float, 1>)),
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Target_H1,
|
||||
&thermalManager.temp_hotend[ExtUI::heater_t::H1].target,
|
||||
&DGUSTxHandler::ExtraToInteger<int16_t>),
|
||||
VP_HELPER_TX(DGUS_Addr::TEMP_Max_H1, &DGUSTxHandler::TempMax),
|
||||
&DGUSTxHandler::extraToInteger<int16_t>),
|
||||
VP_HELPER_TX(DGUS_Addr::TEMP_Max_H1, &DGUSTxHandler::tempMax),
|
||||
#endif
|
||||
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::STEPPER_Status,
|
||||
nullptr,
|
||||
&DGUSTxHandler::StepperStatus),
|
||||
&DGUSTxHandler::stepperStatus),
|
||||
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::LEVEL_OFFSET_Current,
|
||||
&probe.offset.z,
|
||||
(&DGUSTxHandler::ExtraToFixedPoint<float, 2>)),
|
||||
(&DGUSTxHandler::extraToFixedPoint<float, 2>)),
|
||||
VP_HELPER_TX_EXTRA(DGUS_Addr::LEVEL_OFFSET_StepIcons,
|
||||
&DGUSScreenHandler::offset_steps,
|
||||
&DGUSTxHandler::StepIcons),
|
||||
&DGUSTxHandler::stepIcons),
|
||||
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::LEVEL_AUTO_DisableIcon,
|
||||
nullptr,
|
||||
&DGUSTxHandler::ABLDisableIcon),
|
||||
VP_HELPER_TX(DGUS_Addr::LEVEL_AUTO_Grid, &DGUSTxHandler::ABLGrid),
|
||||
&DGUSTxHandler::ablDisableIcon),
|
||||
VP_HELPER_TX(DGUS_Addr::LEVEL_AUTO_Grid, &DGUSTxHandler::ablGrid),
|
||||
|
||||
VP_HELPER_TX_EXTRA(DGUS_Addr::LEVEL_PROBING_Icons1,
|
||||
&DGUSScreenHandler::probing_icons[0],
|
||||
&DGUSTxHandler::ExtraToInteger<uint16_t>),
|
||||
&DGUSTxHandler::extraToInteger<uint16_t>),
|
||||
VP_HELPER_TX_EXTRA(DGUS_Addr::LEVEL_PROBING_Icons2,
|
||||
&DGUSScreenHandler::probing_icons[1],
|
||||
&DGUSTxHandler::ExtraToInteger<uint16_t>),
|
||||
&DGUSTxHandler::extraToInteger<uint16_t>),
|
||||
|
||||
VP_HELPER_TX(DGUS_Addr::FILAMENT_ExtruderIcons, &DGUSTxHandler::FilamentIcons),
|
||||
VP_HELPER_TX(DGUS_Addr::FILAMENT_ExtruderIcons, &DGUSTxHandler::filamentIcons),
|
||||
VP_HELPER_TX_EXTRA(DGUS_Addr::FILAMENT_Length,
|
||||
&DGUSScreenHandler::filament_length,
|
||||
&DGUSTxHandler::ExtraToInteger<uint16_t>),
|
||||
&DGUSTxHandler::extraToInteger<uint16_t>),
|
||||
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::MOVE_CurrentX,
|
||||
¤t_position.x,
|
||||
(&DGUSTxHandler::ExtraToFixedPoint<float, 1>)),
|
||||
(&DGUSTxHandler::extraToFixedPoint<float, 1>)),
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::MOVE_CurrentY,
|
||||
¤t_position.y,
|
||||
(&DGUSTxHandler::ExtraToFixedPoint<float, 1>)),
|
||||
(&DGUSTxHandler::extraToFixedPoint<float, 1>)),
|
||||
VP_HELPER_TX_AUTO(DGUS_Addr::MOVE_CurrentZ,
|
||||
¤t_position.z,
|
||||
(&DGUSTxHandler::ExtraToFixedPoint<float, 1>)),
|
||||
(&DGUSTxHandler::extraToFixedPoint<float, 1>)),
|
||||
VP_HELPER_TX_EXTRA(DGUS_Addr::MOVE_StepIcons,
|
||||
&DGUSScreenHandler::move_steps,
|
||||
&DGUSTxHandler::StepIcons),
|
||||
&DGUSTxHandler::stepIcons),
|
||||
|
||||
VP_HELPER_TX(DGUS_Addr::SETTINGS2_BLTouch, &DGUSTxHandler::BLTouch),
|
||||
VP_HELPER_TX(DGUS_Addr::SETTINGS2_BLTouch, &DGUSTxHandler::blTouch),
|
||||
|
||||
VP_HELPER_TX(DGUS_Addr::PID_HeaterIcons, &DGUSTxHandler::PIDIcons),
|
||||
VP_HELPER_TX(DGUS_Addr::PID_HeaterIcons, &DGUSTxHandler::pidIcons),
|
||||
VP_HELPER_TX_EXTRA(DGUS_Addr::PID_Temp,
|
||||
&DGUSScreenHandler::pid_temp,
|
||||
&DGUSTxHandler::ExtraToInteger<uint16_t>),
|
||||
&DGUSTxHandler::extraToInteger<uint16_t>),
|
||||
VP_HELPER_DWORD(DGUS_Addr::PID_Kp,
|
||||
VPFLAG_AUTOUPLOAD,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&DGUSTxHandler::PIDKp),
|
||||
&DGUSTxHandler::pidKp),
|
||||
VP_HELPER_DWORD(DGUS_Addr::PID_Ki,
|
||||
VPFLAG_AUTOUPLOAD,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&DGUSTxHandler::PIDKi),
|
||||
&DGUSTxHandler::pidKi),
|
||||
VP_HELPER_DWORD(DGUS_Addr::PID_Kd,
|
||||
VPFLAG_AUTOUPLOAD,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&DGUSTxHandler::PIDKd),
|
||||
&DGUSTxHandler::pidKd),
|
||||
|
||||
VP_HELPER(DGUS_Addr::INFOS_Machine,
|
||||
DGUS_MACHINE_LEN,
|
||||
VPFLAG_NONE,
|
||||
(void*)DGUS_MACHINENAME,
|
||||
nullptr,
|
||||
&DGUSTxHandler::ExtraPGMToString),
|
||||
&DGUSTxHandler::extraPGMToString),
|
||||
VP_HELPER_TX_SIZE(DGUS_Addr::INFOS_BuildVolume,
|
||||
DGUS_BUILDVOLUME_LEN,
|
||||
&DGUSTxHandler::BuildVolume),
|
||||
&DGUSTxHandler::buildVolume),
|
||||
VP_HELPER(DGUS_Addr::INFOS_Version,
|
||||
DGUS_VERSION_LEN,
|
||||
VPFLAG_NONE,
|
||||
(void*)DGUS_MARLINVERSION,
|
||||
nullptr,
|
||||
&DGUSTxHandler::ExtraPGMToString),
|
||||
VP_HELPER_TX(DGUS_Addr::INFOS_TotalPrints, &DGUSTxHandler::TotalPrints),
|
||||
VP_HELPER_TX(DGUS_Addr::INFOS_FinishedPrints, &DGUSTxHandler::FinishedPrints),
|
||||
&DGUSTxHandler::extraPGMToString),
|
||||
VP_HELPER_TX(DGUS_Addr::INFOS_TotalPrints, &DGUSTxHandler::totalPrints),
|
||||
VP_HELPER_TX(DGUS_Addr::INFOS_FinishedPrints, &DGUSTxHandler::finishedPrints),
|
||||
VP_HELPER_TX_SIZE(DGUS_Addr::INFOS_PrintTime,
|
||||
DGUS_PRINTTIME_LEN,
|
||||
&DGUSTxHandler::PrintTime),
|
||||
&DGUSTxHandler::printTime),
|
||||
VP_HELPER_TX_SIZE(DGUS_Addr::INFOS_LongestPrint,
|
||||
DGUS_LONGESTPRINT_LEN,
|
||||
&DGUSTxHandler::LongestPrint),
|
||||
&DGUSTxHandler::longestPrint),
|
||||
VP_HELPER_TX_SIZE(DGUS_Addr::INFOS_FilamentUsed,
|
||||
DGUS_FILAMENTUSED_LEN,
|
||||
&DGUSTxHandler::FilamentUsed),
|
||||
&DGUSTxHandler::filamentUsed),
|
||||
|
||||
VP_HELPER_TX(DGUS_Addr::WAIT_Icons, &DGUSTxHandler::WaitIcons),
|
||||
VP_HELPER_TX(DGUS_Addr::WAIT_Icons, &DGUSTxHandler::waitIcons),
|
||||
|
||||
// READ-WRITE VARIABLES
|
||||
|
||||
@ -324,41 +324,41 @@ const struct DGUS_VP vp_list[] PROGMEM = {
|
||||
2,
|
||||
VPFLAG_AUTOUPLOAD,
|
||||
nullptr,
|
||||
&DGUSRxHandler::FanSpeed,
|
||||
&DGUSTxHandler::FanSpeed),
|
||||
&DGUSRxHandler::fanSpeed,
|
||||
&DGUSTxHandler::fanSpeed),
|
||||
|
||||
VP_HELPER(DGUS_Addr::GCODE_Data,
|
||||
DGUS_GCODE_LEN,
|
||||
VPFLAG_RXSTRING,
|
||||
(void*)DGUSScreenHandler::gcode,
|
||||
&DGUSRxHandler::StringToExtra,
|
||||
&DGUSTxHandler::ExtraToString),
|
||||
&DGUSRxHandler::stringToExtra,
|
||||
&DGUSTxHandler::extraToString),
|
||||
|
||||
VP_HELPER(DGUS_Addr::PID_Cycles,
|
||||
2,
|
||||
VPFLAG_NONE,
|
||||
&DGUSScreenHandler::pid_cycles,
|
||||
&DGUSRxHandler::IntegerToExtra<uint8_t>,
|
||||
&DGUSTxHandler::ExtraToInteger<uint8_t>),
|
||||
&DGUSRxHandler::integerToExtra<uint8_t>,
|
||||
&DGUSTxHandler::extraToInteger<uint8_t>),
|
||||
|
||||
VP_HELPER(DGUS_Addr::VOLUME_Level,
|
||||
2,
|
||||
VPFLAG_NONE,
|
||||
nullptr,
|
||||
&DGUSRxHandler::Volume,
|
||||
&DGUSTxHandler::Volume),
|
||||
&DGUSRxHandler::volume,
|
||||
&DGUSTxHandler::volume),
|
||||
|
||||
VP_HELPER(DGUS_Addr::BRIGHTNESS_Level,
|
||||
2,
|
||||
VPFLAG_NONE,
|
||||
nullptr,
|
||||
&DGUSRxHandler::Brightness,
|
||||
&DGUSTxHandler::Brightness),
|
||||
&DGUSRxHandler::brightness,
|
||||
&DGUSTxHandler::brightness),
|
||||
|
||||
// SPECIAL CASES
|
||||
|
||||
VP_HELPER_TX(DGUS_Addr::STATUS_Percent_Complete, &DGUSTxHandler::Percent),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::INFOS_Debug, &DGUSRxHandler::Debug),
|
||||
VP_HELPER_TX(DGUS_Addr::STATUS_Percent_Complete, &DGUSTxHandler::percent),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::INFOS_Debug, &DGUSRxHandler::debug),
|
||||
|
||||
VP_HELPER((DGUS_Addr)0, 0, VPFLAG_NONE, nullptr, nullptr, nullptr)
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
namespace ExtUI {
|
||||
|
||||
void onStartup() { dgus_screen_handler.Init(); }
|
||||
void onStartup() { screen.init(); }
|
||||
|
||||
void onIdle() {
|
||||
static bool processing = false;
|
||||
@ -41,45 +41,45 @@ namespace ExtUI {
|
||||
// Prevent recursion
|
||||
if (!processing) {
|
||||
processing = true;
|
||||
dgus_screen_handler.Loop();
|
||||
screen.loop();
|
||||
processing = false;
|
||||
}
|
||||
}
|
||||
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
|
||||
dgus_screen_handler.printerKilled(error, component);
|
||||
screen.printerKilled(error, component);
|
||||
}
|
||||
|
||||
void onMediaInserted() { TERN_(HAS_MEDIA, dgus_screen_handler.SDCardInserted()); }
|
||||
void onMediaError() { TERN_(HAS_MEDIA, dgus_screen_handler.SDCardError()); }
|
||||
void onMediaRemoved() { TERN_(HAS_MEDIA, dgus_screen_handler.SDCardRemoved()); }
|
||||
void onMediaInserted() { TERN_(HAS_MEDIA, screen.sDCardInserted()); }
|
||||
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
|
||||
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
|
||||
|
||||
void onPlayTone(const uint16_t frequency, const uint16_t duration) {
|
||||
dgus_screen_handler.PlayTone(frequency, duration);
|
||||
screen.playTone(frequency, duration);
|
||||
}
|
||||
|
||||
void onPrintTimerStarted() {
|
||||
dgus_screen_handler.PrintTimerStarted();
|
||||
screen.printTimerStarted();
|
||||
}
|
||||
|
||||
void onPrintTimerPaused() {
|
||||
dgus_screen_handler.PrintTimerPaused();
|
||||
screen.printTimerPaused();
|
||||
}
|
||||
|
||||
void onPrintTimerStopped() {
|
||||
dgus_screen_handler.PrintTimerStopped();
|
||||
screen.printTimerStopped();
|
||||
}
|
||||
|
||||
void onFilamentRunout(const extruder_t extruder) {
|
||||
dgus_screen_handler.filamentRunout(extruder);
|
||||
screen.filamentRunout(extruder);
|
||||
}
|
||||
|
||||
void onUserConfirmRequired(const char * const msg) {
|
||||
dgus_screen_handler.UserConfirmRequired(msg);
|
||||
screen.userConfirmRequired(msg);
|
||||
}
|
||||
|
||||
void onStatusChanged(const char * const msg) {
|
||||
dgus_screen_handler.SetStatusMessage(msg);
|
||||
screen.setStatusMessage(msg);
|
||||
}
|
||||
|
||||
void onHomingStart() {}
|
||||
@ -87,25 +87,25 @@ namespace ExtUI {
|
||||
void onPrintDone() {}
|
||||
|
||||
void onFactoryReset() {
|
||||
dgus_screen_handler.SettingsReset();
|
||||
screen.settingsReset();
|
||||
}
|
||||
|
||||
void onStoreSettings(char *buff) {
|
||||
dgus_screen_handler.StoreSettings(buff);
|
||||
screen.storeSettings(buff);
|
||||
}
|
||||
|
||||
void onLoadSettings(const char *buff) {
|
||||
dgus_screen_handler.LoadSettings(buff);
|
||||
screen.loadSettings(buff);
|
||||
}
|
||||
|
||||
void onPostprocessSettings() {}
|
||||
|
||||
void onSettingsStored(const bool success) {
|
||||
dgus_screen_handler.ConfigurationStoreWritten(success);
|
||||
screen.configurationStoreWritten(success);
|
||||
}
|
||||
|
||||
void onSettingsLoaded(const bool success) {
|
||||
dgus_screen_handler.ConfigurationStoreRead(success);
|
||||
screen.configurationStoreRead(success);
|
||||
}
|
||||
|
||||
#if HAS_LEVELING
|
||||
@ -115,12 +115,12 @@ namespace ExtUI {
|
||||
|
||||
#if HAS_MESH
|
||||
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
|
||||
dgus_screen_handler.MeshUpdate(xpos, ypos);
|
||||
screen.meshUpdate(xpos, ypos);
|
||||
}
|
||||
|
||||
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) {
|
||||
if (state == G29_POINT_FINISH)
|
||||
dgus_screen_handler.MeshUpdate(xpos, ypos);
|
||||
screen.meshUpdate(xpos, ypos);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -133,14 +133,14 @@ namespace ExtUI {
|
||||
}
|
||||
void onPowerLossResume() {
|
||||
// Called on resume from power-loss
|
||||
dgus_screen_handler.PowerLossResume();
|
||||
screen.powerLossResume();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void onPidTuning(const result_t rst) {
|
||||
// Called for temperature PID tuning result
|
||||
dgus_screen_handler.PidTuning(rst);
|
||||
screen.pidTuning(rst);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -101,15 +101,17 @@ const char *resultMessages[] = {
|
||||
"slip data"
|
||||
};
|
||||
|
||||
// A note on baud rates.
|
||||
// The ESP8266 supports 921600, 460800, 230400, 115200, 74880 and some lower baud rates.
|
||||
// 921600b is not reliable because even though it sometimes succeeds in connecting, we get a bad response during uploading after a few blocks.
|
||||
// Probably our UART ISR cannot receive bytes fast enough, perhaps because of the latency of the system tick ISR.
|
||||
// 460800b doesn't always manage to connect, but if it does then uploading appears to be reliable.
|
||||
// 230400b always manages to connect.
|
||||
/**
|
||||
* Baud Rate Notes:
|
||||
* The ESP8266 supports 921600, 460800, 230400, 115200, 74880 and some lower baud rates.
|
||||
* 921600b is not reliable because even though it sometimes succeeds in connecting, we get a bad response during uploading after a few blocks.
|
||||
* Probably our UART ISR cannot receive bytes fast enough, perhaps because of the latency of the system tick ISR.
|
||||
* 460800b doesn't always manage to connect, but if it does then uploading appears to be reliable.
|
||||
* 230400b always manages to connect.
|
||||
*/
|
||||
static const uint32_t uploadBaudRates[] = { 460800, 230400, 115200, 74880 };
|
||||
|
||||
signed char IsReady() {
|
||||
signed char isReady() {
|
||||
return esp_upload.state == upload_idle;
|
||||
}
|
||||
|
||||
@ -170,15 +172,17 @@ void putData(uint32_t val, unsigned byteCnt, uint8_t *buf, int ofst) {
|
||||
}
|
||||
}
|
||||
|
||||
// Read a byte optionally performing SLIP decoding. The return values are:
|
||||
//
|
||||
// 2 - an escaped byte was read successfully
|
||||
// 1 - a non-escaped byte was read successfully
|
||||
// 0 - no data was available
|
||||
// -1 - the value 0xC0 was encountered (shouldn't happen)
|
||||
// -2 - a SLIP escape byte was found but the following byte wasn't available
|
||||
// -3 - a SLIP escape byte was followed by an invalid byte
|
||||
int ReadByte(uint8_t *data, signed char slipDecode) {
|
||||
/**
|
||||
* Read a byte optionally performing SLIP decoding. The return values are:
|
||||
*
|
||||
* 2 - an escaped byte was read successfully
|
||||
* 1 - a non-escaped byte was read successfully
|
||||
* 0 - no data was available
|
||||
* -1 - the value 0xC0 was encountered (shouldn't happen)
|
||||
* -2 - a SLIP escape byte was found but the following byte wasn't available
|
||||
* -3 - a SLIP escape byte was followed by an invalid byte
|
||||
*/
|
||||
int readByte(uint8_t *data, signed char slipDecode) {
|
||||
if (uploadPort_available() == 0) return 0;
|
||||
|
||||
// At least one byte is available
|
||||
@ -206,31 +210,33 @@ void _writePacketRaw(const uint8_t *buf, size_t len) {
|
||||
}
|
||||
|
||||
// Write a byte to the serial port optionally SLIP encoding. Return the number of bytes actually written.
|
||||
void WriteByteRaw(uint8_t b) {
|
||||
void writeByteRaw(uint8_t b) {
|
||||
uploadPort_write((const uint8_t *)&b, 1);
|
||||
}
|
||||
|
||||
// Write a byte to the serial port optionally SLIP encoding. Return the number of bytes actually written.
|
||||
void WriteByteSlip(const uint8_t b) {
|
||||
void writeByteSlip(const uint8_t b) {
|
||||
if (b == 0xC0) {
|
||||
WriteByteRaw(0xDB);
|
||||
WriteByteRaw(0xDC);
|
||||
writeByteRaw(0xDB);
|
||||
writeByteRaw(0xDC);
|
||||
}
|
||||
else if (b == 0xDB) {
|
||||
WriteByteRaw(0xDB);
|
||||
WriteByteRaw(0xDD);
|
||||
writeByteRaw(0xDB);
|
||||
writeByteRaw(0xDD);
|
||||
}
|
||||
else
|
||||
uploadPort_write((const uint8_t *)&b, 1);
|
||||
}
|
||||
|
||||
// Wait for a data packet to be returned. If the body of the packet is
|
||||
// non-zero length, return an allocated buffer indirectly containing the
|
||||
// data and return the data length. Note that if the pointer for returning
|
||||
// the data buffer is nullptr, the response is expected to be two bytes of zero.
|
||||
//
|
||||
// If an error occurs, return a negative value. Otherwise, return the number
|
||||
// of bytes in the response (or zero if the response was not the standard "two bytes of zero").
|
||||
/**
|
||||
* Wait for a data packet to be returned. If the body of the packet is
|
||||
* non-zero length, return an allocated buffer indirectly containing the
|
||||
* data and return the data length. Note that if the pointer for returning
|
||||
* the data buffer is nullptr, the response is expected to be two bytes of zero.
|
||||
*
|
||||
* If an error occurs, return a negative value. Otherwise, return the number
|
||||
* of bytes in the response (or zero if the response was not the standard "two bytes of zero").
|
||||
*/
|
||||
EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t msTimeout) {
|
||||
typedef enum {
|
||||
begin = 0,
|
||||
@ -292,7 +298,7 @@ EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t
|
||||
case body: { // reading the response body
|
||||
int rslt;
|
||||
// retrieve a byte with SLIP decoding
|
||||
rslt = ReadByte(&c, 1);
|
||||
rslt = readByte(&c, 1);
|
||||
if (rslt != 1 && rslt != 2) {
|
||||
// some error occurred
|
||||
stat = (rslt == 0 || rslt == -2) ? slipData : slipFrame;
|
||||
@ -370,19 +376,19 @@ void _writePacket(const uint8_t *data, size_t len) {
|
||||
// 0xC0 and 0xDB replaced by the two-byte sequences {0xDB, 0xDC} and {0xDB, 0xDD} respectively.
|
||||
|
||||
void writePacket(const uint8_t *hdr, size_t hdrLen, const uint8_t *data, size_t dataLen) {
|
||||
WriteByteRaw(0xC0); // send the packet start character
|
||||
writeByteRaw(0xC0); // send the packet start character
|
||||
_writePacket(hdr, hdrLen); // send the header
|
||||
_writePacket(data, dataLen); // send the data block
|
||||
WriteByteRaw(0xC0); // send the packet end character
|
||||
writeByteRaw(0xC0); // send the packet end character
|
||||
}
|
||||
|
||||
// Send a packet to the serial port while performing SLIP framing. The packet data comprises a header and an optional data block.
|
||||
// This is like writePacket except that it does a fast block write for both the header and the main data with no SLIP encoding. Used to send sync commands.
|
||||
void writePacketRaw(const uint8_t *hdr, size_t hdrLen, const uint8_t *data, size_t dataLen) {
|
||||
WriteByteRaw(0xC0); // send the packet start character
|
||||
writeByteRaw(0xC0); // send the packet start character
|
||||
_writePacketRaw(hdr, hdrLen); // send the header
|
||||
_writePacketRaw(data, dataLen); // send the data block in raw mode
|
||||
WriteByteRaw(0xC0); // send the packet end character
|
||||
writeByteRaw(0xC0); // send the packet end character
|
||||
}
|
||||
|
||||
// Send a command to the attached device together with the supplied data, if any.
|
||||
@ -418,7 +424,7 @@ EspUploadResult doCommand(uint8_t op, const uint8_t *data, size_t dataLen, uint3
|
||||
|
||||
// Send a synchronising packet to the serial port in an attempt to induce
|
||||
// the ESP8266 to auto-baud lock on the baud rate.
|
||||
EspUploadResult Sync(uint16_t timeout) {
|
||||
EspUploadResult sync(uint16_t timeout) {
|
||||
uint8_t buf[36];
|
||||
EspUploadResult stat;
|
||||
int i;
|
||||
@ -553,7 +559,7 @@ void upload_spin() {
|
||||
|
||||
case connecting:
|
||||
if ((getWifiTickDiff(esp_upload.lastAttemptTime, getWifiTick()) >= connectAttemptInterval) && (getWifiTickDiff(esp_upload.lastResetTime, getWifiTick()) >= 500)) {
|
||||
EspUploadResult res = Sync(5000);
|
||||
EspUploadResult res = sync(5000);
|
||||
esp_upload.lastAttemptTime = getWifiTick();
|
||||
if (res == success)
|
||||
esp_upload.state = erasing;
|
||||
@ -622,7 +628,7 @@ void upload_spin() {
|
||||
}
|
||||
|
||||
// Try to upload the given file at the given address
|
||||
void SendUpdateFile(const char *file, uint32_t address) {
|
||||
void sendUpdateFile(const char *file, uint32_t address) {
|
||||
const char * const fname = card.diveToFile(false, update_curDir, ESP_FIRMWARE_FILE);
|
||||
if (!update_file.open(update_curDir, fname, O_READ)) return;
|
||||
|
||||
@ -640,7 +646,7 @@ void SendUpdateFile(const char *file, uint32_t address) {
|
||||
|
||||
static const uint32_t FirmwareAddress = 0x00000000, WebFilesAddress = 0x00100000;
|
||||
|
||||
void ResetWiFiForUpload(int begin_or_end) {
|
||||
void resetWiFiForUpload(int begin_or_end) {
|
||||
//#if 0
|
||||
uint32_t start = getWifiTick();
|
||||
|
||||
@ -660,12 +666,12 @@ void ResetWiFiForUpload(int begin_or_end) {
|
||||
int32_t wifi_upload(int type) {
|
||||
esp_upload.retriesPerBaudRate = 9;
|
||||
|
||||
ResetWiFiForUpload(0);
|
||||
resetWiFiForUpload(0);
|
||||
|
||||
switch (type) {
|
||||
case 0: SendUpdateFile(ESP_FIRMWARE_FILE, FirmwareAddress); break;
|
||||
case 1: SendUpdateFile(ESP_WEB_FIRMWARE_FILE, FirmwareAddress); break;
|
||||
case 2: SendUpdateFile(ESP_WEB_FILE, WebFilesAddress); break;
|
||||
case 0: sendUpdateFile(ESP_FIRMWARE_FILE, FirmwareAddress); break;
|
||||
case 1: sendUpdateFile(ESP_WEB_FIRMWARE_FILE, FirmwareAddress); break;
|
||||
case 2: sendUpdateFile(ESP_WEB_FILE, WebFilesAddress); break;
|
||||
default: return -1;
|
||||
}
|
||||
|
||||
@ -674,7 +680,7 @@ int32_t wifi_upload(int type) {
|
||||
hal.watchdog_refresh();
|
||||
}
|
||||
|
||||
ResetWiFiForUpload(1);
|
||||
resetWiFiForUpload(1);
|
||||
|
||||
return esp_upload.uploadResult == success ? 0 : -1;
|
||||
}
|
||||
|
@ -26,31 +26,31 @@
|
||||
|
||||
#include "canvas.h"
|
||||
|
||||
uint16_t CANVAS::width, CANVAS::height;
|
||||
uint16_t CANVAS::startLine, CANVAS::endLine;
|
||||
uint16_t CANVAS::background_color;
|
||||
uint16_t *CANVAS::buffer = TFT::buffer;
|
||||
uint16_t Canvas::width, Canvas::height;
|
||||
uint16_t Canvas::startLine, Canvas::endLine;
|
||||
uint16_t Canvas::background_color;
|
||||
uint16_t *Canvas::buffer = TFT::buffer;
|
||||
|
||||
void CANVAS::New(uint16_t x, uint16_t y, uint16_t width, uint16_t height) {
|
||||
CANVAS::width = width;
|
||||
CANVAS::height = height;
|
||||
void Canvas::instantiate(uint16_t x, uint16_t y, uint16_t width, uint16_t height) {
|
||||
Canvas::width = width;
|
||||
Canvas::height = height;
|
||||
startLine = 0;
|
||||
endLine = 0;
|
||||
|
||||
tft.set_window(x, y, x + width - 1, y + height - 1);
|
||||
}
|
||||
|
||||
void CANVAS::Continue() {
|
||||
void Canvas::next() {
|
||||
startLine = endLine;
|
||||
endLine = TFT_BUFFER_SIZE < width * (height - startLine) ? startLine + TFT_BUFFER_SIZE / width : height;
|
||||
}
|
||||
|
||||
bool CANVAS::ToScreen() {
|
||||
bool Canvas::toScreen() {
|
||||
tft.write_sequence(buffer, width * (endLine - startLine));
|
||||
return endLine == height;
|
||||
}
|
||||
|
||||
void CANVAS::SetBackground(uint16_t color) {
|
||||
void Canvas::setBackground(uint16_t color) {
|
||||
/* TODO: test and optimize performance */
|
||||
/*
|
||||
uint32_t count = (endLine - startLine) * width;
|
||||
@ -67,35 +67,35 @@ void CANVAS::SetBackground(uint16_t color) {
|
||||
|
||||
extern uint16_t gradient(uint16_t colorA, uint16_t colorB, uint16_t factor);
|
||||
|
||||
void CANVAS::AddText(uint16_t x, uint16_t y, uint16_t color, uint16_t *string, uint16_t maxWidth) {
|
||||
if (endLine < y || startLine > y + GetFontHeight()) return;
|
||||
void Canvas::addText(uint16_t x, uint16_t y, uint16_t color, uint16_t *string, uint16_t maxWidth) {
|
||||
if (endLine < y || startLine > y + getFontHeight()) return;
|
||||
|
||||
if (maxWidth == 0) maxWidth = width - x;
|
||||
|
||||
uint16_t colors[16];
|
||||
uint16_t stringWidth = 0;
|
||||
if (GetFontType() == FONT_MARLIN_GLYPHS_2BPP) {
|
||||
if (getFontType() == FONT_MARLIN_GLYPHS_2BPP) {
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
colors[i] = gradient(ENDIAN_COLOR(color), ENDIAN_COLOR(background_color), ((i+1) << 8) / 3);
|
||||
colors[i] = ENDIAN_COLOR(colors[i]);
|
||||
}
|
||||
}
|
||||
for (uint16_t i = 0 ; *(string + i) ; i++) {
|
||||
glyph_t *glyph = Glyph(string + i);
|
||||
if (stringWidth + glyph->BBXWidth > maxWidth) break;
|
||||
switch (GetFontType()) {
|
||||
glyph_t *pGlyph = glyph(string + i);
|
||||
if (stringWidth + pGlyph->BBXWidth > maxWidth) break;
|
||||
switch (getFontType()) {
|
||||
case FONT_MARLIN_GLYPHS_1BPP:
|
||||
AddImage(x + stringWidth + glyph->BBXOffsetX, y + GetFontAscent() - glyph->BBXHeight - glyph->BBXOffsetY, glyph->BBXWidth, glyph->BBXHeight, GREYSCALE1, ((uint8_t *)glyph) + sizeof(glyph_t), &color);
|
||||
addImage(x + stringWidth + pGlyph->BBXOffsetX, y + getFontAscent() - pGlyph->BBXHeight - pGlyph->BBXOffsetY, pGlyph->BBXWidth, pGlyph->BBXHeight, GREYSCALE1, ((uint8_t *)glyph) + sizeof(glyph_t), &color);
|
||||
break;
|
||||
case FONT_MARLIN_GLYPHS_2BPP:
|
||||
AddImage(x + stringWidth + glyph->BBXOffsetX, y + GetFontAscent() - glyph->BBXHeight - glyph->BBXOffsetY, glyph->BBXWidth, glyph->BBXHeight, GREYSCALE2, ((uint8_t *)glyph) + sizeof(glyph_t), colors);
|
||||
addImage(x + stringWidth + pGlyph->BBXOffsetX, y + getFontAscent() - pGlyph->BBXHeight - pGlyph->BBXOffsetY, pGlyph->BBXWidth, pGlyph->BBXHeight, GREYSCALE2, ((uint8_t *)glyph) + sizeof(glyph_t), colors);
|
||||
break;
|
||||
}
|
||||
stringWidth += glyph->DWidth;
|
||||
stringWidth += pGlyph->DWidth;
|
||||
}
|
||||
}
|
||||
|
||||
void CANVAS::AddImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors) {
|
||||
void Canvas::addImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors) {
|
||||
uint16_t *data = (uint16_t *)Images[image].data;
|
||||
if (!data) return;
|
||||
|
||||
@ -104,7 +104,7 @@ void CANVAS::AddImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors)
|
||||
colorMode_t color_mode = Images[image].colorMode;
|
||||
|
||||
if (color_mode != HIGHCOLOR)
|
||||
return AddImage(x, y, image_width, image_height, color_mode, (uint8_t *)data, colors);
|
||||
return addImage(x, y, image_width, image_height, color_mode, (uint8_t *)data, colors);
|
||||
|
||||
// HIGHCOLOR - 16 bits per pixel
|
||||
|
||||
@ -123,7 +123,7 @@ void CANVAS::AddImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors)
|
||||
}
|
||||
}
|
||||
|
||||
void CANVAS::AddImage(int16_t x, int16_t y, uint8_t image_width, uint8_t image_height, colorMode_t color_mode, uint8_t *data, uint16_t *colors) {
|
||||
void Canvas::addImage(int16_t x, int16_t y, uint8_t image_width, uint8_t image_height, colorMode_t color_mode, uint8_t *data, uint16_t *colors) {
|
||||
uint8_t bitsPerPixel;
|
||||
switch (color_mode) {
|
||||
case GREYSCALE1: bitsPerPixel = 1; break;
|
||||
@ -161,7 +161,7 @@ void CANVAS::AddImage(int16_t x, int16_t y, uint8_t image_width, uint8_t image_h
|
||||
}
|
||||
}
|
||||
|
||||
void CANVAS::AddRectangle(uint16_t x, uint16_t y, uint16_t rectangleWidth, uint16_t rectangleHeight, uint16_t color) {
|
||||
void Canvas::addRect(uint16_t x, uint16_t y, uint16_t rectangleWidth, uint16_t rectangleHeight, uint16_t color) {
|
||||
if (endLine < y || startLine > y + rectangleHeight) return;
|
||||
|
||||
for (uint16_t i = 0; i < rectangleHeight; i++) {
|
||||
@ -180,7 +180,7 @@ void CANVAS::AddRectangle(uint16_t x, uint16_t y, uint16_t rectangleWidth, uint1
|
||||
}
|
||||
}
|
||||
|
||||
void CANVAS::AddBar(uint16_t x, uint16_t y, uint16_t barWidth, uint16_t barHeight, uint16_t color) {
|
||||
void Canvas::addBar(uint16_t x, uint16_t y, uint16_t barWidth, uint16_t barHeight, uint16_t color) {
|
||||
if (endLine < y || startLine > y + barHeight) return;
|
||||
|
||||
for (uint16_t i = 0; i < barHeight; i++) {
|
||||
@ -192,6 +192,6 @@ void CANVAS::AddBar(uint16_t x, uint16_t y, uint16_t barWidth, uint16_t barHeigh
|
||||
}
|
||||
}
|
||||
|
||||
CANVAS Canvas;
|
||||
Canvas tftCanvas;
|
||||
|
||||
#endif // HAS_GRAPHICAL_TFT
|
||||
|
@ -28,32 +28,32 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
class CANVAS {
|
||||
class Canvas {
|
||||
private:
|
||||
static uint16_t background_color;
|
||||
static uint16_t width, height;
|
||||
static uint16_t startLine, endLine;
|
||||
static uint16_t *buffer;
|
||||
|
||||
inline static glyph_t *Glyph(uint16_t *character) { return TFT_String::glyph(character); }
|
||||
inline static uint16_t GetFontType() { return TFT_String::font_type(); }
|
||||
inline static uint16_t GetFontAscent() { return TFT_String::font_ascent(); }
|
||||
inline static uint16_t GetFontHeight() { return TFT_String::font_height(); }
|
||||
inline static glyph_t *glyph(uint16_t *character) { return TFT_String::glyph(character); }
|
||||
inline static uint16_t getFontType() { return TFT_String::font_type(); }
|
||||
inline static uint16_t getFontAscent() { return TFT_String::font_ascent(); }
|
||||
inline static uint16_t getFontHeight() { return TFT_String::font_height(); }
|
||||
|
||||
static void AddImage(int16_t x, int16_t y, uint8_t image_width, uint8_t image_height, colorMode_t color_mode, uint8_t *data, uint16_t *colors);
|
||||
static void AddImage(uint16_t x, uint16_t y, uint16_t imageWidth, uint16_t imageHeight, uint16_t color, uint16_t bgColor, uint8_t *image);
|
||||
static void addImage(int16_t x, int16_t y, uint8_t image_width, uint8_t image_height, colorMode_t color_mode, uint8_t *data, uint16_t *colors);
|
||||
static void addImage(uint16_t x, uint16_t y, uint16_t imageWidth, uint16_t imageHeight, uint16_t color, uint16_t bgColor, uint8_t *image);
|
||||
|
||||
public:
|
||||
static void New(uint16_t x, uint16_t y, uint16_t width, uint16_t height);
|
||||
static void Continue();
|
||||
static bool ToScreen();
|
||||
static void instantiate(uint16_t x, uint16_t y, uint16_t width, uint16_t height);
|
||||
static void next();
|
||||
static bool toScreen();
|
||||
|
||||
static void SetBackground(uint16_t color);
|
||||
static void AddText(uint16_t x, uint16_t y, uint16_t color, uint16_t *string, uint16_t maxWidth);
|
||||
static void AddImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors);
|
||||
static void setBackground(uint16_t color);
|
||||
static void addText(uint16_t x, uint16_t y, uint16_t color, uint16_t *string, uint16_t maxWidth);
|
||||
static void addImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors);
|
||||
|
||||
static void AddRectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color);
|
||||
static void AddBar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color);
|
||||
static void addRect(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color);
|
||||
static void addBar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color);
|
||||
};
|
||||
|
||||
extern CANVAS Canvas;
|
||||
extern Canvas tftCanvas;
|
||||
|
@ -107,17 +107,17 @@ void TFT_Queue::canvas(queueTask_t *task) {
|
||||
|
||||
if (task->state == TASK_STATE_READY) {
|
||||
task->state = TASK_STATE_IN_PROGRESS;
|
||||
Canvas.New(task_parameters->x, task_parameters->y, task_parameters->width, task_parameters->height);
|
||||
tftCanvas.instantiate(task_parameters->x, task_parameters->y, task_parameters->width, task_parameters->height);
|
||||
}
|
||||
Canvas.Continue();
|
||||
tftCanvas.next();
|
||||
|
||||
for (i = 0; i < task_parameters->count; i++) {
|
||||
switch (*item) {
|
||||
case CANVAS_SET_BACKGROUND:
|
||||
Canvas.SetBackground(((parametersCanvasBackground_t *)item)->color);
|
||||
tftCanvas.setBackground(((parametersCanvasBackground_t *)item)->color);
|
||||
break;
|
||||
case CANVAS_ADD_TEXT:
|
||||
Canvas.AddText(((parametersCanvasText_t *)item)->x, ((parametersCanvasText_t *)item)->y, ((parametersCanvasText_t *)item)->color, (uint16_t*)(item + sizeof(parametersCanvasText_t)), ((parametersCanvasText_t *)item)->maxWidth);
|
||||
tftCanvas.addText(((parametersCanvasText_t *)item)->x, ((parametersCanvasText_t *)item)->y, ((parametersCanvasText_t *)item)->color, (uint16_t*)(item + sizeof(parametersCanvasText_t)), ((parametersCanvasText_t *)item)->maxWidth);
|
||||
break;
|
||||
|
||||
case CANVAS_ADD_IMAGE:
|
||||
@ -126,20 +126,20 @@ void TFT_Queue::canvas(queueTask_t *task) {
|
||||
|
||||
image = ((parametersCanvasImage_t *)item)->image;
|
||||
colors = (uint16_t *)(item + sizeof(parametersCanvasImage_t));
|
||||
Canvas.AddImage(((parametersCanvasImage_t *)item)->x, ((parametersCanvasImage_t *)item)->y, image, colors);
|
||||
tftCanvas.addImage(((parametersCanvasImage_t *)item)->x, ((parametersCanvasImage_t *)item)->y, image, colors);
|
||||
break;
|
||||
|
||||
case CANVAS_ADD_BAR:
|
||||
Canvas.AddBar(((parametersCanvasBar_t *)item)->x, ((parametersCanvasBar_t *)item)->y, ((parametersCanvasBar_t *)item)->width, ((parametersCanvasBar_t *)item)->height, ((parametersCanvasBar_t *)item)->color);
|
||||
tftCanvas.addBar(((parametersCanvasBar_t *)item)->x, ((parametersCanvasBar_t *)item)->y, ((parametersCanvasBar_t *)item)->width, ((parametersCanvasBar_t *)item)->height, ((parametersCanvasBar_t *)item)->color);
|
||||
break;
|
||||
case CANVAS_ADD_RECTANGLE:
|
||||
Canvas.AddRectangle(((parametersCanvasRectangle_t *)item)->x, ((parametersCanvasRectangle_t *)item)->y, ((parametersCanvasRectangle_t *)item)->width, ((parametersCanvasRectangle_t *)item)->height, ((parametersCanvasRectangle_t *)item)->color);
|
||||
case CANVAS_ADD_RECT:
|
||||
tftCanvas.addRect(((parametersCanvasRectangle_t *)item)->x, ((parametersCanvasRectangle_t *)item)->y, ((parametersCanvasRectangle_t *)item)->width, ((parametersCanvasRectangle_t *)item)->height, ((parametersCanvasRectangle_t *)item)->color);
|
||||
break;
|
||||
}
|
||||
item = ((parametersCanvasBackground_t *)item)->nextParameter;
|
||||
}
|
||||
|
||||
if (Canvas.ToScreen()) task->state = TASK_STATE_COMPLETED;
|
||||
if (tftCanvas.toScreen()) task->state = TASK_STATE_COMPLETED;
|
||||
}
|
||||
|
||||
void TFT_Queue::fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) {
|
||||
@ -265,7 +265,7 @@ void TFT_Queue::add_text(uint16_t x, uint16_t y, uint16_t color, const uint16_t
|
||||
end_of_queue += sizeof(parametersCanvasText_t);
|
||||
|
||||
uint16_t *character = (uint16_t *)end_of_queue;
|
||||
/* TODO: Deal with maxWidth */
|
||||
// TODO: Deal with maxWidth
|
||||
while ((*character++ = *pointer++) != 0);
|
||||
end_of_queue = (uint8_t *)character;
|
||||
|
||||
@ -373,7 +373,7 @@ void TFT_Queue::add_rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t h
|
||||
parametersCanvasRectangle_t *parameters = (parametersCanvasRectangle_t *)end_of_queue;
|
||||
last_parameter = end_of_queue;
|
||||
|
||||
parameters->type = CANVAS_ADD_RECTANGLE;
|
||||
parameters->type = CANVAS_ADD_RECT;
|
||||
parameters->x = x;
|
||||
parameters->y = y;
|
||||
parameters->width = width;
|
||||
|
@ -47,7 +47,7 @@ enum CanvasSubtype : uint8_t {
|
||||
CANVAS_ADD_TEXT,
|
||||
CANVAS_ADD_IMAGE,
|
||||
CANVAS_ADD_BAR,
|
||||
CANVAS_ADD_RECTANGLE,
|
||||
CANVAS_ADD_RECT,
|
||||
};
|
||||
|
||||
typedef struct __attribute__((__packed__)) {
|
||||
|
@ -67,7 +67,7 @@ struct duration_t {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Formats the duration as years
|
||||
* @brief Format the duration as years
|
||||
* @return The number of years
|
||||
*/
|
||||
inline uint8_t year() const {
|
||||
@ -75,7 +75,7 @@ struct duration_t {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Formats the duration as days
|
||||
* @brief Format the duration as days
|
||||
* @return The number of days
|
||||
*/
|
||||
inline uint16_t day() const {
|
||||
@ -83,7 +83,7 @@ struct duration_t {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Formats the duration as hours
|
||||
* @brief Format the duration as hours
|
||||
* @return The number of hours
|
||||
*/
|
||||
inline uint32_t hour() const {
|
||||
@ -91,7 +91,7 @@ struct duration_t {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Formats the duration as minutes
|
||||
* @brief Format the duration as minutes
|
||||
* @return The number of minutes
|
||||
*/
|
||||
inline uint32_t minute() const {
|
||||
@ -99,7 +99,7 @@ struct duration_t {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Formats the duration as seconds
|
||||
* @brief Format the duration as seconds
|
||||
* @return The number of seconds
|
||||
*/
|
||||
inline uint32_t second() const {
|
||||
@ -112,7 +112,7 @@ struct duration_t {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Formats the duration as a string
|
||||
* @brief Format the duration as a string
|
||||
* @details String will be formatted using a "full" representation of duration
|
||||
*
|
||||
* @param buffer The array pointed to must be able to accommodate 22 bytes
|
||||
@ -142,7 +142,7 @@ struct duration_t {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Formats the duration as a string
|
||||
* @brief Format the duration as a string
|
||||
* @details String will be formatted using a "digital" representation of duration
|
||||
*
|
||||
* @param buffer The array pointed to must be able to accommodate 10 bytes
|
||||
|
Loading…
Reference in New Issue
Block a user