✨ New DGUS_LCD_UI option, IA_CREALITY (#25143)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
5026012abb
commit
32e8627510
|
@ -2939,23 +2939,16 @@
|
|||
|
||||
/**
|
||||
* DGUS Touch Display with DWIN OS. (Choose one.)
|
||||
* ORIGIN : https://www.aliexpress.com/item/32993409517.html
|
||||
* FYSETC : https://www.aliexpress.com/item/32961471929.html
|
||||
* MKS : https://www.aliexpress.com/item/1005002008179262.html
|
||||
*
|
||||
* Flash display with DGUS Displays for Marlin:
|
||||
* - Format the SD card to FAT32 with an allocation size of 4kb.
|
||||
* - Download files as specified for your type of display.
|
||||
* - Plug the microSD card into the back of the display.
|
||||
* - Boot the display and wait for the update to complete.
|
||||
*
|
||||
* ORIGIN (Marlin DWIN_SET)
|
||||
* - Download https://github.com/coldtobi/Marlin_DGUS_Resources
|
||||
* - Copy the downloaded DWIN_SET folder to the SD card.
|
||||
* - Product: https://www.aliexpress.com/item/32993409517.html
|
||||
*
|
||||
* FYSETC (Supplier default)
|
||||
* - Download https://github.com/FYSETC/FYSTLCD-2.0
|
||||
* - Copy the downloaded SCREEN folder to the SD card.
|
||||
* - Product: https://www.aliexpress.com/item/32961471929.html
|
||||
*
|
||||
* HIPRECY (Supplier default)
|
||||
* - Download https://github.com/HiPrecy/Touch-Lcd-LEO
|
||||
|
@ -2964,17 +2957,24 @@
|
|||
* MKS (MKS-H43) (Supplier default)
|
||||
* - Download https://github.com/makerbase-mks/MKS-H43
|
||||
* - Copy the downloaded DWIN_SET folder to the SD card.
|
||||
* - Product: https://www.aliexpress.com/item/1005002008179262.html
|
||||
*
|
||||
* RELOADED (T5UID1)
|
||||
* - Download https://github.com/Desuuuu/DGUS-reloaded/releases
|
||||
* - Copy the downloaded DWIN_SET folder to the SD card.
|
||||
*
|
||||
* IA_CREALITY (T5UID1)
|
||||
* - Download https://github.com/InsanityAutomation/Marlin/raw/CrealityDwin2.0_Bleeding/TM3D_Combined480272_Landscape_V7.7z
|
||||
* - Copy the downloaded DWIN_SET folder to the SD card.
|
||||
*
|
||||
* Flash display with DGUS Displays for Marlin:
|
||||
* - Format the SD card to FAT32 with an allocation size of 4kb.
|
||||
* - Download files as specified for your type of display.
|
||||
* - Plug the microSD card into the back of the display.
|
||||
* - Boot the display and wait for the update to complete.
|
||||
*/
|
||||
//#define DGUS_LCD_UI_ORIGIN
|
||||
//#define DGUS_LCD_UI_FYSETC
|
||||
//#define DGUS_LCD_UI_HIPRECY
|
||||
//#define DGUS_LCD_UI_MKS
|
||||
//#define DGUS_LCD_UI_RELOADED
|
||||
#if ENABLED(DGUS_LCD_UI_MKS)
|
||||
//#define DGUS_LCD_UI ORIGIN
|
||||
#if DGUS_UI_IS(MKS)
|
||||
#define USE_MKS_GREEN_UI
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1867,11 +1867,11 @@
|
|||
|
||||
#define DGUS_UPDATE_INTERVAL_MS 500 // (ms) Interval between automatic screen updates
|
||||
|
||||
#if ANY(DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_MKS, DGUS_LCD_UI_HIPRECY)
|
||||
#if DGUS_UI_IS(FYSETC, MKS, HIPRECY)
|
||||
#define DGUS_PRINT_FILENAME // Display the filename during printing
|
||||
#define DGUS_PREHEAT_UI // Display a preheat screen during heatup
|
||||
|
||||
#if EITHER(DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_MKS)
|
||||
#if DGUS_UI_IS(FYSETC, MKS)
|
||||
//#define DGUS_UI_MOVE_DIS_OPTION // Disabled by default for FYSETC and MKS
|
||||
#else
|
||||
#define DGUS_UI_MOVE_DIS_OPTION // Enabled by default for UI_HIPRECY
|
||||
|
|
|
@ -742,3 +742,13 @@
|
|||
#define _HAS_E_TEMP(N) || TEMP_SENSOR(N)
|
||||
#define HAS_E_TEMP_SENSOR (0 REPEAT(EXTRUDERS, _HAS_E_TEMP))
|
||||
#define TEMP_SENSOR_IS_MAX_TC(T) (TEMP_SENSOR(T) == -5 || TEMP_SENSOR(T) == -3 || TEMP_SENSOR(T) == -2)
|
||||
|
||||
#define _UI_NONE 0
|
||||
#define _UI_ORIGIN 101
|
||||
#define _UI_FYSETC 102
|
||||
#define _UI_HIPRECY 103
|
||||
#define _UI_MKS 104
|
||||
#define _UI_RELOADED 105
|
||||
#define _UI_IA_CREALITY 106
|
||||
#define _DGUS_UI_IS(N) || (DGUS_LCD_UI == _UI_ ## N)
|
||||
#define DGUS_UI_IS(V...) (0 MAP(_DGUS_UI_IS, V))
|
||||
|
|
|
@ -36,6 +36,21 @@
|
|||
#define FYSETC_MINI_12864_2_1
|
||||
#endif
|
||||
|
||||
// Updated DGUS_UI shorthand single option can be used, or old settings, for now
|
||||
#if DGUS_UI_IS(ORIGIN)
|
||||
#define DGUS_LCD_UI_ORIGIN
|
||||
#elif DGUS_UI_IS(FYSETC)
|
||||
#define DGUS_LCD_UI_FYSETC
|
||||
#elif DGUS_UI_IS(HIPRECY)
|
||||
#define DGUS_LCD_UI_HIPRECY
|
||||
#elif DGUS_UI_IS(MKS)
|
||||
#define DGUS_LCD_UI_MKS
|
||||
#elif DGUS_UI_IS(RELOADED)
|
||||
#define DGUS_LCD_UI_RELOADED
|
||||
#elif DGUS_UI_IS(IA_CREALITY)
|
||||
#define DGUS_LCD_UI_IA_CREALITY
|
||||
#endif
|
||||
|
||||
/**
|
||||
* General Flags that may be set below by specific LCDs
|
||||
*
|
||||
|
@ -462,12 +477,11 @@
|
|||
#endif
|
||||
|
||||
// Aliases for LCD features
|
||||
#if ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY, DGUS_LCD_UI_MKS)
|
||||
#define HAS_DGUS_LCD_CLASSIC 1
|
||||
#endif
|
||||
|
||||
#if EITHER(HAS_DGUS_LCD_CLASSIC, DGUS_LCD_UI_RELOADED)
|
||||
#if !DGUS_UI_IS(NONE)
|
||||
#define HAS_DGUS_LCD 1
|
||||
#if DGUS_UI_IS(ORIGIN, FYSETC, HIPRECY, MKS)
|
||||
#define HAS_DGUS_LCD_CLASSIC 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Extensible UI serial touch screens. (See src/lcd/extui)
|
||||
|
|
|
@ -513,7 +513,7 @@
|
|||
#elif defined(HOME_USING_SPREADCYCLE)
|
||||
#error "HOME_USING_SPREADCYCLE is now obsolete. Please remove it."
|
||||
#elif defined(DGUS_LCD)
|
||||
#error "DGUS_LCD is now DGUS_LCD_UI_(ORIGIN|FYSETC|HIPRECY)."
|
||||
#error "DGUS_LCD is now DGUS_LCD_UI ORIGIN|FYSETC|HIPRECY)."
|
||||
#elif defined(DGUS_SERIAL_PORT)
|
||||
#error "DGUS_SERIAL_PORT is now LCD_SERIAL_PORT."
|
||||
#elif defined(DGUS_BAUDRATE)
|
||||
|
@ -3024,7 +3024,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
|||
+ (DISABLED(IS_LEGACY_TFT) && ENABLED(TFT_GENERIC)) \
|
||||
+ (ENABLED(IS_LEGACY_TFT) && COUNT_ENABLED(TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI)) \
|
||||
+ COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35) \
|
||||
+ COUNT_ENABLED(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY, DGUS_LCD_UI_MKS, DGUS_LCD_UI_RELOADED) \
|
||||
+ DGUS_UI_IS(ORIGIN) + DGUS_UI_IS(FYSETC) + DGUS_UI_IS(HIPRECY) + DGUS_UI_IS(MKS) + DGUS_UI_IS(RELOADED) + DGUS_UI_IS(IA_CREALITY) \
|
||||
+ COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY) \
|
||||
+ COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) \
|
||||
+ COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_GENERIC_12864_1_1) \
|
||||
|
@ -4285,34 +4285,51 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive.");
|
|||
#undef _BAD_DRIVER
|
||||
|
||||
/**
|
||||
* Require certain features for DGUS_LCD_UI_RELOADED.
|
||||
* Require certain features for DGUS_LCD_UI RELOADED.
|
||||
*/
|
||||
#if ENABLED(DGUS_LCD_UI_RELOADED)
|
||||
#if DGUS_UI_IS(RELOADED)
|
||||
#if BUFSIZE < 4
|
||||
#error "DGUS_LCD_UI_RELOADED requires a BUFSIZE of at least 4."
|
||||
#error "DGUS_LCD_UI RELOADED requires a BUFSIZE of at least 4."
|
||||
#elif HOTENDS < 1
|
||||
#error "DGUS_LCD_UI_RELOADED requires at least 1 hotend."
|
||||
#error "DGUS_LCD_UI RELOADED requires at least 1 hotend."
|
||||
#elif EXTRUDERS < 1
|
||||
#error "DGUS_LCD_UI_RELOADED requires at least 1 extruder."
|
||||
#error "DGUS_LCD_UI RELOADED requires at least 1 extruder."
|
||||
#elif !HAS_HEATED_BED
|
||||
#error "DGUS_LCD_UI_RELOADED requires a heated bed."
|
||||
#error "DGUS_LCD_UI RELOADED requires a heated bed."
|
||||
#elif FAN_COUNT < 1
|
||||
#error "DGUS_LCD_UI_RELOADED requires a fan."
|
||||
#error "DGUS_LCD_UI RELOADED requires a fan."
|
||||
#elif !HAS_BED_PROBE
|
||||
#error "DGUS_LCD_UI_RELOADED requires a bed probe."
|
||||
#error "DGUS_LCD_UI RELOADED requires a bed probe."
|
||||
#elif !HAS_MESH
|
||||
#error "DGUS_LCD_UI_RELOADED requires mesh leveling."
|
||||
#error "DGUS_LCD_UI RELOADED requires mesh leveling."
|
||||
#elif DISABLED(LCD_BED_TRAMMING)
|
||||
#error "DGUS_LCD_UI_RELOADED requires LCD_BED_TRAMMING."
|
||||
#error "DGUS_LCD_UI RELOADED requires LCD_BED_TRAMMING."
|
||||
#elif DISABLED(BABYSTEP_ALWAYS_AVAILABLE)
|
||||
#error "DGUS_LCD_UI_RELOADED requires BABYSTEP_ALWAYS_AVAILABLE."
|
||||
#error "DGUS_LCD_UI RELOADED requires BABYSTEP_ALWAYS_AVAILABLE."
|
||||
#elif DISABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||
#error "DGUS_LCD_UI_RELOADED requires BABYSTEP_ZPROBE_OFFSET."
|
||||
#error "DGUS_LCD_UI RELOADED requires BABYSTEP_ZPROBE_OFFSET."
|
||||
#elif ENABLED(AUTO_BED_LEVELING_UBL) && DISABLED(UBL_SAVE_ACTIVE_ON_M500)
|
||||
#warning "Without UBL_SAVE_ACTIVE_ON_M500, your mesh will not be saved when using the touchscreen."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Require certain features for DGUS_LCD_UI IA_CREALITY.
|
||||
*/
|
||||
#if DGUS_UI_IS(IA_CREALITY)
|
||||
#if DISABLED(ADVANCED_PAUSE_FEATURE)
|
||||
#error "DGUS_LCD_UI IA_CREALITY requires ADVANCED_PAUSE_FEATURE."
|
||||
#elif DISABLED(LCD_BED_TRAMMING)
|
||||
#error "DGUS_LCD_UI IA_CREALITY requires LCD_BED_TRAMMING."
|
||||
#elif DISABLED(CLASSIC_JERK)
|
||||
#error "DGUS_LCD_UI IA_CREALITY requires CLASSIC_JERK."
|
||||
#elif DISABLED(BABYSTEPPING)
|
||||
#error "DGUS_LCD_UI IA_CREALITY requires BABYSTEPPING."
|
||||
#elif NONE(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING)
|
||||
#error "DGUS_LCD_UI IA_CREALITY requires AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, or MESH_BED_LEVELING."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// JTAG support in the HAL
|
||||
#if ENABLED(DISABLE_DEBUG) && !defined(JTAGSWD_DISABLE)
|
||||
#error "DISABLE_DEBUG is not supported for the selected MCU/Board."
|
||||
|
|
183
Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp
Normal file
183
Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp
Normal file
|
@ -0,0 +1,183 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2022 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/ia_creality/FileNavigator.cpp
|
||||
* ****************************************
|
||||
* Extensible_UI implementation for Creality DWIN
|
||||
* 10SPro, Max, CR10V2
|
||||
* Based on implementations for Anycubic Chiron and Nextion by Nick Wells and Skorpi08
|
||||
* Written by Insanity Automation
|
||||
* ***************************************/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_IA_CREALITY)
|
||||
|
||||
#include "FileNavigator.h"
|
||||
|
||||
using namespace ExtUI;
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_DWIN)
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
FileList FileNavigator::filelist; // Instance of the Marlin file API
|
||||
char FileNavigator::currentfoldername[MAX_PATH_LEN]; // Current folder path
|
||||
uint16_t FileNavigator::lastindex;
|
||||
uint8_t FileNavigator::folderdepth;
|
||||
uint16_t FileNavigator::currentindex; // override the panel request
|
||||
|
||||
FileNavigator filenavigator;
|
||||
|
||||
FileNavigator::FileNavigator() { reset(); }
|
||||
|
||||
void FileNavigator::reset() {
|
||||
currentfoldername[0] = '\0';
|
||||
folderdepth = 0;
|
||||
currentindex = 0;
|
||||
lastindex = 0;
|
||||
// Start at root folder
|
||||
while (!filelist.isAtRootDir()) filelist.upDir();
|
||||
refresh();
|
||||
}
|
||||
|
||||
void FileNavigator::refresh() { filelist.refresh(); }
|
||||
|
||||
bool FileNavigator::getIndexisDir(uint16_t index){
|
||||
filelist.seek(index);
|
||||
return filelist.isDir();
|
||||
}
|
||||
|
||||
const char *FileNavigator::getIndexName(uint16_t index){
|
||||
filelist.seek(index);
|
||||
return filelist.shortFilename();
|
||||
}
|
||||
|
||||
uint16_t FileNavigator::maxFiles() {
|
||||
return filelist.count();
|
||||
}
|
||||
|
||||
void FileNavigator::getFiles(uint16_t index) {
|
||||
uint16_t files = DISPLAY_FILES, fcnt = 0;
|
||||
if (index == 0)
|
||||
currentindex = 0;
|
||||
else {
|
||||
// Each time we change folder we reset the file index to 0 and keep track
|
||||
// of the current position as the TFT panel isn't aware of folder trees.
|
||||
--currentindex; // go back a file to take account of the .. added to the root.
|
||||
if (index > lastindex)
|
||||
currentindex += files + 1;
|
||||
else if (currentindex >= files)
|
||||
currentindex -= files - 1;
|
||||
else
|
||||
currentindex = 0;
|
||||
}
|
||||
lastindex = index;
|
||||
|
||||
|
||||
// Clear currently drawn screen
|
||||
for (int i = 0; i < DISPLAY_FILES; i++) {
|
||||
for (int j = 0; j < 20; j++)
|
||||
rtscheck.RTS_SndData(0, SDFILE_ADDR + (i * 20) + j);
|
||||
}
|
||||
|
||||
for (int j = 0; j < 10; j++) {
|
||||
rtscheck.RTS_SndData(0, Printfilename + j); // clear screen.
|
||||
rtscheck.RTS_SndData(0, Choosefilename + j); // clear filename
|
||||
}
|
||||
for (int j = 0; j < 8; j++)
|
||||
rtscheck.RTS_SndData(0, FilenameCount + j);
|
||||
for (int j = 1; j <= DISPLAY_FILES; j++) {
|
||||
rtscheck.RTS_SndData(10, FilenameIcon + j);
|
||||
rtscheck.RTS_SndData(10, FilenameIcon1 + j);
|
||||
}
|
||||
|
||||
DEBUG_ECHOLNPGM("index=", index, " currentindex=", currentindex, "folderdepth=", folderdepth);
|
||||
|
||||
if (currentindex == 0 && folderdepth > 0) { // Add a link to go up a folder
|
||||
files--;
|
||||
rtscheck.RTS_SndData("Up Directory", SDFILE_ADDR);
|
||||
fcnt++;
|
||||
}
|
||||
else if (currentindex == DISPLAY_FILES && folderdepth > 0)
|
||||
currentindex--;
|
||||
|
||||
for (uint16_t seek = currentindex; seek < currentindex + files; seek++) {
|
||||
if (filelist.seek(seek)) {
|
||||
const int filelen = strlen(filelist.filename());
|
||||
if (filelen > 20) {
|
||||
char *buf = (char *)filelist.filename();
|
||||
//char buf[filelen];
|
||||
//strcpy(&buf[filelen], filelist.filename());
|
||||
buf[18] = '\0'; // cutoff at screen edge
|
||||
rtscheck.RTS_SndData(buf, (SDFILE_ADDR + (fcnt * 20)));
|
||||
}
|
||||
else
|
||||
rtscheck.RTS_SndData(filelist.filename(), (SDFILE_ADDR + (fcnt * 20)));
|
||||
|
||||
if (filelist.isDir()) {
|
||||
rtscheck.RTS_SndData((uint8_t)4, FilenameIcon + (fcnt+1));
|
||||
rtscheck.RTS_SndData((unsigned long)0x041F, (FilenameNature + ((1+fcnt) * 16))); // Change BG of selected line to Blue
|
||||
}
|
||||
else {
|
||||
rtscheck.RTS_SndData((uint8_t)0, FilenameIcon + (fcnt+1));
|
||||
rtscheck.RTS_SndData((unsigned long)0xFFFF, (FilenameNature + ((1+fcnt) * 16))); // white
|
||||
}
|
||||
SERIAL_ECHOLNPGM("-", seek, " '", filelist.filename(), "' '", currentfoldername, "", filelist.shortFilename(), "'\n");
|
||||
fcnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileNavigator::changeDIR(char *folder) {
|
||||
DEBUG_ECHOLNPGM("currentfolder: ", currentfoldername, " New: ", folder);
|
||||
if (folderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth
|
||||
strcat(currentfoldername, folder);
|
||||
strcat(currentfoldername, "/");
|
||||
filelist.changeDir(folder);
|
||||
refresh();
|
||||
folderdepth++;
|
||||
currentindex = 0;
|
||||
}
|
||||
|
||||
void FileNavigator::upDIR() {
|
||||
filelist.upDir();
|
||||
refresh();
|
||||
folderdepth--;
|
||||
currentindex = 0;
|
||||
// Remove the last child folder from the stored path
|
||||
if (folderdepth == 0) {
|
||||
currentfoldername[0] = '\0';
|
||||
reset();
|
||||
}
|
||||
else {
|
||||
char *pos = nullptr;
|
||||
for (uint8_t f = 0; f < folderdepth; f++)
|
||||
pos = strchr(currentfoldername, '/');
|
||||
pos[1] = '\0';
|
||||
}
|
||||
DEBUG_ECHOLNPGM("depth: ", folderdepth, " currentfoldername: ", currentfoldername);
|
||||
}
|
||||
|
||||
char* FileNavigator::getCurrentFolderName() { return currentfoldername; }
|
||||
|
||||
#endif // DGUS_LCD_UI_IA_CREALITY
|
63
Marlin/src/lcd/extui/ia_creality/FileNavigator.h
Normal file
63
Marlin/src/lcd/extui/ia_creality/FileNavigator.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2022 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/ia_creality/FileNavigator.h
|
||||
* ****************************************
|
||||
* Extensible_UI implementation for Creality DWIN
|
||||
* 10SPro, Max, CRX and others
|
||||
* Based on implementations for Anycubic Chiron and Nextion by Nick Wells and Skorpi08
|
||||
* Written by Insanity Automation
|
||||
* ***************************************/
|
||||
|
||||
#include "creality_extui.h"
|
||||
#include "../ui_api.h"
|
||||
|
||||
#define MAX_FOLDER_DEPTH 4 // Limit folder depth TFT has a limit for the file path
|
||||
#define MAX_CMND_LEN 16 * MAX_FOLDER_DEPTH // Maximum Length for a Panel command
|
||||
#define MAX_PATH_LEN 16 * MAX_FOLDER_DEPTH // Maximum number of characters in a SD file path
|
||||
#define DISPLAY_FILES 4
|
||||
|
||||
using namespace ExtUI;
|
||||
|
||||
class FileNavigator {
|
||||
public:
|
||||
FileNavigator();
|
||||
static void reset();
|
||||
static void getFiles(uint16_t);
|
||||
static void upDIR();
|
||||
static void changeDIR(char *);
|
||||
static void refresh();
|
||||
static char* getCurrentFolderName();
|
||||
static uint8_t folderdepth;
|
||||
static uint16_t currentindex;
|
||||
static bool getIndexisDir(uint16_t);
|
||||
const char *getIndexName(uint16_t);
|
||||
static uint16_t maxFiles();
|
||||
private:
|
||||
static FileList filelist;
|
||||
static char currentfoldername[MAX_PATH_LEN];
|
||||
static uint16_t lastindex;
|
||||
};
|
||||
|
||||
extern FileNavigator filenavigator;
|
2369
Marlin/src/lcd/extui/ia_creality/creality_extui.cpp
Normal file
2369
Marlin/src/lcd/extui/ia_creality/creality_extui.cpp
Normal file
File diff suppressed because it is too large
Load diff
303
Marlin/src/lcd/extui/ia_creality/creality_extui.h
Normal file
303
Marlin/src/lcd/extui/ia_creality/creality_extui.h
Normal file
|
@ -0,0 +1,303 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2022 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/ia_creality/creality_extui.h
|
||||
* ****************************************
|
||||
* Extensible_UI implementation for Creality DWIN
|
||||
* 10SPro, Max, CRX, and others
|
||||
* Based original Creality release, ported to ExtUI for Marlin 2.0
|
||||
* Written by Insanity Automation, sponsored by Tiny Machines 3D
|
||||
*
|
||||
* ***************************************/
|
||||
|
||||
#include "string.h"
|
||||
#include <Arduino.h>
|
||||
#include "../ui_api.h"
|
||||
|
||||
/*********************************/
|
||||
#define FHONE (0x5A)
|
||||
#define FHTWO (0xA5)
|
||||
#define FHLENG (0x06)
|
||||
|
||||
#define TEXTBYTELEN 18
|
||||
#define MaxFileNumber 20 // 16
|
||||
|
||||
#define CEIconGrap 12
|
||||
#define FileNum MaxFileNumber
|
||||
#define FileNameLen TEXTBYTELEN
|
||||
|
||||
#define SizeofDatabuf 46
|
||||
|
||||
/*************Register and Variable addr*****************/
|
||||
#define RegAddr_W 0x80
|
||||
#define RegAddr_R 0x81
|
||||
#define VarAddr_W 0x82
|
||||
#define VarAddr_R 0x83
|
||||
#define ExchangePageBase (unsigned long)0x5A010000 // the first page ID. other page = first page ID + relevant num;
|
||||
#define StartSoundSet ((unsigned long)0x060480A0) // 06,start-music; 04, 4 musics; 80, the volume value; 04, return value about music number.
|
||||
//#define FONT_EEPROM 90
|
||||
//#define AutoLeve_EEPROM 100
|
||||
//#define FanOn 255
|
||||
#define FanOff 0
|
||||
|
||||
/*variable addr*/
|
||||
#define ExchangepageAddr 0x0084
|
||||
#define SoundAddr 0x00A0
|
||||
#define StartIcon 0x1000
|
||||
#define FeedrateDisplay 0x1006 // Speed
|
||||
#define Stopprint 0x1008
|
||||
#define Pauseprint 0x100A
|
||||
#define Resumeprint 0x100C
|
||||
#define PrintscheduleIcon 0x100E
|
||||
#define Timehour 0x1010
|
||||
#define Timemin 0x1012
|
||||
#define IconPrintstatus 0x1014
|
||||
#define Percentage 0x1016
|
||||
#define FanKeyIcon 0x101E
|
||||
#define Flowrate 0x1300
|
||||
|
||||
#define RunoutToggle 0x1018
|
||||
#define PowerLossToggle 0x101A
|
||||
#define LedToggle 0x101C
|
||||
|
||||
#define StepMM_X 0x1242
|
||||
#define StepMM_Y 0x1246
|
||||
#define StepMM_Z 0x124A
|
||||
#define StepMM_E 0x124E
|
||||
|
||||
#define ProbeOffset_X 0x1236
|
||||
#define ProbeOffset_Y 0x123A
|
||||
#define ProbeOffset_Z 0x1026
|
||||
|
||||
#define T2Offset_X 0x1090
|
||||
#define T2Offset_Y 0x1092
|
||||
#define T2Offset_Z 0x1094
|
||||
#define T2StepMM_E 0x1096
|
||||
|
||||
#define ActiveToolVP 0x1014
|
||||
|
||||
#define HotendPID_AutoTmp 0x1252
|
||||
#define BedPID_AutoTmp 0x1254
|
||||
|
||||
#define HotendPID_P 0x1256
|
||||
#define HotendPID_I 0x125A
|
||||
#define HotendPID_D 0x125E
|
||||
|
||||
#define BedPID_P 0x1262
|
||||
#define BedPID_I 0x1266
|
||||
#define BedPID_D 0x126A
|
||||
|
||||
#define Jerk_X 0x1270
|
||||
#define Jerk_Y 0x1272
|
||||
#define Jerk_Z 0x1274
|
||||
#define Jerk_E 0x1276
|
||||
|
||||
#define Feed_X 0x1278
|
||||
#define Feed_Y 0x127A
|
||||
#define Feed_Z 0x127C
|
||||
#define Feed_E 0x127E
|
||||
|
||||
#define Accel_X 0x1280
|
||||
#define Accel_Y 0x1282
|
||||
#define Accel_Z 0x1284
|
||||
#define Accel_E 0x1286
|
||||
|
||||
#define HeatPercentIcon 0x1024
|
||||
|
||||
#define NzBdSet 0x1032 // cooldown Hotend and Bed
|
||||
#define NozzlePreheat 0x1034 // setpoint
|
||||
#define NozzleTemp 0x1036 // Actual
|
||||
#define BedPreheat 0x103A // Setpoint
|
||||
#define Bedtemp 0x103C // Actual
|
||||
|
||||
#define e2Temp 0x1050
|
||||
#define e2Preheat 0x104E
|
||||
|
||||
#define AutoZeroIcon 0x1042
|
||||
#define AutoLevelIcon 0x1045
|
||||
#define AutoZero 0x1046
|
||||
#define DisplayXaxis 0x1048
|
||||
#define DisplayYaxis 0x104A
|
||||
#define DisplayZaxis 0x104C
|
||||
|
||||
#define FilamentUnit1 0x1054
|
||||
#define Exchfilement 0x1056
|
||||
#define FilamentUnit2 0x1058
|
||||
|
||||
#define MacVersion 0x1060
|
||||
#define SoftVersion 0x106A
|
||||
#define PrinterSize 0x1074
|
||||
#define CorpWebsite 0x107E
|
||||
#define VolumeIcon 0x108A
|
||||
#define SoundIcon 0x108C
|
||||
#define AutolevelIcon 0x108D
|
||||
#define ExchFlmntIcon 0x108E
|
||||
#define AutolevelVal 0x1100
|
||||
|
||||
#define FilenameIcon 0x1200
|
||||
#define FilenameIcon1 0x1220
|
||||
#define Printfilename 0x2000
|
||||
#define FilesCurentPage 0x1310
|
||||
#define FilesMaxPage 0x1312
|
||||
#define SDFILE_ADDR 0x200A
|
||||
#define FilenamePlay 0x20D2
|
||||
#define FilenameChs 0x20D3
|
||||
#define Choosefilename 0x20D4
|
||||
#define FilenameCount 0x20DE
|
||||
#define FilenameNature 0x6003
|
||||
|
||||
#define VolumeDisplay 0x1140
|
||||
#define DisplayBrightness 0x1142
|
||||
#define DisplayStandbyBrightness 0x1144
|
||||
#define DisplayStandbyEnableIndicator 0x1146
|
||||
#define DisplayStandbySeconds 0x1148
|
||||
|
||||
#define StatusMessageString 0x2064
|
||||
|
||||
#ifdef TARGET_STM32F4
|
||||
#define DWIN_SERIAL Serial1
|
||||
#else
|
||||
#define DWIN_SERIAL LCD_SERIAL
|
||||
#endif
|
||||
|
||||
namespace ExtUI {
|
||||
|
||||
/************struct**************/
|
||||
|
||||
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;
|
||||
|
||||
typedef struct DataBuf {
|
||||
unsigned char len;
|
||||
unsigned char head[2];
|
||||
unsigned char command;
|
||||
unsigned long addr;
|
||||
unsigned long bytelen;
|
||||
unsigned short data[32];
|
||||
unsigned char reserv[4];
|
||||
} DB;
|
||||
|
||||
struct creality_dwin_settings_t {
|
||||
size_t settings_size;
|
||||
uint8_t settings_version;
|
||||
|
||||
bool display_standby;
|
||||
bool display_sound;
|
||||
int8_t screen_rotation;
|
||||
int16_t display_volume;
|
||||
uint8_t standby_screen_brightness;
|
||||
uint8_t screen_brightness;
|
||||
int16_t standby_time_seconds;
|
||||
};
|
||||
|
||||
void SetTouchScreenConfiguration();
|
||||
|
||||
class RTSSHOW {
|
||||
public:
|
||||
RTSSHOW();
|
||||
int RTS_RecData();
|
||||
void RTS_SDCardInit(void);
|
||||
void RTS_SDCardUpate(bool, bool);
|
||||
int RTS_CheckFilament(int);
|
||||
void RTS_SndData(void);
|
||||
void RTS_SndData(const String &, unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(const char[], unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(char, unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(unsigned char*, unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(int, unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(float, unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(unsigned int,unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(long,unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(unsigned long,unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SDcard_Stop();
|
||||
void RTS_HandleData();
|
||||
void RTS_Init();
|
||||
|
||||
DB recdat;
|
||||
DB snddat;
|
||||
unsigned char databuf[SizeofDatabuf];
|
||||
|
||||
static rx_datagram_state_t rx_datagram_state;
|
||||
static uint8_t rx_datagram_len;
|
||||
static bool Initialized;
|
||||
};
|
||||
|
||||
static RTSSHOW rtscheck;
|
||||
|
||||
#define Addvalue 3
|
||||
#define PrintChoice_Value (0+Addvalue)
|
||||
#define Zoffset_Value (3+Addvalue)
|
||||
#define Setting_Value (8+Addvalue)
|
||||
#define XYZEaxis_Value (12+Addvalue)
|
||||
#define Filament_Value (15+Addvalue)
|
||||
#define Language_Value (18+Addvalue)
|
||||
#define Filename_Value (22+Addvalue)
|
||||
|
||||
enum PROC_COM {
|
||||
Printfile = 0,
|
||||
Adjust,
|
||||
Feedrate,
|
||||
PrintChoice = PrintChoice_Value,
|
||||
Zoffset = Zoffset_Value,
|
||||
TempControl,
|
||||
ManualSetTemp,
|
||||
Setting = Setting_Value,
|
||||
ReturnBack,
|
||||
Bedlevel,
|
||||
Autohome,
|
||||
XYZEaxis = XYZEaxis_Value,
|
||||
Filament = Filament_Value,
|
||||
LanguageChoice = Language_Value,
|
||||
No_Filament,
|
||||
PwrOffNoF,
|
||||
Volume,
|
||||
Filename = Filename_Value
|
||||
};
|
||||
|
||||
const unsigned long Addrbuf[] = {
|
||||
0x1002, 0x1004, 0x1006, 0x1008, 0x100A, 0x100C, 0x1026, 0x1030, 0x1032, 0x1034, 0x103A,
|
||||
0x103E, 0x1040, 0x1044, 0x1046, 0x1048, 0x104A, 0x104C, 0x1054, 0x1056, 0x1058,
|
||||
0x105C, 0x105E, 0x105F, 0x1088, 0
|
||||
};
|
||||
|
||||
void RTSUpdate();
|
||||
void RTSInit();
|
||||
|
||||
} // ExtUI
|
||||
|
||||
#ifndef MAIN_MENU_ITEM_1_GCODE
|
||||
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||
#define MEASURING_GCODE "M190S55\nG28O\nG34\nG29\nM400\nM104S215\nG28\nM109S215\nM420S1\nG1X100Y100F5000\nG1Z0\nM500\nM117 Set Z Offset"
|
||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
#define MEASURING_GCODE "M190S55\nG28O\nG34\nG29P1\nG29P3\nG29S1\nG29S0\nG29F0.0\nG29A\nM104S215\nG28\nM109S215\nG1X150Y150F5000\nG1Z0\nM500\nM400\nM117 Set Z Offset"
|
||||
#else
|
||||
#define MEASURING_GCODE "G28"
|
||||
#endif
|
||||
#else
|
||||
#define MEASURING_GCODE MAIN_MENU_ITEM_1_GCODE
|
||||
#endif
|
|
@ -167,7 +167,7 @@ void machine_setting_disp() {
|
|||
machine_menu.Extrude_Min_Temper = EXTRUD_MIN_TEMPER_CN;
|
||||
|
||||
machine_menu.HotbedConfTitle = HOTBED_CONF_TITLE_CN;
|
||||
machine_menu.HotbedAjustType = HOTBED_ADJUST_CN;
|
||||
machine_menu.HotbedAdjustType = HOTBED_ADJUST_CN;
|
||||
machine_menu.HotbedMinTemperature = HOTBED_MIN_TEMPERATURE_CN;
|
||||
machine_menu.HotbedMaxTemperature = HOTBED_MAX_TEMPERATURE_CN;
|
||||
|
||||
|
@ -395,7 +395,7 @@ void machine_setting_disp() {
|
|||
machine_menu.Extrude_Min_Temper = EXTRUD_MIN_TEMPER_T_CN;
|
||||
|
||||
machine_menu.HotbedConfTitle = HOTBED_CONF_TITLE_T_CN;
|
||||
machine_menu.HotbedAjustType = HOTBED_ADJUST_T_CN;
|
||||
machine_menu.HotbedAdjustType = HOTBED_ADJUST_T_CN;
|
||||
machine_menu.HotbedMinTemperature = HOTBED_MIN_TEMPERATURE_T_CN;
|
||||
machine_menu.HotbedMaxTemperature = HOTBED_MAX_TEMPERATURE_T_CN;
|
||||
|
||||
|
@ -627,7 +627,7 @@ void machine_setting_disp() {
|
|||
|
||||
machine_menu.HotbedEnable = HOTBED_ENABLE_EN;
|
||||
machine_menu.HotbedConfTitle = HOTBED_CONF_TITLE_EN;
|
||||
machine_menu.HotbedAjustType = HOTBED_ADJUST_EN;
|
||||
machine_menu.HotbedAdjustType = HOTBED_ADJUST_EN;
|
||||
machine_menu.HotbedMinTemperature = HOTBED_MIN_TEMPERATURE_EN;
|
||||
machine_menu.HotbedMaxTemperature = HOTBED_MAX_TEMPERATURE_EN;
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ typedef struct machine_common_disp {
|
|||
|
||||
const char *HotbedEnable;
|
||||
const char *HotbedConfTitle;
|
||||
const char *HotbedAjustType;
|
||||
const char *HotbedAdjustType;
|
||||
const char *HotbedMinTemperature;
|
||||
const char *HotbedMaxTemperature;
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@ set -e
|
|||
# Build with the default configurations
|
||||
#
|
||||
restore_configs
|
||||
opt_set MOTHERBOARD BOARD_FYSETC_F6_13 LCD_SERIAL_PORT 1
|
||||
opt_enable DGUS_LCD_UI_FYSETC
|
||||
opt_set MOTHERBOARD BOARD_FYSETC_F6_13 LCD_SERIAL_PORT 1 DGUS_LCD_UI FYSETC
|
||||
exec_test $1 $2 "FYSETC F6 1.3 with DGUS" "$3"
|
||||
|
||||
#
|
||||
|
|
|
@ -88,6 +88,7 @@ DGUS_LCD_UI_FYSETC = src_filter=+<src/lcd/extui/dgus/fysetc>
|
|||
DGUS_LCD_UI_HIPRECY = src_filter=+<src/lcd/extui/dgus/hiprecy>
|
||||
DGUS_LCD_UI_MKS = src_filter=+<src/lcd/extui/dgus/mks>
|
||||
DGUS_LCD_UI_ORIGIN = src_filter=+<src/lcd/extui/dgus/origin>
|
||||
DGUS_LCD_UI_IA_CREALITY = src_filter=+<src/lcd/extui/ia_creality>
|
||||
EXTUI_EXAMPLE = src_filter=+<src/lcd/extui/example>
|
||||
TOUCH_UI_FTDI_EVE = src_filter=+<src/lcd/extui/ftdi_eve_touch_ui>
|
||||
MALYAN_LCD = src_filter=+<src/lcd/extui/malyan>
|
||||
|
|
|
@ -89,6 +89,7 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared> -<src/t
|
|||
-<src/lcd/extui/malyan>
|
||||
-<src/lcd/extui/mks_ui>
|
||||
-<src/lcd/extui/nextion>
|
||||
-<src/lcd/extui/ia_creality>
|
||||
-<src/lcd/lcdprint.cpp>
|
||||
-<src/lcd/touch/touch_buttons.cpp>
|
||||
-<src/sd/usb_flashdrive/lib-uhs2> -<src/sd/usb_flashdrive/lib-uhs3>
|
||||
|
|
Loading…
Reference in a new issue