0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-01-19 08:08:25 +00:00

🧑‍💻 IA RTS refactor

This commit is contained in:
Scott Lahteine 2023-05-02 18:26:06 -05:00
parent 18e63ad880
commit 5201869a55
4 changed files with 2195 additions and 2203 deletions

View file

@ -95,23 +95,23 @@ void FileNavigator::getFiles(uint16_t 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);
rts.sendData(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
rts.sendData(0, Printfilename + j); // clear screen.
rts.sendData(0, Choosefilename + j); // clear filename
}
for (int j = 0; j < 8; j++)
rtscheck.RTS_SndData(0, FilenameCount + j);
rts.sendData(0, FilenameCount + j);
for (int j = 1; j <= DISPLAY_FILES; j++) {
rtscheck.RTS_SndData(10, FilenameIcon + j);
rtscheck.RTS_SndData(10, FilenameIcon1 + j);
rts.sendData(10, FilenameIcon + j);
rts.sendData(10, FilenameIcon1 + j);
}
if (currentindex == 0 && folderdepth > 0) { // Add a link to go up a folder
files--;
rtscheck.RTS_SndData("Up Directory", SDFILE_ADDR);
rts.sendData("Up Directory", SDFILE_ADDR);
fcnt++;
}
else if (currentindex == DISPLAY_FILES && folderdepth > 0)
@ -123,18 +123,18 @@ void FileNavigator::getFiles(uint16_t index) {
if (filelen > 20) {
char *buf = (char *)filelist.filename();
buf[18] = '\0'; // cutoff at screen edge
rtscheck.RTS_SndData(buf, (SDFILE_ADDR + (fcnt * 20)));
rts.sendData(buf, (SDFILE_ADDR + (fcnt * 20)));
}
else
rtscheck.RTS_SndData(filelist.filename(), (SDFILE_ADDR + (fcnt * 20)));
rts.sendData(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
rts.sendData((uint8_t)4, FilenameIcon + (fcnt+1));
rts.sendData((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
rts.sendData((uint8_t)0, FilenameIcon + (fcnt+1));
rts.sendData((unsigned long)0xFFFF, (FilenameNature + ((1+fcnt) * 16))); // white
}
SERIAL_ECHOLNPGM("-", seek, " '", filelist.filename(), "' '", currentfoldername, "", filelist.shortFilename(), "'\n");
fcnt++;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -47,7 +47,7 @@
#define FileNum MaxFileNumber
#define FileNameLen TEXTBYTELEN
#define SizeofDatabuf 46
#define DATA_BUF_SIZE 46
//#define FONT_EEPROM 90
//#define AutoLeve_EEPROM 100
@ -177,14 +177,13 @@
#define StatusMessageString 0x2064
// TODO: Use LCD_SERIAL 1 or 3 (?) by configuration, not overriding here
#ifdef TARGET_STM32F4
#define DWIN_SERIAL Serial1
#else
#define DWIN_SERIAL LCD_SERIAL
#endif
namespace ExtUI {
/************struct**************/
typedef enum : uint8_t {
@ -217,41 +216,37 @@ namespace ExtUI {
int16_t standby_time_seconds;
};
void SetTouchScreenConfiguration();
class RTSSHOW {
class RTS {
public:
RTSSHOW();
int16_t RTS_RecData();
void RTS_SDCardInit();
void RTS_SDCardUpate(bool, bool);
int16_t RTS_CheckFilament(int16_t);
void RTS_SndData();
void RTS_SndData(const String&, const uint32_t, const uint8_t=VarAddr_W);
void RTS_SndData(const char[], const uint32_t, const uint8_t=VarAddr_W);
void RTS_SndData(char, const uint32_t, const uint8_t=VarAddr_W);
void RTS_SndData(int, const uint32_t, const uint8_t=VarAddr_W);
void RTS_SndData(unsigned long, const uint32_t, const uint8_t=VarAddr_W);
void RTS_SndData(const_float_t, const uint32_t, const uint8_t=VarAddr_W);
RTS();
static void onStartup();
static void onIdle();
static int16_t receiveData();
static void sendData();
static void sendData(const String&, const uint32_t, const uint8_t=VarAddr_W);
static void sendData(const char[], const uint32_t, const uint8_t=VarAddr_W);
static void sendData(char, const uint32_t, const uint8_t=VarAddr_W);
static void sendData(int, const uint32_t, const uint8_t=VarAddr_W);
static void sendData(unsigned long, const uint32_t, const uint8_t=VarAddr_W);
static void sendData(const_float_t, const uint32_t, const uint8_t=VarAddr_W);
void RTS_SndData(uint8_t * const str, const uint32_t addr, const uint8_t cmd=VarAddr_W) { RTS_SndData((char *)str, addr, cmd); }
void RTS_SndData(const unsigned int n, uint32_t addr, const uint8_t cmd=VarAddr_W) { RTS_SndData(int(n), addr, cmd); }
void RTS_SndData(const long n, const uint32_t addr, const uint8_t cmd=VarAddr_W) { RTS_SndData((unsigned long)n, addr, cmd); }
static void sendData(uint8_t * const str, const uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData((char *)str, addr, cmd); }
static void sendData(const unsigned int n, uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData(int(n), addr, cmd); }
static void sendData(const long n, const uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData((unsigned long)n, addr, cmd); }
void RTS_SDcard_Stop();
void RTS_HandleData();
void RTS_Init();
static void handleData();
DB recdat;
DB snddat;
uint8_t databuf[SizeofDatabuf];
static void writeVariable(const uint16_t adr, const void * const values, uint8_t valueslen, const bool isstr=false, const char fillChar=' ');
static void setTouchScreenConfiguration();
static DB recdat, snddat;
static uint8_t databuf[DATA_BUF_SIZE];
static rx_datagram_state_t rx_datagram_state;
static uint8_t rx_datagram_len;
static bool Initialized;
};
static RTSSHOW rtscheck;
extern RTS rts;
#define Addvalue 3
#define PrintChoice_Value (0 + Addvalue)
@ -289,10 +284,7 @@ namespace ExtUI {
0x105C, 0x105E, 0x105F, 0x1088, 0
};
void RTSUpdate();
void RTSInit();
} // ExtUI
void RTS_Update();
#ifndef MAIN_MENU_ITEM_1_GCODE
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)