Move ExtUI subfolders up a level (#21820)
This commit is contained in:
committed by
Scott Lahteine
parent
0b3420a012
commit
d3e902af76
271
Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp
Normal file
271
Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp
Normal file
@ -0,0 +1,271 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if HAS_DGUS_LCD
|
||||
|
||||
#if HOTENDS > 2
|
||||
#warning "More than 2 hotends not implemented on DGUS Display UI."
|
||||
#endif
|
||||
|
||||
#include "../ui_api.h"
|
||||
|
||||
#include "../../../MarlinCore.h"
|
||||
#include "../../../module/motion.h"
|
||||
#include "../../../gcode/queue.h"
|
||||
#include "../../../module/planner.h"
|
||||
#include "../../../libs/duration_t.h"
|
||||
#include "../../../module/printcounter.h"
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
#include "DGUSDisplay.h"
|
||||
#include "DGUSVPVariable.h"
|
||||
#include "DGUSDisplayDef.h"
|
||||
|
||||
DGUSDisplay dgusdisplay;
|
||||
|
||||
// Preamble... 2 Bytes, usually 0x5A 0xA5, but configurable
|
||||
constexpr uint8_t DGUS_HEADER1 = 0x5A;
|
||||
constexpr uint8_t DGUS_HEADER2 = 0xA5;
|
||||
|
||||
constexpr uint8_t DGUS_CMD_WRITEVAR = 0x82;
|
||||
constexpr uint8_t DGUS_CMD_READVAR = 0x83;
|
||||
|
||||
#if ENABLED(DEBUG_DGUSLCD)
|
||||
bool dguslcd_local_debug; // = false;
|
||||
#endif
|
||||
|
||||
void DGUSDisplay::InitDisplay() {
|
||||
#ifndef LCD_BAUDRATE
|
||||
#define LCD_BAUDRATE 115200
|
||||
#endif
|
||||
LCD_SERIAL.begin(LCD_BAUDRATE);
|
||||
|
||||
if (TERN1(POWER_LOSS_RECOVERY, !recovery.valid())) { // If no Power-Loss Recovery is needed...
|
||||
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));
|
||||
}
|
||||
|
||||
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);
|
||||
while (valueslen--) {
|
||||
char x;
|
||||
if (!strend) x = *myvalues++;
|
||||
if ((isstr && !x) || strend) {
|
||||
strend = true;
|
||||
x = ' ';
|
||||
}
|
||||
LCD_SERIAL.write(x);
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_MKS)
|
||||
void DGUSDisplay::MKS_WriteVariable(uint16_t adr, uint8_t value) {
|
||||
WriteVariable(adr, static_cast<const void *>(&value), sizeof(uint8_t));
|
||||
}
|
||||
#endif
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, long value) {
|
||||
union { long l; char lb[4]; } endian;
|
||||
char tmp[4];
|
||||
endian.l = value;
|
||||
tmp[0] = endian.lb[3];
|
||||
tmp[1] = endian.lb[2];
|
||||
tmp[2] = endian.lb[1];
|
||||
tmp[3] = endian.lb[0];
|
||||
WriteVariable(adr, static_cast<const void*>(&tmp), sizeof(long));
|
||||
}
|
||||
|
||||
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);
|
||||
while (valueslen--) {
|
||||
char x;
|
||||
if (!strend) x = pgm_read_byte(myvalues++);
|
||||
if ((isstr && !x) || strend) {
|
||||
strend = true;
|
||||
x = ' ';
|
||||
}
|
||||
LCD_SERIAL.write(x);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSDisplay::ProcessRx() {
|
||||
|
||||
#if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
|
||||
if (!LCD_SERIAL.available() && LCD_SERIAL.buffer_overruns()) {
|
||||
// Overrun, but reset the flag only when the buffer is empty
|
||||
// We want to extract as many as valid datagrams possible...
|
||||
DEBUG_ECHOPGM("OVFL");
|
||||
rx_datagram_state = DGUS_IDLE;
|
||||
//LCD_SERIAL.reset_rx_overun();
|
||||
LCD_SERIAL.flush();
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t receivedbyte;
|
||||
while (LCD_SERIAL.available()) {
|
||||
switch (rx_datagram_state) {
|
||||
|
||||
case DGUS_IDLE: // Waiting for the first header byte
|
||||
receivedbyte = LCD_SERIAL.read();
|
||||
//DEBUG_ECHOPAIR("< ",x);
|
||||
if (DGUS_HEADER1 == receivedbyte) rx_datagram_state = DGUS_HEADER1_SEEN;
|
||||
break;
|
||||
|
||||
case DGUS_HEADER1_SEEN: // Waiting for the second header byte
|
||||
receivedbyte = LCD_SERIAL.read();
|
||||
//DEBUG_ECHOPAIR(" ",x);
|
||||
rx_datagram_state = (DGUS_HEADER2 == receivedbyte) ? DGUS_HEADER2_SEEN : DGUS_IDLE;
|
||||
break;
|
||||
|
||||
case DGUS_HEADER2_SEEN: // Waiting for the length byte
|
||||
rx_datagram_len = LCD_SERIAL.read();
|
||||
DEBUG_ECHOPAIR(" (", rx_datagram_len, ") ");
|
||||
|
||||
// Telegram min len is 3 (command and one word of payload)
|
||||
rx_datagram_state = WITHIN(rx_datagram_len, 3, DGUS_RX_BUFFER_SIZE) ? DGUS_WAIT_TELEGRAM : DGUS_IDLE;
|
||||
break;
|
||||
|
||||
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();
|
||||
|
||||
DEBUG_ECHOPAIR("# ", command);
|
||||
|
||||
uint8_t readlen = rx_datagram_len - 1; // command is part of len.
|
||||
unsigned char tmp[rx_datagram_len - 1];
|
||||
unsigned char *ptmp = tmp;
|
||||
while (readlen--) {
|
||||
receivedbyte = LCD_SERIAL.read();
|
||||
DEBUG_ECHOPAIR(" ", receivedbyte);
|
||||
*ptmp++ = receivedbyte;
|
||||
}
|
||||
DEBUG_ECHOPGM(" # ");
|
||||
// mostly we'll get this: 5A A5 03 82 4F 4B -- ACK on 0x82, so discard it.
|
||||
if (command == DGUS_CMD_WRITEVAR && 'O' == tmp[0] && 'K' == tmp[1]) {
|
||||
DEBUG_ECHOLNPGM(">");
|
||||
rx_datagram_state = DGUS_IDLE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* AutoUpload, (and answer to) Command 0x83 :
|
||||
| tmp[0 1 2 3 4 ... ]
|
||||
| Example 5A A5 06 83 20 01 01 78 01 ……
|
||||
| / / | | \ / | \ \
|
||||
| Header | | | | \_____\_ DATA (Words!)
|
||||
| DatagramLen / VPAdr |
|
||||
| Command DataLen (in Words) */
|
||||
if (command == DGUS_CMD_READVAR) {
|
||||
const uint16_t vp = tmp[0] << 8 | tmp[1];
|
||||
//const uint8_t dlen = tmp[2] << 1; // Convert to Bytes. (Display works with words)
|
||||
//DEBUG_ECHOPAIR(" vp=", vp, " dlen=", dlen);
|
||||
DGUS_VP_Variable ramcopy;
|
||||
if (populate_VPVar(vp, &ramcopy)) {
|
||||
if (ramcopy.set_by_display_handler)
|
||||
ramcopy.set_by_display_handler(ramcopy, &tmp[3]);
|
||||
else
|
||||
DEBUG_ECHOLNPGM(" VPVar found, no handler.");
|
||||
}
|
||||
else
|
||||
DEBUG_ECHOLNPAIR(" VPVar not found:", vp);
|
||||
|
||||
rx_datagram_state = DGUS_IDLE;
|
||||
break;
|
||||
}
|
||||
|
||||
// discard anything else
|
||||
rx_datagram_state = DGUS_IDLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t DGUSDisplay::GetFreeTxBuffer() { return SERIAL_GET_TX_BUFFER_FREE(); }
|
||||
|
||||
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);
|
||||
LCD_SERIAL.write(cmd);
|
||||
LCD_SERIAL.write(adr >> 8);
|
||||
LCD_SERIAL.write(adr & 0xFF);
|
||||
}
|
||||
|
||||
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 gcode commands.
|
||||
if (!no_reentrance) {
|
||||
no_reentrance = true;
|
||||
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::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) {
|
||||
// DEBUG_ECHOPAIR("populate_VPVar ", VP);
|
||||
const DGUS_VP_Variable *pvp = DGUSLCD_FindVPVar(VP);
|
||||
// DEBUG_ECHOLNPAIR(" pvp ", (uint16_t )pvp);
|
||||
if (!pvp) return false;
|
||||
memcpy_P(ramcopy, pvp, sizeof(DGUS_VP_Variable));
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // HAS_DGUS_LCD
|
123
Marlin/src/lcd/extui/dgus/DGUSDisplay.h
Normal file
123
Marlin/src/lcd/extui/dgus/DGUSDisplay.h
Normal file
@ -0,0 +1,123 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* lcd/extui/dgus/DGUSDisplay.h
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include <stdlib.h> // size_t
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
#include "../../../module/probe.h"
|
||||
#endif
|
||||
#include "DGUSVPVariable.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
|
||||
//#define DEBUG_DGUSLCD
|
||||
#define DEBUG_OUT ENABLED(DEBUG_DGUSLCD)
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
typedef enum : uint8_t {
|
||||
DGUS_IDLE, //< waiting for DGUS_HEADER1.
|
||||
DGUS_HEADER1_SEEN, //< DGUS_HEADER1 received
|
||||
DGUS_HEADER2_SEEN, //< DGUS_HEADER2 received
|
||||
DGUS_WAIT_TELEGRAM, //< LEN received, Waiting for to receive all bytes.
|
||||
} rx_datagram_state_t;
|
||||
|
||||
// Low-Level access to the display.
|
||||
class DGUSDisplay {
|
||||
public:
|
||||
|
||||
DGUSDisplay() = default;
|
||||
|
||||
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 MKS_WriteVariable(uint16_t adr, uint8_t 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));
|
||||
}
|
||||
|
||||
template<typename T, void(*Setter)(const float V, const T), T selector>
|
||||
static void GetVariable(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t newvalue = swap16(*(uint16_t*)val_ptr);
|
||||
Setter(newvalue, selector);
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
// 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);
|
||||
|
||||
// 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();
|
||||
|
||||
// Checks two things: Can we confirm the presence of the display and has we initiliazed it.
|
||||
// (both boils down that the display answered to our chatting)
|
||||
static inline 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 inline uint16_t swap16(const uint16_t value) { return (value & 0xFFU) << 8U | (value >> 8U); }
|
||||
static rx_datagram_state_t rx_datagram_state;
|
||||
static uint8_t rx_datagram_len;
|
||||
static bool Initialized, no_reentrance;
|
||||
};
|
||||
|
||||
#define GET_VARIABLE(f, t, V...) (&DGUSDisplay::GetVariable<decltype(t), f, t, ##V>)
|
||||
#define SET_VARIABLE(f, t, V...) (&DGUSDisplay::SetVariable<decltype(t), f, t, ##V>)
|
||||
|
||||
extern DGUSDisplay dgusdisplay;
|
||||
|
||||
// compile-time x^y
|
||||
constexpr float cpow(const float x, const int y) { return y == 0 ? 1.0 : x * cpow(x, y - 1); }
|
||||
|
||||
/// Find the flash address of a DGUS_VP_Variable for the VP.
|
||||
const DGUS_VP_Variable* DGUSLCD_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);
|
57
Marlin/src/lcd/extui/dgus/DGUSDisplayDef.h
Normal file
57
Marlin/src/lcd/extui/dgus/DGUSDisplayDef.h
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* lcd/extui/dgus/DGUSDisplayDef.h
|
||||
* Defines the interaction between Marlin and the display firmware
|
||||
*/
|
||||
|
||||
#include "DGUSVPVariable.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Information on which screen which VP is displayed.
|
||||
// As this is a sparse table, two arrays are needed:
|
||||
// one to list the VPs of one screen and one to map screens to the lists.
|
||||
// (Strictly this would not be necessary, but allows to only send data the display needs and reducing load on Marlin)
|
||||
struct VPMapping {
|
||||
const uint8_t screen;
|
||||
const uint16_t *VPList; // The list is null-terminated.
|
||||
};
|
||||
|
||||
extern const struct VPMapping VPMap[];
|
||||
|
||||
// List of VPs handled by Marlin / The Display.
|
||||
extern const struct DGUS_VP_Variable ListOfVP[];
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_ORIGIN)
|
||||
#include "origin/DGUSDisplayDef.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_MKS)
|
||||
#include "mks/DGUSDisplayDef.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_FYSETC)
|
||||
#include "fysetc/DGUSDisplayDef.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_HIPRECY)
|
||||
#include "hiprecy/DGUSDisplayDef.h"
|
||||
#endif
|
777
Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp
Normal file
777
Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp
Normal file
@ -0,0 +1,777 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if HAS_DGUS_LCD
|
||||
|
||||
#include "DGUSScreenHandler.h"
|
||||
|
||||
#include "../../../MarlinCore.h"
|
||||
#include "../../../gcode/queue.h"
|
||||
#include "../../../libs/duration_t.h"
|
||||
#include "../../../module/settings.h"
|
||||
#include "../../../module/temperature.h"
|
||||
#include "../../../module/motion.h"
|
||||
#include "../../../module/planner.h"
|
||||
#include "../../../module/printcounter.h"
|
||||
#include "../../../sd/cardreader.h"
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
DGUSScreenHandler ScreenHandler;
|
||||
|
||||
uint16_t DGUSScreenHandler::ConfirmVP;
|
||||
|
||||
DGUSLCD_Screens DGUSScreenHandler::current_screen;
|
||||
DGUSLCD_Screens DGUSScreenHandler::past_screens[NUM_PAST_SCREENS];
|
||||
uint8_t DGUSScreenHandler::update_ptr;
|
||||
uint16_t DGUSScreenHandler::skipVP;
|
||||
bool DGUSScreenHandler::ScreenComplete;
|
||||
|
||||
void (*DGUSScreenHandler::confirm_action_cb)() = nullptr;
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
int16_t DGUSScreenHandler::top_file = 0,
|
||||
DGUSScreenHandler::file_to_print = 0;
|
||||
static ExtUI::FileList filelist;
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
filament_data_t filament_data;
|
||||
#endif
|
||||
|
||||
void DGUSScreenHandler::sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *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);
|
||||
}
|
||||
if (populate_VPVar(VP_MSGSTR2, &ramcopy)) {
|
||||
ramcopy.memadr = (void*) line2;
|
||||
l2inflash ? DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::DGUSLCD_SendStringToDisplay(ramcopy);
|
||||
}
|
||||
if (populate_VPVar(VP_MSGSTR3, &ramcopy)) {
|
||||
ramcopy.memadr = (void*) line3;
|
||||
l3inflash ? DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::DGUSLCD_SendStringToDisplay(ramcopy);
|
||||
}
|
||||
if (populate_VPVar(VP_MSGSTR4, &ramcopy)) {
|
||||
ramcopy.memadr = (void*) line4;
|
||||
l4inflash ? DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::DGUSLCD_SendStringToDisplay(ramcopy);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleUserConfirmationPopUp(uint16_t VP, const char *line1, const char *line2, const char *line3, const char *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();
|
||||
|
||||
ConfirmVP = VP;
|
||||
sendinfoscreen(line1, line2, line3, line4, l1, l2, l3, l4);
|
||||
GotoScreen(DGUSLCD_SCREEN_CONFIRM);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::setstatusmessage(const char *msg) {
|
||||
DGUS_VP_Variable ramcopy;
|
||||
if (populate_VPVar(VP_M117, &ramcopy)) {
|
||||
ramcopy.memadr = (void*) msg;
|
||||
DGUSLCD_SendStringToDisplay(ramcopy);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::setstatusmessagePGM(PGM_P const msg) {
|
||||
DGUS_VP_Variable ramcopy;
|
||||
if (populate_VPVar(VP_M117, &ramcopy)) {
|
||||
ramcopy.memadr = (void*) msg;
|
||||
DGUSLCD_SendStringToDisplayPGM(ramcopy);
|
||||
}
|
||||
}
|
||||
|
||||
// Send an 8 bit or 16 bit value to the display.
|
||||
void DGUSScreenHandler::DGUSLCD_SendWordValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
//DEBUG_ECHOPAIR(" DGUS_LCD_SendWordValueToDisplay ", var.VP);
|
||||
//DEBUG_ECHOLNPAIR(" data ", *(uint16_t *)var.memadr);
|
||||
if (var.size > 1)
|
||||
dgusdisplay.WriteVariable(var.VP, *(int16_t*)var.memadr);
|
||||
else
|
||||
dgusdisplay.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) {
|
||||
if (var.memadr) {
|
||||
//DEBUG_ECHOPAIR(" DGUS_LCD_SendWordValueToDisplay ", var.VP);
|
||||
//DEBUG_ECHOLNPAIR(" data ", *(uint16_t *)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);
|
||||
}
|
||||
}
|
||||
|
||||
// Send the current print progress to the display.
|
||||
void DGUSScreenHandler::DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var) {
|
||||
//DEBUG_ECHOPAIR(" DGUSLCD_SendPrintProgressToDisplay ", var.VP);
|
||||
uint16_t tmp = ExtUI::getProgress_percent();
|
||||
//DEBUG_ECHOLNPAIR(" data ", tmp);
|
||||
dgusdisplay.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) {
|
||||
duration_t elapsed = print_job_timer.duration();
|
||||
char buf[32];
|
||||
elapsed.toString(buf);
|
||||
dgusdisplay.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) {
|
||||
if (var.memadr) {
|
||||
uint16_t value = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("FAN value get:", value);
|
||||
*(uint8_t*)var.memadr = map(constrain(value, 0, 100), 0, 100, 0, 255);
|
||||
DEBUG_ECHOLNPAIR("FAN value change:", *(uint8_t*)var.memadr);
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
char *tmp = (char*) var.memadr;
|
||||
dgusdisplay.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) {
|
||||
char *tmp = (char*) var.memadr;
|
||||
dgusdisplay.WriteVariablePGM(var.VP, tmp, var.size, true);
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::DGUSLCD_SendTemperaturePID(DGUS_VP_Variable &var) {
|
||||
float value = *(float *)var.memadr;
|
||||
value /= 10;
|
||||
float valuesend = 0;
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_PID_P: valuesend = value; break;
|
||||
case VP_E0_PID_I: valuesend = unscalePID_i(value); break;
|
||||
case VP_E0_PID_D: valuesend = unscalePID_d(value); break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_PID_P: valuesend = value; break;
|
||||
case VP_E1_PID_I: valuesend = unscalePID_i(value); break;
|
||||
case VP_E1_PID_D: valuesend = unscalePID_d(value); break;
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
case VP_BED_PID_P: valuesend = value; break;
|
||||
case VP_BED_PID_I: valuesend = unscalePID_i(value); break;
|
||||
case VP_BED_PID_D: valuesend = unscalePID_d(value); break;
|
||||
#endif
|
||||
}
|
||||
|
||||
valuesend *= cpow(10, 1);
|
||||
union { int16_t i; char lb[2]; } endian;
|
||||
|
||||
char tmp[2];
|
||||
endian.i = valuesend;
|
||||
tmp[0] = endian.lb[1];
|
||||
tmp[1] = endian.lb[0];
|
||||
dgusdisplay.WriteVariable(var.VP, tmp, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
|
||||
// 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) {
|
||||
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);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_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);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Send fan status value to the display.
|
||||
#if HAS_FAN
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
DEBUG_ECHOPAIR(" DGUSLCD_SendFanStatusToDisplay ", var.VP);
|
||||
DEBUG_ECHOLNPAIR(" data ", *(uint8_t *)var.memadr);
|
||||
uint16_t data_to_send = 0;
|
||||
if (*(uint8_t *) var.memadr) data_to_send = 1;
|
||||
dgusdisplay.WriteVariable(var.VP, data_to_send);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Send heater status value to the display.
|
||||
void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
DEBUG_ECHOPAIR(" DGUSLCD_SendHeaterStatusToDisplay ", var.VP);
|
||||
DEBUG_ECHOLNPAIR(" data ", *(int16_t *)var.memadr);
|
||||
uint16_t data_to_send = 0;
|
||||
if (*(int16_t *) var.memadr) data_to_send = 1;
|
||||
dgusdisplay.WriteVariable(var.VP, data_to_send);
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_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;
|
||||
//DEBUG_ECHOPAIR(" DGUSLCD_SendWaitingStatusToDisplay ", var.VP);
|
||||
//DEBUG_ECHOLNPAIR(" data ", swap16(index));
|
||||
if (period++ > DGUS_UI_WAITING_STATUS_PERIOD) {
|
||||
dgusdisplay.WriteVariable(var.VP, index);
|
||||
//DEBUG_ECHOLNPAIR(" data ", swap16(index));
|
||||
if (++index >= DGUS_UI_WAITING_STATUS) index = 0;
|
||||
period = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
// if we are printing, we jump to two screens after the requested one.
|
||||
// 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);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't let the user in the dark why there is no reaction.
|
||||
if (!ExtUI::isMediaInserted()) {
|
||||
setstatusmessagePGM(GET_TEXT(MSG_NO_MEDIA));
|
||||
return;
|
||||
}
|
||||
if (card.flag.abort_sd_printing) {
|
||||
setstatusmessagePGM(GET_TEXT(MSG_MEDIA_ABORTING));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable& var, void *val_ptr) {
|
||||
auto old_top = top_file;
|
||||
const int16_t scroll = (int16_t)swap16(*(uint16_t*)val_ptr);
|
||||
if (scroll) {
|
||||
top_file += scroll;
|
||||
DEBUG_ECHOPAIR("new topfile calculated:", top_file);
|
||||
if (top_file < 0) {
|
||||
top_file = 0;
|
||||
DEBUG_ECHOLNPGM("Top of filelist reached");
|
||||
}
|
||||
else {
|
||||
int16_t max_top = filelist.count() - DGUS_SD_FILESPERSCREEN;
|
||||
NOLESS(max_top, 0);
|
||||
NOMORE(top_file, max_top);
|
||||
}
|
||||
DEBUG_ECHOPAIR("new topfile adjusted:", top_file);
|
||||
}
|
||||
else if (!filelist.isAtRootDir()) {
|
||||
IF_DISABLED(DGUS_LCD_UI_MKS, filelist.upDir());
|
||||
top_file = 0;
|
||||
ForceCompleteUpdate();
|
||||
}
|
||||
|
||||
if (old_top != top_file) ForceCompleteUpdate();
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
ExtUI::stopPrint();
|
||||
GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_PrintTune(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);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardError() {
|
||||
DGUSScreenHandler::SDCardRemoved();
|
||||
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("SD card error"), nullptr, true, true, true, true);
|
||||
SetupConfirmAction(nullptr);
|
||||
GotoScreen(DGUSLCD_SCREEN_POPUP);
|
||||
}
|
||||
#endif // SDSUPPORT
|
||||
|
||||
void DGUSScreenHandler::ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DGUS_VP_Variable ramcopy;
|
||||
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 *ret;
|
||||
const struct VPMapping *map = VPMap;
|
||||
while ((ret = (uint16_t*) pgm_read_ptr(&(map->VPList)))) {
|
||||
if (pgm_read_byte(&(map->screen)) == screen) return ret;
|
||||
map++;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const DGUS_VP_Variable* DGUSLCD_FindVPVar(const uint16_t vp) {
|
||||
const DGUS_VP_Variable *ret = ListOfVP;
|
||||
do {
|
||||
const uint16_t vpcheck = pgm_read_word(&(ret->VP));
|
||||
if (vpcheck == 0) break;
|
||||
if (vpcheck == vp) return ret;
|
||||
++ret;
|
||||
} while (1);
|
||||
|
||||
DEBUG_ECHOLNPAIR("FindVPVar NOT FOUND ", vp);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::ScreenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!ExtUI::isPrinting()) {
|
||||
ScreenChangeHook(var, val_ptr);
|
||||
dgusdisplay.RequestScreen(current_screen);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
thermalManager.disable_all_heaters();
|
||||
ForceCompleteUpdate(); // hint to send all data.
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
celsius_t newvalue = swap16(*(uint16_t*)val_ptr);
|
||||
celsius_t acceptedvalue;
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_T_E0_Set:
|
||||
NOMORE(newvalue, HEATER_0_MAXTEMP);
|
||||
thermalManager.setTargetHotend(newvalue, 0);
|
||||
acceptedvalue = thermalManager.degTargetHotend(0);
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_T_E1_Set:
|
||||
NOMORE(newvalue, HEATER_1_MAXTEMP);
|
||||
thermalManager.setTargetHotend(newvalue, 1);
|
||||
acceptedvalue = thermalManager.degTargetHotend(1);
|
||||
break;
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
case VP_T_Bed_Set:
|
||||
NOMORE(newvalue, BED_MAXTEMP);
|
||||
thermalManager.setTargetBed(newvalue);
|
||||
acceptedvalue = thermalManager.degTargetBed();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
// reply to display the new value to update the view if the new value was rejected by the Thermal Manager.
|
||||
if (newvalue != acceptedvalue && var.send_to_display_handler) var.send_to_display_handler(var);
|
||||
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) {
|
||||
#if EXTRUDERS
|
||||
uint16_t newvalue = swap16(*(uint16_t*)val_ptr);
|
||||
uint8_t target_extruder;
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_Flowrate_E0: target_extruder = 0; break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_Flowrate_E1: target_extruder = 1; break;
|
||||
#endif
|
||||
}
|
||||
|
||||
planner.set_flow(target_extruder, newvalue);
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
#else
|
||||
UNUSED(var); UNUSED(val_ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleManualExtrude");
|
||||
|
||||
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
|
||||
float target = movevalue * 0.01f;
|
||||
ExtUI::extruder_t target_extruder;
|
||||
|
||||
switch (var.VP) {
|
||||
#if HOTENDS >= 1
|
||||
case VP_MOVE_E0: target_extruder = ExtUI::extruder_t::E0; break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_MOVE_E1: target_extruder = ExtUI::extruder_t::E1; break;
|
||||
#endif
|
||||
default: return;
|
||||
}
|
||||
|
||||
target += ExtUI::getAxisPosition_mm(target_extruder);
|
||||
ExtUI::setAxisPosition_mm(target, target_extruder);
|
||||
skipVP = var.VP;
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
void DGUSScreenHandler::HandleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleManualMoveOption");
|
||||
*(uint16_t*)var.memadr = swap16(*(uint16_t*)val_ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
void DGUSScreenHandler::HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleMotorLockUnlock");
|
||||
|
||||
char buf[4];
|
||||
const int16_t lock = swap16(*(uint16_t*)val_ptr);
|
||||
strcpy_P(buf, lock ? PSTR("M18") : PSTR("M17"));
|
||||
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleSettings(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleSettings");
|
||||
uint16_t value = swap16(*(uint16_t*)val_ptr);
|
||||
switch (value) {
|
||||
default: break;
|
||||
case 1:
|
||||
TERN_(PRINTCOUNTER, print_job_timer.initStats());
|
||||
settings.reset();
|
||||
settings.save();
|
||||
break;
|
||||
case 2: settings.load(); break;
|
||||
case 3: settings.save(); break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleStepPerMMChanged");
|
||||
|
||||
uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("value_raw:", value_raw);
|
||||
float value = (float)value_raw / 10;
|
||||
ExtUI::axis_t axis;
|
||||
switch (var.VP) {
|
||||
case VP_X_STEP_PER_MM: axis = ExtUI::axis_t::X; break;
|
||||
case VP_Y_STEP_PER_MM: axis = ExtUI::axis_t::Y; break;
|
||||
case VP_Z_STEP_PER_MM: axis = ExtUI::axis_t::Z; break;
|
||||
default: return;
|
||||
}
|
||||
DEBUG_ECHOLNPAIR_F("value:", value);
|
||||
ExtUI::setAxisSteps_per_mm(value, axis);
|
||||
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisSteps_per_mm(axis));
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
return;
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleStepPerMMExtruderChanged");
|
||||
|
||||
uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("value_raw:", value_raw);
|
||||
float value = (float)value_raw / 10;
|
||||
ExtUI::extruder_t extruder;
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_STEP_PER_MM: extruder = ExtUI::extruder_t::E0; break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_STEP_PER_MM: extruder = ExtUI::extruder_t::E1; break;
|
||||
#endif
|
||||
}
|
||||
DEBUG_ECHOLNPAIR_F("value:", value);
|
||||
ExtUI::setAxisSteps_per_mm(value, extruder);
|
||||
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisSteps_per_mm(extruder));
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandlePIDAutotune");
|
||||
|
||||
char buf[32] = {0};
|
||||
|
||||
switch (var.VP) {
|
||||
default: break;
|
||||
#if ENABLED(PIDTEMP)
|
||||
#if HOTENDS >= 1
|
||||
case VP_PID_AUTOTUNE_E0: // Autotune Extruder 0
|
||||
sprintf_P(buf, PSTR("M303 E%d C5 S210 U1"), ExtUI::extruder_t::E0);
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_PID_AUTOTUNE_E1:
|
||||
sprintf_P(buf, PSTR("M303 E%d C5 S210 U1"), ExtUI::extruder_t::E1);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
case VP_PID_AUTOTUNE_BED:
|
||||
sprintf_P(buf, PSTR("M303 E-1 C5 S70 U1"));
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (buf[0]) queue.enqueue_one_now(buf);
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
sendinfoscreen(PSTR("PID is autotuning"), PSTR("please wait"), NUL_STR, NUL_STR, true, true, true, true);
|
||||
GotoScreen(DGUSLCD_SCREEN_WAITING);
|
||||
#endif
|
||||
}
|
||||
#endif // HAS_PID_HEATING
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
void DGUSScreenHandler::HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleProbeOffsetZChanged");
|
||||
|
||||
const float offset = float(int16_t(swap16(*(uint16_t*)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
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_FAN
|
||||
void DGUSScreenHandler::HandleFanControl(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleFanControl");
|
||||
*(uint8_t*)var.memadr = *(uint8_t*)var.memadr > 0 ? 0 : 255;
|
||||
}
|
||||
#endif
|
||||
|
||||
void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleHeaterControl");
|
||||
|
||||
uint8_t preheat_temp = 0;
|
||||
switch (var.VP) {
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_CONTROL:
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_CONTROL:
|
||||
#endif
|
||||
#if HOTENDS >= 3
|
||||
case VP_E2_CONTROL:
|
||||
#endif
|
||||
preheat_temp = PREHEAT_1_TEMP_HOTEND;
|
||||
break;
|
||||
|
||||
case VP_BED_CONTROL:
|
||||
preheat_temp = PREHEAT_1_TEMP_BED;
|
||||
break;
|
||||
}
|
||||
|
||||
*(int16_t*)var.memadr = *(int16_t*)var.memadr > 0 ? 0 : preheat_temp;
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
|
||||
void DGUSScreenHandler::HandlePreheat(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandlePreheat");
|
||||
|
||||
uint8_t e_temp = 0;
|
||||
#if ENABLED(HAS_HEATED_BED)
|
||||
uint8_t bed_temp = 0;
|
||||
#endif
|
||||
const uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
|
||||
switch (preheat_option) {
|
||||
default:
|
||||
case 0: // Preheat PLA
|
||||
#if defined(PREHEAT_1_TEMP_HOTEND) && defined(PREHEAT_1_TEMP_BED)
|
||||
e_temp = PREHEAT_1_TEMP_HOTEND;
|
||||
TERN_(HAS_HEATED_BED, bed_temp = PREHEAT_1_TEMP_BED);
|
||||
#endif
|
||||
break;
|
||||
case 1: // Preheat ABS
|
||||
#if defined(PREHEAT_2_TEMP_HOTEND) && defined(PREHEAT_2_TEMP_BED)
|
||||
e_temp = PREHEAT_2_TEMP_HOTEND;
|
||||
TERN_(HAS_HEATED_BED, bed_temp = PREHEAT_2_TEMP_BED);
|
||||
#endif
|
||||
break;
|
||||
case 2: // Preheat PET
|
||||
#if defined(PREHEAT_3_TEMP_HOTEND) && defined(PREHEAT_3_TEMP_BED)
|
||||
e_temp = PREHEAT_3_TEMP_HOTEND;
|
||||
TERN_(HAS_HEATED_BED, bed_temp = PREHEAT_3_TEMP_BED);
|
||||
#endif
|
||||
break;
|
||||
case 3: // Preheat FLEX
|
||||
#if defined(PREHEAT_4_TEMP_HOTEND) && defined(PREHEAT_4_TEMP_BED)
|
||||
e_temp = PREHEAT_4_TEMP_HOTEND;
|
||||
TERN_(HAS_HEATED_BED, bed_temp = PREHEAT_4_TEMP_BED);
|
||||
#endif
|
||||
break;
|
||||
case 7: break; // Custom preheat
|
||||
case 9: break; // Cool down
|
||||
}
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_BED_PREHEAT:
|
||||
thermalManager.setTargetHotend(e_temp, 0);
|
||||
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(bed_temp));
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_BED_PREHEAT:
|
||||
thermalManager.setTargetHotend(e_temp, 1);
|
||||
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(bed_temp));
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Go to the preheat screen to show the heating progress
|
||||
GotoScreen(DGUSLCD_SCREEN_PREHEAT);
|
||||
}
|
||||
|
||||
#endif // DGUS_PREHEAT_UI
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
|
||||
void DGUSScreenHandler::HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t value = swap16(*(uint16_t*)val_ptr);
|
||||
if (value) {
|
||||
queue.inject_P(PSTR("M1000"));
|
||||
dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), 32, true);
|
||||
GotoScreen(PLR_SCREEN_RECOVER);
|
||||
}
|
||||
else {
|
||||
recovery.cancel();
|
||||
GotoScreen(PLR_SCREEN_CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void DGUSScreenHandler::UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup) {
|
||||
DEBUG_ECHOLNPAIR("SetNewScreen: ", newscreen);
|
||||
if (!popup) {
|
||||
memmove(&past_screens[1], &past_screens[0], sizeof(past_screens) - 1);
|
||||
past_screens[0] = current_screen;
|
||||
}
|
||||
current_screen = newscreen;
|
||||
skipVP = 0;
|
||||
ForceCompleteUpdate();
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::PopToOldScreen() {
|
||||
DEBUG_ECHOLNPAIR("PopToOldScreen s=", past_screens[0]);
|
||||
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::UpdateScreenVPData() {
|
||||
DEBUG_ECHOPAIR(" UpdateScreenVPData Screen: ", current_screen);
|
||||
|
||||
const uint16_t *VPList = DGUSLCD_FindScreenVPMapList(current_screen);
|
||||
if (!VPList) {
|
||||
DEBUG_ECHOLNPAIR(" NO SCREEN FOR: ", current_screen);
|
||||
ScreenComplete = true;
|
||||
return; // nothing to do, likely a bug or boring screen.
|
||||
}
|
||||
|
||||
// Round-robin updating of all VPs.
|
||||
VPList += update_ptr;
|
||||
|
||||
bool sent_one = false;
|
||||
do {
|
||||
uint16_t VP = pgm_read_word(VPList);
|
||||
DEBUG_ECHOPAIR(" VP: ", VP);
|
||||
if (!VP) {
|
||||
update_ptr = 0;
|
||||
DEBUG_ECHOLNPGM(" UpdateScreenVPData done");
|
||||
ScreenComplete = true;
|
||||
return; // Screen completed.
|
||||
}
|
||||
|
||||
if (VP == skipVP) { skipVP = 0; continue; }
|
||||
|
||||
DGUS_VP_Variable rcpy;
|
||||
if (populate_VPVar(VP, &rcpy)) {
|
||||
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())) {
|
||||
//DEBUG_ECHOPAIR(" calling handler for ", rcpy.VP);
|
||||
sent_one = true;
|
||||
rcpy.send_to_display_handler(rcpy);
|
||||
}
|
||||
else {
|
||||
// auto x=dgusdisplay.GetFreeTxBuffer();
|
||||
//DEBUG_ECHOLNPAIR(" tx almost full: ", x);
|
||||
//DEBUG_ECHOPAIR(" update_ptr ", update_ptr);
|
||||
ScreenComplete = false;
|
||||
return; // please call again!
|
||||
}
|
||||
}
|
||||
|
||||
} while (++update_ptr, ++VPList, true);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::GotoScreen(DGUSLCD_Screens screen, bool ispopup) {
|
||||
dgusdisplay.RequestScreen(screen);
|
||||
UpdateNewScreen(screen, ispopup);
|
||||
}
|
||||
|
||||
void DGUSDisplay::RequestScreen(DGUSLCD_Screens screen) {
|
||||
DEBUG_ECHOLNPAIR("GotoScreen ", screen);
|
||||
const unsigned char gotoscreen[] = { 0x5A, 0x01, (unsigned char) (screen >> 8U), (unsigned char) (screen & 0xFFU) };
|
||||
WriteVariable(0x84, gotoscreen, sizeof(gotoscreen));
|
||||
}
|
||||
|
||||
#endif // HAS_DGUS_LCD
|
58
Marlin/src/lcd/extui/dgus/DGUSScreenHandler.h
Normal file
58
Marlin/src/lcd/extui/dgus/DGUSScreenHandler.h
Normal file
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* lcd/extui/dgus/DGUSScreenHandler.h
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include "../ui_api.h"
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
|
||||
typedef struct {
|
||||
ExtUI::extruder_t extruder; // which extruder to operate
|
||||
uint8_t action; // load or unload
|
||||
bool heated; // heating done ?
|
||||
float purge_length; // the length to extrude before unload, prevent filament jam
|
||||
} filament_data_t;
|
||||
|
||||
extern filament_data_t filament_data;
|
||||
|
||||
#endif
|
||||
|
||||
// endianness swap
|
||||
inline uint16_t swap16(const uint16_t value) { return (value & 0xFFU) << 8U | (value >> 8U); }
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_ORIGIN)
|
||||
#include "origin/DGUSScreenHandler.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_MKS)
|
||||
#include "mks/DGUSScreenHandler.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_FYSETC)
|
||||
#include "fysetc/DGUSScreenHandler.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_HIPRECY)
|
||||
#include "hiprecy/DGUSScreenHandler.h"
|
||||
#endif
|
||||
|
||||
extern DGUSScreenHandler ScreenHandler;
|
49
Marlin/src/lcd/extui/dgus/DGUSVPVariable.h
Normal file
49
Marlin/src/lcd/extui/dgus/DGUSVPVariable.h
Normal file
@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* DGUSVPVariable.h
|
||||
*
|
||||
* Created on: Feb 9, 2019
|
||||
* Author: tobi
|
||||
*/
|
||||
|
||||
struct DGUS_VP_Variable {
|
||||
uint16_t VP;
|
||||
void* memadr; // If nullptr, the value cannot be uploaded to the display.
|
||||
uint8_t size;
|
||||
|
||||
// Callback that will be called if the display modified the value.
|
||||
// nullptr makes it readonly for the display.
|
||||
void (*set_by_display_handler)(DGUS_VP_Variable &var, void *val_ptr);
|
||||
void (*send_to_display_handler)(DGUS_VP_Variable &var);
|
||||
|
||||
template<typename T>
|
||||
DGUS_VP_Variable& operator =(T &o) {
|
||||
*(T*)memadr = o; // warning this is not typesafe.
|
||||
// TODO: Call out the display or mark as dirty for the next update.
|
||||
return *this;
|
||||
}
|
||||
};
|
159
Marlin/src/lcd/extui/dgus/dgus_extui.cpp
Normal file
159
Marlin/src/lcd/extui/dgus/dgus_extui.cpp
Normal file
@ -0,0 +1,159 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* lcd/extui/dgus/dgus_extui.cpp
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if HAS_DGUS_LCD
|
||||
|
||||
#include "../ui_api.h"
|
||||
#include "DGUSDisplay.h"
|
||||
#include "DGUSDisplayDef.h"
|
||||
#include "DGUSScreenHandler.h"
|
||||
|
||||
namespace ExtUI {
|
||||
|
||||
void onStartup() {
|
||||
dgusdisplay.InitDisplay();
|
||||
ScreenHandler.UpdateScreenVPData();
|
||||
}
|
||||
|
||||
void onIdle() { ScreenHandler.loop(); }
|
||||
|
||||
void onPrinterKilled(PGM_P const error, PGM_P const component) {
|
||||
ScreenHandler.sendinfoscreen(GET_TEXT(MSG_HALTED), error, NUL_STR, GET_TEXT(MSG_PLEASE_RESET), true, true, true, true);
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_KILL);
|
||||
while (!ScreenHandler.loop()); // Wait while anything is left to be sent
|
||||
}
|
||||
|
||||
void onMediaInserted() { TERN_(SDSUPPORT, ScreenHandler.SDCardInserted()); }
|
||||
void onMediaError() { TERN_(SDSUPPORT, ScreenHandler.SDCardError()); }
|
||||
void onMediaRemoved() { TERN_(SDSUPPORT, ScreenHandler.SDCardRemoved()); }
|
||||
|
||||
void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
|
||||
void onPrintTimerStarted() {}
|
||||
void onPrintTimerPaused() {}
|
||||
void onPrintTimerStopped() {}
|
||||
void onFilamentRunout(const extruder_t extruder) {}
|
||||
|
||||
void onUserConfirmRequired(const char * const msg) {
|
||||
if (msg) {
|
||||
ScreenHandler.sendinfoscreen(PSTR("Please confirm."), nullptr, msg, nullptr, true, true, false, true);
|
||||
ScreenHandler.SetupConfirmAction(setUserConfirmed);
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP);
|
||||
}
|
||||
else if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_POPUP ) {
|
||||
ScreenHandler.SetupConfirmAction(nullptr);
|
||||
ScreenHandler.PopToOldScreen();
|
||||
}
|
||||
}
|
||||
|
||||
void onStatusChanged(const char * const msg) { ScreenHandler.setstatusmessage(msg); }
|
||||
|
||||
void onHomingStart() {}
|
||||
void onHomingComplete() {}
|
||||
void onPrintFinished() {}
|
||||
|
||||
void onFactoryReset() {}
|
||||
|
||||
void onStoreSettings(char *buff) {
|
||||
// Called when saving to EEPROM (i.e. M500). If the ExtUI needs
|
||||
// permanent data to be stored, it can write up to eeprom_data_size bytes
|
||||
// into buff.
|
||||
|
||||
// Example:
|
||||
// static_assert(sizeof(myDataStruct) <= eeprom_data_size);
|
||||
// memcpy(buff, &myDataStruct, sizeof(myDataStruct));
|
||||
}
|
||||
|
||||
void onLoadSettings(const char *buff) {
|
||||
// Called while loading settings from EEPROM. If the ExtUI
|
||||
// needs to retrieve data, it should copy up to eeprom_data_size bytes
|
||||
// from buff
|
||||
|
||||
// Example:
|
||||
// static_assert(sizeof(myDataStruct) <= eeprom_data_size);
|
||||
// memcpy(&myDataStruct, buff, sizeof(myDataStruct));
|
||||
}
|
||||
|
||||
void onPostprocessSettings() {
|
||||
// Called after loading or resetting stored settings
|
||||
}
|
||||
|
||||
void onConfigurationStoreWritten(bool success) {
|
||||
// Called after the entire EEPROM has been written,
|
||||
// whether successful or not.
|
||||
}
|
||||
|
||||
void onConfigurationStoreRead(bool success) {
|
||||
// Called after the entire EEPROM has been read,
|
||||
// whether successful or not.
|
||||
}
|
||||
|
||||
#if HAS_MESH
|
||||
void onMeshLevelingStart() {}
|
||||
|
||||
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
|
||||
// Called when any mesh points are updated
|
||||
}
|
||||
|
||||
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) {
|
||||
// Called to indicate a special condition
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLossResume() {
|
||||
// Called on resume from power-loss
|
||||
IF_DISABLED(DGUS_LCD_UI_MKS, ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POWER_LOSS));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void onPidTuning(const result_t rst) {
|
||||
// Called for temperature PID tuning result
|
||||
switch (rst) {
|
||||
case PID_BAD_EXTRUDER_NUM:
|
||||
ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_BAD_EXTRUDER_NUM));
|
||||
break;
|
||||
case PID_TEMP_TOO_HIGH:
|
||||
ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_TEMP_TOO_HIGH));
|
||||
break;
|
||||
case PID_TUNING_TIMEOUT:
|
||||
ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_TIMEOUT));
|
||||
break;
|
||||
case PID_DONE:
|
||||
ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_AUTOTUNE_DONE));
|
||||
break;
|
||||
}
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
}
|
||||
#endif
|
||||
|
||||
void onSteppersDisabled() {}
|
||||
void onSteppersEnabled() {}
|
||||
}
|
||||
|
||||
#endif // HAS_DGUS_LCD
|
486
Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp
Normal file
486
Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp
Normal file
@ -0,0 +1,486 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* DGUS VPs changed by George Fu in 2019 for Marlin */
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_FYSETC)
|
||||
|
||||
#include "DGUSDisplayDef.h"
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
#include "../../../../module/planner.h"
|
||||
|
||||
#include "../../ui_api.h"
|
||||
#include "../../../marlinui.h"
|
||||
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
uint16_t distanceToMove = 10;
|
||||
#endif
|
||||
|
||||
const uint16_t VPList_Boot[] PROGMEM = {
|
||||
VP_MARLIN_VERSION,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Main[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded. */
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set, VP_E0_STATUS,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set, VP_BED_STATUS,
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
VP_Fan0_Percentage, VP_FAN0_STATUS,
|
||||
#endif
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
VP_Fan0_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
VP_PrintProgress_Percentage,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Temp[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Status[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded */
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
VP_Fan0_Percentage,
|
||||
#endif
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
VP_Fan0_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
VP_PrintProgress_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Status2[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded */
|
||||
#if HOTENDS >= 1
|
||||
VP_Flowrate_E0,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_Flowrate_E1,
|
||||
#endif
|
||||
VP_PrintProgress_Percentage,
|
||||
VP_PrintTime,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Preheat[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_ManualMove[] PROGMEM = {
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_ManualExtrude[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
VP_EPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FanAndFeedrate[] PROGMEM = {
|
||||
VP_Feedrate_Percentage, VP_Fan0_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SD_FlowRates[] PROGMEM = {
|
||||
VP_Flowrate_E0, VP_Flowrate_E1,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Filament_heating[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
VP_E0_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
VP_E1_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Filament_load_unload[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_E0_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_E1_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SDFileList[] PROGMEM = {
|
||||
VP_SD_FileName0, VP_SD_FileName1, VP_SD_FileName2, VP_SD_FileName3, VP_SD_FileName4,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SD_PrintManipulation[] PROGMEM = {
|
||||
VP_PrintProgress_Percentage, VP_PrintTime,
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
VP_Fan0_Percentage,
|
||||
#if FAN_COUNT > 1
|
||||
VP_Fan1_Percentage,
|
||||
#endif
|
||||
#endif
|
||||
VP_Flowrate_E0,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SDPrintTune[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set, VP_Flowrate_E0,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set, VP_Flowrate_E1,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
VP_Feedrate_Percentage,
|
||||
VP_SD_Print_ProbeOffsetZ,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_StepPerMM[] PROGMEM = {
|
||||
VP_X_STEP_PER_MM,
|
||||
VP_Y_STEP_PER_MM,
|
||||
VP_Z_STEP_PER_MM,
|
||||
#if HOTENDS >= 1
|
||||
VP_E0_STEP_PER_MM,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_E1_STEP_PER_MM,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PIDE0[] PROGMEM = {
|
||||
#if ENABLED(PIDTEMP)
|
||||
VP_E0_PID_P,
|
||||
VP_E0_PID_I,
|
||||
VP_E0_PID_D,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PIDBED[] PROGMEM = {
|
||||
#if ENABLED(PIDTEMP)
|
||||
VP_BED_PID_P,
|
||||
VP_BED_PID_I,
|
||||
VP_BED_PID_D,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Infos[] PROGMEM = {
|
||||
VP_MARLIN_VERSION,
|
||||
VP_PrintTime,
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
VP_PrintAccTime,
|
||||
VP_PrintsTotal,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PIDTuningWaiting[] PROGMEM = {
|
||||
VP_WAITING_STATUS,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FLCPreheat[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FLCPrinting[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_SD_Print_ProbeOffsetZ,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Z_Offset[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_SD_Print_ProbeOffsetZ,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const struct VPMapping VPMap[] PROGMEM = {
|
||||
{ DGUSLCD_SCREEN_BOOT, VPList_Boot },
|
||||
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
|
||||
{ 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 },
|
||||
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
|
||||
};
|
||||
|
||||
const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
|
||||
|
||||
// Helper to define a DGUS_VP_Variable for common use cases.
|
||||
#define VPHELPER(VPADR, VPADRVAR, RXFPTR, TXFPTR ) { .VP=VPADR, .memadr=VPADRVAR, .size=sizeof(VPADRVAR), \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR }
|
||||
|
||||
// Helper to define a DGUS_VP_Variable when the sizeo of the var cannot be determined automaticalyl (eg. a string)
|
||||
#define VPHELPER_STR(VPADR, VPADRVAR, STRLEN, RXFPTR, TXFPTR ) { .VP=VPADR, .memadr=VPADRVAR, .size=STRLEN, \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR }
|
||||
|
||||
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),
|
||||
#if ENABLED(SDSUPPORT)
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, ScreenHandler.ScreenChangeHookIfSD, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr),
|
||||
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, &ScreenHandler.HandleAllHeatersOff, nullptr),
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_OPTION, &distanceToMove, &ScreenHandler.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),
|
||||
#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),
|
||||
#endif
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, &ScreenHandler.HandleMotorLockUnlock, nullptr),
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, &ScreenHandler.HandlePowerLossRecovery, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_SETTINGS, nullptr, &ScreenHandler.HandleSettings, nullptr),
|
||||
#if ENABLED(SINGLE_Z_CALIBRATION)
|
||||
VPHELPER(VP_Z_CALIBRATE, nullptr, &ScreenHandler.HandleZCalibration, nullptr),
|
||||
#endif
|
||||
|
||||
#if ENABLED(FIRST_LAYER_CAL)
|
||||
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, &ScreenHandler.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 },
|
||||
// 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 },
|
||||
|
||||
// Temperature Data
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
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),
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, &ScreenHandler.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),
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, &ScreenHandler.HandleFilamentOption, &ScreenHandler.HandleFilamentLoadUnload),
|
||||
#endif
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
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),
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, &ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_E1_FILAMENT_LOAD_UNLOAD, nullptr, &ScreenHandler.HandleFilamentOption, &ScreenHandler.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),
|
||||
#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),
|
||||
#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),
|
||||
REPEAT(FAN_COUNT, FAN_VPHELPER)
|
||||
#endif
|
||||
|
||||
// Feedrate
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, &ScreenHandler.DGUSLCD_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>),
|
||||
|
||||
// Print Progress
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay ),
|
||||
|
||||
// Print Time
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_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),
|
||||
#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>),
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
|
||||
// SDCard File listing.
|
||||
#if ENABLED(SDSUPPORT)
|
||||
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),
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, ScreenHandler.HandleProbeOffsetZChanged, &ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, ScreenHandler.DGUSLCD_SendWaitingStatusToDisplay),
|
||||
#endif
|
||||
|
||||
// Messages for the User, shared by the popup and the kill screen. They cant 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 },
|
||||
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
||||
#endif // DGUS_LCD_UI_FYSETC
|
296
Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.h
Normal file
296
Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.h
Normal file
@ -0,0 +1,296 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#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"
|
||||
DGUSLDC_SCREEN_UNUSED = 255
|
||||
};
|
||||
|
||||
// Display Memory layout used (T5UID)
|
||||
// Except system variables this is arbitrary, just to organize stuff....
|
||||
|
||||
// 0x0000 .. 0x0FFF -- System variables and reserved by the display
|
||||
// 0x1000 .. 0x1FFF -- Variables to never change location, regardless of UI Version
|
||||
// 0x2000 .. 0x2FFF -- Controls (VPs that will trigger some action)
|
||||
// 0x3000 .. 0x4FFF -- Marlin Data to be displayed
|
||||
// 0x5000 .. -- SPs (if we want to modify display elements, e.g change color or like) -- currently unused
|
||||
|
||||
// As there is plenty of space (at least most displays have >8k RAM), we do not pack them too tight,
|
||||
// so that we can keep variables nicely together in the address space.
|
||||
|
||||
// UI Version always on 0x1000...0x1002 so that the firmware can check this and bail out.
|
||||
constexpr uint16_t VP_UI_VERSION_MAJOR = 0x1000; // Major -- incremented when incompatible
|
||||
constexpr uint16_t VP_UI_VERSION_MINOR = 0x1001; // Minor -- incremented on new features, but compatible
|
||||
constexpr uint16_t VP_UI_VERSION_PATCH = 0x1002; // Patch -- fixed which do not change functionality.
|
||||
constexpr uint16_t VP_UI_FLAVOUR = 0x1010; // lets reserve 16 bytes here to determine if UI is suitable for this Marlin. tbd.
|
||||
|
||||
// Storage space for the Killscreen messages. 0x1100 - 0x1200 . Reused for the popup.
|
||||
constexpr uint16_t VP_MSGSTR1 = 0x1100;
|
||||
constexpr uint8_t VP_MSGSTR1_LEN = 0x20; // might be more place for it...
|
||||
constexpr uint16_t VP_MSGSTR2 = 0x1140;
|
||||
constexpr uint8_t VP_MSGSTR2_LEN = 0x20;
|
||||
constexpr uint16_t VP_MSGSTR3 = 0x1180;
|
||||
constexpr uint8_t VP_MSGSTR3_LEN = 0x20;
|
||||
constexpr uint16_t VP_MSGSTR4 = 0x11C0;
|
||||
constexpr uint8_t VP_MSGSTR4_LEN = 0x20;
|
||||
|
||||
// Screenchange request for screens that only make sense when printer is idle.
|
||||
// e.g movement is only allowed if printer is not printing.
|
||||
// Marlin must confirm by setting the screen manually.
|
||||
constexpr uint16_t VP_SCREENCHANGE_ASK = 0x2000;
|
||||
constexpr uint16_t VP_SCREENCHANGE = 0x2001; // Key-Return button to new menu pressed. Data contains target screen in low byte and info in high byte.
|
||||
constexpr uint16_t VP_TEMP_ALL_OFF = 0x2002; // Turn all heaters off. Value arbitrary ;)=
|
||||
constexpr uint16_t VP_SCREENCHANGE_WHENSD = 0x2003; // "Print" Button touched -- go only there if there is an SD Card.
|
||||
|
||||
constexpr uint16_t VP_CONFIRMED = 0x2010; // OK on confirm screen.
|
||||
|
||||
// Buttons on the SD-Card File listing.
|
||||
constexpr uint16_t VP_SD_ScrollEvent = 0x2020; // Data: 0 for "up a directory", numbers are the amount to scroll, e.g -1 one up, 1 one down
|
||||
constexpr uint16_t VP_SD_FileSelected = 0x2022; // Number of file field selected.
|
||||
constexpr uint16_t VP_SD_FileSelectConfirm = 0x2024; // (This is a virtual VP and emulated by the Confirm Screen when a file has been confirmed)
|
||||
|
||||
constexpr uint16_t VP_SD_ResumePauseAbort = 0x2026; // Resume(Data=0), Pause(Data=1), Abort(Data=2) SD Card prints
|
||||
constexpr uint16_t VP_SD_AbortPrintConfirmed = 0x2028; // Abort print confirmation (virtual, will be injected by the confirm dialog)
|
||||
constexpr uint16_t VP_SD_Print_Setting = 0x2040;
|
||||
constexpr uint16_t VP_SD_Print_LiveAdjustZ = 0x2050; // Data: 0 down, 1 up
|
||||
|
||||
// Controls for movement (we can't use the incremental / decremental feature of the display at this feature works only with 16 bit values
|
||||
// (which would limit us to 655.35mm, which is likely not a problem for common setups, but i don't want to rule out hangprinters support)
|
||||
// A word about the coding: The VP will be per axis and the return code will be an signed 16 bit value in 0.01 mm resolution, telling us
|
||||
// the relative travel amount t he user wants to do. So eg. if the display sends us VP=2100 with value 100, the user wants us to move X by +1 mm.
|
||||
constexpr uint16_t VP_MOVE_X = 0x2100;
|
||||
constexpr uint16_t VP_MOVE_Y = 0x2102;
|
||||
constexpr uint16_t VP_MOVE_Z = 0x2104;
|
||||
constexpr uint16_t VP_MOVE_E0 = 0x2110;
|
||||
constexpr uint16_t VP_MOVE_E1 = 0x2112;
|
||||
//constexpr uint16_t VP_MOVE_E2 = 0x2114;
|
||||
//constexpr uint16_t VP_MOVE_E3 = 0x2116;
|
||||
//constexpr uint16_t VP_MOVE_E4 = 0x2118;
|
||||
//constexpr uint16_t VP_MOVE_E5 = 0x211A;
|
||||
constexpr uint16_t VP_HOME_ALL = 0x2120;
|
||||
constexpr uint16_t VP_MOTOR_LOCK_UNLOK = 0x2130;
|
||||
|
||||
// Power loss recovery
|
||||
constexpr uint16_t VP_POWER_LOSS_RECOVERY = 0x2180;
|
||||
|
||||
// Fan Control Buttons , switch between "off" and "on"
|
||||
constexpr uint16_t VP_FAN0_CONTROL = 0x2200;
|
||||
constexpr uint16_t VP_FAN1_CONTROL = 0x2202;
|
||||
constexpr uint16_t VP_FAN2_CONTROL = 0x2204;
|
||||
constexpr uint16_t VP_FAN3_CONTROL = 0x2206;
|
||||
|
||||
// Heater Control Buttons , triged between "cool down" and "heat PLA" state
|
||||
constexpr uint16_t VP_E0_CONTROL = 0x2210;
|
||||
constexpr uint16_t VP_E1_CONTROL = 0x2212;
|
||||
//constexpr uint16_t VP_E2_CONTROL = 0x2214;
|
||||
//constexpr uint16_t VP_E3_CONTROL = 0x2216;
|
||||
//constexpr uint16_t VP_E4_CONTROL = 0x2218;
|
||||
//constexpr uint16_t VP_E5_CONTROL = 0x221A;
|
||||
constexpr uint16_t VP_BED_CONTROL = 0x221C;
|
||||
|
||||
// Preheat
|
||||
constexpr uint16_t VP_E0_BED_PREHEAT = 0x2220;
|
||||
constexpr uint16_t VP_E1_BED_PREHEAT = 0x2222;
|
||||
//constexpr uint16_t VP_E2_BED_PREHEAT = 0x2224;
|
||||
//constexpr uint16_t VP_E3_BED_PREHEAT = 0x2226;
|
||||
//constexpr uint16_t VP_E4_BED_PREHEAT = 0x2228;
|
||||
//constexpr uint16_t VP_E5_BED_PREHEAT = 0x222A;
|
||||
|
||||
// Filament load and unload
|
||||
constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x2300;
|
||||
constexpr uint16_t VP_E1_FILAMENT_LOAD_UNLOAD = 0x2302;
|
||||
|
||||
// Settings store , reset
|
||||
constexpr uint16_t VP_SETTINGS = 0x2400;
|
||||
|
||||
// PID autotune
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E0 = 0x2410;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E1 = 0x2412;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E2 = 0x2414;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E3 = 0x2416;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E4 = 0x2418;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E5 = 0x241A;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_BED = 0x2420;
|
||||
|
||||
// Calibrate Z
|
||||
constexpr uint16_t VP_Z_CALIBRATE = 0x2430;
|
||||
|
||||
// First layer cal
|
||||
constexpr uint16_t VP_Z_FIRST_LAYER_CAL = 0x2500; // Data: 0 - Cancel first layer cal progress, >0 filament type have loaded
|
||||
|
||||
// Firmware version on the boot screen.
|
||||
constexpr uint16_t VP_MARLIN_VERSION = 0x3000;
|
||||
constexpr uint8_t VP_MARLIN_VERSION_LEN = 16; // there is more space on the display, if needed.
|
||||
|
||||
// Place for status messages.
|
||||
constexpr uint16_t VP_M117 = 0x3020;
|
||||
constexpr uint8_t VP_M117_LEN = 0x20;
|
||||
|
||||
// Temperatures.
|
||||
constexpr uint16_t VP_T_E0_Is = 0x3060; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E0_Set = 0x3062; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E1_Is = 0x3064; // 4 Byte Integer
|
||||
|
||||
// reserved to support up to 6 Extruders:
|
||||
constexpr uint16_t VP_T_E1_Set = 0x3066; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E2_Is = 0x3068; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E2_Set = 0x306A; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E3_Is = 0x306C; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E3_Set = 0x306E; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Is = 0x3070; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Set = 0x3072; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Is = 0x3074; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Set = 0x3076; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_Is = 0x3078; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_Set = 0x307A; // 2 Byte Integer
|
||||
|
||||
constexpr uint16_t VP_T_Bed_Is = 0x3080; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_Bed_Set = 0x3082; // 2 Byte Integer
|
||||
|
||||
constexpr uint16_t VP_Flowrate_E0 = 0x3090; // 2 Byte Integer
|
||||
constexpr uint16_t VP_Flowrate_E1 = 0x3092; // 2 Byte Integer
|
||||
|
||||
// reserved for up to 6 Extruders:
|
||||
//constexpr uint16_t VP_Flowrate_E2 = 0x3094;
|
||||
//constexpr uint16_t VP_Flowrate_E3 = 0x3096;
|
||||
//constexpr uint16_t VP_Flowrate_E4 = 0x3098;
|
||||
//constexpr uint16_t VP_Flowrate_E5 = 0x309A;
|
||||
|
||||
constexpr uint16_t VP_Fan0_Percentage = 0x3100; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Fan1_Percentage = 0x3102; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Fan2_Percentage = 0x3104; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Fan3_Percentage = 0x3106; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Feedrate_Percentage = 0x3108; // 2 Byte Integer (0..100)
|
||||
|
||||
// Actual Position
|
||||
constexpr uint16_t VP_XPos = 0x3110; // 4 Byte Fixed point number; format xxx.yy
|
||||
constexpr uint16_t VP_YPos = 0x3112; // 4 Byte Fixed point number; format xxx.yy
|
||||
constexpr uint16_t VP_ZPos = 0x3114; // 4 Byte Fixed point number; format xxx.yy
|
||||
|
||||
constexpr uint16_t VP_EPos = 0x3120; // 4 Byte Fixed point number; format xxx.yy
|
||||
|
||||
constexpr uint16_t VP_PrintProgress_Percentage = 0x3130; // 2 Byte Integer (0..100)
|
||||
|
||||
constexpr uint16_t VP_PrintTime = 0x3140;
|
||||
constexpr uint16_t VP_PrintTime_LEN = 32;
|
||||
|
||||
constexpr uint16_t VP_PrintAccTime = 0x3160;
|
||||
constexpr uint16_t VP_PrintAccTime_LEN = 32;
|
||||
|
||||
constexpr uint16_t VP_PrintsTotal = 0x3180;
|
||||
constexpr uint16_t VP_PrintsTotal_LEN = 16;
|
||||
|
||||
// SDCard File Listing
|
||||
constexpr uint16_t VP_SD_FileName_LEN = 32; // LEN is shared for all entries.
|
||||
constexpr uint16_t DGUS_SD_FILESPERSCREEN = 5; // FIXME move that info to the display and read it from there.
|
||||
constexpr uint16_t VP_SD_FileName0 = 0x3200;
|
||||
constexpr uint16_t VP_SD_FileName1 = 0x3220;
|
||||
constexpr uint16_t VP_SD_FileName2 = 0x3240;
|
||||
constexpr uint16_t VP_SD_FileName3 = 0x3260;
|
||||
constexpr uint16_t VP_SD_FileName4 = 0x3280;
|
||||
|
||||
constexpr uint16_t VP_SD_Print_ProbeOffsetZ = 0x32A0; //
|
||||
constexpr uint16_t VP_SD_Print_Filename = 0x32C0;
|
||||
|
||||
// Fan status
|
||||
constexpr uint16_t VP_FAN0_STATUS = 0x3300;
|
||||
constexpr uint16_t VP_FAN1_STATUS = 0x3302;
|
||||
constexpr uint16_t VP_FAN2_STATUS = 0x3304;
|
||||
constexpr uint16_t VP_FAN3_STATUS = 0x3306;
|
||||
|
||||
// Heater status
|
||||
constexpr uint16_t VP_E0_STATUS = 0x3310;
|
||||
constexpr uint16_t VP_E1_STATUS = 0x3312;
|
||||
//constexpr uint16_t VP_E2_STATUS = 0x3314;
|
||||
//constexpr uint16_t VP_E3_STATUS = 0x3316;
|
||||
//constexpr uint16_t VP_E4_STATUS = 0x3318;
|
||||
//constexpr uint16_t VP_E5_STATUS = 0x331A;
|
||||
constexpr uint16_t VP_BED_STATUS = 0x331C;
|
||||
|
||||
constexpr uint16_t VP_MOVE_OPTION = 0x3400;
|
||||
|
||||
// Step per mm
|
||||
constexpr uint16_t VP_X_STEP_PER_MM = 0x3600; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
//constexpr uint16_t VP_X2_STEP_PER_MM = 0x3602;
|
||||
constexpr uint16_t VP_Y_STEP_PER_MM = 0x3604;
|
||||
//constexpr uint16_t VP_Y2_STEP_PER_MM = 0x3606;
|
||||
constexpr uint16_t VP_Z_STEP_PER_MM = 0x3608;
|
||||
//constexpr uint16_t VP_Z2_STEP_PER_MM = 0x360A;
|
||||
constexpr uint16_t VP_E0_STEP_PER_MM = 0x3610;
|
||||
constexpr uint16_t VP_E1_STEP_PER_MM = 0x3612;
|
||||
//constexpr uint16_t VP_E2_STEP_PER_MM = 0x3614;
|
||||
//constexpr uint16_t VP_E3_STEP_PER_MM = 0x3616;
|
||||
//constexpr uint16_t VP_E4_STEP_PER_MM = 0x3618;
|
||||
//constexpr uint16_t VP_E5_STEP_PER_MM = 0x361A;
|
||||
|
||||
// PIDs
|
||||
constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
constexpr uint16_t VP_E0_PID_I = 0x3702;
|
||||
constexpr uint16_t VP_E0_PID_D = 0x3704;
|
||||
constexpr uint16_t VP_E1_PID_P = 0x3706; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
constexpr uint16_t VP_E1_PID_I = 0x3708;
|
||||
constexpr uint16_t VP_E1_PID_D = 0x370A;
|
||||
constexpr uint16_t VP_BED_PID_P = 0x3710;
|
||||
constexpr uint16_t VP_BED_PID_I = 0x3712;
|
||||
constexpr uint16_t VP_BED_PID_D = 0x3714;
|
||||
|
||||
// Wating screen status
|
||||
constexpr uint16_t VP_WAITING_STATUS = 0x3800;
|
||||
|
||||
// SPs for certain variables...
|
||||
// located at 0x5000 and up
|
||||
// Not used yet!
|
||||
// This can be used e.g to make controls / data display invisible
|
||||
constexpr uint16_t SP_T_E0_Is = 0x5000;
|
||||
constexpr uint16_t SP_T_E0_Set = 0x5010;
|
||||
constexpr uint16_t SP_T_E1_Is = 0x5020;
|
||||
constexpr uint16_t SP_T_Bed_Is = 0x5030;
|
||||
constexpr uint16_t SP_T_Bed_Set = 0x5040;
|
418
Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp
Normal file
418
Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp
Normal file
@ -0,0 +1,418 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_FYSETC)
|
||||
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "../../../../MarlinCore.h"
|
||||
#include "../../../../gcode/queue.h"
|
||||
#include "../../../../libs/duration_t.h"
|
||||
#include "../../../../module/settings.h"
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
#include "../../../../module/planner.h"
|
||||
#include "../../../../module/printcounter.h"
|
||||
#include "../../../../sd/cardreader.h"
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(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;
|
||||
|
||||
if (filelist.isDir()) {
|
||||
filelist.changeDir(filelist.filename());
|
||||
top_file = 0;
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_PRINT_FILENAME)
|
||||
// Send print filename
|
||||
dgusdisplay.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);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!filelist.seek(file_to_print)) return;
|
||||
ExtUI::printFile(filelist.shortFilename());
|
||||
GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(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)) {
|
||||
case 0: { // Resume
|
||||
if (ExtUI::isPrintingFromMediaPaused()) {
|
||||
ExtUI::resumePrint();
|
||||
}
|
||||
} break;
|
||||
|
||||
case 1: // 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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_SendFilename(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] = "";
|
||||
var.memadr = (void*)tmpfilename;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardInserted() {
|
||||
top_file = 0;
|
||||
filelist.refresh();
|
||||
auto cs = getCurrentScreen();
|
||||
if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS)
|
||||
GotoScreen(DGUSLCD_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);
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
||||
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,
|
||||
// meaning "return to previous screen"
|
||||
DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1];
|
||||
|
||||
DEBUG_ECHOLNPAIR("\n DEBUG target", target);
|
||||
|
||||
if (target == DGUSLCD_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();
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateNewScreen(target);
|
||||
|
||||
#ifdef DEBUG_DGUSLCD
|
||||
if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPAIR("WARNING: No screen Mapping found for ", target);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleManualMove");
|
||||
|
||||
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
if (movevalue) {
|
||||
const uint16_t choice = *(uint16_t*)var.memadr;
|
||||
movevalue = movevalue < 0 ? -choice : choice;
|
||||
}
|
||||
#endif
|
||||
char axiscode;
|
||||
unsigned int speed = 1500; // FIXME: get default feedrate for manual moves, dont hardcode.
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
|
||||
case VP_MOVE_X:
|
||||
axiscode = 'X';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::X)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Y:
|
||||
axiscode = 'Y';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Z:
|
||||
axiscode = 'Z';
|
||||
speed = 300; // default to 5mm/s
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_HOME_ALL: // only used for homing
|
||||
axiscode = '\0';
|
||||
movevalue = 0; // ignore value sent from display, this VP is _ONLY_ for homing.
|
||||
break;
|
||||
}
|
||||
|
||||
if (!movevalue) {
|
||||
// homing
|
||||
DEBUG_ECHOPAIR(" homing ", AS_CHAR(axiscode));
|
||||
char buf[6] = "G28 X";
|
||||
buf[4] = axiscode;
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓");
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// movement
|
||||
DEBUG_ECHOPAIR(" move ", AS_CHAR(axiscode));
|
||||
bool old_relative_mode = relative_mode;
|
||||
if (!relative_mode) {
|
||||
//DEBUG_ECHOPGM(" G91");
|
||||
queue.enqueue_now_P(PSTR("G91"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
char buf[32]; // G1 X9999.99 F12345
|
||||
unsigned int backup_speed = MMS_TO_MMM(feedrate_mm_s);
|
||||
char sign[] = "\0";
|
||||
int16_t value = movevalue / 100;
|
||||
if (movevalue < 0) { value = -value; sign[0] = '-'; }
|
||||
int16_t fraction = ABS(movevalue) % 100;
|
||||
snprintf_P(buf, 32, PSTR("G0 %c%s%d.%02d F%d"), axiscode, sign, value, fraction, speed);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (backup_speed != speed) {
|
||||
snprintf_P(buf, 32, PSTR("G0 F%d"), backup_speed);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
}
|
||||
// while (!enqueue_and_echo_command(buf)) idle();
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (!old_relative_mode) {
|
||||
//DEBUG_ECHOPGM("G90");
|
||||
queue.enqueue_now_P(PSTR("G90"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
}
|
||||
|
||||
ForceCompleteUpdate();
|
||||
DEBUG_ECHOLNPGM("manmv done.");
|
||||
return;
|
||||
|
||||
cannotmove:
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", AS_CHAR(axiscode));
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("V1:", rawvalue);
|
||||
float value = (float)rawvalue / 10;
|
||||
DEBUG_ECHOLNPAIR("V2:", value);
|
||||
float newvalue = 0;
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_PID_P: newvalue = value; break;
|
||||
case VP_E0_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E0_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_PID_P: newvalue = value; break;
|
||||
case VP_E1_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E1_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
case VP_BED_PID_P: newvalue = value; break;
|
||||
case VP_BED_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_BED_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
}
|
||||
|
||||
DEBUG_ECHOLNPAIR_F("V3:", newvalue);
|
||||
*(float *)var.memadr = newvalue;
|
||||
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
}
|
||||
#endif // HAS_PID_HEATING
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleLiveAdjustZ");
|
||||
int16_t flag = swap16(*(uint16_t*)val_ptr),
|
||||
steps = flag ? -20 : 20;
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true);
|
||||
ForceCompleteUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentOption");
|
||||
|
||||
uint8_t e_temp = 0;
|
||||
filament_data.heated = false;
|
||||
uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
|
||||
if (preheat_option <= 8) { // Load filament type
|
||||
filament_data.action = 1;
|
||||
}
|
||||
else if (preheat_option >= 10) { // Unload filament type
|
||||
preheat_option -= 10;
|
||||
filament_data.action = 2;
|
||||
filament_data.purge_length = DGUS_FILAMENT_PURGE_LENGTH;
|
||||
}
|
||||
else { // Cancel filament operation
|
||||
filament_data.action = 0;
|
||||
}
|
||||
|
||||
switch (preheat_option) {
|
||||
case 0: // Load PLA
|
||||
#ifdef PREHEAT_1_TEMP_HOTEND
|
||||
e_temp = PREHEAT_1_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 1: // Load ABS
|
||||
TERN_(PREHEAT_2_TEMP_HOTEND, e_temp = PREHEAT_2_TEMP_HOTEND);
|
||||
break;
|
||||
case 2: // Load PET
|
||||
#ifdef PREHEAT_3_TEMP_HOTEND
|
||||
e_temp = PREHEAT_3_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 3: // Load FLEX
|
||||
#ifdef PREHEAT_4_TEMP_HOTEND
|
||||
e_temp = PREHEAT_4_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 9: // Cool down
|
||||
default:
|
||||
e_temp = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (filament_data.action == 0) { // Go back to utility screen
|
||||
#if HOTENDS >= 1
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E0);
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1);
|
||||
#endif
|
||||
GotoScreen(DGUSLCD_SCREEN_UTILITY);
|
||||
}
|
||||
else { // Go to the preheat screen to show the heating progress
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E0;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E1;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_HEATING);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentLoadUnload");
|
||||
if (filament_data.action <= 0) return;
|
||||
|
||||
// If we close to the target temperature, we can start load or unload the filament
|
||||
if (thermalManager.hotEnoughToExtrude(filament_data.extruder) && \
|
||||
thermalManager.targetHotEnoughToExtrude(filament_data.extruder)) {
|
||||
float movevalue = DGUS_FILAMENT_LOAD_LENGTH_PER_TIME;
|
||||
|
||||
if (filament_data.action == 1) { // load filament
|
||||
if (!filament_data.heated) {
|
||||
//GotoScreen(DGUSLCD_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);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
// Before unloading extrude to prevent jamming
|
||||
if (filament_data.purge_length >= 0) {
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue;
|
||||
filament_data.purge_length -= movevalue;
|
||||
}
|
||||
else {
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) - movevalue;
|
||||
}
|
||||
}
|
||||
ExtUI::setAxisPosition_mm(movevalue, filament_data.extruder);
|
||||
}
|
||||
}
|
||||
#endif // DGUS_FILAMENT_LOADUNLOAD
|
||||
|
||||
bool DGUSScreenHandler::loop() {
|
||||
dgusdisplay.loop();
|
||||
|
||||
const millis_t ms = millis();
|
||||
static millis_t next_event_ms = 0;
|
||||
|
||||
if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) {
|
||||
next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS;
|
||||
UpdateScreenVPData();
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
static bool booted = false;
|
||||
|
||||
if (!booted && TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
|
||||
booted = true;
|
||||
|
||||
if (!booted && ELAPSED(ms, TERN(USE_MKS_GREEN_UI, 1000, BOOTSCREEN_TIMEOUT)))
|
||||
booted = true;
|
||||
#endif
|
||||
return IsScreenComplete();
|
||||
}
|
||||
|
||||
#endif // DGUS_LCD_UI_FYSETC
|
240
Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.h
Normal file
240
Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.h
Normal file
@ -0,0 +1,240 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSVPVariable.h"
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
#include "../../../../inc/MarlinConfig.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
|
||||
class DGUSScreenHandler {
|
||||
public:
|
||||
DGUSScreenHandler() = default;
|
||||
|
||||
static bool loop();
|
||||
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifing whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
// "M117" Message -- msg is a RAM ptr.
|
||||
static void setstatusmessage(const char *msg);
|
||||
// The same for messages from Flash
|
||||
static void setstatusmessagePGM(PGM_P const msg);
|
||||
// Callback for VP "Display wants to change screen on idle printer"
|
||||
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);
|
||||
|
||||
// Callback for VP "All Heaters Off"
|
||||
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);
|
||||
// Hook for "Change Flowrate"
|
||||
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);
|
||||
#endif
|
||||
|
||||
// Hook for manual move.
|
||||
static void HandleManualMove(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for manual extrude.
|
||||
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);
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Hook for power loss recovery.
|
||||
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);
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
// Hook for "Change this temperature PID para"
|
||||
static void HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for PID autotune
|
||||
static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_BED_PROBE
|
||||
// Hook for "Change probe offset z"
|
||||
static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
// Hook for live z adjust action
|
||||
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
// Hook for fan control
|
||||
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);
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
// Hook for preheat
|
||||
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);
|
||||
// Hook for filament load and unload
|
||||
static void HandleFilamentLoadUnload(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
// Callback for VP "Display wants to change screen when there is a SD card"
|
||||
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);
|
||||
// File touched.
|
||||
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// start print after confirmation received.
|
||||
static void DGUSLCD_SD_StartPrint(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);
|
||||
// User confirmed the abort action
|
||||
static void DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the tune button
|
||||
static void DGUSLCD_SD_PrintTune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Send a single filename to the display.
|
||||
static void DGUSLCD_SD_SendFilename(DGUS_VP_Variable &var);
|
||||
// Marlin informed us that a new SD has been inserted.
|
||||
static void SDCardInserted();
|
||||
// Marlin informed us that the SD Card has been removed().
|
||||
static void SDCardRemoved();
|
||||
// Marlin informed us about a bad SD Card.
|
||||
static void SDCardError();
|
||||
#endif
|
||||
|
||||
// OK Button the Confirm screen.
|
||||
static void ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Update data after went to new screen (by display or by GotoScreen)
|
||||
// remember: store the last-displayed screen, so it can get returned to.
|
||||
// (e.g for pop up messages)
|
||||
static void UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup=false);
|
||||
|
||||
// Recall the remembered screen.
|
||||
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 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);
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
static void DGUSLCD_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);
|
||||
|
||||
template<typename T>
|
||||
static void DGUSLCD_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;
|
||||
LOOP_L_N(i, sizeof(T)) x.tmp[i] = ptr[sizeof(T) - i - 1];
|
||||
*(T*)var.memadr = x.t;
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// 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<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (long)f);
|
||||
}
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// 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<unsigned int decimals>
|
||||
static void DGUSLCD_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);
|
||||
}
|
||||
}
|
||||
|
||||
// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static inline void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
private:
|
||||
static DGUSLCD_Screens current_screen; //< 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 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 uint16_t ConfirmVP; //< context for confirm screen (VP that will be emulated-sent on "OK").
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static int16_t top_file; //< file on top of file chooser
|
||||
static int16_t file_to_print; //< touched file to be confirmed
|
||||
#endif
|
||||
|
||||
static void (*confirm_action_cb)();
|
||||
};
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#define PLR_SCREEN_RECOVER DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
#define PLR_SCREEN_CANCEL DGUSLCD_SCREEN_STATUS
|
||||
#endif
|
485
Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp
Normal file
485
Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp
Normal file
@ -0,0 +1,485 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* DGUS VPs changed by George Fu in 2019 for Marlin */
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_HIPRECY)
|
||||
|
||||
#include "DGUSDisplayDef.h"
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
#include "../../../../module/planner.h"
|
||||
|
||||
#include "../../ui_api.h"
|
||||
#include "../../../marlinui.h"
|
||||
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
uint16_t distanceToMove = 10;
|
||||
#endif
|
||||
|
||||
const uint16_t VPList_Boot[] PROGMEM = {
|
||||
VP_MARLIN_VERSION,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Main[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded. */
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set, VP_E0_STATUS,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set, VP_BED_STATUS,
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
VP_Fan0_Percentage, VP_FAN0_STATUS,
|
||||
#endif
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
VP_Fan0_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
VP_PrintProgress_Percentage,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Temp[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Status[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded */
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
VP_Fan0_Percentage,
|
||||
#endif
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
VP_Fan0_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
VP_PrintProgress_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Status2[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded */
|
||||
#if HOTENDS >= 1
|
||||
VP_Flowrate_E0,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_Flowrate_E1,
|
||||
#endif
|
||||
VP_PrintProgress_Percentage,
|
||||
VP_PrintTime,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Preheat[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_ManualMove[] PROGMEM = {
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_ManualExtrude[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
VP_EPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FanAndFeedrate[] PROGMEM = {
|
||||
VP_Feedrate_Percentage, VP_Fan0_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SD_FlowRates[] PROGMEM = {
|
||||
VP_Flowrate_E0, VP_Flowrate_E1,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Filament_heating[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
VP_E0_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Filament_load_unload[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_E0_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_E1_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SDFileList[] PROGMEM = {
|
||||
VP_SD_FileName0, VP_SD_FileName1, VP_SD_FileName2, VP_SD_FileName3, VP_SD_FileName4,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SD_PrintManipulation[] PROGMEM = {
|
||||
VP_PrintProgress_Percentage, VP_PrintTime,
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
VP_Fan0_Percentage,
|
||||
#if FAN_COUNT > 1
|
||||
VP_Fan1_Percentage,
|
||||
#endif
|
||||
#endif
|
||||
VP_Flowrate_E0,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SDPrintTune[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
VP_Feedrate_Percentage,
|
||||
#if HAS_FAN
|
||||
VP_Fan0_Percentage,
|
||||
#endif
|
||||
VP_Flowrate_E0,
|
||||
VP_SD_Print_ProbeOffsetZ,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_StepPerMM[] PROGMEM = {
|
||||
VP_X_STEP_PER_MM,
|
||||
VP_Y_STEP_PER_MM,
|
||||
VP_Z_STEP_PER_MM,
|
||||
#if HOTENDS >= 1
|
||||
VP_E0_STEP_PER_MM,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_E1_STEP_PER_MM,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PIDE0[] PROGMEM = {
|
||||
#if ENABLED(PIDTEMP)
|
||||
VP_E0_PID_P,
|
||||
VP_E0_PID_I,
|
||||
VP_E0_PID_D,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PIDBED[] PROGMEM = {
|
||||
#if ENABLED(PIDTEMP)
|
||||
VP_BED_PID_P,
|
||||
VP_BED_PID_I,
|
||||
VP_BED_PID_D,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Infos[] PROGMEM = {
|
||||
VP_MARLIN_VERSION,
|
||||
VP_PrintTime,
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
VP_PrintAccTime,
|
||||
VP_PrintsTotal,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PIDTuningWaiting[] PROGMEM = {
|
||||
VP_WAITING_STATUS,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FLCPreheat[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FLCPrinting[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_SD_Print_ProbeOffsetZ,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Z_Offset[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_SD_Print_ProbeOffsetZ,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const struct VPMapping VPMap[] PROGMEM = {
|
||||
{ DGUSLCD_SCREEN_BOOT, VPList_Boot },
|
||||
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
|
||||
{ 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 },
|
||||
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
|
||||
};
|
||||
|
||||
const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
|
||||
|
||||
// Helper to define a DGUS_VP_Variable for common use cases.
|
||||
#define VPHELPER(VPADR, VPADRVAR, RXFPTR, TXFPTR ) { .VP=VPADR, .memadr=VPADRVAR, .size=sizeof(VPADRVAR), \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR }
|
||||
|
||||
// Helper to define a DGUS_VP_Variable when the sizeo of the var cannot be determined automaticalyl (eg. a string)
|
||||
#define VPHELPER_STR(VPADR, VPADRVAR, STRLEN, RXFPTR, TXFPTR ) { .VP=VPADR, .memadr=VPADRVAR, .size=STRLEN, \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR }
|
||||
|
||||
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),
|
||||
#if ENABLED(SDSUPPORT)
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, ScreenHandler.ScreenChangeHookIfSD, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr),
|
||||
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, &ScreenHandler.HandleAllHeatersOff, nullptr),
|
||||
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_OPTION, &distanceToMove, &ScreenHandler.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),
|
||||
#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),
|
||||
#endif
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, &ScreenHandler.HandleMotorLockUnlock, nullptr),
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, &ScreenHandler.HandlePowerLossRecovery, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_SETTINGS, nullptr, &ScreenHandler.HandleSettings, nullptr),
|
||||
#if ENABLED(SINGLE_Z_CALIBRATION)
|
||||
VPHELPER(VP_Z_CALIBRATE, nullptr, &ScreenHandler.HandleZCalibration, nullptr),
|
||||
#endif
|
||||
#if ENABLED(FIRST_LAYER_CAL)
|
||||
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, &ScreenHandler.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 },
|
||||
// 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 },
|
||||
|
||||
// Temperature Data
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
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),
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, &ScreenHandler.HandlePreheat, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, &ScreenHandler.HandleFilamentOption, &ScreenHandler.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),
|
||||
#endif
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
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),
|
||||
#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),
|
||||
#if ENABLED(PIDTEMP)
|
||||
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),
|
||||
#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),
|
||||
REPEAT(FAN_COUNT, FAN_VPHELPER)
|
||||
#endif
|
||||
|
||||
// Feedrate
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, &ScreenHandler.DGUSLCD_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>),
|
||||
|
||||
// Print Progress
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay ),
|
||||
|
||||
// Print Time
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_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 ),
|
||||
#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>),
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
|
||||
// SDCard File listing.
|
||||
#if ENABLED(SDSUPPORT)
|
||||
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),
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, ScreenHandler.HandleProbeOffsetZChanged, &ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, ScreenHandler.DGUSLCD_SendWaitingStatusToDisplay),
|
||||
#endif
|
||||
|
||||
// Messages for the User, shared by the popup and the kill screen. They cant 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 },
|
||||
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
||||
#endif // DGUS_LCD_UI_HIPRECY
|
292
Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.h
Normal file
292
Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.h
Normal file
@ -0,0 +1,292 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#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"
|
||||
DGUSLDC_SCREEN_UNUSED = 255
|
||||
};
|
||||
|
||||
// Display Memory layout used (T5UID)
|
||||
// Except system variables this is arbitrary, just to organize stuff....
|
||||
|
||||
// 0x0000 .. 0x0FFF -- System variables and reserved by the display
|
||||
// 0x1000 .. 0x1FFF -- Variables to never change location, regardless of UI Version
|
||||
// 0x2000 .. 0x2FFF -- Controls (VPs that will trigger some action)
|
||||
// 0x3000 .. 0x4FFF -- Marlin Data to be displayed
|
||||
// 0x5000 .. -- SPs (if we want to modify display elements, e.g change color or like) -- currently unused
|
||||
|
||||
// As there is plenty of space (at least most displays have >8k RAM), we do not pack them too tight,
|
||||
// so that we can keep variables nicely together in the address space.
|
||||
|
||||
// UI Version always on 0x1000...0x1002 so that the firmware can check this and bail out.
|
||||
constexpr uint16_t VP_UI_VERSION_MAJOR = 0x1000; // Major -- incremented when incompatible
|
||||
constexpr uint16_t VP_UI_VERSION_MINOR = 0x1001; // Minor -- incremented on new features, but compatible
|
||||
constexpr uint16_t VP_UI_VERSION_PATCH = 0x1002; // Patch -- fixed which do not change functionality.
|
||||
constexpr uint16_t VP_UI_FLAVOUR = 0x1010; // lets reserve 16 bytes here to determine if UI is suitable for this Marlin. tbd.
|
||||
|
||||
// Storage space for the Killscreen messages. 0x1100 - 0x1200 . Reused for the popup.
|
||||
constexpr uint16_t VP_MSGSTR1 = 0x1100;
|
||||
constexpr uint8_t VP_MSGSTR1_LEN = 0x20; // might be more place for it...
|
||||
constexpr uint16_t VP_MSGSTR2 = 0x1140;
|
||||
constexpr uint8_t VP_MSGSTR2_LEN = 0x20;
|
||||
constexpr uint16_t VP_MSGSTR3 = 0x1180;
|
||||
constexpr uint8_t VP_MSGSTR3_LEN = 0x20;
|
||||
constexpr uint16_t VP_MSGSTR4 = 0x11C0;
|
||||
constexpr uint8_t VP_MSGSTR4_LEN = 0x20;
|
||||
|
||||
// Screenchange request for screens that only make sense when printer is idle.
|
||||
// e.g movement is only allowed if printer is not printing.
|
||||
// Marlin must confirm by setting the screen manually.
|
||||
constexpr uint16_t VP_SCREENCHANGE_ASK = 0x2000;
|
||||
constexpr uint16_t VP_SCREENCHANGE = 0x2001; // Key-Return button to new menu pressed. Data contains target screen in low byte and info in high byte.
|
||||
constexpr uint16_t VP_TEMP_ALL_OFF = 0x2002; // Turn all heaters off. Value arbitrary ;)=
|
||||
constexpr uint16_t VP_SCREENCHANGE_WHENSD = 0x2003; // "Print" Button touched -- go only there if there is an SD Card.
|
||||
|
||||
constexpr uint16_t VP_CONFIRMED = 0x2010; // OK on confirm screen.
|
||||
|
||||
// Buttons on the SD-Card File listing.
|
||||
constexpr uint16_t VP_SD_ScrollEvent = 0x2020; // Data: 0 for "up a directory", numbers are the amount to scroll, e.g -1 one up, 1 one down
|
||||
constexpr uint16_t VP_SD_FileSelected = 0x2022; // Number of file field selected.
|
||||
constexpr uint16_t VP_SD_FileSelectConfirm = 0x2024; // (This is a virtual VP and emulated by the Confirm Screen when a file has been confirmed)
|
||||
|
||||
constexpr uint16_t VP_SD_ResumePauseAbort = 0x2026; // Resume(Data=0), Pause(Data=1), Abort(Data=2) SD Card prints
|
||||
constexpr uint16_t VP_SD_AbortPrintConfirmed = 0x2028; // Abort print confirmation (virtual, will be injected by the confirm dialog)
|
||||
constexpr uint16_t VP_SD_Print_Setting = 0x2040;
|
||||
constexpr uint16_t VP_SD_Print_LiveAdjustZ = 0x2050; // Data: 0 down, 1 up
|
||||
|
||||
// Controls for movement (we can't use the incremental / decremental feature of the display at this feature works only with 16 bit values
|
||||
// (which would limit us to 655.35mm, which is likely not a problem for common setups, but i don't want to rule out hangprinters support)
|
||||
// A word about the coding: The VP will be per axis and the return code will be an signed 16 bit value in 0.01 mm resolution, telling us
|
||||
// the relative travel amount t he user wants to do. So eg. if the display sends us VP=2100 with value 100, the user wants us to move X by +1 mm.
|
||||
constexpr uint16_t VP_MOVE_X = 0x2100;
|
||||
constexpr uint16_t VP_MOVE_Y = 0x2102;
|
||||
constexpr uint16_t VP_MOVE_Z = 0x2104;
|
||||
constexpr uint16_t VP_MOVE_E0 = 0x2110;
|
||||
constexpr uint16_t VP_MOVE_E1 = 0x2112;
|
||||
//constexpr uint16_t VP_MOVE_E2 = 0x2114;
|
||||
//constexpr uint16_t VP_MOVE_E3 = 0x2116;
|
||||
//constexpr uint16_t VP_MOVE_E4 = 0x2118;
|
||||
//constexpr uint16_t VP_MOVE_E5 = 0x211A;
|
||||
constexpr uint16_t VP_HOME_ALL = 0x2120;
|
||||
constexpr uint16_t VP_MOTOR_LOCK_UNLOK = 0x2130;
|
||||
|
||||
// Power loss recovery
|
||||
constexpr uint16_t VP_POWER_LOSS_RECOVERY = 0x2180;
|
||||
|
||||
// Fan Control Buttons , switch between "off" and "on"
|
||||
constexpr uint16_t VP_FAN0_CONTROL = 0x2200;
|
||||
constexpr uint16_t VP_FAN1_CONTROL = 0x2202;
|
||||
//constexpr uint16_t VP_FAN2_CONTROL = 0x2204;
|
||||
//constexpr uint16_t VP_FAN3_CONTROL = 0x2206;
|
||||
|
||||
// Heater Control Buttons , triged between "cool down" and "heat PLA" state
|
||||
constexpr uint16_t VP_E0_CONTROL = 0x2210;
|
||||
constexpr uint16_t VP_E1_CONTROL = 0x2212;
|
||||
//constexpr uint16_t VP_E2_CONTROL = 0x2214;
|
||||
//constexpr uint16_t VP_E3_CONTROL = 0x2216;
|
||||
//constexpr uint16_t VP_E4_CONTROL = 0x2218;
|
||||
//constexpr uint16_t VP_E5_CONTROL = 0x221A;
|
||||
constexpr uint16_t VP_BED_CONTROL = 0x221C;
|
||||
|
||||
// Preheat
|
||||
constexpr uint16_t VP_E0_BED_PREHEAT = 0x2220;
|
||||
//constexpr uint16_t VP_E1_BED_PREHEAT = 0x2222;
|
||||
//constexpr uint16_t VP_E2_BED_PREHEAT = 0x2224;
|
||||
//constexpr uint16_t VP_E3_BED_PREHEAT = 0x2226;
|
||||
//constexpr uint16_t VP_E4_BED_PREHEAT = 0x2228;
|
||||
//constexpr uint16_t VP_E5_BED_PREHEAT = 0x222A;
|
||||
|
||||
// Filament load and unload
|
||||
constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x2300;
|
||||
|
||||
// Settings store , reset
|
||||
constexpr uint16_t VP_SETTINGS = 0x2400;
|
||||
|
||||
// PID autotune
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E0 = 0x2410;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E1 = 0x2412;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E2 = 0x2414;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E3 = 0x2416;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E4 = 0x2418;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E5 = 0x241A;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_BED = 0x2420;
|
||||
|
||||
// Calibrate Z
|
||||
constexpr uint16_t VP_Z_CALIBRATE = 0x2430;
|
||||
|
||||
// First layer cal
|
||||
constexpr uint16_t VP_Z_FIRST_LAYER_CAL = 0x2500; // Data: 0 - Cancel first layer cal progress, >0 filament type have loaded
|
||||
|
||||
// Firmware version on the boot screen.
|
||||
constexpr uint16_t VP_MARLIN_VERSION = 0x3000;
|
||||
constexpr uint8_t VP_MARLIN_VERSION_LEN = 16; // there is more space on the display, if needed.
|
||||
|
||||
// Place for status messages.
|
||||
constexpr uint16_t VP_M117 = 0x3020;
|
||||
constexpr uint8_t VP_M117_LEN = 0x20;
|
||||
|
||||
// Temperatures.
|
||||
constexpr uint16_t VP_T_E0_Is = 0x3060; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E0_Set = 0x3062; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E1_Is = 0x3064; // 4 Byte Integer
|
||||
|
||||
// reserved to support up to 6 Extruders:
|
||||
//constexpr uint16_t VP_T_E1_Set = 0x3066; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E2_Is = 0x3068; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E2_Set = 0x306A; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E3_Is = 0x306C; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E3_Set = 0x306E; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Is = 0x3070; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Set = 0x3072; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Is = 0x3074; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Set = 0x3076; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_Is = 0x3078; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_Set = 0x307A; // 2 Byte Integer
|
||||
|
||||
constexpr uint16_t VP_T_Bed_Is = 0x3080; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_Bed_Set = 0x3082; // 2 Byte Integer
|
||||
|
||||
constexpr uint16_t VP_Flowrate_E0 = 0x3090; // 2 Byte Integer
|
||||
constexpr uint16_t VP_Flowrate_E1 = 0x3092; // 2 Byte Integer
|
||||
|
||||
// reserved for up to 6 Extruders:
|
||||
//constexpr uint16_t VP_Flowrate_E2 = 0x3094;
|
||||
//constexpr uint16_t VP_Flowrate_E3 = 0x3096;
|
||||
//constexpr uint16_t VP_Flowrate_E4 = 0x3098;
|
||||
//constexpr uint16_t VP_Flowrate_E5 = 0x309A;
|
||||
|
||||
constexpr uint16_t VP_Fan0_Percentage = 0x3100; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Fan1_Percentage = 0x3102; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Fan2_Percentage = 0x3104; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Fan3_Percentage = 0x3106; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Feedrate_Percentage = 0x3108; // 2 Byte Integer (0..100)
|
||||
|
||||
// Actual Position
|
||||
constexpr uint16_t VP_XPos = 0x3110; // 4 Byte Fixed point number; format xxx.yy
|
||||
constexpr uint16_t VP_YPos = 0x3112; // 4 Byte Fixed point number; format xxx.yy
|
||||
constexpr uint16_t VP_ZPos = 0x3114; // 4 Byte Fixed point number; format xxx.yy
|
||||
|
||||
constexpr uint16_t VP_EPos = 0x3120; // 4 Byte Fixed point number; format xxx.yy
|
||||
|
||||
constexpr uint16_t VP_PrintProgress_Percentage = 0x3130; // 2 Byte Integer (0..100)
|
||||
|
||||
constexpr uint16_t VP_PrintTime = 0x3140;
|
||||
constexpr uint16_t VP_PrintTime_LEN = 32;
|
||||
|
||||
constexpr uint16_t VP_PrintAccTime = 0x3160;
|
||||
constexpr uint16_t VP_PrintAccTime_LEN = 32;
|
||||
|
||||
constexpr uint16_t VP_PrintsTotal = 0x3180;
|
||||
constexpr uint16_t VP_PrintsTotal_LEN = 16;
|
||||
|
||||
// SDCard File Listing
|
||||
constexpr uint16_t VP_SD_FileName_LEN = 32; // LEN is shared for all entries.
|
||||
constexpr uint16_t DGUS_SD_FILESPERSCREEN = 5; // FIXME move that info to the display and read it from there.
|
||||
constexpr uint16_t VP_SD_FileName0 = 0x3200;
|
||||
constexpr uint16_t VP_SD_FileName1 = 0x3220;
|
||||
constexpr uint16_t VP_SD_FileName2 = 0x3240;
|
||||
constexpr uint16_t VP_SD_FileName3 = 0x3260;
|
||||
constexpr uint16_t VP_SD_FileName4 = 0x3280;
|
||||
|
||||
constexpr uint16_t VP_SD_Print_ProbeOffsetZ = 0x32A0; //
|
||||
|
||||
constexpr uint16_t VP_SD_Print_Filename = 0x32C0; //
|
||||
// Fan status
|
||||
constexpr uint16_t VP_FAN0_STATUS = 0x3300;
|
||||
constexpr uint16_t VP_FAN1_STATUS = 0x3302;
|
||||
//constexpr uint16_t VP_FAN2_STATUS = 0x3304;
|
||||
//constexpr uint16_t VP_FAN3_STATUS = 0x3306;
|
||||
|
||||
// Heater status
|
||||
constexpr uint16_t VP_E0_STATUS = 0x3310;
|
||||
//constexpr uint16_t VP_E1_STATUS = 0x3312;
|
||||
//constexpr uint16_t VP_E2_STATUS = 0x3314;
|
||||
//constexpr uint16_t VP_E3_STATUS = 0x3316;
|
||||
//constexpr uint16_t VP_E4_STATUS = 0x3318;
|
||||
//constexpr uint16_t VP_E5_STATUS = 0x331A;
|
||||
constexpr uint16_t VP_BED_STATUS = 0x331C;
|
||||
|
||||
constexpr uint16_t VP_MOVE_OPTION = 0x3400;
|
||||
|
||||
// Step per mm
|
||||
constexpr uint16_t VP_X_STEP_PER_MM = 0x3600; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
//constexpr uint16_t VP_X2_STEP_PER_MM = 0x3602;
|
||||
constexpr uint16_t VP_Y_STEP_PER_MM = 0x3604;
|
||||
//constexpr uint16_t VP_Y2_STEP_PER_MM = 0x3606;
|
||||
constexpr uint16_t VP_Z_STEP_PER_MM = 0x3608;
|
||||
//constexpr uint16_t VP_Z2_STEP_PER_MM = 0x360A;
|
||||
constexpr uint16_t VP_E0_STEP_PER_MM = 0x3610;
|
||||
//constexpr uint16_t VP_E1_STEP_PER_MM = 0x3612;
|
||||
//constexpr uint16_t VP_E2_STEP_PER_MM = 0x3614;
|
||||
//constexpr uint16_t VP_E3_STEP_PER_MM = 0x3616;
|
||||
//constexpr uint16_t VP_E4_STEP_PER_MM = 0x3618;
|
||||
//constexpr uint16_t VP_E5_STEP_PER_MM = 0x361A;
|
||||
|
||||
// PIDs
|
||||
constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
constexpr uint16_t VP_E0_PID_I = 0x3702;
|
||||
constexpr uint16_t VP_E0_PID_D = 0x3704;
|
||||
constexpr uint16_t VP_BED_PID_P = 0x3710;
|
||||
constexpr uint16_t VP_BED_PID_I = 0x3712;
|
||||
constexpr uint16_t VP_BED_PID_D = 0x3714;
|
||||
|
||||
// Wating screen status
|
||||
constexpr uint16_t VP_WAITING_STATUS = 0x3800;
|
||||
|
||||
// SPs for certain variables...
|
||||
// located at 0x5000 and up
|
||||
// Not used yet!
|
||||
// This can be used e.g to make controls / data display invisible
|
||||
constexpr uint16_t SP_T_E0_Is = 0x5000;
|
||||
constexpr uint16_t SP_T_E0_Set = 0x5010;
|
||||
constexpr uint16_t SP_T_E1_Is = 0x5020;
|
||||
constexpr uint16_t SP_T_Bed_Is = 0x5030;
|
||||
constexpr uint16_t SP_T_Bed_Set = 0x5040;
|
418
Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp
Normal file
418
Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp
Normal file
@ -0,0 +1,418 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_HYPRECY)
|
||||
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "../../../../MarlinCore.h"
|
||||
#include "../../../../gcode/queue.h"
|
||||
#include "../../../../libs/duration_t.h"
|
||||
#include "../../../../module/settings.h"
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
#include "../../../../module/planner.h"
|
||||
#include "../../../../module/printcounter.h"
|
||||
#include "../../../../sd/cardreader.h"
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(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;
|
||||
|
||||
if (filelist.isDir()) {
|
||||
filelist.changeDir(filelist.filename());
|
||||
top_file = 0;
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_PRINT_FILENAME)
|
||||
// Send print filename
|
||||
dgusdisplay.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);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!filelist.seek(file_to_print)) return;
|
||||
ExtUI::printFile(filelist.shortFilename());
|
||||
GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(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)) {
|
||||
case 0: { // Resume
|
||||
if (ExtUI::isPrintingFromMediaPaused()) {
|
||||
ExtUI::resumePrint();
|
||||
}
|
||||
} break;
|
||||
|
||||
case 1: // 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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_SendFilename(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] = "";
|
||||
var.memadr = (void*)tmpfilename;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardInserted() {
|
||||
top_file = 0;
|
||||
filelist.refresh();
|
||||
auto cs = getCurrentScreen();
|
||||
if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS)
|
||||
GotoScreen(DGUSLCD_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);
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
||||
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,
|
||||
// meaning "return to previous screen"
|
||||
DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1];
|
||||
|
||||
DEBUG_ECHOLNPAIR("\n DEBUG target", target);
|
||||
|
||||
if (target == DGUSLCD_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();
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateNewScreen(target);
|
||||
|
||||
#ifdef DEBUG_DGUSLCD
|
||||
if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPAIR("WARNING: No screen Mapping found for ", target);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleManualMove");
|
||||
|
||||
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
if (movevalue) {
|
||||
const uint16_t choice = *(uint16_t*)var.memadr;
|
||||
movevalue = movevalue < 0 ? -choice : choice;
|
||||
}
|
||||
#endif
|
||||
char axiscode;
|
||||
unsigned int speed = 1500; // FIXME: get default feedrate for manual moves, dont hardcode.
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
|
||||
case VP_MOVE_X:
|
||||
axiscode = 'X';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::X)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Y:
|
||||
axiscode = 'Y';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Z:
|
||||
axiscode = 'Z';
|
||||
speed = 300; // default to 5mm/s
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_HOME_ALL: // only used for homing
|
||||
axiscode = '\0';
|
||||
movevalue = 0; // ignore value sent from display, this VP is _ONLY_ for homing.
|
||||
break;
|
||||
}
|
||||
|
||||
if (!movevalue) {
|
||||
// homing
|
||||
DEBUG_ECHOPAIR(" homing ", AS_CHAR(axiscode));
|
||||
char buf[6] = "G28 X";
|
||||
buf[4] = axiscode;
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓");
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// movement
|
||||
DEBUG_ECHOPAIR(" move ", AS_CHAR(axiscode));
|
||||
bool old_relative_mode = relative_mode;
|
||||
if (!relative_mode) {
|
||||
//DEBUG_ECHOPGM(" G91");
|
||||
queue.enqueue_now_P(PSTR("G91"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
char buf[32]; // G1 X9999.99 F12345
|
||||
unsigned int backup_speed = MMS_TO_MMM(feedrate_mm_s);
|
||||
char sign[] = "\0";
|
||||
int16_t value = movevalue / 100;
|
||||
if (movevalue < 0) { value = -value; sign[0] = '-'; }
|
||||
int16_t fraction = ABS(movevalue) % 100;
|
||||
snprintf_P(buf, 32, PSTR("G0 %c%s%d.%02d F%d"), axiscode, sign, value, fraction, speed);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (backup_speed != speed) {
|
||||
snprintf_P(buf, 32, PSTR("G0 F%d"), backup_speed);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
}
|
||||
// while (!enqueue_and_echo_command(buf)) idle();
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (!old_relative_mode) {
|
||||
//DEBUG_ECHOPGM("G90");
|
||||
queue.enqueue_now_P(PSTR("G90"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
}
|
||||
|
||||
ForceCompleteUpdate();
|
||||
DEBUG_ECHOLNPGM("manmv done.");
|
||||
return;
|
||||
|
||||
cannotmove:
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", AS_CHAR(axiscode));
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("V1:", rawvalue);
|
||||
float value = (float)rawvalue / 10;
|
||||
DEBUG_ECHOLNPAIR("V2:", value);
|
||||
float newvalue = 0;
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_PID_P: newvalue = value; break;
|
||||
case VP_E0_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E0_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_PID_P: newvalue = value; break;
|
||||
case VP_E1_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E1_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
case VP_BED_PID_P: newvalue = value; break;
|
||||
case VP_BED_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_BED_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
}
|
||||
|
||||
DEBUG_ECHOLNPAIR_F("V3:", newvalue);
|
||||
*(float *)var.memadr = newvalue;
|
||||
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
}
|
||||
#endif // HAS_PID_HEATING
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleLiveAdjustZ");
|
||||
int16_t flag = swap16(*(uint16_t*)val_ptr),
|
||||
steps = flag ? -20 : 20;
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true);
|
||||
ForceCompleteUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentOption");
|
||||
|
||||
uint8_t e_temp = 0;
|
||||
filament_data.heated = false;
|
||||
uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
|
||||
if (preheat_option <= 8) { // Load filament type
|
||||
filament_data.action = 1;
|
||||
}
|
||||
else if (preheat_option >= 10) { // Unload filament type
|
||||
preheat_option -= 10;
|
||||
filament_data.action = 2;
|
||||
filament_data.purge_length = DGUS_FILAMENT_PURGE_LENGTH;
|
||||
}
|
||||
else { // Cancel filament operation
|
||||
filament_data.action = 0;
|
||||
}
|
||||
|
||||
switch (preheat_option) {
|
||||
case 0: // Load PLA
|
||||
#ifdef PREHEAT_1_TEMP_HOTEND
|
||||
e_temp = PREHEAT_1_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 1: // Load ABS
|
||||
TERN_(PREHEAT_2_TEMP_HOTEND, e_temp = PREHEAT_2_TEMP_HOTEND);
|
||||
break;
|
||||
case 2: // Load PET
|
||||
#ifdef PREHEAT_3_TEMP_HOTEND
|
||||
e_temp = PREHEAT_3_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 3: // Load FLEX
|
||||
#ifdef PREHEAT_4_TEMP_HOTEND
|
||||
e_temp = PREHEAT_4_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 9: // Cool down
|
||||
default:
|
||||
e_temp = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (filament_data.action == 0) { // Go back to utility screen
|
||||
#if HOTENDS >= 1
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E0);
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1);
|
||||
#endif
|
||||
GotoScreen(DGUSLCD_SCREEN_UTILITY);
|
||||
}
|
||||
else { // Go to the preheat screen to show the heating progress
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E0;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E1;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_HEATING);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentLoadUnload");
|
||||
if (filament_data.action <= 0) return;
|
||||
|
||||
// If we close to the target temperature, we can start load or unload the filament
|
||||
if (thermalManager.hotEnoughToExtrude(filament_data.extruder) && \
|
||||
thermalManager.targetHotEnoughToExtrude(filament_data.extruder)) {
|
||||
float movevalue = DGUS_FILAMENT_LOAD_LENGTH_PER_TIME;
|
||||
|
||||
if (filament_data.action == 1) { // load filament
|
||||
if (!filament_data.heated) {
|
||||
//GotoScreen(DGUSLCD_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);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
// Before unloading extrude to prevent jamming
|
||||
if (filament_data.purge_length >= 0) {
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue;
|
||||
filament_data.purge_length -= movevalue;
|
||||
}
|
||||
else {
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) - movevalue;
|
||||
}
|
||||
}
|
||||
ExtUI::setAxisPosition_mm(movevalue, filament_data.extruder);
|
||||
}
|
||||
}
|
||||
#endif // DGUS_FILAMENT_LOADUNLOAD
|
||||
|
||||
bool DGUSScreenHandler::loop() {
|
||||
dgusdisplay.loop();
|
||||
|
||||
const millis_t ms = millis();
|
||||
static millis_t next_event_ms = 0;
|
||||
|
||||
if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) {
|
||||
next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS;
|
||||
UpdateScreenVPData();
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
static bool booted = false;
|
||||
|
||||
if (!booted && TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
|
||||
booted = true;
|
||||
|
||||
if (!booted && ELAPSED(ms, TERN(USE_MKS_GREEN_UI, 1000, BOOTSCREEN_TIMEOUT)))
|
||||
booted = true;
|
||||
#endif
|
||||
return IsScreenComplete();
|
||||
}
|
||||
|
||||
#endif // DGUS_LCD_UI_HYPRECY
|
240
Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.h
Normal file
240
Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.h
Normal file
@ -0,0 +1,240 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSVPVariable.h"
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
#include "../../../../inc/MarlinConfig.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
|
||||
class DGUSScreenHandler {
|
||||
public:
|
||||
DGUSScreenHandler() = default;
|
||||
|
||||
static bool loop();
|
||||
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifing whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
// "M117" Message -- msg is a RAM ptr.
|
||||
static void setstatusmessage(const char *msg);
|
||||
// The same for messages from Flash
|
||||
static void setstatusmessagePGM(PGM_P const msg);
|
||||
// Callback for VP "Display wants to change screen on idle printer"
|
||||
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);
|
||||
|
||||
// Callback for VP "All Heaters Off"
|
||||
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);
|
||||
// Hook for "Change Flowrate"
|
||||
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);
|
||||
#endif
|
||||
|
||||
// Hook for manual move.
|
||||
static void HandleManualMove(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for manual extrude.
|
||||
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);
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Hook for power loss recovery.
|
||||
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);
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
// Hook for "Change this temperature PID para"
|
||||
static void HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for PID autotune
|
||||
static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_BED_PROBE
|
||||
// Hook for "Change probe offset z"
|
||||
static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
// Hook for live z adjust action
|
||||
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
// Hook for fan control
|
||||
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);
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
// Hook for preheat
|
||||
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);
|
||||
// Hook for filament load and unload
|
||||
static void HandleFilamentLoadUnload(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
// Callback for VP "Display wants to change screen when there is a SD card"
|
||||
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);
|
||||
// File touched.
|
||||
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// start print after confirmation received.
|
||||
static void DGUSLCD_SD_StartPrint(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);
|
||||
// User confirmed the abort action
|
||||
static void DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the tune button
|
||||
static void DGUSLCD_SD_PrintTune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Send a single filename to the display.
|
||||
static void DGUSLCD_SD_SendFilename(DGUS_VP_Variable &var);
|
||||
// Marlin informed us that a new SD has been inserted.
|
||||
static void SDCardInserted();
|
||||
// Marlin informed us that the SD Card has been removed().
|
||||
static void SDCardRemoved();
|
||||
// Marlin informed us about a bad SD Card.
|
||||
static void SDCardError();
|
||||
#endif
|
||||
|
||||
// OK Button the Confirm screen.
|
||||
static void ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Update data after went to new screen (by display or by GotoScreen)
|
||||
// remember: store the last-displayed screen, so it can get returned to.
|
||||
// (e.g for pop up messages)
|
||||
static void UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup=false);
|
||||
|
||||
// Recall the remembered screen.
|
||||
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 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);
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
static void DGUSLCD_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);
|
||||
|
||||
template<typename T>
|
||||
static void DGUSLCD_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;
|
||||
LOOP_L_N(i, sizeof(T)) x.tmp[i] = ptr[sizeof(T) - i - 1];
|
||||
*(T*)var.memadr = x.t;
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// 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<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (long)f);
|
||||
}
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// 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<unsigned int decimals>
|
||||
static void DGUSLCD_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);
|
||||
}
|
||||
}
|
||||
|
||||
// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static inline void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
private:
|
||||
static DGUSLCD_Screens current_screen; //< 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 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 uint16_t ConfirmVP; //< context for confirm screen (VP that will be emulated-sent on "OK").
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static int16_t top_file; //< file on top of file chooser
|
||||
static int16_t file_to_print; //< touched file to be confirmed
|
||||
#endif
|
||||
|
||||
static void (*confirm_action_cb)();
|
||||
};
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#define PLR_SCREEN_RECOVER DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
#define PLR_SCREEN_CANCEL DGUSLCD_SCREEN_STATUS
|
||||
#endif
|
797
Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp
Normal file
797
Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp
Normal file
@ -0,0 +1,797 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_MKS)
|
||||
|
||||
#include "DGUSDisplayDef.h"
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
#include "../../../../module/planner.h"
|
||||
|
||||
#include "../../ui_api.h"
|
||||
#include "../../../marlinui.h"
|
||||
|
||||
#if ENABLED(HAS_STEALTHCHOP)
|
||||
#include "../../../../module/stepper/trinamic.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
uint16_t distanceToMove = 10;
|
||||
#endif
|
||||
|
||||
uint16_t manualMoveStep = 1;
|
||||
uint16_t distanceFilament = 10;
|
||||
uint16_t filamentSpeed_mm_s = 25;
|
||||
float ZOffset_distance = 0.1;
|
||||
float mesh_adj_distance = 0.01;
|
||||
float Z_distance = 0.1;
|
||||
|
||||
//struct { uint16_t h, m, s; } dgus_time;
|
||||
|
||||
//
|
||||
// Persistent settings
|
||||
//
|
||||
xy_int_t mks_corner_offsets[5]; // Initialized by settings.load()
|
||||
xyz_int_t mks_park_pos; // Initialized by settings.load()
|
||||
celsius_t mks_min_extrusion_temp; // Initialized by settings.load()
|
||||
|
||||
void MKS_reset_settings() {
|
||||
constexpr xy_int_t init_dgus_level_offsets[5] = {
|
||||
{ 20, 20 }, { 20, 20 },
|
||||
{ 20, 20 }, { 20, 20 },
|
||||
{ X_CENTER, Y_CENTER }
|
||||
};
|
||||
mks_language_index = 0;
|
||||
COPY(mks_corner_offsets, init_dgus_level_offsets);
|
||||
mks_park_pos.set(20, 20, 10);
|
||||
mks_min_extrusion_temp = 0;
|
||||
}
|
||||
|
||||
xyz_pos_t position_before_pause;
|
||||
constexpr feedRate_t park_speed_xy = TERN(NOZZLE_PARK_FEATURE, NOZZLE_PARK_XY_FEEDRATE, 100),
|
||||
park_speed_z = TERN(NOZZLE_PARK_FEATURE, NOZZLE_PARK_Z_FEEDRATE, 5);
|
||||
|
||||
void MKS_pause_print_move() {
|
||||
queue.exhaust();
|
||||
position_before_pause = current_position;
|
||||
destination.z = _MIN(current_position.z + mks_park_pos.z, Z_MAX_POS);
|
||||
prepare_internal_move_to_destination(park_speed_z);
|
||||
destination.set(X_MIN_POS + mks_park_pos.x, Y_MIN_POS + mks_park_pos.y);
|
||||
prepare_internal_move_to_destination(park_speed_xy);
|
||||
}
|
||||
|
||||
void MKS_resume_print_move() {
|
||||
destination.set(position_before_pause.x, position_before_pause.y);
|
||||
prepare_internal_move_to_destination(park_speed_xy);
|
||||
destination.z = position_before_pause.z;
|
||||
prepare_internal_move_to_destination(park_speed_z);
|
||||
}
|
||||
|
||||
float z_offset_add = 0;
|
||||
|
||||
xyz_int_t tmc_step; // = { 0, 0, 0 }
|
||||
|
||||
uint16_t lcd_default_light = 50;
|
||||
|
||||
EX_FILAMENT_DEF ex_filament;
|
||||
RUNOUT_MKS_DEF runout_mks;
|
||||
NOZZLE_PARK_DEF nozzle_park_mks;
|
||||
|
||||
const uint16_t VPList_Boot[] PROGMEM = {
|
||||
VP_MARLIN_VERSION,
|
||||
0x0000
|
||||
};
|
||||
|
||||
#define MKSLIST_E_ITEM(N) VP_T_E##N##_Is, VP_T_E##N##_Set,
|
||||
|
||||
const uint16_t VPList_Main[] PROGMEM = {
|
||||
// VP_M117, for completeness, but it cannot be auto-uploaded.
|
||||
#if HOTENDS >= 1
|
||||
MKSLIST_E_ITEM(0) VP_E0_STATUS,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
MKSLIST_E_ITEM(1)
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set, VP_BED_STATUS,
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
VP_Fan0_Percentage, VP_FAN0_STATUS,
|
||||
#endif
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
VP_Fan0_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
VP_PrintProgress_Percentage,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Home[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
// Language
|
||||
// VP_HOME_Dis,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Setting[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
// Language
|
||||
VP_Setting_Dis,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Tool[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
// Language
|
||||
VP_Tool_Dis,
|
||||
// LCD BLK
|
||||
VP_LCD_BLK,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_EXTRUE[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
VP_Filament_distance,
|
||||
VP_Filament_speed,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_LEVEL[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_MOVE[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Print[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
// Print Percent
|
||||
VP_PrintProgress_Percentage,
|
||||
|
||||
VP_PrintTime,
|
||||
|
||||
VP_Flowrate_E0,
|
||||
VP_Flowrate_E1,
|
||||
VP_Feedrate_Percentage,
|
||||
|
||||
VP_PrintTime_H,
|
||||
VP_PrintTime_M,
|
||||
VP_PrintTime_S,
|
||||
|
||||
VP_XPos,
|
||||
VP_YPos,
|
||||
VP_ZPos,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_SD_File[] PROGMEM = {
|
||||
VP_SD_FileName0, VP_SD_FileName1,
|
||||
VP_SD_FileName2, VP_SD_FileName3,
|
||||
VP_SD_FileName4, VP_SD_FileName5,
|
||||
VP_SD_FileName6, VP_SD_FileName7,
|
||||
VP_SD_FileName8, VP_SD_FileName9,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_TempOnly[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
// LCD BLK
|
||||
VP_LCD_BLK,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Pluse[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
// Pluse
|
||||
VP_X_STEP_PER_MM,
|
||||
VP_Y_STEP_PER_MM,
|
||||
VP_Z_STEP_PER_MM,
|
||||
VP_E0_STEP_PER_MM,
|
||||
VP_E1_STEP_PER_MM,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_MaxSpeed[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
// Pluse
|
||||
VP_X_MAX_SPEED,
|
||||
VP_Y_MAX_SPEED,
|
||||
VP_Z_MAX_SPEED,
|
||||
VP_E0_MAX_SPEED,
|
||||
VP_E1_MAX_SPEED,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_MaxAcc[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
// ACC
|
||||
VP_ACC_SPEED,
|
||||
VP_X_ACC_MAX_SPEED,
|
||||
VP_Y_ACC_MAX_SPEED,
|
||||
VP_Z_ACC_MAX_SPEED,
|
||||
VP_E0_ACC_MAX_SPEED,
|
||||
VP_E1_ACC_MAX_SPEED,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_PID[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
// PID
|
||||
VP_E0_PID_P,
|
||||
VP_E0_PID_I,
|
||||
VP_E0_PID_D,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Level_Point[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
// Level Point
|
||||
VP_Level_Point_One_X,
|
||||
VP_Level_Point_One_Y,
|
||||
VP_Level_Point_Two_X,
|
||||
VP_Level_Point_Two_Y,
|
||||
VP_Level_Point_Three_X,
|
||||
VP_Level_Point_Three_Y,
|
||||
VP_Level_Point_Four_X,
|
||||
VP_Level_Point_Four_Y,
|
||||
VP_Level_Point_Five_X,
|
||||
VP_Level_Point_Five_Y,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Level_PrintConfig[] PROGMEM = {
|
||||
VP_T_E0_Set,
|
||||
VP_T_E1_Set,
|
||||
VP_T_Bed_Set,
|
||||
VP_Flowrate_E0,
|
||||
VP_Flowrate_E1,
|
||||
VP_Fan0_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_PrintPauseConfig[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
|
||||
VP_X_PARK_POS,
|
||||
VP_Y_PARK_POS,
|
||||
VP_Z_PARK_POS,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_MotoConfig[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
|
||||
VP_TRAVEL_SPEED,
|
||||
VP_FEEDRATE_MIN_SPEED,
|
||||
VP_T_F_SPEED,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_EX_Config[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
VP_MIN_EX_T,VP_Min_EX_T_E,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSTMC_Config[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
VP_MIN_EX_T,
|
||||
|
||||
VP_TMC_X_STEP,
|
||||
VP_TMC_Y_STEP,
|
||||
VP_TMC_Z_STEP,
|
||||
VP_TMC_X1_Current,
|
||||
VP_TMC_Y1_Current,
|
||||
VP_TMC_X_Current,
|
||||
VP_TMC_Y_Current,
|
||||
VP_TMC_Z_Current,
|
||||
VP_TMC_E0_Current,
|
||||
VP_TMC_E1_Current,
|
||||
VP_TMC_Z1_Current,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSAuto_Level[] PROGMEM = {
|
||||
VP_MESH_LEVEL_POINT_DIS,
|
||||
VP_ZPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSOffset_Config[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
VP_OFFSET_X,
|
||||
VP_OFFSET_Y,
|
||||
VP_OFFSET_Z,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSBabyStep[] PROGMEM = {
|
||||
VP_ZOffset_DE_DIS,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_About[] PROGMEM = {
|
||||
// Marlin version
|
||||
VP_MARLIN_VERSION,
|
||||
// H43 Version
|
||||
VP_MKS_H43_VERSION,
|
||||
VP_MKS_H43_UpdataVERSION,
|
||||
0x0000
|
||||
};
|
||||
|
||||
// Page data updata
|
||||
const struct VPMapping VPMap[] PROGMEM = {
|
||||
{ MKSLCD_SCREEN_BOOT, VPList_Boot }, // Boot Page to show logo 0
|
||||
{ MKSLCD_SCREEN_HOME, MKSList_Home }, // Home, Page 1
|
||||
{ MKSLCD_SCREEN_SETTING, MKSList_Setting }, // Setting, Page 2
|
||||
{ MKSLCD_SCREEM_TOOL, MKSList_Tool }, // Page 3
|
||||
{ MKSLCD_SCREEN_EXTRUDE_P1, MKSList_EXTRUE }, // Page 4
|
||||
{ MKSLCD_SCREEN_EXTRUDE_P2, MKSList_EXTRUE }, // Page 11
|
||||
{ MKSLCD_PAUSE_SETTING_EX, MKSList_EXTRUE }, // Page 57
|
||||
{ MKSLCD_PAUSE_SETTING_EX2, MKSList_EXTRUE }, // Page 61
|
||||
{ MKSLCD_SCREEN_LEVEL, MKSList_LEVEL }, // Page 5
|
||||
{ MKSLCD_SCREEN_MOVE, MKSList_MOVE }, // Page 6
|
||||
{ MKSLCD_SCREEN_PRINT, MKSList_Print }, // Page 7
|
||||
{ MKSLCD_SCREEN_PAUSE, MKSList_Print }, // Page 26
|
||||
{ MKSLCD_SCREEN_CHOOSE_FILE, MKSList_SD_File }, // Page 15
|
||||
{ MKSLCD_SCREEN_MOTOR_PLUSE, MKSList_Pluse }, // Page 51
|
||||
{ MKSLCD_SCREEN_MOTOR_SPEED, MKSList_MaxSpeed }, // Page 55
|
||||
{ MKSLCD_SCREEN_MOTOR_ACC_MAX, MKSList_MaxAcc }, // Page 53
|
||||
{ MKSLCD_SCREEN_LEVEL_DATA, MKSList_Level_Point }, // Page 48
|
||||
{ MKSLCD_PrintPause_SET, MKSList_PrintPauseConfig }, // Page 49
|
||||
{ MKSLCD_FILAMENT_DATA, MKSList_SD_File }, // Page 50
|
||||
{ MKSLCD_SCREEN_Config, MKSList_TempOnly }, // Page 46
|
||||
{ MKSLCD_SCREEN_Config_MOTOR, MKSList_MotoConfig }, // Page 47
|
||||
{ MKSLCD_PID, MKSList_PID }, // Page 56
|
||||
{ MKSLCD_ABOUT, MKSList_About }, // Page 36
|
||||
{ MKSLCD_SCREEN_PRINT_CONFIG, MKSList_Level_PrintConfig }, // Page 60
|
||||
{ MKSLCD_SCREEN_EX_CONFIG, MKSList_EX_Config }, // Page 65
|
||||
{ MKSLCD_SCREEN_TMC_Config, MKSTMC_Config }, // Page 70
|
||||
{ MKSLCD_AUTO_LEVEL, MKSAuto_Level }, // Page 73
|
||||
{ MKSLCD_Screen_Offset_Config, MKSOffset_Config }, // Page 30
|
||||
{ MKSLCD_Screen_PMove, MKSList_MOVE }, // Page 64
|
||||
{ MKSLCD_Screen_Baby, MKSBabyStep }, // Page 71
|
||||
//{ MKSLCD_SCREEN_LEVEL_DATA, MKSList_SD_File},
|
||||
//{ MKSLCD_SCREEN_HOME, VPList_Boot },
|
||||
{ 0, nullptr } // List is terminated with an nullptr as table entry.
|
||||
};
|
||||
|
||||
const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
|
||||
const char H43Version[] PROGMEM = "MKS H43_V1.30";
|
||||
const char Updata_Time[] PROGMEM = STRING_DISTRIBUTION_DATE;
|
||||
|
||||
// Helper to define a DGUS_VP_Variable for common use cases.
|
||||
#define VPHELPER(VPADR, VPADRVAR, RXFPTR, TXFPTR) \
|
||||
{ \
|
||||
.VP = VPADR, .memadr = VPADRVAR, .size = sizeof(VPADRVAR), \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR \
|
||||
}
|
||||
|
||||
// Helper to define a DGUS_VP_Variable when the sizeo of the var cannot be determined automaticalyl (eg. a string)
|
||||
#define VPHELPER_STR(VPADR, VPADRVAR, STRLEN, RXFPTR, TXFPTR) \
|
||||
{ \
|
||||
.VP = VPADR, .memadr = VPADRVAR, .size = STRLEN, \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR \
|
||||
}
|
||||
|
||||
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),
|
||||
#if ENABLED(SDSUPPORT)
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, ScreenHandler.ScreenChangeHookIfSD, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr),
|
||||
|
||||
// Back Button
|
||||
VPHELPER(VP_BACK_PAGE, nullptr, &ScreenHandler.ScreenBackChange, nullptr),
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, &ScreenHandler.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_X_HOME, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_Y_HOME, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_Z_HOME, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
|
||||
VPHELPER(VP_MOVE_DISTANCE, &manualMoveStep, &ScreenHandler.GetManualMovestep, nullptr),
|
||||
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_LEVEL_POINT, nullptr, &ScreenHandler.ManualAssistLeveling, nullptr),
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, &ScreenHandler.HandlePowerLossRecovery, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_SETTINGS, nullptr, &ScreenHandler.HandleSettings, nullptr),
|
||||
#if ENABLED(SINGLE_Z_CALIBRATION)
|
||||
VPHELPER(VP_Z_CALIBRATE, nullptr, &ScreenHandler.HandleZCalibration, nullptr),
|
||||
#endif
|
||||
#if ENABLED(FIRST_LAYER_CAL)
|
||||
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, &ScreenHandler.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},
|
||||
// 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},
|
||||
|
||||
// Temperature Data
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
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),
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, &ScreenHandler.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),
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_LOAD_Filament, nullptr, &ScreenHandler.MKS_FilamentLoad, nullptr),
|
||||
VPHELPER(VP_UNLOAD_Filament, nullptr, &ScreenHandler.MKS_FilamentUnLoad, nullptr),
|
||||
VPHELPER(VP_Filament_distance, &distanceFilament, &ScreenHandler.GetManualFilament, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Filament_speed, &filamentSpeed_mm_s, &ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
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),
|
||||
|
||||
#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),
|
||||
#endif
|
||||
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, &ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_E1_FILAMENT_LOAD_UNLOAD, nullptr, &ScreenHandler.HandleFilamentOption, &ScreenHandler.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),
|
||||
#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),
|
||||
#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),
|
||||
REPEAT(FAN_COUNT, FAN_VPHELPER)
|
||||
#endif
|
||||
|
||||
// Feedrate
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, &ScreenHandler.DGUSLCD_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>),
|
||||
|
||||
// Level Point Set
|
||||
VPHELPER(VP_Level_Point_One_X, &mks_corner_offsets[0].x, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_One_Y, &mks_corner_offsets[0].y, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Two_X, &mks_corner_offsets[1].x, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Two_Y, &mks_corner_offsets[1].y, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Three_X, &mks_corner_offsets[2].x, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Three_Y, &mks_corner_offsets[2].y, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Four_X, &mks_corner_offsets[3].x, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Four_Y, &mks_corner_offsets[3].y, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Five_X, &mks_corner_offsets[4].x, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Five_Y, &mks_corner_offsets[4].y, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
// Print Progress
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay),
|
||||
|
||||
//LCD Control
|
||||
VPHELPER(VP_LCD_BLK, &lcd_default_light, &ScreenHandler.LCD_BLK_Adjust, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
// Print Time
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintTimeToDisplay_MKS),
|
||||
|
||||
#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),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], ScreenHandler.HandleStepPerMMChanged_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], ScreenHandler.HandleStepPerMMChanged_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], ScreenHandler.HandleStepPerMMChanged_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
|
||||
VPHELPER(VP_X_MAX_SPEED, &planner.settings.max_feedrate_mm_s[X_AXIS], ScreenHandler.HandleMaxSpeedChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Y_MAX_SPEED, &planner.settings.max_feedrate_mm_s[Y_AXIS], ScreenHandler.HandleMaxSpeedChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Z_MAX_SPEED, &planner.settings.max_feedrate_mm_s[Z_AXIS], ScreenHandler.HandleMaxSpeedChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_E0_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E0_AXIS], ScreenHandler.HandleExtruderMaxSpeedChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_E1_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E1_AXIS], ScreenHandler.HandleExtruderMaxSpeedChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_X_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[X_AXIS], ScreenHandler.HandleMaxAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Y_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[Y_AXIS], ScreenHandler.HandleMaxAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Z_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[Z_AXIS], ScreenHandler.HandleMaxAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_E0_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E0_AXIS], ScreenHandler.HandleExtruderAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_E1_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E1_AXIS], ScreenHandler.HandleExtruderAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_TRAVEL_SPEED, (uint16_t *)&planner.settings.travel_acceleration, ScreenHandler.HandleTravelAccChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_FEEDRATE_MIN_SPEED, (uint16_t *)&planner.settings.min_feedrate_mm_s, ScreenHandler.HandleFeedRateMinChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_T_F_SPEED, (uint16_t *)&planner.settings.min_travel_feedrate_mm_s, ScreenHandler.HandleMin_T_F_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_ACC_SPEED, (uint16_t *)&planner.settings.acceleration, ScreenHandler.HandleAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
VPHELPER(VP_X_PARK_POS, &mks_park_pos.x, ScreenHandler.GetParkPos_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Y_PARK_POS, &mks_park_pos.y, ScreenHandler.GetParkPos_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Z_PARK_POS, &mks_park_pos.z, ScreenHandler.GetParkPos_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_MIN_EX_T, &thermalManager.extrude_min_temp, ScreenHandler.HandleGetExMinTemp_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING) // TMC SENSORLESS Setting
|
||||
#if AXIS_HAS_STEALTHCHOP(X)
|
||||
VPHELPER(VP_TMC_X_STEP, &tmc_step.x, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Y)
|
||||
VPHELPER(VP_TMC_Y_STEP, &tmc_step.y, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Z)
|
||||
VPHELPER(VP_TMC_Z_STEP, &tmc_step.z, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_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),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y)
|
||||
VPHELPER(VP_TMC_Y_Current, &stepperY.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z)
|
||||
VPHELPER(VP_TMC_Z_Current, &stepperZ.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E0)
|
||||
VPHELPER(VP_TMC_E0_Current, &stepperE0.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E1)
|
||||
VPHELPER(VP_TMC_E1_Current, &stepperE1.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(X2)
|
||||
VPHELPER(VP_TMC_X1_Current, &stepperX2.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
VPHELPER(VP_TMC_Y1_Current, &stepperY2.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
VPHELPER(VP_TMC_Z1_Current, &stepperZ2.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_EEPROM_CTRL, nullptr, ScreenHandler.EEPROM_CTRL, nullptr),
|
||||
VPHELPER(VP_LEVEL_BUTTON, nullptr, ScreenHandler.Level_Ctrl_MKS, nullptr),
|
||||
VPHELPER(VP_LANGUAGE_CHANGE, nullptr, ScreenHandler.LanguageChange_MKS, nullptr),
|
||||
|
||||
//VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, nullptr),
|
||||
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ_Confirm, nullptr, ScreenHandler.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_Min_EX_T_E, &thermalManager.extrude_min_temp, &ScreenHandler.GetMinExtrudeTemp, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_AutoTurnOffSw, nullptr, &ScreenHandler.GetTurnOffCtrl, nullptr),
|
||||
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
#endif
|
||||
|
||||
|
||||
// SDCard File listing
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
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),
|
||||
#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>),
|
||||
#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>),
|
||||
#endif
|
||||
#else
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.PrintReturn, nullptr),
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, ScreenHandler.DGUSLCD_SendWaitingStatusToDisplay),
|
||||
#endif
|
||||
|
||||
// Messages for the User, shared by the popup and the kill screen. They cant 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 = &ScreenHandler.DGUSLCD_SendStringToDisplay_Language_MKS},
|
||||
{.VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplay_Language_MKS},
|
||||
{.VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplay_Language_MKS},
|
||||
{.VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplay_Language_MKS},
|
||||
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
||||
#endif // DGUS_LCD_UI_MKS
|
891
Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h
Normal file
891
Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h
Normal file
@ -0,0 +1,891 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
//#define DGUS_MKS_RUNOUT_SENSOR
|
||||
|
||||
#define LOGO_TIME_DELAY TERN(USE_MKS_GREEN_UI, 8000, 1500)
|
||||
|
||||
#if ENABLED(DGUS_MKS_RUNOUT_SENSOR)
|
||||
#define MT_DET_1_PIN 1
|
||||
#define MT_DET_2_PIN 2
|
||||
#define MT_DET_PIN_INVERTING false
|
||||
#endif
|
||||
|
||||
#define MKS_FINSH
|
||||
|
||||
extern uint16_t manualMoveStep;
|
||||
extern uint16_t distanceFilament;
|
||||
extern uint16_t filamentSpeed_mm_s;
|
||||
extern float ZOffset_distance;
|
||||
extern float mesh_adj_distance;
|
||||
extern float Z_distance;
|
||||
|
||||
//extern struct { uint16_t h, m, s; } dgus_time;
|
||||
|
||||
extern xy_int_t mks_corner_offsets[5];
|
||||
extern xyz_int_t mks_park_pos;
|
||||
extern celsius_t mks_min_extrusion_temp;
|
||||
|
||||
void MKS_reset_settings(); // Restore persistent settings to defaults
|
||||
|
||||
void MKS_pause_print_move();
|
||||
void MKS_resume_print_move();
|
||||
|
||||
extern float z_offset_add;
|
||||
|
||||
extern xyz_int_t tmc_step;
|
||||
|
||||
extern uint16_t lcd_default_light;
|
||||
|
||||
#if AXIS_HAS_STEALTHCHOP(X)
|
||||
extern uint16_t tmc_x_current;
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Y)
|
||||
extern uint16_t tmc_y_current;
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Z)
|
||||
extern uint16_t tmc_z_current;
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(E0)
|
||||
extern uint16_t tmc_e0_current;
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(E1)
|
||||
extern uint16_t tmc_e1_current;
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
EX_HEATING,
|
||||
EX_HEAT_STARUS,
|
||||
EX_CHANGING,
|
||||
EX_CHANGE_STATUS,
|
||||
EX_NONE,
|
||||
} EX_STATUS_DEF;
|
||||
|
||||
typedef struct {
|
||||
//uint8_t ex_change_flag:1;
|
||||
//uint8_t ex_heat_flag:1;
|
||||
uint8_t ex_load_unload_flag:1; //0:unload 1:load
|
||||
EX_STATUS_DEF ex_status;
|
||||
uint32_t ex_tick_start;
|
||||
uint32_t ex_tick_end;
|
||||
uint32_t ex_speed;
|
||||
uint32_t ex_length;
|
||||
uint32_t ex_need_time;
|
||||
} EX_FILAMENT_DEF;
|
||||
|
||||
extern EX_FILAMENT_DEF ex_filament;
|
||||
|
||||
typedef enum {
|
||||
UNRUNOUT_STATUS,
|
||||
RUNOUT_STATUS,
|
||||
RUNOUT_WAITTING_STATUS,
|
||||
RUNOUT_BEGIN_STATUS,
|
||||
} RUNOUT_MKS_STATUS_DEF;
|
||||
|
||||
typedef struct {
|
||||
RUNOUT_MKS_STATUS_DEF runout_status;
|
||||
uint8_t pin_status;
|
||||
uint8_t de_count;
|
||||
uint8_t de_times;
|
||||
} RUNOUT_MKS_DEF;
|
||||
|
||||
extern RUNOUT_MKS_DEF runout_mks;
|
||||
|
||||
typedef struct {
|
||||
uint8_t print_pause_start_flag:1;
|
||||
uint8_t runout_flag:1;
|
||||
bool blstatus;
|
||||
uint16_t x_pos;
|
||||
uint16_t y_pos;
|
||||
uint16_t z_pos;
|
||||
} NOZZLE_PARK_DEF;
|
||||
|
||||
extern NOZZLE_PARK_DEF nozzle_park_mks;
|
||||
|
||||
enum DGUSLCD_Screens : 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,
|
||||
|
||||
MKSLCD_SCREEN_BOOT = 33,
|
||||
MKSLCD_SCREEN_HOME = 60, // MKS main page
|
||||
MKSLCD_SCREEN_SETTING = 62, // MKS Setting page / no wifi whit
|
||||
MKSLCD_SCREEM_TOOL = 64, // MKS Tool page
|
||||
MKSLCD_SCREEN_EXTRUDE_P1 = 75,
|
||||
MKSLCD_SCREEN_EXTRUDE_P2 = 77,
|
||||
MKSLCD_SCREEN_LEVEL = 73,
|
||||
MKSLCD_AUTO_LEVEL = 81,
|
||||
MKSLCD_SCREEN_MOVE = 66,
|
||||
MKSLCD_SCREEN_PRINT = 68,
|
||||
MKSLCD_SCREEN_PAUSE = 70,
|
||||
MKSLCD_SCREEN_CHOOSE_FILE = 87,
|
||||
MKSLCD_SCREEN_NO_CHOOSE_FILE = 88,
|
||||
MKSLCD_SCREEN_Config = 101,
|
||||
MKSLCD_SCREEN_Config_MOTOR = 103,
|
||||
MKSLCD_SCREEN_MOTOR_PLUSE = 104,
|
||||
MKSLCD_SCREEN_MOTOR_SPEED = 102,
|
||||
MKSLCD_SCREEN_MOTOR_ACC_MAX = 105,
|
||||
MKSLCD_SCREEN_PRINT_CONFIG = 72,
|
||||
MKSLCD_SCREEN_LEVEL_DATA = 106,
|
||||
MKSLCD_PrintPause_SET = 107,
|
||||
MKSLCD_FILAMENT_DATA = 50,
|
||||
MKSLCD_ABOUT = 83,
|
||||
MKSLCD_PID = 108,
|
||||
MKSLCD_PAUSE_SETTING_MOVE = 98,
|
||||
MKSLCD_PAUSE_SETTING_EX = 96,
|
||||
MKSLCD_PAUSE_SETTING_EX2 = 97,
|
||||
MKSLCD_SCREEN_PRINT_CONFIRM = 94,
|
||||
MKSLCD_SCREEN_EX_CONFIG = 112,
|
||||
MKSLCD_SCREEN_EEP_Config = 89,
|
||||
MKSLCD_SCREEN_PrintDone = 92,
|
||||
MKSLCD_SCREEN_TMC_Config = 111,
|
||||
MKSLCD_Screen_Offset_Config = 109,
|
||||
MKSLCD_Screen_PMove = 98,
|
||||
MKSLCD_Screen_Baby = 79,
|
||||
|
||||
#else
|
||||
|
||||
DGUSLCD_SCREEN_BOOT = 120,
|
||||
DGUSLCD_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,
|
||||
|
||||
MKSLCD_SCREEN_BOOT = 0,
|
||||
MKSLCD_SCREEN_HOME = 1, // MKS main page
|
||||
MKSLCD_SCREEN_SETTING = 2, // MKS Setting page / no wifi whit
|
||||
MKSLCD_SCREEM_TOOL = 3, // MKS Tool page
|
||||
MKSLCD_SCREEN_EXTRUDE_P1 = 4,
|
||||
MKSLCD_SCREEN_EXTRUDE_P2 = 11,
|
||||
MKSLCD_SCREEN_LEVEL = 5,
|
||||
MKSLCD_AUTO_LEVEL = 73,
|
||||
MKSLCD_SCREEN_LEVEL_PRESS = 9,
|
||||
MKSLCD_SCREEN_MOVE = 6,
|
||||
MKSLCD_SCREEN_PRINT = 7,
|
||||
MKSLCD_SCREEN_PRINT_PRESS = 13,
|
||||
MKSLCD_SCREEN_PAUSE = 26,
|
||||
MKSLCD_SCREEN_PAUSE_PRESS = 26,
|
||||
MKSLCD_SCREEN_CHOOSE_FILE = 15,
|
||||
MKSLCD_SCREEN_NO_CHOOSE_FILE = 17,
|
||||
MKSLCD_SCREEN_Config = 46,
|
||||
MKSLCD_SCREEN_Config_MOTOR = 47,
|
||||
MKSLCD_SCREEN_MOTOR_PLUSE = 51,
|
||||
MKSLCD_SCREEN_MOTOR_SPEED = 55,
|
||||
MKSLCD_SCREEN_MOTOR_ACC_MAX = 53,
|
||||
MKSLCD_SCREEN_PRINT_CONFIG = 60,
|
||||
MKSLCD_SCREEN_LEVEL_DATA = 48,
|
||||
MKSLCD_PrintPause_SET = 49,
|
||||
MKSLCD_FILAMENT_DATA = 50,
|
||||
MKSLCD_ABOUT = 36,
|
||||
MKSLCD_PID = 56,
|
||||
MKSLCD_PAUSE_SETTING_MOVE = 58,
|
||||
MKSLCD_PAUSE_SETTING_EX = 57,
|
||||
MKSLCD_PAUSE_SETTING_EX2 = 61,
|
||||
MKSLCD_SCREEN_NO_FILE = 42,
|
||||
MKSLCD_SCREEN_PRINT_CONFIRM = 43,
|
||||
MKSLCD_SCREEN_EX_CONFIG = 65,
|
||||
MKSLCD_SCREEN_EEP_Config = 20,
|
||||
MKSLCD_SCREEN_PrintDone = 25,
|
||||
MKSLCD_SCREEN_TMC_Config = 70,
|
||||
MKSLCD_Screen_Offset_Config = 30,
|
||||
MKSLCD_Screen_PMove = 64,
|
||||
MKSLCD_Screen_Baby = 71,
|
||||
|
||||
#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"
|
||||
DGUSLDC_SCREEN_UNUSED = 255
|
||||
};
|
||||
|
||||
// Display Memory layout used (T5UID)
|
||||
// Except system variables this is arbitrary, just to organize stuff....
|
||||
|
||||
// 0x0000 .. 0x0FFF -- System variables and reserved by the display
|
||||
// 0x1000 .. 0x1FFF -- Variables to never change location, regardless of UI Version
|
||||
// 0x2000 .. 0x2FFF -- Controls (VPs that will trigger some action)
|
||||
// 0x3000 .. 0x4FFF -- Marlin Data to be displayed
|
||||
// 0x5000 .. -- SPs (if we want to modify display elements, e.g change color or like) -- currently unused
|
||||
|
||||
// As there is plenty of space (at least most displays have >8k RAM), we do not pack them too tight,
|
||||
// so that we can keep variables nicely together in the address space.
|
||||
|
||||
// UI Version always on 0x1000...0x1002 so that the firmware can check this and bail out.
|
||||
|
||||
// constexpr uint16_t VP_UI_VERSION_MAJOR = 0x1000; // Major -- incremented when incompatible
|
||||
// constexpr uint16_t VP_UI_VERSION_MINOR = 0x1001; // Minor -- incremented on new features, but compatible
|
||||
// constexpr uint16_t VP_UI_VERSION_PATCH = 0x1002; // Patch -- fixed which do not change functionality.
|
||||
// constexpr uint16_t VP_UI_FLAVOUR = 0x1010; // lets reserve 16 bytes here to determine if UI is suitable for this Marlin. tbd.
|
||||
|
||||
// Storage space for the Killscreen messages. 0x1100 - 0x1200 . Reused for the popup.
|
||||
// constexpr uint16_t VP_MSGSTR1 = 0x1100;
|
||||
// constexpr uint8_t VP_MSGSTR1_LEN = 0x20; // might be more place for it...
|
||||
// constexpr uint16_t VP_MSGSTR2 = 0x1140;
|
||||
// constexpr uint8_t VP_MSGSTR2_LEN = 0x20;
|
||||
// constexpr uint16_t VP_MSGSTR3 = 0x1180;
|
||||
// constexpr uint8_t VP_MSGSTR3_LEN = 0x20;
|
||||
// constexpr uint16_t VP_MSGSTR4 = 0x11C0;
|
||||
// constexpr uint8_t VP_MSGSTR4_LEN = 0x20;
|
||||
|
||||
// Screenchange request for screens that only make sense when printer is idle.
|
||||
// e.g movement is only allowed if printer is not printing.
|
||||
// Marlin must confirm by setting the screen manually.
|
||||
// constexpr uint16_t VP_SCREENCHANGE_ASK = 0x2000;
|
||||
// constexpr uint16_t VP_SCREENCHANGE = 0x2001; // Key-Return button to new menu pressed. Data contains target screen in low byte and info in high byte.
|
||||
// constexpr uint16_t VP_TEMP_ALL_OFF = 0x2002; // Turn all heaters off. Value arbitrary ;)=
|
||||
// constexpr uint16_t VP_SCREENCHANGE_WHENSD = 0x2003; // "Print" Button touched -- go only there if there is an SD Card.
|
||||
// constexpr uint16_t VP_CONFIRMED = 0x2010; // OK on confirm screen.
|
||||
|
||||
// // Buttons on the SD-Card File listing.
|
||||
// constexpr uint16_t VP_SD_ScrollEvent = 0x2020; // Data: 0 for "up a directory", numbers are the amount to scroll, e.g -1 one up, 1 one down
|
||||
// constexpr uint16_t VP_SD_FileSelected = 0x2022; // Number of file field selected.
|
||||
// constexpr uint16_t VP_SD_FileSelectConfirm = 0x2024; // (This is a virtual VP and emulated by the Confirm Screen when a file has been confirmed)
|
||||
|
||||
// constexpr uint16_t VP_SD_ResumePauseAbort = 0x2026; // Resume(Data=0), Pause(Data=1), Abort(Data=2) SD Card prints
|
||||
// constexpr uint16_t VP_SD_AbortPrintConfirmed = 0x2028; // Abort print confirmation (virtual, will be injected by the confirm dialog)
|
||||
// constexpr uint16_t VP_SD_Print_Setting = 0x2040;
|
||||
// constexpr uint16_t VP_SD_Print_LiveAdjustZ = 0x2050; // Data: 0 down, 1 up
|
||||
|
||||
// Controls for movement (we can't use the incremental / decremental feature of the display at this feature works only with 16 bit values
|
||||
// (which would limit us to 655.35mm, which is likely not a problem for common setups, but i don't want to rule out hangprinters support)
|
||||
// A word about the coding: The VP will be per axis and the return code will be an signed 16 bit value in 0.01 mm resolution, telling us
|
||||
// the relative travel amount t he user wants to do. So eg. if the display sends us VP=2100 with value 100, the user wants us to move X by +1 mm.
|
||||
// constexpr uint16_t VP_MOVE_X = 0x2100;
|
||||
// constexpr uint16_t VP_MOVE_Y = 0x2102;
|
||||
// constexpr uint16_t VP_MOVE_Z = 0x2104;
|
||||
// constexpr uint16_t VP_MOVE_E0 = 0x2110;
|
||||
// constexpr uint16_t VP_MOVE_E1 = 0x2112;
|
||||
// //constexpr uint16_t VP_MOVE_E2 = 0x2114;
|
||||
// //constexpr uint16_t VP_MOVE_E3 = 0x2116;
|
||||
// //constexpr uint16_t VP_MOVE_E4 = 0x2118;
|
||||
// //constexpr uint16_t VP_MOVE_E5 = 0x211A;
|
||||
// constexpr uint16_t VP_HOME_ALL = 0x2120;
|
||||
// constexpr uint16_t VP_MOTOR_LOCK_UNLOK = 0x2130;
|
||||
// constexpr uint16_t VP_XYZ_HOME = 0x2132;
|
||||
|
||||
// Power loss recovery
|
||||
// constexpr uint16_t VP_POWER_LOSS_RECOVERY = 0x2180;
|
||||
|
||||
// // Fan Control Buttons , switch between "off" and "on"
|
||||
// constexpr uint16_t VP_FAN0_CONTROL = 0x2200;
|
||||
// constexpr uint16_t VP_FAN1_CONTROL = 0x2202;
|
||||
// constexpr uint16_t VP_FAN2_CONTROL = 0x2204;
|
||||
// constexpr uint16_t VP_FAN3_CONTROL = 0x2206;
|
||||
|
||||
// // Heater Control Buttons , triged between "cool down" and "heat PLA" state
|
||||
// constexpr uint16_t VP_E0_CONTROL = 0x2210;
|
||||
// constexpr uint16_t VP_E1_CONTROL = 0x2212;
|
||||
// //constexpr uint16_t VP_E2_CONTROL = 0x2214;
|
||||
// //constexpr uint16_t VP_E3_CONTROL = 0x2216;
|
||||
// //constexpr uint16_t VP_E4_CONTROL = 0x2218;
|
||||
// //constexpr uint16_t VP_E5_CONTROL = 0x221A;
|
||||
// constexpr uint16_t VP_BED_CONTROL = 0x221C;
|
||||
|
||||
// // Preheat
|
||||
// constexpr uint16_t VP_E0_BED_PREHEAT = 0x2220;
|
||||
// constexpr uint16_t VP_E1_BED_PREHEAT = 0x2222;
|
||||
// //constexpr uint16_t VP_E2_BED_PREHEAT = 0x2224;
|
||||
// //constexpr uint16_t VP_E3_BED_PREHEAT = 0x2226;
|
||||
// //constexpr uint16_t VP_E4_BED_PREHEAT = 0x2228;
|
||||
// //constexpr uint16_t VP_E5_BED_PREHEAT = 0x222A;
|
||||
|
||||
// // Filament load and unload
|
||||
// // constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x2300;
|
||||
// // constexpr uint16_t VP_E1_FILAMENT_LOAD_UNLOAD = 0x2302;
|
||||
|
||||
// // Settings store , reset
|
||||
|
||||
// // PID autotune
|
||||
// constexpr uint16_t VP_PID_AUTOTUNE_E0 = 0x2410;
|
||||
// constexpr uint16_t VP_PID_AUTOTUNE_E1 = 0x2412;
|
||||
// //constexpr uint16_t VP_PID_AUTOTUNE_E2 = 0x2414;
|
||||
// //constexpr uint16_t VP_PID_AUTOTUNE_E3 = 0x2416;
|
||||
// //constexpr uint16_t VP_PID_AUTOTUNE_E4 = 0x2418;
|
||||
// //constexpr uint16_t VP_PID_AUTOTUNE_E5 = 0x241A;
|
||||
// constexpr uint16_t VP_PID_AUTOTUNE_BED = 0x2420;
|
||||
// // Calibrate Z
|
||||
// constexpr uint16_t VP_Z_CALIBRATE = 0x2430;
|
||||
|
||||
// First layer cal
|
||||
// constexpr uint16_t VP_Z_FIRST_LAYER_CAL = 0x2500; // Data: 0 - Cancel first layer cal progress, >0 filament type have loaded
|
||||
|
||||
// Firmware version on the boot screen.
|
||||
// constexpr uint16_t VP_MARLIN_VERSION = 0x3000;
|
||||
// constexpr uint8_t VP_MARLIN_VERSION_LEN = 16; // there is more space on the display, if needed.
|
||||
|
||||
// Place for status messages.
|
||||
constexpr uint16_t VP_M117 = 0x7020;
|
||||
constexpr uint8_t VP_M117_LEN = 0x20;
|
||||
|
||||
// // Temperatures.
|
||||
// constexpr uint16_t VP_T_E0_Is = 0x3060; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E0_Set = 0x3062; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E1_Is = 0x3064; // 4 Byte Integer
|
||||
// // reserved to support up to 6 Extruders:
|
||||
// constexpr uint16_t VP_T_E1_Set = 0x3066; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E2_Is = 0x3068; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E2_Set = 0x306A; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E3_Is = 0x306C; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E3_Set = 0x306E; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E4_Is = 0x3070; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E4_Set = 0x3072; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E5_Is = 0x3074; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E5_Set = 0x3076; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E6_Is = 0x3078; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E6_Set = 0x307A; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E7_Is = 0x3078; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E7_Set = 0x307A; // 2 Byte Integer
|
||||
|
||||
|
||||
// constexpr uint16_t VP_T_Bed_Is = 0x3080; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_Bed_Set = 0x3082; // 2 Byte Integer
|
||||
|
||||
// constexpr uint16_t VP_Flowrate_E0 = 0x3090; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_Flowrate_E1 = 0x3092; // 2 Byte Integer
|
||||
// // reserved for up to 6 Extruders:
|
||||
// constexpr uint16_t VP_Flowrate_E2 = 0x3094;
|
||||
// constexpr uint16_t VP_Flowrate_E3 = 0x3096;
|
||||
// constexpr uint16_t VP_Flowrate_E4 = 0x3098;
|
||||
// constexpr uint16_t VP_Flowrate_E5 = 0x309A;
|
||||
|
||||
// constexpr uint16_t VP_Fan0_Percentage = 0x3100; // 2 Byte Integer (0..100)
|
||||
// constexpr uint16_t VP_Fan1_Percentage = 0x3102; // 2 Byte Integer (0..100)
|
||||
// constexpr uint16_t VP_Fan2_Percentage = 0x3104; // 2 Byte Integer (0..100)
|
||||
// constexpr uint16_t VP_Fan3_Percentage = 0x3106; // 2 Byte Integer (0..100)
|
||||
// constexpr uint16_t VP_Feedrate_Percentage = 0x3108; // 2 Byte Integer (0..100)
|
||||
|
||||
// Actual Position
|
||||
// constexpr uint16_t VP_XPos = 0x3110; // 4 Byte Fixed point number; format xxx.yy
|
||||
// constexpr uint16_t VP_YPos = 0x3112; // 4 Byte Fixed point number; format xxx.yy
|
||||
// constexpr uint16_t VP_ZPos = 0x3114; // 4 Byte Fixed point number; format xxx.yy
|
||||
// constexpr uint16_t VP_EPos = 0x3120; // 4 Byte Fixed point number; format xxx.yy
|
||||
|
||||
// constexpr uint16_t VP_PrintProgress_Percentage = 0x3130; // 2 Byte Integer (0..100)
|
||||
|
||||
// constexpr uint16_t VP_PrintTime = 0x3140;
|
||||
// constexpr uint16_t VP_PrintTime_LEN = 32;
|
||||
|
||||
// constexpr uint16_t VP_PrintAccTime = 0x3160;
|
||||
// constexpr uint16_t VP_PrintAccTime_LEN = 32;
|
||||
|
||||
// constexpr uint16_t VP_PrintsTotal = 0x3180;
|
||||
// constexpr uint16_t VP_PrintsTotal_LEN = 16;
|
||||
|
||||
// // SDCard File Listing
|
||||
// constexpr uint16_t VP_SD_FileName_LEN = 32; // LEN is shared for all entries.
|
||||
// constexpr uint16_t DGUS_SD_FILESPERSCREEN = 8; // FIXME move that info to the display and read it from there.
|
||||
// constexpr uint16_t VP_SD_FileName0 = 0x3200;
|
||||
// constexpr uint16_t VP_SD_FileName1 = 0x3220;
|
||||
// constexpr uint16_t VP_SD_FileName2 = 0x3240;
|
||||
// constexpr uint16_t VP_SD_FileName3 = 0x3260;
|
||||
// constexpr uint16_t VP_SD_FileName4 = 0x3280;
|
||||
// constexpr uint16_t VP_SD_FileName5 = 0x32A0;
|
||||
// constexpr uint16_t VP_SD_FileName6 = 0x32C0;
|
||||
// constexpr uint16_t VP_SD_FileName7 = 0x32E0;
|
||||
|
||||
// Heater status
|
||||
constexpr uint16_t VP_E0_STATUS = 0x3410;
|
||||
constexpr uint16_t VP_E1_STATUS = 0x3412;
|
||||
//constexpr uint16_t VP_E2_STATUS = 0x3414;
|
||||
//constexpr uint16_t VP_E3_STATUS = 0x3416;
|
||||
//constexpr uint16_t VP_E4_STATUS = 0x3418;
|
||||
//constexpr uint16_t VP_E5_STATUS = 0x341A;
|
||||
constexpr uint16_t VP_MOVE_OPTION = 0x3500;
|
||||
|
||||
// // PIDs
|
||||
// constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
// constexpr uint16_t VP_E0_PID_I = 0x3702;
|
||||
// constexpr uint16_t VP_E0_PID_D = 0x3704;
|
||||
// constexpr uint16_t VP_E1_PID_P = 0x3706; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
// constexpr uint16_t VP_E1_PID_I = 0x3708;
|
||||
// constexpr uint16_t VP_E1_PID_D = 0x370A;
|
||||
// constexpr uint16_t VP_BED_PID_P = 0x3710;
|
||||
// constexpr uint16_t VP_BED_PID_I = 0x3712;
|
||||
// constexpr uint16_t VP_BED_PID_D = 0x3714;
|
||||
|
||||
// Wating screen status
|
||||
constexpr uint16_t VP_WAITING_STATUS = 0x3800;
|
||||
|
||||
// SPs for certain variables...
|
||||
// located at 0x5000 and up
|
||||
// Not used yet!
|
||||
// This can be used e.g to make controls / data display invisible
|
||||
constexpr uint16_t SP_T_E0_Is = 0x5000;
|
||||
constexpr uint16_t SP_T_E0_Set = 0x5010;
|
||||
constexpr uint16_t SP_T_E1_Is = 0x5020;
|
||||
constexpr uint16_t SP_T_Bed_Is = 0x5030;
|
||||
constexpr uint16_t SP_T_Bed_Set = 0x5040;
|
||||
|
||||
/*************************************************************************************************************************
|
||||
*************************************************************************************************************************
|
||||
* DGUS for MKS Mem layout
|
||||
************************************************************************************************************************
|
||||
************************************************************************************************************************/
|
||||
|
||||
#if ENABLED(MKS_FINSH)
|
||||
/* -------------------------------0x1000-0x1FFF------------------------------- */
|
||||
constexpr uint16_t VP_MSGSTR1 = 0x1100;
|
||||
constexpr uint8_t VP_MSGSTR1_LEN = 0x20; // might be more place for it...
|
||||
constexpr uint16_t VP_MSGSTR2 = 0x1140;
|
||||
constexpr uint8_t VP_MSGSTR2_LEN = 0x20;
|
||||
constexpr uint16_t VP_MSGSTR3 = 0x1180;
|
||||
constexpr uint8_t VP_MSGSTR3_LEN = 0x20;
|
||||
constexpr uint16_t VP_MSGSTR4 = 0x11C0;
|
||||
constexpr uint8_t VP_MSGSTR4_LEN = 0x20;
|
||||
|
||||
constexpr uint16_t VP_MARLIN_VERSION = 0x1A00;
|
||||
constexpr uint8_t VP_MARLIN_VERSION_LEN = 16; // there is more space on the display, if needed.
|
||||
|
||||
|
||||
constexpr uint16_t VP_SCREENCHANGE_ASK = 0x1500;
|
||||
constexpr uint16_t VP_SCREENCHANGE = 0x1501; // Key-Return button to new menu pressed. Data contains target screen in low byte and info in high byte.
|
||||
constexpr uint16_t VP_TEMP_ALL_OFF = 0x1502; // Turn all heaters off. Value arbitrary ;)=
|
||||
constexpr uint16_t VP_SCREENCHANGE_WHENSD = 0x1503; // "Print" Button touched -- go only there if there is an SD Card.
|
||||
constexpr uint16_t VP_CONFIRMED = 0x1510; // OK on confirm screen.
|
||||
|
||||
constexpr uint16_t VP_BACK_PAGE = 0x1600;
|
||||
constexpr uint16_t VP_SETTINGS = 0x1620;
|
||||
// Power loss recovery
|
||||
constexpr uint16_t VP_POWER_LOSS_RECOVERY = 0x1680;
|
||||
/* -------------------------------0x2000-0x2FFF------------------------------- */
|
||||
// Temperatures.
|
||||
constexpr uint16_t VP_T_E0_Is = 0x2000; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E0_Set = 0x2004; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E1_Is = 0x2008; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E1_Set = 0x200B; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E2_Is = 0x2010; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E2_Set = 0x2014; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E3_Is = 0x2018; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E3_Set = 0x201B; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E4_Is = 0x2020; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E4_Set = 0x2024; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E5_Is = 0x2028; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E5_Set = 0x202B; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E6_Is = 0x2030; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E6_Set = 0x2034; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E7_Is = 0x2038; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E7_Set = 0x203B; // 2 Byte Integer
|
||||
|
||||
constexpr uint16_t VP_T_Bed_Is = 0x2040; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_Bed_Set = 0x2044; // 2 Byte Integer
|
||||
|
||||
constexpr uint16_t VP_Min_EX_T_E = 0x2100;
|
||||
|
||||
constexpr uint16_t VP_Flowrate_E0 = 0x2200; // 2 Byte Integer
|
||||
constexpr uint16_t VP_Flowrate_E1 = 0x2202; // 2 Byte Integer
|
||||
constexpr uint16_t VP_Flowrate_E2 = 0x2204;
|
||||
constexpr uint16_t VP_Flowrate_E3 = 0x2206;
|
||||
constexpr uint16_t VP_Flowrate_E4 = 0x2208;
|
||||
constexpr uint16_t VP_Flowrate_E5 = 0x220A;
|
||||
constexpr uint16_t VP_Flowrate_E6 = 0x220C;
|
||||
constexpr uint16_t VP_Flowrate_E7 = 0x220E;
|
||||
|
||||
// Move
|
||||
constexpr uint16_t VP_MOVE_X = 0x2300;
|
||||
constexpr uint16_t VP_MOVE_Y = 0x2302;
|
||||
constexpr uint16_t VP_MOVE_Z = 0x2304;
|
||||
constexpr uint16_t VP_MOVE_E0 = 0x2310;
|
||||
constexpr uint16_t VP_MOVE_E1 = 0x2312;
|
||||
constexpr uint16_t VP_MOVE_E2 = 0x2314;
|
||||
constexpr uint16_t VP_MOVE_E3 = 0x2316;
|
||||
constexpr uint16_t VP_MOVE_E4 = 0x2318;
|
||||
constexpr uint16_t VP_MOVE_E5 = 0x231A;
|
||||
constexpr uint16_t VP_MOVE_E6 = 0x231C;
|
||||
constexpr uint16_t VP_MOVE_E7 = 0x231E;
|
||||
constexpr uint16_t VP_HOME_ALL = 0x2320;
|
||||
constexpr uint16_t VP_MOTOR_LOCK_UNLOK = 0x2330;
|
||||
constexpr uint16_t VP_MOVE_DISTANCE = 0x2334;
|
||||
constexpr uint16_t VP_X_HOME = 0x2336;
|
||||
constexpr uint16_t VP_Y_HOME = 0x2338;
|
||||
constexpr uint16_t VP_Z_HOME = 0x233A;
|
||||
|
||||
// Fan Control Buttons , switch between "off" and "on"
|
||||
constexpr uint16_t VP_FAN0_CONTROL = 0x2350;
|
||||
constexpr uint16_t VP_FAN1_CONTROL = 0x2352;
|
||||
constexpr uint16_t VP_FAN2_CONTROL = 0x2354;
|
||||
constexpr uint16_t VP_FAN3_CONTROL = 0x2356;
|
||||
constexpr uint16_t VP_FAN4_CONTROL = 0x2358;
|
||||
constexpr uint16_t VP_FAN5_CONTROL = 0x235A;
|
||||
|
||||
constexpr uint16_t VP_LANGUAGE_CHANGE = 0x2380;
|
||||
constexpr uint16_t VP_LANGUAGE_CHANGE1 = 0x2382;
|
||||
constexpr uint16_t VP_LANGUAGE_CHANGE2 = 0x2384;
|
||||
constexpr uint16_t VP_LANGUAGE_CHANGE3 = 0x2386;
|
||||
constexpr uint16_t VP_LANGUAGE_CHANGE4 = 0x2388;
|
||||
constexpr uint16_t VP_LANGUAGE_CHANGE5 = 0x238A;
|
||||
|
||||
// LEVEL
|
||||
constexpr uint16_t VP_LEVEL_POINT = 0x2400;
|
||||
constexpr uint16_t VP_MESH_LEVEL_POINT = 0x2410;
|
||||
constexpr uint16_t VP_MESH_LEVEL_ADJUST = 0x2412;
|
||||
constexpr uint16_t VP_MESH_LEVEL_DIP = 0x2414;
|
||||
constexpr uint16_t VP_MESH_LEVEL_POINT_X = 0x2416;
|
||||
constexpr uint16_t VP_MESH_LEVEL_POINT_Y = 0x2418;
|
||||
constexpr uint16_t VP_LEVEL_BUTTON = 0x2420;
|
||||
constexpr uint16_t VP_MESH_LEVEL_POINT_DIS = 0x2422;
|
||||
constexpr uint16_t VP_MESH_LEVEL_BACK = 0x2424;
|
||||
|
||||
constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x2500;
|
||||
constexpr uint16_t VP_E1_FILAMENT_LOAD_UNLOAD = 0x2504;
|
||||
constexpr uint16_t VP_LOAD_Filament = 0x2508;
|
||||
// constexpr uint16_t VP_LOAD_UNLOAD_Cancle = 0x250A;
|
||||
constexpr uint16_t VP_UNLOAD_Filament = 0x250B;
|
||||
constexpr uint16_t VP_Filament_distance = 0x2600;
|
||||
constexpr uint16_t VP_Filament_speed = 0x2604;
|
||||
constexpr uint16_t VP_MIN_EX_T = 0x2606;
|
||||
|
||||
constexpr uint16_t VP_E1_Filament_distance = 0x2614;
|
||||
constexpr uint16_t VP_E1_Filament_speed = 0x2616;
|
||||
constexpr uint16_t VP_E1_MIN_EX_T = 0x2618;
|
||||
|
||||
constexpr uint16_t VP_Fan0_Percentage = 0x2700; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Fan1_Percentage = 0x2702; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Fan2_Percentage = 0x2704; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Fan3_Percentage = 0x2706; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Feedrate_Percentage = 0x2708; // 2 Byte Integer (0..100)
|
||||
|
||||
// Fan status
|
||||
constexpr uint16_t VP_FAN0_STATUS = 0x2710;
|
||||
constexpr uint16_t VP_FAN1_STATUS = 0x2712;
|
||||
constexpr uint16_t VP_FAN2_STATUS = 0x2714;
|
||||
constexpr uint16_t VP_FAN3_STATUS = 0x2716;
|
||||
|
||||
// Step per mm
|
||||
constexpr uint16_t VP_X_STEP_PER_MM = 0x2900; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
constexpr uint16_t VP_Y_STEP_PER_MM = 0x2904;
|
||||
constexpr uint16_t VP_Z_STEP_PER_MM = 0x2908;
|
||||
constexpr uint16_t VP_E0_STEP_PER_MM = 0x2910;
|
||||
constexpr uint16_t VP_E1_STEP_PER_MM = 0x2912;
|
||||
constexpr uint16_t VP_E2_STEP_PER_MM = 0x2914;
|
||||
constexpr uint16_t VP_E3_STEP_PER_MM = 0x2916;
|
||||
constexpr uint16_t VP_E4_STEP_PER_MM = 0x2918;
|
||||
constexpr uint16_t VP_E5_STEP_PER_MM = 0x291A;
|
||||
constexpr uint16_t VP_E6_STEP_PER_MM = 0x291C;
|
||||
constexpr uint16_t VP_E7_STEP_PER_MM = 0x291E;
|
||||
|
||||
constexpr uint16_t VP_X_MAX_SPEED = 0x2A00;
|
||||
constexpr uint16_t VP_Y_MAX_SPEED = 0x2A04;
|
||||
constexpr uint16_t VP_Z_MAX_SPEED = 0x2A08;
|
||||
constexpr uint16_t VP_E0_MAX_SPEED = 0x2A0C;
|
||||
constexpr uint16_t VP_E1_MAX_SPEED = 0x2A10;
|
||||
|
||||
constexpr uint16_t VP_X_ACC_MAX_SPEED = 0x2A28;
|
||||
constexpr uint16_t VP_Y_ACC_MAX_SPEED = 0x2A2C;
|
||||
constexpr uint16_t VP_Z_ACC_MAX_SPEED = 0x2A30;
|
||||
constexpr uint16_t VP_E0_ACC_MAX_SPEED = 0x2A34;
|
||||
constexpr uint16_t VP_E1_ACC_MAX_SPEED = 0x2A38;
|
||||
|
||||
constexpr uint16_t VP_TRAVEL_SPEED = 0x2A3C;
|
||||
constexpr uint16_t VP_FEEDRATE_MIN_SPEED = 0x2A40;
|
||||
constexpr uint16_t VP_T_F_SPEED = 0x2A44;
|
||||
constexpr uint16_t VP_ACC_SPEED = 0x2A48;
|
||||
|
||||
/* -------------------------------0x3000-0x3FFF------------------------------- */
|
||||
// Buttons on the SD-Card File listing.
|
||||
constexpr uint16_t VP_SD_ScrollEvent = 0x3020; // Data: 0 for "up a directory", numbers are the amount to scroll, e.g -1 one up, 1 one down
|
||||
constexpr uint16_t VP_SD_FileSelected = 0x3022; // Number of file field selected.
|
||||
constexpr uint16_t VP_SD_FileSelectConfirm = 0x3024; // (This is a virtual VP and emulated by the Confirm Screen when a file has been confirmed)
|
||||
constexpr uint16_t VP_SD_ResumePauseAbort = 0x3026; // Resume(Data=0), Pause(Data=1), Abort(Data=2) SD Card prints
|
||||
constexpr uint16_t VP_SD_AbortPrintConfirmed = 0x3028; // Abort print confirmation (virtual, will be injected by the confirm dialog)
|
||||
constexpr uint16_t VP_SD_Print_Setting = 0x3040;
|
||||
constexpr uint16_t VP_SD_Print_LiveAdjustZ = 0x3050; // Data: 0 down, 1 up
|
||||
constexpr uint16_t VP_SD_Print_LiveAdjustZ_Confirm = 0x3060;
|
||||
constexpr uint16_t VP_ZOffset_Distance = 0x3070;
|
||||
constexpr uint16_t VP_ZOffset_DE_DIS = 0x3080;
|
||||
// SDCard File Listing
|
||||
constexpr uint16_t VP_SD_FileName_LEN = 32; // LEN is shared for all entries.
|
||||
constexpr uint16_t DGUS_SD_FILESPERSCREEN = 10; // FIXME move that info to the display and read it from there.
|
||||
constexpr uint16_t VP_SD_FileName0 = 0x3100;
|
||||
constexpr uint16_t VP_SD_FileName1 = 0x3120;
|
||||
constexpr uint16_t VP_SD_FileName2 = 0x3140;
|
||||
constexpr uint16_t VP_SD_FileName3 = 0x3160;
|
||||
constexpr uint16_t VP_SD_FileName4 = 0x3180;
|
||||
constexpr uint16_t VP_SD_FileName5 = 0x31A0;
|
||||
constexpr uint16_t VP_SD_FileName6 = 0x31C0;
|
||||
constexpr uint16_t VP_SD_FileName7 = 0x31E0;
|
||||
constexpr uint16_t VP_SD_FileName8 = 0x3200;
|
||||
constexpr uint16_t VP_SD_FileName9 = 0x3220;
|
||||
|
||||
constexpr uint16_t VP_SD_Print_ProbeOffsetZ = 0x32A0;
|
||||
constexpr uint16_t VP_SD_Print_Baby = 0x32B0;
|
||||
constexpr uint16_t VP_SD_Print_Filename = 0x32C0;
|
||||
|
||||
// X Y Z Point
|
||||
constexpr uint16_t VP_XPos = 0x3300; // 4 Byte Fixed point number; format xxx.yy
|
||||
constexpr uint16_t VP_YPos = 0x3302; // 4 Byte Fixed point number; format xxx.yy
|
||||
constexpr uint16_t VP_ZPos = 0x3304; // 4 Byte Fixed point number; format xxx.yy
|
||||
constexpr uint16_t VP_EPos = 0x3306; // 4 Byte Fixed point number; format xxx.yy
|
||||
|
||||
// Print
|
||||
constexpr uint16_t VP_PrintProgress_Percentage = 0x3330; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_PrintTime = 0x3340;
|
||||
constexpr uint16_t VP_PrintTime_LEN = 32;
|
||||
constexpr uint16_t VP_PrintAccTime = 0x3360;
|
||||
constexpr uint16_t VP_PrintAccTime_LEN = 32;
|
||||
constexpr uint16_t VP_PrintsTotal = 0x3380;
|
||||
constexpr uint16_t VP_PrintsTotal_LEN = 16;
|
||||
|
||||
constexpr uint16_t VP_File_Pictutr0 = 0x3400;
|
||||
constexpr uint16_t VP_File_Pictutr1 = 0x3402;
|
||||
constexpr uint16_t VP_File_Pictutr2 = 0x3404;
|
||||
constexpr uint16_t VP_File_Pictutr3 = 0x3406;
|
||||
constexpr uint16_t VP_File_Pictutr4 = 0x3408;
|
||||
constexpr uint16_t VP_File_Pictutr5 = 0x340A;
|
||||
constexpr uint16_t VP_File_Pictutr6 = 0x340C;
|
||||
constexpr uint16_t VP_File_Pictutr7 = 0x340E;
|
||||
constexpr uint16_t VP_File_Pictutr8 = 0x3410;
|
||||
constexpr uint16_t VP_File_Pictutr9 = 0x3412;
|
||||
|
||||
constexpr uint16_t VP_BED_STATUS = 0x341C;
|
||||
|
||||
constexpr uint16_t VP_TMC_X_STEP = 0x3430;
|
||||
constexpr uint16_t VP_TMC_Y_STEP = 0x3432;
|
||||
constexpr uint16_t VP_TMC_Z_STEP = 0x3434;
|
||||
|
||||
constexpr uint16_t VP_TMC_X1_Current = 0x3436;
|
||||
constexpr uint16_t VP_TMC_Y1_Current = 0x3438;
|
||||
constexpr uint16_t VP_TMC_X_Current = 0x343A;
|
||||
constexpr uint16_t VP_TMC_Y_Current = 0x343C;
|
||||
constexpr uint16_t VP_TMC_Z_Current = 0x343E;
|
||||
constexpr uint16_t VP_TMC_E0_Current = 0x3440;
|
||||
constexpr uint16_t VP_TMC_E1_Current = 0x3442;
|
||||
constexpr uint16_t VP_TMC_Z1_Current = 0x3444;
|
||||
|
||||
|
||||
constexpr uint16_t VP_PrintTime_H = 0x3500;
|
||||
constexpr uint16_t VP_PrintTime_M = 0x3502;
|
||||
constexpr uint16_t VP_PrintTime_S = 0x3504;
|
||||
|
||||
// PIDs
|
||||
constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
constexpr uint16_t VP_E0_PID_I = 0x3702;
|
||||
constexpr uint16_t VP_E0_PID_D = 0x3704;
|
||||
constexpr uint16_t VP_E1_PID_P = 0x3706; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
constexpr uint16_t VP_E1_PID_I = 0x3708;
|
||||
constexpr uint16_t VP_E1_PID_D = 0x370A;
|
||||
constexpr uint16_t VP_BED_PID_P = 0x3710;
|
||||
constexpr uint16_t VP_BED_PID_I = 0x3712;
|
||||
constexpr uint16_t VP_BED_PID_D = 0x3714;
|
||||
|
||||
constexpr uint16_t VP_EEPROM_CTRL = 0x3720;
|
||||
|
||||
constexpr uint16_t VP_OFFSET_X = 0x3724;
|
||||
constexpr uint16_t VP_OFFSET_Y = 0x3728;
|
||||
constexpr uint16_t VP_OFFSET_Z = 0x372B;
|
||||
|
||||
// PID autotune
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E0 = 0x3800;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E1 = 0x3802;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E2 = 0x3804;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E3 = 0x3806;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E4 = 0x3808;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E5 = 0x380A;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_BED = 0x380C;
|
||||
// Calibrate Z
|
||||
constexpr uint16_t VP_Z_CALIBRATE = 0x3810;
|
||||
|
||||
constexpr uint16_t VP_AutoTurnOffSw = 0x3812;
|
||||
constexpr uint16_t VP_LCD_BLK = 0x3814;
|
||||
|
||||
constexpr uint16_t VP_X_PARK_POS = 0x3900;
|
||||
constexpr uint16_t VP_Y_PARK_POS = 0x3902;
|
||||
constexpr uint16_t VP_Z_PARK_POS = 0x3904;
|
||||
|
||||
/* -------------------------------0x4000-0x4FFF------------------------------- */
|
||||
// Heater Control Buttons , triged between "cool down" and "heat PLA" state
|
||||
constexpr uint16_t VP_E0_CONTROL = 0x4010;
|
||||
constexpr uint16_t VP_E1_CONTROL = 0x4012;
|
||||
//constexpr uint16_t VP_E2_CONTROL = 0x2214;
|
||||
//constexpr uint16_t VP_E3_CONTROL = 0x2216;
|
||||
//constexpr uint16_t VP_E4_CONTROL = 0x2218;
|
||||
//constexpr uint16_t VP_E5_CONTROL = 0x221A;
|
||||
constexpr uint16_t VP_BED_CONTROL = 0x401C;
|
||||
|
||||
// Preheat
|
||||
constexpr uint16_t VP_E0_BED_PREHEAT = 0x4020;
|
||||
constexpr uint16_t VP_E1_BED_PREHEAT = 0x4022;
|
||||
//constexpr uint16_t VP_E2_BED_PREHEAT = 0x4024;
|
||||
//constexpr uint16_t VP_E3_BED_PREHEAT = 0x4026;
|
||||
//constexpr uint16_t VP_E4_BED_PREHEAT = 0x4028;
|
||||
//constexpr uint16_t VP_E5_BED_PREHEAT = 0x402A;
|
||||
|
||||
// Filament load and unload
|
||||
// constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x4030;
|
||||
// constexpr uint16_t VP_E1_FILAMENT_LOAD_UNLOAD = 0x4032;
|
||||
|
||||
// Settings store , reset
|
||||
|
||||
// Level data
|
||||
constexpr uint16_t VP_Level_Point_One_X = 0x4100;
|
||||
constexpr uint16_t VP_Level_Point_One_Y = 0x4102;
|
||||
constexpr uint16_t VP_Level_Point_Two_X = 0x4104;
|
||||
constexpr uint16_t VP_Level_Point_Two_Y = 0x4106;
|
||||
constexpr uint16_t VP_Level_Point_Three_X = 0x4108;
|
||||
constexpr uint16_t VP_Level_Point_Three_Y = 0x410A;
|
||||
constexpr uint16_t VP_Level_Point_Four_X = 0x410C;
|
||||
constexpr uint16_t VP_Level_Point_Four_Y = 0x410E;
|
||||
constexpr uint16_t VP_Level_Point_Five_X = 0x4110;
|
||||
constexpr uint16_t VP_Level_Point_Five_Y = 0x4112;
|
||||
|
||||
|
||||
/* H43 Version */
|
||||
constexpr uint16_t VP_MKS_H43_VERSION = 0x4A00; // MKS H43 V1.0.0
|
||||
constexpr uint16_t VP_MKS_H43_VERSION_LEN = 16;
|
||||
constexpr uint16_t VP_MKS_H43_UpdataVERSION = 0x4A10; // MKS H43 V1.0.0
|
||||
constexpr uint16_t VP_MKS_H43_UpdataVERSION_LEN = 16;
|
||||
|
||||
/* -------------------------------0x5000-0xFFFF------------------------------- */
|
||||
constexpr uint16_t VP_HOME_Dis = 0x5000;
|
||||
constexpr uint16_t VP_Setting_Dis = 0x5010;
|
||||
constexpr uint16_t VP_Tool_Dis = 0x5020;
|
||||
constexpr uint16_t VP_Printing_Dis = 0x5030;
|
||||
|
||||
constexpr uint16_t VP_Language_Dis = 0x5080;
|
||||
constexpr uint16_t VP_LossPoint_Dis = 0x5090;
|
||||
|
||||
constexpr uint16_t VP_PrintPauseConfig_Dis = 0x5120;
|
||||
constexpr uint16_t VP_MotorPluse_Dis = 0x5140;
|
||||
constexpr uint16_t VP_MotorMaxSpeed_Dis = 0x5150;
|
||||
constexpr uint16_t VP_MotorMaxAcc_Dis = 0x5160;
|
||||
|
||||
constexpr uint16_t VP_X_Pluse_Dis = 0x5170;
|
||||
constexpr uint16_t VP_Y_Pluse_Dis = 0x5180;
|
||||
constexpr uint16_t VP_Z_Pluse_Dis = 0x5190;
|
||||
constexpr uint16_t VP_E0_Pluse_Dis = 0x51A0;
|
||||
constexpr uint16_t VP_E1_Pluse_Dis = 0x51B0;
|
||||
|
||||
constexpr uint16_t VP_X_Max_Speed_Dis = 0x5280;
|
||||
constexpr uint16_t VP_Y_Max_Speed_Dis = 0x5290;
|
||||
constexpr uint16_t VP_Z_Max_Speed_Dis = 0x52A0;
|
||||
constexpr uint16_t VP_E0_Max_Speed_Dis = 0x52B0;
|
||||
constexpr uint16_t VP_E1_Max_Speed_Dis = 0x52C0;
|
||||
|
||||
constexpr uint16_t VP_X_Max_Acc_Speed_Dis = 0x51E0;
|
||||
constexpr uint16_t VP_Y_Max_Acc_Speed_Dis = 0x51F0;
|
||||
constexpr uint16_t VP_Z_Max_Acc_Speed_Dis = 0x5200;
|
||||
constexpr uint16_t VP_E0_Max_Acc_Speed_Dis = 0x5210;
|
||||
constexpr uint16_t VP_E1_Max_Acc_Speed_Dis = 0x5220;
|
||||
|
||||
|
||||
constexpr uint16_t VP_PrintTime_Dis = 0x5470;
|
||||
constexpr uint16_t VP_E0_Temp_Dis = 0x5310;
|
||||
constexpr uint16_t VP_E1_Temp_Dis = 0x5320;
|
||||
constexpr uint16_t VP_HB_Temp_Dis = 0x5330;
|
||||
constexpr uint16_t VP_Feedrate_Dis = 0x5350;
|
||||
constexpr uint16_t VP_PrintAcc_Dis = 0x5340;
|
||||
constexpr uint16_t VP_Fan_Speed_Dis = 0x5360;
|
||||
|
||||
constexpr uint16_t VP_Min_Ex_Temp_Dis = 0x5380;
|
||||
|
||||
|
||||
constexpr uint16_t VP_X_PARK_POS_Dis = 0x53E0;
|
||||
constexpr uint16_t VP_Y_PARK_POS_Dis = 0x53F0;
|
||||
constexpr uint16_t VP_Z_PARK_POS_Dis = 0x5400;
|
||||
|
||||
|
||||
constexpr uint16_t VP_TravelAcc_Dis = 0x5440;
|
||||
constexpr uint16_t VP_FeedRateMin_Dis = 0x5450;
|
||||
constexpr uint16_t VP_TravelFeeRateMin_Dis = 0x5460;
|
||||
constexpr uint16_t VP_ACC_Dis = 0x5480;
|
||||
|
||||
constexpr uint16_t VP_Extrusion_Dis = 0x5230;
|
||||
constexpr uint16_t VP_HeatBed_Dis = 0x5240;
|
||||
|
||||
constexpr uint16_t VP_Printting_Dis = 0x5430;
|
||||
constexpr uint16_t VP_FactoryDefaults_Dis = 0x54C0;
|
||||
constexpr uint16_t VP_StoreSetting_Dis = 0x54B0;
|
||||
constexpr uint16_t VP_Info_EEPROM_2_Dis = 0x54D0;
|
||||
constexpr uint16_t VP_Info_EEPROM_1_Dis = 0x54E0;
|
||||
|
||||
constexpr uint16_t VP_AutoLevel_1_Dis = 0x55F0;
|
||||
|
||||
constexpr uint16_t VP_TMC_X_Step_Dis = 0x5530;
|
||||
constexpr uint16_t VP_TMC_Y_Step_Dis = 0x5540;
|
||||
constexpr uint16_t VP_TMC_Z_Step_Dis = 0x5550;
|
||||
constexpr uint16_t VP_TMC_X1_Current_Dis = 0x5560;
|
||||
constexpr uint16_t VP_TMC_Y1_Current_Dis = 0x5570;
|
||||
constexpr uint16_t VP_TMC_X_Current_Dis = 0x5580;
|
||||
constexpr uint16_t VP_TMC_Y_Current_Dis = 0x5590;
|
||||
constexpr uint16_t VP_TMC_Z_Current_Dis = 0x55A0;
|
||||
constexpr uint16_t VP_TMC_E0_Current_Dis = 0x55B0;
|
||||
constexpr uint16_t VP_TMC_E1_Current_Dis = 0x55C0;
|
||||
constexpr uint16_t VP_TMC_Z1_Current_Dis = 0x55E0;
|
||||
|
||||
constexpr uint16_t VP_AutoLEVEL_INFO1 = 0x5600;
|
||||
constexpr uint16_t VP_EX_TEMP_INFO1_Dis = 0x5610;
|
||||
constexpr uint16_t VP_EX_TEMP_INFO2_Dis = 0x5620;
|
||||
constexpr uint16_t VP_EX_TEMP_INFO3_Dis = 0x5630;
|
||||
constexpr uint16_t VP_LCD_BLK_Dis = 0x56A0;
|
||||
constexpr uint16_t VP_Info_PrinfFinsh_1_Dis = 0x5C00;
|
||||
constexpr uint16_t VP_Info_PrinfFinsh_2_Dis = 0x5C10;
|
||||
|
||||
constexpr uint16_t VP_Length_Dis = 0x5B00;
|
||||
|
||||
constexpr uint16_t VP_PrintConfrim_Info_Dis = 0x5B90;
|
||||
constexpr uint16_t VP_StopPrintConfrim_Info_Dis = 0x5B80;
|
||||
|
||||
constexpr uint16_t VP_Point_One_Dis = 0x5BA0;
|
||||
constexpr uint16_t VP_Point_Two_Dis = 0x5BB0;
|
||||
constexpr uint16_t VP_Point_Three_Dis = 0x5BC0;
|
||||
constexpr uint16_t VP_Point_Four_Dis = 0x5BD0;
|
||||
constexpr uint16_t VP_Point_Five_Dis = 0x5BE0;
|
||||
|
||||
constexpr uint16_t VP_Print_Dis = 0x5250;
|
||||
|
||||
constexpr uint16_t VP_About_Dis = 0x5A00;
|
||||
constexpr uint16_t VP_Config_Dis = 0x5A10;
|
||||
constexpr uint16_t VP_Filament_Dis = 0x5A20;
|
||||
constexpr uint16_t VP_Move_Dis = 0x5A30;
|
||||
constexpr uint16_t VP_Level_Dis = 0x5A50;
|
||||
constexpr uint16_t VP_Speed_Dis = 0x5A70;
|
||||
constexpr uint16_t VP_InOut_Dis = 0x5A80;
|
||||
|
||||
constexpr uint16_t VP_MotorConfig_Dis = 0x5100;
|
||||
constexpr uint16_t VP_LevelConfig_Dis = 0x5110;
|
||||
constexpr uint16_t VP_Advance_Dis = 0x5130;
|
||||
constexpr uint16_t VP_TemperatureConfig_Dis = 0x5390;
|
||||
|
||||
#endif // MKS_FINSH
|
2036
Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp
Normal file
2036
Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp
Normal file
File diff suppressed because it is too large
Load Diff
312
Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.h
Normal file
312
Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.h
Normal file
@ -0,0 +1,312 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSVPVariable.h"
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
#include "../../../../inc/MarlinConfig.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
|
||||
class DGUSScreenHandler {
|
||||
public:
|
||||
DGUSScreenHandler() = default;
|
||||
|
||||
static bool loop();
|
||||
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifing whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
#if 0
|
||||
static void sendinfoscreen_ch_mks(const uint16_t *line1, const uint16_t *line2, const uint16_t *line3, const uint16_t *line4);
|
||||
static void sendinfoscreen_en_mks(const char *line1, const char *line2, const char *line3, const char *line4) ;
|
||||
static void sendinfoscreen_mks(const void *line1, const void *line2, const void *line3, const void *line4, uint16_t language);
|
||||
#endif
|
||||
|
||||
// "M117" Message -- msg is a RAM ptr.
|
||||
static void setstatusmessage(const char *msg);
|
||||
// The same for messages from Flash
|
||||
static void setstatusmessagePGM(PGM_P const msg);
|
||||
// Callback for VP "Display wants to change screen on idle printer"
|
||||
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 ScreenBackChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Callback for VP "All Heaters Off"
|
||||
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);
|
||||
// Hook for "Change Flowrate"
|
||||
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);
|
||||
#endif
|
||||
|
||||
static void EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void LanguageChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetOffsetValue(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void Level_Ctrl_MKS(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_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleGetExMinTemp_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
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(void);
|
||||
static void DGUS_Runout_Idle(void);
|
||||
static void DGUS_RunoutInit(void);
|
||||
static void DGUS_ExtrudeLoadInit(void);
|
||||
static void LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Hook for manual move.
|
||||
static void HandleManualMove(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for manual extrude.
|
||||
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);
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Hook for power loss recovery.
|
||||
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 HandleStepPerMMChanged_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMExtruderChanged_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleExtruderMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleMaxAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleExtruderAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleChangeLevelPoint_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleTravelAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleFeedRateMinChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleMin_T_F_MKS(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);
|
||||
// Hook for PID autotune
|
||||
static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_BED_PROBE
|
||||
// Hook for "Change probe offset z"
|
||||
static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
// Hook for live z adjust action
|
||||
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
// Hook for fan control
|
||||
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);
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
// Hook for preheat
|
||||
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);
|
||||
// Hook for filament load and unload
|
||||
static void HandleFilamentLoadUnload(DGUS_VP_Variable &var);
|
||||
|
||||
static void MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir);
|
||||
static void MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void MKS_LOAD_UNLOAD_IDLE();
|
||||
static void MKS_LOAD_Cancle(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 ENABLED(SDSUPPORT)
|
||||
// Callback for VP "Display wants to change screen when there is a SD card"
|
||||
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);
|
||||
// File touched.
|
||||
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// start print after confirmation received.
|
||||
static void DGUSLCD_SD_StartPrint(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);
|
||||
// User confirmed the abort action
|
||||
static void DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the tune button
|
||||
static void DGUSLCD_SD_PrintTune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Send a single filename to the display.
|
||||
static void DGUSLCD_SD_SendFilename(DGUS_VP_Variable &var);
|
||||
// Marlin informed us that a new SD has been inserted.
|
||||
static void SDCardInserted();
|
||||
// Marlin informed us that the SD Card has been removed().
|
||||
static void SDCardRemoved();
|
||||
// Marlin informed us about a bad SD Card.
|
||||
static void SDCardError();
|
||||
// Marlin informed us about SD print completion.
|
||||
static void SDPrintingFinished();
|
||||
#else
|
||||
static void PrintReturn(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
// OK Button the Confirm screen.
|
||||
static void ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Update data after went to new screen (by display or by GotoScreen)
|
||||
// remember: store the last-displayed screen, so it can get returned to.
|
||||
// (e.g for pop up messages)
|
||||
static void UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup=false);
|
||||
|
||||
// Recall the remembered screen.
|
||||
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 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 DGUSLCD_SendPrintTimeToDisplay_MKS(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendBabyStepToDisplay_MKS(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_MKS(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var);
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
static void DGUSLCD_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 DGUSLCD_SetUint8(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
template<typename T>
|
||||
static void DGUSLCD_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;
|
||||
LOOP_L_N(i, sizeof(T)) x.tmp[i] = ptr[sizeof(T) - i - 1];
|
||||
*(T*)var.memadr = x.t;
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// 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<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (long)f);
|
||||
}
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// 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<unsigned int decimals>
|
||||
static void DGUSLCD_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);
|
||||
}
|
||||
}
|
||||
|
||||
// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static inline void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
private:
|
||||
static DGUSLCD_Screens current_screen; //< 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 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 uint16_t ConfirmVP; //< context for confirm screen (VP that will be emulated-sent on "OK").
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static int16_t top_file; //< file on top of file chooser
|
||||
static int16_t file_to_print; //< touched file to be confirmed
|
||||
#endif
|
||||
|
||||
static void (*confirm_action_cb)();
|
||||
};
|
||||
|
||||
#define MKS_Language_Choose 0x00
|
||||
#define MKS_Language_NoChoose 0x01
|
||||
|
||||
#define MKS_SimpleChinese 0
|
||||
#define MKS_English 1
|
||||
extern uint8_t mks_language_index;
|
||||
extern bool DGUSAutoTurnOff;
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#define PLR_SCREEN_RECOVER MKSLCD_SCREEN_PRINT
|
||||
#define PLR_SCREEN_CANCEL MKSLCD_SCREEN_HOME
|
||||
#endif
|
312
Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp
Normal file
312
Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp
Normal file
@ -0,0 +1,312 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* lcd/extui/dgus/origin/DGUSDisplayDef.cpp
|
||||
*/
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_ORIGIN)
|
||||
|
||||
#include "DGUSDisplayDef.h"
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
#include "../../../../module/planner.h"
|
||||
|
||||
#include "../../../marlinui.h"
|
||||
#include "../../ui_api.h"
|
||||
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
uint16_t distanceToMove = 10;
|
||||
#endif
|
||||
using namespace ExtUI;
|
||||
|
||||
const uint16_t VPList_Boot[] PROGMEM = {
|
||||
VP_MARLIN_VERSION,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Main[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded. */
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Temp[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Status[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded */
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
VP_Fan0_Percentage,
|
||||
#endif
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
VP_Fan0_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
VP_PrintProgress_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Status2[] PROGMEM = {
|
||||
// VP_M117, for completeness, but it cannot be auto-uploaded
|
||||
#if HOTENDS >= 1
|
||||
VP_Flowrate_E0,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_Flowrate_E1,
|
||||
#endif
|
||||
VP_PrintProgress_Percentage,
|
||||
VP_PrintTime,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_ManualMove[] PROGMEM = {
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_ManualExtrude[] PROGMEM = {
|
||||
VP_EPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FanAndFeedrate[] PROGMEM = {
|
||||
VP_Feedrate_Percentage, VP_Fan0_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SD_FlowRates[] PROGMEM = {
|
||||
VP_Flowrate_E0, VP_Flowrate_E1,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SDFileList[] PROGMEM = {
|
||||
VP_SD_FileName0, VP_SD_FileName1, VP_SD_FileName2, VP_SD_FileName3, VP_SD_FileName4,
|
||||
0x0000
|
||||
};
|
||||
|
||||
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 },
|
||||
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
|
||||
};
|
||||
|
||||
const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
|
||||
|
||||
// Helper to define a DGUS_VP_Variable for common use cases.
|
||||
#define VPHELPER(VPADR, VPADRVAR, RXFPTR, TXFPTR ) { .VP=VPADR, .memadr=VPADRVAR, .size=sizeof(VPADRVAR), \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR }
|
||||
|
||||
// Helper to define a DGUS_VP_Variable when the sizeo of the var cannot be determined automaticalyl (eg. a string)
|
||||
#define VPHELPER_STR(VPADR, VPADRVAR, STRLEN, RXFPTR, TXFPTR ) { .VP=VPADR, .memadr=VPADRVAR, .size=STRLEN, \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR }
|
||||
|
||||
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),
|
||||
#if ENABLED(SDSUPPORT)
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, ScreenHandler.ScreenChangeHookIfSD, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr),
|
||||
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, &ScreenHandler.HandleAllHeatersOff, nullptr),
|
||||
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_OPTION, &distanceToMove, &ScreenHandler.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),
|
||||
#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),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, &ScreenHandler.HandleMotorLockUnlock, nullptr),
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, &ScreenHandler.HandlePowerLossRecovery, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_SETTINGS, nullptr, &ScreenHandler.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 },
|
||||
// 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 },
|
||||
|
||||
// Temperature Data
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_T_E0_Is, nullptr, nullptr, SET_VARIABLE(getActualTemp_celsius, E0, long)),
|
||||
VPHELPER(VP_T_E0_Set, nullptr, GET_VARIABLE(setTargetTemp_celsius, E0),
|
||||
SET_VARIABLE(getTargetTemp_celsius, E0)),
|
||||
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),
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, &ScreenHandler.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),
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, &ScreenHandler.HandleFilamentOption, &ScreenHandler.HandleFilamentLoadUnload),
|
||||
#endif
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, DGUSLCD_SendWordValueToDisplay),
|
||||
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),
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, &ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#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),
|
||||
#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),
|
||||
#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),
|
||||
REPEAT(FAN_COUNT, FAN_VPHELPER)
|
||||
#endif
|
||||
|
||||
// Feedrate
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, &ScreenHandler.DGUSLCD_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>),
|
||||
|
||||
// Print Progress
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay ),
|
||||
|
||||
// Print Time
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_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 ),
|
||||
#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>),
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
|
||||
// SDCard File listing.
|
||||
#if ENABLED(SDSUPPORT)
|
||||
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),
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, ScreenHandler.HandleProbeOffsetZChanged, &ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, ScreenHandler.DGUSLCD_SendWaitingStatusToDisplay),
|
||||
#endif
|
||||
|
||||
// Messages for the User, shared by the popup and the kill screen. They cant 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 },
|
||||
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
||||
#endif // DGUS_LCD_UI_ORIGIN
|
282
Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.h
Normal file
282
Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.h
Normal file
@ -0,0 +1,282 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#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"
|
||||
DGUSLDC_SCREEN_UNUSED = 255
|
||||
};
|
||||
|
||||
// Display Memory layout used (T5UID)
|
||||
// Except system variables this is arbitrary, just to organize stuff....
|
||||
|
||||
// 0x0000 .. 0x0FFF -- System variables and reserved by the display
|
||||
// 0x1000 .. 0x1FFF -- Variables to never change location, regardless of UI Version
|
||||
// 0x2000 .. 0x2FFF -- Controls (VPs that will trigger some action)
|
||||
// 0x3000 .. 0x4FFF -- Marlin Data to be displayed
|
||||
// 0x5000 .. -- SPs (if we want to modify display elements, e.g change color or like) -- currently unused
|
||||
|
||||
// As there is plenty of space (at least most displays have >8k RAM), we do not pack them too tight,
|
||||
// so that we can keep variables nicely together in the address space.
|
||||
|
||||
// UI Version always on 0x1000...0x1002 so that the firmware can check this and bail out.
|
||||
constexpr uint16_t VP_UI_VERSION_MAJOR = 0x1000; // Major -- incremented when incompatible
|
||||
constexpr uint16_t VP_UI_VERSION_MINOR = 0x1001; // Minor -- incremented on new features, but compatible
|
||||
constexpr uint16_t VP_UI_VERSION_PATCH = 0x1002; // Patch -- fixed which do not change functionality.
|
||||
constexpr uint16_t VP_UI_FLAVOUR = 0x1010; // lets reserve 16 bytes here to determine if UI is suitable for this Marlin. tbd.
|
||||
|
||||
// Storage space for the Killscreen messages. 0x1100 - 0x1200 . Reused for the popup.
|
||||
constexpr uint16_t VP_MSGSTR1 = 0x1100;
|
||||
constexpr uint8_t VP_MSGSTR1_LEN = 0x20; // might be more place for it...
|
||||
constexpr uint16_t VP_MSGSTR2 = 0x1140;
|
||||
constexpr uint8_t VP_MSGSTR2_LEN = 0x20;
|
||||
constexpr uint16_t VP_MSGSTR3 = 0x1180;
|
||||
constexpr uint8_t VP_MSGSTR3_LEN = 0x20;
|
||||
constexpr uint16_t VP_MSGSTR4 = 0x11C0;
|
||||
constexpr uint8_t VP_MSGSTR4_LEN = 0x20;
|
||||
|
||||
// Screenchange request for screens that only make sense when printer is idle.
|
||||
// e.g movement is only allowed if printer is not printing.
|
||||
// Marlin must confirm by setting the screen manually.
|
||||
constexpr uint16_t VP_SCREENCHANGE_ASK = 0x2000;
|
||||
constexpr uint16_t VP_SCREENCHANGE = 0x2001; // Key-Return button to new menu pressed. Data contains target screen in low byte and info in high byte.
|
||||
constexpr uint16_t VP_TEMP_ALL_OFF = 0x2002; // Turn all heaters off. Value arbitrary ;)=
|
||||
constexpr uint16_t VP_SCREENCHANGE_WHENSD = 0x2003; // "Print" Button touched -- go only there if there is an SD Card.
|
||||
|
||||
constexpr uint16_t VP_CONFIRMED = 0x2010; // OK on confirm screen.
|
||||
|
||||
// Buttons on the SD-Card File listing.
|
||||
constexpr uint16_t VP_SD_ScrollEvent = 0x2020; // Data: 0 for "up a directory", numbers are the amount to scroll, e.g -1 one up, 1 one down
|
||||
constexpr uint16_t VP_SD_FileSelected = 0x2022; // Number of file field selected.
|
||||
constexpr uint16_t VP_SD_FileSelectConfirm = 0x2024; // (This is a virtual VP and emulated by the Confirm Screen when a file has been confirmed)
|
||||
|
||||
constexpr uint16_t VP_SD_ResumePauseAbort = 0x2026; // Resume(Data=0), Pause(Data=1), Abort(Data=2) SD Card prints
|
||||
constexpr uint16_t VP_SD_AbortPrintConfirmed = 0x2028; // Abort print confirmation (virtual, will be injected by the confirm dialog)
|
||||
constexpr uint16_t VP_SD_Print_Setting = 0x2040;
|
||||
constexpr uint16_t VP_SD_Print_LiveAdjustZ = 0x2050; // Data: 0 down, 1 up
|
||||
|
||||
// Controls for movement (we can't use the incremental / decremental feature of the display at this feature works only with 16 bit values
|
||||
// (which would limit us to 655.35mm, which is likely not a problem for common setups, but i don't want to rule out hangprinters support)
|
||||
// A word about the coding: The VP will be per axis and the return code will be an signed 16 bit value in 0.01 mm resolution, telling us
|
||||
// the relative travel amount t he user wants to do. So eg. if the display sends us VP=2100 with value 100, the user wants us to move X by +1 mm.
|
||||
constexpr uint16_t VP_MOVE_X = 0x2100;
|
||||
constexpr uint16_t VP_MOVE_Y = 0x2102;
|
||||
constexpr uint16_t VP_MOVE_Z = 0x2104;
|
||||
constexpr uint16_t VP_MOVE_E0 = 0x2110;
|
||||
constexpr uint16_t VP_MOVE_E1 = 0x2112;
|
||||
//constexpr uint16_t VP_MOVE_E2 = 0x2114;
|
||||
//constexpr uint16_t VP_MOVE_E3 = 0x2116;
|
||||
//constexpr uint16_t VP_MOVE_E4 = 0x2118;
|
||||
//constexpr uint16_t VP_MOVE_E5 = 0x211A;
|
||||
constexpr uint16_t VP_HOME_ALL = 0x2120;
|
||||
constexpr uint16_t VP_MOTOR_LOCK_UNLOK = 0x2130;
|
||||
|
||||
// Power loss recovery
|
||||
constexpr uint16_t VP_POWER_LOSS_RECOVERY = 0x2180;
|
||||
|
||||
// Fan Control Buttons , switch between "off" and "on"
|
||||
constexpr uint16_t VP_FAN0_CONTROL = 0x2200;
|
||||
constexpr uint16_t VP_FAN1_CONTROL = 0x2202;
|
||||
//constexpr uint16_t VP_FAN2_CONTROL = 0x2204;
|
||||
//constexpr uint16_t VP_FAN3_CONTROL = 0x2206;
|
||||
|
||||
// Heater Control Buttons , triged between "cool down" and "heat PLA" state
|
||||
constexpr uint16_t VP_E0_CONTROL = 0x2210;
|
||||
constexpr uint16_t VP_E1_CONTROL = 0x2212;
|
||||
//constexpr uint16_t VP_E2_CONTROL = 0x2214;
|
||||
//constexpr uint16_t VP_E3_CONTROL = 0x2216;
|
||||
//constexpr uint16_t VP_E4_CONTROL = 0x2218;
|
||||
//constexpr uint16_t VP_E5_CONTROL = 0x221A;
|
||||
constexpr uint16_t VP_BED_CONTROL = 0x221C;
|
||||
|
||||
// Preheat
|
||||
constexpr uint16_t VP_E0_BED_PREHEAT = 0x2220;
|
||||
constexpr uint16_t VP_E1_BED_CONTROL = 0x2222;
|
||||
//constexpr uint16_t VP_E2_BED_CONTROL = 0x2224;
|
||||
//constexpr uint16_t VP_E3_BED_CONTROL = 0x2226;
|
||||
//constexpr uint16_t VP_E4_BED_CONTROL = 0x2228;
|
||||
//constexpr uint16_t VP_E5_BED_CONTROL = 0x222A;
|
||||
|
||||
// Filament load and unload
|
||||
constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x2300;
|
||||
constexpr uint16_t VP_E1_FILAMENT_LOAD_UNLOAD = 0x2302;
|
||||
|
||||
// Settings store , reset
|
||||
constexpr uint16_t VP_SETTINGS = 0x2400;
|
||||
|
||||
// PID autotune
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E0 = 0x2410;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E1 = 0x2412;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E2 = 0x2414;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E3 = 0x2416;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E4 = 0x2418;
|
||||
//constexpr uint16_t VP_PID_AUTOTUNE_E5 = 0x241A;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_BED = 0x2420;
|
||||
|
||||
// Firmware version on the boot screen.
|
||||
constexpr uint16_t VP_MARLIN_VERSION = 0x3000;
|
||||
constexpr uint8_t VP_MARLIN_VERSION_LEN = 16; // there is more space on the display, if needed.
|
||||
|
||||
// Place for status messages.
|
||||
constexpr uint16_t VP_M117 = 0x3020;
|
||||
constexpr uint8_t VP_M117_LEN = 0x20;
|
||||
|
||||
// Temperatures.
|
||||
constexpr uint16_t VP_T_E0_Is = 0x3060; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E0_Set = 0x3062; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E1_Is = 0x3064; // 4 Byte Integer
|
||||
|
||||
// reserved to support up to 6 Extruders:
|
||||
//constexpr uint16_t VP_T_E1_Set = 0x3066; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E2_Is = 0x3068; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E2_Set = 0x306A; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E3_Is = 0x306C; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E3_Set = 0x306E; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Is = 0x3070; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Set = 0x3072; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Is = 0x3074; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Set = 0x3076; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_Is = 0x3078; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_Set = 0x307A; // 2 Byte Integer
|
||||
|
||||
constexpr uint16_t VP_T_Bed_Is = 0x3080; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_Bed_Set = 0x3082; // 2 Byte Integer
|
||||
|
||||
constexpr uint16_t VP_Flowrate_E0 = 0x3090; // 2 Byte Integer
|
||||
constexpr uint16_t VP_Flowrate_E1 = 0x3092; // 2 Byte Integer
|
||||
|
||||
// reserved for up to 6 Extruders:
|
||||
//constexpr uint16_t VP_Flowrate_E2 = 0x3094;
|
||||
//constexpr uint16_t VP_Flowrate_E3 = 0x3096;
|
||||
//constexpr uint16_t VP_Flowrate_E4 = 0x3098;
|
||||
//constexpr uint16_t VP_Flowrate_E5 = 0x309A;
|
||||
|
||||
constexpr uint16_t VP_Fan0_Percentage = 0x3100; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Fan1_Percentage = 0x33A2; // 2 Byte Integer (0..100)
|
||||
//constexpr uint16_t VP_Fan2_Percentage = 0x33A4; // 2 Byte Integer (0..100)
|
||||
//constexpr uint16_t VP_Fan3_Percentage = 0x33A6; // 2 Byte Integer (0..100)
|
||||
|
||||
constexpr uint16_t VP_Feedrate_Percentage = 0x3102; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_PrintProgress_Percentage = 0x3104; // 2 Byte Integer (0..100)
|
||||
|
||||
constexpr uint16_t VP_PrintTime = 0x3106;
|
||||
constexpr uint16_t VP_PrintTime_LEN = 10;
|
||||
|
||||
constexpr uint16_t VP_PrintAccTime = 0x3160;
|
||||
constexpr uint16_t VP_PrintAccTime_LEN = 32;
|
||||
|
||||
constexpr uint16_t VP_PrintsTotal = 0x3180;
|
||||
constexpr uint16_t VP_PrintsTotal_LEN = 16;
|
||||
|
||||
// Actual Position
|
||||
constexpr uint16_t VP_XPos = 0x3110; // 4 Byte Fixed point number; format xxx.yy
|
||||
constexpr uint16_t VP_YPos = 0x3112; // 4 Byte Fixed point number; format xxx.yy
|
||||
constexpr uint16_t VP_ZPos = 0x3114; // 4 Byte Fixed point number; format xxx.yy
|
||||
|
||||
constexpr uint16_t VP_EPos = 0x3120; // 4 Byte Fixed point number; format xxx.yy
|
||||
|
||||
// SDCard File Listing
|
||||
constexpr uint16_t VP_SD_FileName_LEN = 32; // LEN is shared for all entries.
|
||||
constexpr uint16_t DGUS_SD_FILESPERSCREEN = 5; // FIXME move that info to the display and read it from there.
|
||||
constexpr uint16_t VP_SD_FileName0 = 0x3200;
|
||||
constexpr uint16_t VP_SD_FileName1 = 0x3220;
|
||||
constexpr uint16_t VP_SD_FileName2 = 0x3240;
|
||||
constexpr uint16_t VP_SD_FileName3 = 0x3260;
|
||||
constexpr uint16_t VP_SD_FileName4 = 0x3280;
|
||||
|
||||
constexpr uint16_t VP_SD_Print_ProbeOffsetZ = 0x32A0; //
|
||||
constexpr uint16_t VP_SD_Print_Filename = 0x32C0; //
|
||||
|
||||
// Fan status
|
||||
constexpr uint16_t VP_FAN0_STATUS = 0x3300;
|
||||
constexpr uint16_t VP_FAN1_STATUS = 0x3302;
|
||||
//constexpr uint16_t VP_FAN2_STATUS = 0x3304;
|
||||
//constexpr uint16_t VP_FAN3_STATUS = 0x3306;
|
||||
|
||||
// Heater status
|
||||
constexpr uint16_t VP_E0_STATUS = 0x3310;
|
||||
//constexpr uint16_t VP_E1_STATUS = 0x3312;
|
||||
//constexpr uint16_t VP_E2_STATUS = 0x3314;
|
||||
//constexpr uint16_t VP_E3_STATUS = 0x3316;
|
||||
//constexpr uint16_t VP_E4_STATUS = 0x3318;
|
||||
//constexpr uint16_t VP_E5_STATUS = 0x331A;
|
||||
constexpr uint16_t VP_BED_STATUS = 0x331C;
|
||||
|
||||
constexpr uint16_t VP_MOVE_OPTION = 0x3400;
|
||||
|
||||
// Step per mm
|
||||
constexpr uint16_t VP_X_STEP_PER_MM = 0x3600; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
//constexpr uint16_t VP_X2_STEP_PER_MM = 0x3602;
|
||||
constexpr uint16_t VP_Y_STEP_PER_MM = 0x3604;
|
||||
//constexpr uint16_t VP_Y2_STEP_PER_MM = 0x3606;
|
||||
constexpr uint16_t VP_Z_STEP_PER_MM = 0x3608;
|
||||
//constexpr uint16_t VP_Z2_STEP_PER_MM = 0x360A;
|
||||
constexpr uint16_t VP_E0_STEP_PER_MM = 0x3610;
|
||||
//constexpr uint16_t VP_E1_STEP_PER_MM = 0x3612;
|
||||
//constexpr uint16_t VP_E2_STEP_PER_MM = 0x3614;
|
||||
//constexpr uint16_t VP_E3_STEP_PER_MM = 0x3616;
|
||||
//constexpr uint16_t VP_E4_STEP_PER_MM = 0x3618;
|
||||
//constexpr uint16_t VP_E5_STEP_PER_MM = 0x361A;
|
||||
|
||||
// PIDs
|
||||
constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
constexpr uint16_t VP_E0_PID_I = 0x3702;
|
||||
constexpr uint16_t VP_E0_PID_D = 0x3704;
|
||||
constexpr uint16_t VP_BED_PID_P = 0x3710;
|
||||
constexpr uint16_t VP_BED_PID_I = 0x3712;
|
||||
constexpr uint16_t VP_BED_PID_D = 0x3714;
|
||||
|
||||
// Wating screen status
|
||||
constexpr uint16_t VP_WAITING_STATUS = 0x3800;
|
||||
|
||||
// SPs for certain variables...
|
||||
// located at 0x5000 and up
|
||||
// Not used yet!
|
||||
// This can be used e.g to make controls / data display invisible
|
||||
constexpr uint16_t SP_T_E0_Is = 0x5000;
|
||||
constexpr uint16_t SP_T_E0_Set = 0x5010;
|
||||
constexpr uint16_t SP_T_E1_Is = 0x5020;
|
||||
constexpr uint16_t SP_T_Bed_Is = 0x5030;
|
||||
constexpr uint16_t SP_T_Bed_Set = 0x5040;
|
420
Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp
Normal file
420
Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp
Normal file
@ -0,0 +1,420 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_ORIGIN)
|
||||
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "../../../../MarlinCore.h"
|
||||
#include "../../../../gcode/queue.h"
|
||||
#include "../../../../libs/duration_t.h"
|
||||
#include "../../../../module/settings.h"
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
#include "../../../../module/planner.h"
|
||||
#include "../../../../module/printcounter.h"
|
||||
#include "../../../../sd/cardreader.h"
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
static ExtUI::FileList filelist;
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(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;
|
||||
|
||||
if (filelist.isDir()) {
|
||||
filelist.changeDir(filelist.filename());
|
||||
top_file = 0;
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_PRINT_FILENAME)
|
||||
// Send print filename
|
||||
dgusdisplay.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);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!filelist.seek(file_to_print)) return;
|
||||
ExtUI::printFile(filelist.shortFilename());
|
||||
GotoScreen(DGUSLCD_SCREEN_STATUS);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(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)) {
|
||||
case 0: { // Resume
|
||||
if (ExtUI::isPrintingFromMediaPaused()) {
|
||||
ExtUI::resumePrint();
|
||||
}
|
||||
} break;
|
||||
|
||||
case 1: // 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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_SendFilename(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] = "";
|
||||
var.memadr = (void*)tmpfilename;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardInserted() {
|
||||
top_file = 0;
|
||||
filelist.refresh();
|
||||
auto cs = getCurrentScreen();
|
||||
if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS)
|
||||
GotoScreen(DGUSLCD_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);
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
||||
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,
|
||||
// meaning "return to previous screen"
|
||||
DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1];
|
||||
|
||||
DEBUG_ECHOLNPAIR("\n DEBUG target", target);
|
||||
|
||||
if (target == DGUSLCD_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();
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateNewScreen(target);
|
||||
|
||||
#ifdef DEBUG_DGUSLCD
|
||||
if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPAIR("WARNING: No screen Mapping found for ", target);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleManualMove");
|
||||
|
||||
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
if (movevalue) {
|
||||
const uint16_t choice = *(uint16_t*)var.memadr;
|
||||
movevalue = movevalue < 0 ? -choice : choice;
|
||||
}
|
||||
#endif
|
||||
char axiscode;
|
||||
unsigned int speed = 1500; // FIXME: get default feedrate for manual moves, dont hardcode.
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
|
||||
case VP_MOVE_X:
|
||||
axiscode = 'X';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::X)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Y:
|
||||
axiscode = 'Y';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Z:
|
||||
axiscode = 'Z';
|
||||
speed = 300; // default to 5mm/s
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_HOME_ALL: // only used for homing
|
||||
axiscode = '\0';
|
||||
movevalue = 0; // ignore value sent from display, this VP is _ONLY_ for homing.
|
||||
break;
|
||||
}
|
||||
|
||||
if (!movevalue) {
|
||||
// homing
|
||||
DEBUG_ECHOPAIR(" homing ", AS_CHAR(axiscode));
|
||||
char buf[6] = "G28 X";
|
||||
buf[4] = axiscode;
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓");
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// movement
|
||||
DEBUG_ECHOPAIR(" move ", AS_CHAR(axiscode));
|
||||
bool old_relative_mode = relative_mode;
|
||||
if (!relative_mode) {
|
||||
//DEBUG_ECHOPGM(" G91");
|
||||
queue.enqueue_now_P(PSTR("G91"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
char buf[32]; // G1 X9999.99 F12345
|
||||
unsigned int backup_speed = MMS_TO_MMM(feedrate_mm_s);
|
||||
char sign[] = "\0";
|
||||
int16_t value = movevalue / 100;
|
||||
if (movevalue < 0) { value = -value; sign[0] = '-'; }
|
||||
int16_t fraction = ABS(movevalue) % 100;
|
||||
snprintf_P(buf, 32, PSTR("G0 %c%s%d.%02d F%d"), axiscode, sign, value, fraction, speed);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (backup_speed != speed) {
|
||||
snprintf_P(buf, 32, PSTR("G0 F%d"), backup_speed);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
}
|
||||
// while (!enqueue_and_echo_command(buf)) idle();
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (!old_relative_mode) {
|
||||
//DEBUG_ECHOPGM("G90");
|
||||
queue.enqueue_now_P(PSTR("G90"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
}
|
||||
|
||||
ForceCompleteUpdate();
|
||||
DEBUG_ECHOLNPGM("manmv done.");
|
||||
return;
|
||||
|
||||
cannotmove:
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", AS_CHAR(axiscode));
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("V1:", rawvalue);
|
||||
float value = (float)rawvalue / 10;
|
||||
DEBUG_ECHOLNPAIR("V2:", value);
|
||||
float newvalue = 0;
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_PID_P: newvalue = value; break;
|
||||
case VP_E0_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E0_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_PID_P: newvalue = value; break;
|
||||
case VP_E1_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E1_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
case VP_BED_PID_P: newvalue = value; break;
|
||||
case VP_BED_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_BED_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
}
|
||||
|
||||
DEBUG_ECHOLNPAIR_F("V3:", newvalue);
|
||||
*(float *)var.memadr = newvalue;
|
||||
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
}
|
||||
#endif // HAS_PID_HEATING
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleLiveAdjustZ");
|
||||
int16_t flag = swap16(*(uint16_t*)val_ptr),
|
||||
steps = flag ? -20 : 20;
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true);
|
||||
ForceCompleteUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentOption");
|
||||
|
||||
uint8_t e_temp = 0;
|
||||
filament_data.heated = false;
|
||||
uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
|
||||
if (preheat_option <= 8) { // Load filament type
|
||||
filament_data.action = 1;
|
||||
}
|
||||
else if (preheat_option >= 10) { // Unload filament type
|
||||
preheat_option -= 10;
|
||||
filament_data.action = 2;
|
||||
filament_data.purge_length = DGUS_FILAMENT_PURGE_LENGTH;
|
||||
}
|
||||
else { // Cancel filament operation
|
||||
filament_data.action = 0;
|
||||
}
|
||||
|
||||
switch (preheat_option) {
|
||||
case 0: // Load PLA
|
||||
#ifdef PREHEAT_1_TEMP_HOTEND
|
||||
e_temp = PREHEAT_1_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 1: // Load ABS
|
||||
TERN_(PREHEAT_2_TEMP_HOTEND, e_temp = PREHEAT_2_TEMP_HOTEND);
|
||||
break;
|
||||
case 2: // Load PET
|
||||
#ifdef PREHEAT_3_TEMP_HOTEND
|
||||
e_temp = PREHEAT_3_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 3: // Load FLEX
|
||||
#ifdef PREHEAT_4_TEMP_HOTEND
|
||||
e_temp = PREHEAT_4_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 9: // Cool down
|
||||
default:
|
||||
e_temp = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (filament_data.action == 0) { // Go back to utility screen
|
||||
#if HOTENDS >= 1
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E0);
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1);
|
||||
#endif
|
||||
GotoScreen(DGUSLCD_SCREEN_UTILITY);
|
||||
}
|
||||
else { // Go to the preheat screen to show the heating progress
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E0;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E1;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_HEATING);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentLoadUnload");
|
||||
if (filament_data.action <= 0) return;
|
||||
|
||||
// If we close to the target temperature, we can start load or unload the filament
|
||||
if (thermalManager.hotEnoughToExtrude(filament_data.extruder) && \
|
||||
thermalManager.targetHotEnoughToExtrude(filament_data.extruder)) {
|
||||
float movevalue = DGUS_FILAMENT_LOAD_LENGTH_PER_TIME;
|
||||
|
||||
if (filament_data.action == 1) { // load filament
|
||||
if (!filament_data.heated) {
|
||||
//GotoScreen(DGUSLCD_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);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
// Before unloading extrude to prevent jamming
|
||||
if (filament_data.purge_length >= 0) {
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue;
|
||||
filament_data.purge_length -= movevalue;
|
||||
}
|
||||
else {
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) - movevalue;
|
||||
}
|
||||
}
|
||||
ExtUI::setAxisPosition_mm(movevalue, filament_data.extruder);
|
||||
}
|
||||
}
|
||||
#endif // DGUS_FILAMENT_LOADUNLOAD
|
||||
|
||||
bool DGUSScreenHandler::loop() {
|
||||
dgusdisplay.loop();
|
||||
|
||||
const millis_t ms = millis();
|
||||
static millis_t next_event_ms = 0;
|
||||
|
||||
if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) {
|
||||
next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS;
|
||||
UpdateScreenVPData();
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
static bool booted = false;
|
||||
|
||||
if (!booted && TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
|
||||
booted = true;
|
||||
|
||||
if (!booted && ELAPSED(ms, TERN(USE_MKS_GREEN_UI, 1000, BOOTSCREEN_TIMEOUT)))
|
||||
booted = true;
|
||||
#endif
|
||||
return IsScreenComplete();
|
||||
}
|
||||
|
||||
#endif // DGUS_LCD_UI_ORIGIN
|
240
Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.h
Normal file
240
Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.h
Normal file
@ -0,0 +1,240 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSVPVariable.h"
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
#include "../../../../inc/MarlinConfig.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
|
||||
class DGUSScreenHandler {
|
||||
public:
|
||||
DGUSScreenHandler() = default;
|
||||
|
||||
static bool loop();
|
||||
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifing whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
// "M117" Message -- msg is a RAM ptr.
|
||||
static void setstatusmessage(const char *msg);
|
||||
// The same for messages from Flash
|
||||
static void setstatusmessagePGM(PGM_P const msg);
|
||||
// Callback for VP "Display wants to change screen on idle printer"
|
||||
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);
|
||||
|
||||
// Callback for VP "All Heaters Off"
|
||||
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);
|
||||
// Hook for "Change Flowrate"
|
||||
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);
|
||||
#endif
|
||||
|
||||
// Hook for manual move.
|
||||
static void HandleManualMove(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for manual extrude.
|
||||
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);
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Hook for power loss recovery.
|
||||
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);
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
// Hook for "Change this temperature PID para"
|
||||
static void HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for PID autotune
|
||||
static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_BED_PROBE
|
||||
// Hook for "Change probe offset z"
|
||||
static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
// Hook for live z adjust action
|
||||
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
// Hook for fan control
|
||||
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);
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
// Hook for preheat
|
||||
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);
|
||||
// Hook for filament load and unload
|
||||
static void HandleFilamentLoadUnload(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
// Callback for VP "Display wants to change screen when there is a SD card"
|
||||
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);
|
||||
// File touched.
|
||||
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// start print after confirmation received.
|
||||
static void DGUSLCD_SD_StartPrint(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);
|
||||
// User confirmed the abort action
|
||||
static void DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the tune button
|
||||
static void DGUSLCD_SD_PrintTune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Send a single filename to the display.
|
||||
static void DGUSLCD_SD_SendFilename(DGUS_VP_Variable &var);
|
||||
// Marlin informed us that a new SD has been inserted.
|
||||
static void SDCardInserted();
|
||||
// Marlin informed us that the SD Card has been removed().
|
||||
static void SDCardRemoved();
|
||||
// Marlin informed us about a bad SD Card.
|
||||
static void SDCardError();
|
||||
#endif
|
||||
|
||||
// OK Button the Confirm screen.
|
||||
static void ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Update data after went to new screen (by display or by GotoScreen)
|
||||
// remember: store the last-displayed screen, so it can get returned to.
|
||||
// (e.g for pop up messages)
|
||||
static void UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup=false);
|
||||
|
||||
// Recall the remembered screen.
|
||||
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 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);
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
static void DGUSLCD_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);
|
||||
|
||||
template<typename T>
|
||||
static void DGUSLCD_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;
|
||||
LOOP_L_N(i, sizeof(T)) x.tmp[i] = ptr[sizeof(T) - i - 1];
|
||||
*(T*)var.memadr = x.t;
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// 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<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (long)f);
|
||||
}
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// 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<unsigned int decimals>
|
||||
static void DGUSLCD_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);
|
||||
}
|
||||
}
|
||||
|
||||
// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static inline void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
private:
|
||||
static DGUSLCD_Screens current_screen; //< 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 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 uint16_t ConfirmVP; //< context for confirm screen (VP that will be emulated-sent on "OK").
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static int16_t top_file; //< file on top of file chooser
|
||||
static int16_t file_to_print; //< touched file to be confirmed
|
||||
#endif
|
||||
|
||||
static void (*confirm_action_cb)();
|
||||
};
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#define PLR_SCREEN_RECOVER DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
#define PLR_SCREEN_CANCEL DGUSLCD_SCREEN_STATUS
|
||||
#endif
|
Reference in New Issue
Block a user