mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-26 21:36:21 +00:00
🧑💻 Misc. ExtUI LCD cleanup (#25872)
This commit is contained in:
parent
9036cec562
commit
37d0f49a82
@ -140,7 +140,7 @@ typedef Servo hal_servo_t;
|
||||
#endif
|
||||
#define LCD_SERIAL lcdSerial
|
||||
#if HAS_DGUS_LCD
|
||||
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -101,7 +101,7 @@ extern DefaultSerial1 USBSerial;
|
||||
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
|
||||
#endif
|
||||
#if HAS_DGUS_LCD
|
||||
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.available()
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.available()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -114,7 +114,7 @@
|
||||
#error "LCD_SERIAL_PORT must be from 1 to 6, or -1 for Native USB."
|
||||
#endif
|
||||
#if HAS_DGUS_LCD
|
||||
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -140,7 +140,7 @@
|
||||
static_assert(false, "LCD_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
|
||||
#endif
|
||||
#if HAS_DGUS_LCD
|
||||
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -2536,7 +2536,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item
|
||||
Draw_Menu_Item(row, ICON_Back, F("Back"));
|
||||
else
|
||||
Draw_Menu(Motion, MOTION_STEPS);
|
||||
break;
|
||||
break;
|
||||
#if HAS_X_AXIS
|
||||
case STEPS_X:
|
||||
if (draw) {
|
||||
|
@ -60,21 +60,21 @@ using namespace ExtUI;
|
||||
namespace Anycubic {
|
||||
|
||||
FileNavigator filenavigator;
|
||||
FileList FileNavigator::filelist; // Instance of the Marlin file API
|
||||
FileList FileNavigator::filelist; // ExtUI file API
|
||||
uint16_t FileNavigator::lastpanelindex;
|
||||
uint16_t FileNavigator::currentindex; // override the panel request
|
||||
uint8_t FileNavigator::folderdepth;
|
||||
uint16_t FileNavigator::currentfolderindex[MAX_FOLDER_DEPTH]; // track folder pos for iteration
|
||||
char FileNavigator::currentfoldername[MAX_PATH_LEN + 1]; // Current folder path
|
||||
uint16_t FileNavigator::currentDirIndex[MAX_FOLDER_DEPTH]; // track folder pos for iteration
|
||||
char FileNavigator::currentDirPath[MAX_PATH_LEN + 1]; // Current folder path
|
||||
|
||||
FileNavigator::FileNavigator() { reset(); }
|
||||
|
||||
void FileNavigator::reset() {
|
||||
currentfoldername[0] = '\0';
|
||||
currentDirPath[0] = '\0';
|
||||
folderdepth = 0;
|
||||
currentindex = 0;
|
||||
lastpanelindex = 0;
|
||||
ZERO(currentfolderindex);
|
||||
ZERO(currentDirIndex);
|
||||
|
||||
// Start at root folder
|
||||
while (!filelist.isAtRootDir()) filelist.upDir();
|
||||
@ -85,9 +85,9 @@ void FileNavigator::refresh() { filelist.refresh(); }
|
||||
|
||||
void FileNavigator::changeDIR(const char *folder) {
|
||||
if (folderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth
|
||||
currentfolderindex[folderdepth] = currentindex;
|
||||
strcat(currentfoldername, folder);
|
||||
strcat(currentfoldername, "/");
|
||||
currentDirIndex[folderdepth] = currentindex;
|
||||
strcat(currentDirPath, folder);
|
||||
strcat(currentDirPath, "/");
|
||||
filelist.changeDir(folder);
|
||||
folderdepth++;
|
||||
currentindex = 0;
|
||||
@ -97,15 +97,15 @@ void FileNavigator::upDIR() {
|
||||
if (!filelist.isAtRootDir()) {
|
||||
filelist.upDir();
|
||||
folderdepth--;
|
||||
currentindex = currentfolderindex[folderdepth]; // restore last position in the folder
|
||||
currentindex = currentDirIndex[folderdepth]; // restore last position in the folder
|
||||
filelist.seek(currentindex); // restore file information
|
||||
}
|
||||
|
||||
// Remove the child folder from the stored path
|
||||
if (folderdepth == 0)
|
||||
currentfoldername[0] = '\0';
|
||||
currentDirPath[0] = '\0';
|
||||
else {
|
||||
char * const pos = strchr(currentfoldername, '/');
|
||||
char * const pos = strchr(currentDirPath, '/');
|
||||
*(pos + 1) = '\0';
|
||||
}
|
||||
}
|
||||
@ -151,7 +151,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
|
||||
// The new panel ignores entries that don't end in .GCO or .gcode so add and pad them.
|
||||
if (paneltype <= AC_panel_new) {
|
||||
TFTSer.println("<<.GCO");
|
||||
Chiron.SendtoTFTLN(F(".. .gcode"));
|
||||
chiron.tftSendLn(F(".. .gcode"));
|
||||
}
|
||||
else {
|
||||
TFTSer.println("<<");
|
||||
@ -186,7 +186,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
|
||||
}
|
||||
else { // Not DIR
|
||||
TFTSer.write('/');
|
||||
if (folderdepth > 0) TFTSer.print(currentfoldername);
|
||||
if (folderdepth > 0) TFTSer.print(currentDirPath);
|
||||
TFTSer.println(filelist.shortFilename());
|
||||
TFTSer.print(filelist.longFilename());
|
||||
|
||||
@ -233,9 +233,9 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
|
||||
|
||||
void FileNavigator::sendFile(panel_type_t paneltype) {
|
||||
TFTSer.write('/');
|
||||
if (folderdepth > 0) TFTSer.print(currentfoldername);
|
||||
if (folderdepth > 0) TFTSer.print(currentDirPath);
|
||||
TFTSer.println(filelist.shortFilename());
|
||||
if (folderdepth > 0) TFTSer.print(currentfoldername);
|
||||
if (folderdepth > 0) TFTSer.print(currentDirPath);
|
||||
TFTSer.println(filelist.longFilename());
|
||||
}
|
||||
|
||||
|
@ -52,8 +52,8 @@ namespace Anycubic {
|
||||
static uint16_t lastpanelindex;
|
||||
static uint16_t currentindex;
|
||||
static uint8_t folderdepth;
|
||||
static uint16_t currentfolderindex[MAX_FOLDER_DEPTH];
|
||||
static char currentfoldername[MAX_PATH_LEN + 1];
|
||||
static uint16_t currentDirIndex[MAX_FOLDER_DEPTH];
|
||||
static char currentDirPath[MAX_PATH_LEN + 1];
|
||||
};
|
||||
|
||||
extern FileNavigator filenavigator;
|
||||
|
@ -37,17 +37,17 @@ using namespace Anycubic;
|
||||
|
||||
namespace ExtUI {
|
||||
|
||||
void onStartup() { Chiron.Startup(); }
|
||||
void onStartup() { chiron.startup(); }
|
||||
|
||||
void onIdle() { Chiron.IdleLoop(); }
|
||||
void onIdle() { chiron.idleLoop(); }
|
||||
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
|
||||
Chiron.PrinterKilled(error, component);
|
||||
chiron.printerKilled(error, component);
|
||||
}
|
||||
|
||||
void onMediaInserted() { Chiron.MediaEvent(AC_media_inserted); }
|
||||
void onMediaError() { Chiron.MediaEvent(AC_media_error); }
|
||||
void onMediaRemoved() { Chiron.MediaEvent(AC_media_removed); }
|
||||
void onMediaInserted() { chiron.mediaEvent(AC_media_inserted); }
|
||||
void onMediaError() { chiron.mediaEvent(AC_media_error); }
|
||||
void onMediaRemoved() { chiron.mediaEvent(AC_media_removed); }
|
||||
|
||||
void onPlayTone(const uint16_t frequency, const uint16_t duration) {
|
||||
#if ENABLED(SPEAKER)
|
||||
@ -55,15 +55,15 @@ namespace ExtUI {
|
||||
#endif
|
||||
}
|
||||
|
||||
void onPrintTimerStarted() { Chiron.TimerEvent(AC_timer_started); }
|
||||
void onPrintTimerPaused() { Chiron.TimerEvent(AC_timer_paused); }
|
||||
void onPrintTimerStopped() { Chiron.TimerEvent(AC_timer_stopped); }
|
||||
void onPrintTimerStarted() { chiron.timerEvent(AC_timer_started); }
|
||||
void onPrintTimerPaused() { chiron.timerEvent(AC_timer_paused); }
|
||||
void onPrintTimerStopped() { chiron.timerEvent(AC_timer_stopped); }
|
||||
void onPrintDone() {}
|
||||
|
||||
void onFilamentRunout(const extruder_t) { Chiron.FilamentRunout(); }
|
||||
void onFilamentRunout(const extruder_t) { chiron.filamentRunout(); }
|
||||
|
||||
void onUserConfirmRequired(const char * const msg) { Chiron.ConfirmationRequest(msg); }
|
||||
void onStatusChanged(const char * const msg) { Chiron.StatusChange(msg); }
|
||||
void onUserConfirmRequired(const char * const msg) { chiron.confirmationRequest(msg); }
|
||||
void onStatusChanged(const char * const msg) { chiron.statusChange(msg); }
|
||||
|
||||
void onHomingStart() {}
|
||||
void onHomingDone() {}
|
||||
@ -127,7 +127,7 @@ namespace ExtUI {
|
||||
// Called when power-loss state is detected
|
||||
}
|
||||
// Called on resume from power-loss
|
||||
void onPowerLossResume() { Chiron.PowerLossRecovery(); }
|
||||
void onPowerLossResume() { chiron.powerLossRecovery(); }
|
||||
#endif
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
|
@ -42,9 +42,13 @@
|
||||
#include "../../../libs/numtostr.h"
|
||||
#include "../../../MarlinCore.h"
|
||||
|
||||
#define DEBUG_OUT ACDEBUGLEVEL
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
namespace Anycubic {
|
||||
|
||||
ChironTFT Chiron;
|
||||
ChironTFT chiron;
|
||||
|
||||
#if AUTO_DETECT_CHIRON_TFT
|
||||
panel_type_t ChironTFT::panel_type = AC_panel_unknown;
|
||||
#endif
|
||||
@ -60,7 +64,7 @@ uint8_t ChironTFT::command_len;
|
||||
float ChironTFT::live_Zoffset;
|
||||
file_menu_t ChironTFT::file_menu;
|
||||
|
||||
void ChironTFT::Startup() {
|
||||
void ChironTFT::startup() {
|
||||
selectedfile[0] = '\0';
|
||||
panel_command[0] = '\0';
|
||||
command_len = 0;
|
||||
@ -92,73 +96,73 @@ void ChironTFT::Startup() {
|
||||
break;
|
||||
default:
|
||||
SERIAL_ECHOLNF(AC_msg_auto_panel_detection);
|
||||
DetectPanelType();
|
||||
detectPanelType();
|
||||
break;
|
||||
}
|
||||
|
||||
// Signal Board has reset
|
||||
SendtoTFTLN(AC_msg_main_board_has_reset);
|
||||
tftSendLn(AC_msg_main_board_has_reset);
|
||||
|
||||
// Enable leveling and Disable end stops during print
|
||||
// as Z home places nozzle above the bed so we need to allow it past the end stops
|
||||
injectCommands(AC_cmnd_enable_leveling);
|
||||
|
||||
// Startup tunes are defined in Tunes.h
|
||||
// startup tunes are defined in Tunes.h
|
||||
PlayTune(TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn));
|
||||
|
||||
#if ACDEBUGLEVEL
|
||||
SERIAL_ECHOLNPGM("AC Debug Level ", ACDEBUGLEVEL);
|
||||
DEBUG_ECHOLNPGM("AC Debug Level ", ACDEBUGLEVEL);
|
||||
#endif
|
||||
SendtoTFTLN(AC_msg_ready);
|
||||
tftSendLn(AC_msg_ready);
|
||||
}
|
||||
|
||||
void ChironTFT::DetectPanelType() {
|
||||
void ChironTFT::detectPanelType() {
|
||||
#if AUTO_DETECT_CHIRON_TFT
|
||||
// Send a query to the TFT
|
||||
SendtoTFTLN(AC_Test_for_OldPanel); // The panel will respond with 'SXY 480 320'
|
||||
SendtoTFTLN(AC_Test_for_NewPanel); // the panel will respond with '[0]=0 ' to '[19]=0 '
|
||||
tftSendLn(AC_Test_for_OldPanel); // The panel will respond with 'SXY 480 320'
|
||||
tftSendLn(AC_Test_for_NewPanel); // the panel will respond with '[0]=0 ' to '[19]=0 '
|
||||
#endif
|
||||
}
|
||||
|
||||
void ChironTFT::IdleLoop() {
|
||||
if (ReadTFTCommand()) {
|
||||
ProcessPanelRequest();
|
||||
void ChironTFT::idleLoop() {
|
||||
if (readTFTCommand()) {
|
||||
processPanelRequest();
|
||||
command_len = 0;
|
||||
}
|
||||
CheckHeaters();
|
||||
checkHeaters();
|
||||
}
|
||||
|
||||
void ChironTFT::PrinterKilled(FSTR_P const error, FSTR_P const component) {
|
||||
SendtoTFTLN(AC_msg_kill_lcd);
|
||||
void ChironTFT::printerKilled(FSTR_P const error, FSTR_P const component) {
|
||||
tftSendLn(AC_msg_kill_lcd);
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
SERIAL_ECHOLNPGM("PrinterKilled()\nerror: ", error , "\ncomponent: ", component);
|
||||
DEBUG_ECHOLNPGM("printerKilled()\nerror: ", error , "\ncomponent: ", component);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ChironTFT::MediaEvent(media_event_t event) {
|
||||
void ChironTFT::mediaEvent(media_event_t event) {
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
SERIAL_ECHOLNPGM("ProcessMediaStatus() ", event);
|
||||
DEBUG_ECHOLNPGM("ProcessMediaStatus() ", event);
|
||||
#endif
|
||||
switch (event) {
|
||||
case AC_media_inserted:
|
||||
SendtoTFTLN(AC_msg_sd_card_inserted);
|
||||
tftSendLn(AC_msg_sd_card_inserted);
|
||||
break;
|
||||
|
||||
case AC_media_removed:
|
||||
SendtoTFTLN(AC_msg_sd_card_removed);
|
||||
tftSendLn(AC_msg_sd_card_removed);
|
||||
break;
|
||||
|
||||
case AC_media_error:
|
||||
last_error = AC_error_noSD;
|
||||
SendtoTFTLN(AC_msg_no_sd_card);
|
||||
tftSendLn(AC_msg_no_sd_card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ChironTFT::TimerEvent(timer_event_t event) {
|
||||
void ChironTFT::timerEvent(timer_event_t event) {
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
SERIAL_ECHOLNPGM("TimerEvent() ", event);
|
||||
SERIAL_ECHOLNPGM("Printer State: ", printer_state);
|
||||
DEBUG_ECHOLNPGM("timerEvent() ", event);
|
||||
DEBUG_ECHOLNPGM("Printer State: ", printer_state);
|
||||
#endif
|
||||
|
||||
switch (event) {
|
||||
@ -166,44 +170,44 @@ void ChironTFT::TimerEvent(timer_event_t event) {
|
||||
live_Zoffset = 0.0; // reset print offset
|
||||
setSoftEndstopState(false); // disable endstops to print
|
||||
printer_state = AC_printer_printing;
|
||||
SendtoTFTLN(AC_msg_print_from_sd_card);
|
||||
tftSendLn(AC_msg_print_from_sd_card);
|
||||
} break;
|
||||
|
||||
case AC_timer_paused: {
|
||||
printer_state = AC_printer_paused;
|
||||
pause_state = AC_paused_idle;
|
||||
SendtoTFTLN(AC_msg_paused);
|
||||
tftSendLn(AC_msg_paused);
|
||||
} break;
|
||||
|
||||
case AC_timer_stopped: {
|
||||
if (printer_state != AC_printer_idle) {
|
||||
printer_state = AC_printer_stopping;
|
||||
SendtoTFTLN(AC_msg_print_complete);
|
||||
tftSendLn(AC_msg_print_complete);
|
||||
}
|
||||
setSoftEndstopState(true); // enable endstops
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void ChironTFT::FilamentRunout() {
|
||||
void ChironTFT::filamentRunout() {
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
SERIAL_ECHOLNPGM("FilamentRunout() printer_state ", printer_state);
|
||||
DEBUG_ECHOLNPGM("filamentRunout() printer_state ", printer_state);
|
||||
#endif
|
||||
// 1 Signal filament out
|
||||
last_error = AC_error_filament_runout;
|
||||
SendtoTFTLN(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block);
|
||||
tftSendLn(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block);
|
||||
PlayTune(FilamentOut);
|
||||
}
|
||||
|
||||
void ChironTFT::ConfirmationRequest(const char * const msg) {
|
||||
void ChironTFT::confirmationRequest(const char * const msg) {
|
||||
// M108 continue
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
SERIAL_ECHOLNPGM("ConfirmationRequest() ", msg, " printer_state:", printer_state);
|
||||
DEBUG_ECHOLNPGM("confirmationRequest() ", msg, " printer_state:", printer_state);
|
||||
#endif
|
||||
switch (printer_state) {
|
||||
case AC_printer_pausing: {
|
||||
if (strcmp_P(msg, MARLIN_msg_print_paused) == 0 || strcmp_P(msg, MARLIN_msg_nozzle_parked) == 0) {
|
||||
SendtoTFTLN(AC_msg_paused); // enable continue button
|
||||
tftSendLn(AC_msg_paused); // enable continue button
|
||||
printer_state = AC_printer_paused;
|
||||
}
|
||||
} break;
|
||||
@ -214,18 +218,18 @@ void ChironTFT::ConfirmationRequest(const char * const msg) {
|
||||
// Heater timeout, send acknowledgement
|
||||
if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) {
|
||||
pause_state = AC_paused_heater_timed_out;
|
||||
SendtoTFTLN(AC_msg_paused); // enable continue button
|
||||
tftSendLn(AC_msg_paused); // enable continue button
|
||||
PlayTune(HeaterTimeout);
|
||||
}
|
||||
// Reheat finished, send acknowledgement
|
||||
else if (strcmp_P(msg, MARLIN_msg_reheat_done) == 0) {
|
||||
pause_state = AC_paused_idle;
|
||||
SendtoTFTLN(AC_msg_paused); // enable continue button
|
||||
tftSendLn(AC_msg_paused); // enable continue button
|
||||
}
|
||||
// Filament Purging, send acknowledgement enter run mode
|
||||
else if (strcmp_P(msg, MARLIN_msg_filament_purging) == 0) {
|
||||
pause_state = AC_paused_purging_filament;
|
||||
SendtoTFTLN(AC_msg_paused); // enable continue button
|
||||
tftSendLn(AC_msg_paused); // enable continue button
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
@ -233,10 +237,10 @@ void ChironTFT::ConfirmationRequest(const char * const msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void ChironTFT::StatusChange(const char * const msg) {
|
||||
void ChironTFT::statusChange(const char * const msg) {
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
SERIAL_ECHOLNPGM("StatusChange() ", msg);
|
||||
SERIAL_ECHOLNPGM("printer_state:", printer_state);
|
||||
DEBUG_ECHOLNPGM("statusChange() ", msg);
|
||||
DEBUG_ECHOLNPGM("printer_state:", printer_state);
|
||||
#endif
|
||||
bool msg_matched = false;
|
||||
// The only way to get printer status is to parse messages
|
||||
@ -247,7 +251,7 @@ void ChironTFT::StatusChange(const char * const msg) {
|
||||
// Ignore the custom machine name
|
||||
if (strcmp_P(msg + strlen(MACHINE_NAME), MARLIN_msg_ready) == 0) {
|
||||
injectCommands(F("M500\nG27"));
|
||||
SendtoTFTLN(AC_msg_probing_complete);
|
||||
tftSendLn(AC_msg_probing_complete);
|
||||
printer_state = AC_printer_idle;
|
||||
msg_matched = true;
|
||||
}
|
||||
@ -255,7 +259,7 @@ void ChironTFT::StatusChange(const char * const msg) {
|
||||
if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) {
|
||||
PlayTune(BeepBeepBeeep);
|
||||
injectCommands(F("G1 Z50 F500"));
|
||||
SendtoTFTLN(AC_msg_probing_complete);
|
||||
tftSendLn(AC_msg_probing_complete);
|
||||
printer_state = AC_printer_idle;
|
||||
msg_matched = true;
|
||||
}
|
||||
@ -263,14 +267,14 @@ void ChironTFT::StatusChange(const char * const msg) {
|
||||
|
||||
case AC_printer_printing: {
|
||||
if (strcmp_P(msg, MARLIN_msg_reheating) == 0) {
|
||||
SendtoTFTLN(AC_msg_paused); // enable continue button
|
||||
tftSendLn(AC_msg_paused); // enable continue button
|
||||
msg_matched = true;
|
||||
}
|
||||
} break;
|
||||
|
||||
case AC_printer_pausing: {
|
||||
if (strcmp_P(msg, MARLIN_msg_print_paused) == 0) {
|
||||
SendtoTFTLN(AC_msg_paused);
|
||||
tftSendLn(AC_msg_paused);
|
||||
printer_state = AC_printer_paused;
|
||||
pause_state = AC_paused_idle;
|
||||
msg_matched = true;
|
||||
@ -279,7 +283,7 @@ void ChironTFT::StatusChange(const char * const msg) {
|
||||
|
||||
case AC_printer_stopping: {
|
||||
if (strcmp_P(msg, MARLIN_msg_print_aborted) == 0) {
|
||||
SendtoTFTLN(AC_msg_stop);
|
||||
tftSendLn(AC_msg_stop);
|
||||
printer_state = AC_printer_idle;
|
||||
msg_matched = true;
|
||||
}
|
||||
@ -291,11 +295,11 @@ void ChironTFT::StatusChange(const char * const msg) {
|
||||
// If not matched earlier see if this was a heater message
|
||||
if (!msg_matched) {
|
||||
if (strcmp_P(msg, MARLIN_msg_extruder_heating) == 0) {
|
||||
SendtoTFTLN(AC_msg_nozzle_heating);
|
||||
tftSendLn(AC_msg_nozzle_heating);
|
||||
hotend_state = AC_heater_temp_set;
|
||||
}
|
||||
else if (strcmp_P(msg, MARLIN_msg_bed_heating) == 0) {
|
||||
SendtoTFTLN(AC_msg_bed_heating);
|
||||
tftSendLn(AC_msg_bed_heating);
|
||||
hotbed_state = AC_heater_temp_set;
|
||||
}
|
||||
else if (strcmp_P(msg, MARLIN_msg_EEPROM_version) == 0) {
|
||||
@ -304,33 +308,33 @@ void ChironTFT::StatusChange(const char * const msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void ChironTFT::PowerLossRecovery() {
|
||||
void ChironTFT::powerLossRecovery() {
|
||||
printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover.
|
||||
last_error = AC_error_powerloss;
|
||||
PlayTune(SOS);
|
||||
SERIAL_ECHOLNF(AC_msg_powerloss_recovery);
|
||||
}
|
||||
|
||||
void ChironTFT::PrintComplete() {
|
||||
SendtoTFT(AC_msg_print_complete);
|
||||
void ChironTFT::printComplete() {
|
||||
tftSend(AC_msg_print_complete);
|
||||
printer_state = AC_printer_idle;
|
||||
setSoftEndstopState(true); // enable endstops
|
||||
}
|
||||
|
||||
void ChironTFT::SendtoTFT(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel
|
||||
void ChironTFT::tftSend(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel
|
||||
#if ACDEBUG(AC_SOME)
|
||||
SERIAL_ECHOF(fstr);
|
||||
DEBUG_ECHOF(fstr);
|
||||
#endif
|
||||
PGM_P str = FTOP(fstr);
|
||||
while (const char c = pgm_read_byte(str++)) TFTSer.write(c);
|
||||
}
|
||||
|
||||
void ChironTFT::SendtoTFTLN(FSTR_P const fstr/*=nullptr*/) {
|
||||
void ChironTFT::tftSendLn(FSTR_P const fstr/*=nullptr*/) {
|
||||
if (fstr) {
|
||||
#if ACDEBUG(AC_SOME)
|
||||
SERIAL_ECHOPGM("> ");
|
||||
DEBUG_ECHOPGM("> ");
|
||||
#endif
|
||||
SendtoTFT(fstr);
|
||||
tftSend(fstr);
|
||||
#if ACDEBUG(AC_SOME)
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
@ -338,7 +342,7 @@ void ChironTFT::SendtoTFTLN(FSTR_P const fstr/*=nullptr*/) {
|
||||
TFTSer.println();
|
||||
}
|
||||
|
||||
bool ChironTFT::ReadTFTCommand() {
|
||||
bool ChironTFT::readTFTCommand() {
|
||||
bool command_ready = false;
|
||||
while (TFTSer.available() > 0 && command_len < MAX_CMND_LEN) {
|
||||
panel_command[command_len] = TFTSer.read();
|
||||
@ -352,29 +356,29 @@ bool ChironTFT::ReadTFTCommand() {
|
||||
if (command_ready || command_len == MAX_CMND_LEN) {
|
||||
panel_command[command_len] = '\0';
|
||||
#if ACDEBUG(AC_ALL)
|
||||
SERIAL_ECHOLNPGM("len(",command_len,") < ", panel_command);
|
||||
DEBUG_ECHOLNPGM("len(",command_len,") < ", panel_command);
|
||||
#endif
|
||||
command_ready = true;
|
||||
}
|
||||
return command_ready;
|
||||
}
|
||||
|
||||
int8_t ChironTFT::FindToken(char c) {
|
||||
int8_t ChironTFT::findToken(char c) {
|
||||
for (int8_t pos = 0; pos < command_len; pos++) {
|
||||
if (panel_command[pos] == c) {
|
||||
#if ACDEBUG(AC_INFO)
|
||||
SERIAL_ECHOLNPGM("Tpos:", pos, " ", c);
|
||||
DEBUG_ECHOLNPGM("Tpos:", pos, " ", c);
|
||||
#endif
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
#if ACDEBUG(AC_INFO)
|
||||
SERIAL_ECHOLNPGM("Not found: ", c);
|
||||
DEBUG_ECHOLNPGM("Not found: ", c);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ChironTFT::CheckHeaters() {
|
||||
void ChironTFT::checkHeaters() {
|
||||
uint8_t faultDuration = 0;
|
||||
|
||||
// if the hotend temp is abnormal, confirm state before signalling panel
|
||||
@ -382,7 +386,7 @@ void ChironTFT::CheckHeaters() {
|
||||
while (!WITHIN(temp, HEATER_0_MINTEMP, HEATER_0_MAXTEMP)) {
|
||||
faultDuration++;
|
||||
if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) {
|
||||
SendtoTFTLN(AC_msg_nozzle_temp_abnormal);
|
||||
tftSendLn(AC_msg_nozzle_temp_abnormal);
|
||||
last_error = AC_error_abnormal_temp_t0;
|
||||
SERIAL_ECHOLNPGM("Extruder temp abnormal! : ", temp);
|
||||
break;
|
||||
@ -397,7 +401,7 @@ void ChironTFT::CheckHeaters() {
|
||||
while (!WITHIN(temp, BED_MINTEMP, BED_MAXTEMP)) {
|
||||
faultDuration++;
|
||||
if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) {
|
||||
SendtoTFTLN(AC_msg_nozzle_temp_abnormal);
|
||||
tftSendLn(AC_msg_nozzle_temp_abnormal);
|
||||
last_error = AC_error_abnormal_temp_bed;
|
||||
SERIAL_ECHOLNPGM("Bed temp abnormal! : ", temp);
|
||||
break;
|
||||
@ -409,7 +413,7 @@ void ChironTFT::CheckHeaters() {
|
||||
// Update panel with hotend heater status
|
||||
if (hotend_state != AC_heater_temp_reached) {
|
||||
if (WITHIN(getActualTemp_celsius(E0) - getTargetTemp_celsius(E0), -(TEMP_WINDOW), TEMP_WINDOW)) {
|
||||
SendtoTFTLN(AC_msg_nozzle_heating_done);
|
||||
tftSendLn(AC_msg_nozzle_heating_done);
|
||||
hotend_state = AC_heater_temp_reached;
|
||||
}
|
||||
}
|
||||
@ -417,23 +421,23 @@ void ChironTFT::CheckHeaters() {
|
||||
// Update panel with bed heater status
|
||||
if (hotbed_state != AC_heater_temp_reached) {
|
||||
if (WITHIN(getActualTemp_celsius(BED) - getTargetTemp_celsius(BED), -(TEMP_BED_WINDOW), TEMP_BED_WINDOW)) {
|
||||
SendtoTFTLN(AC_msg_bed_heating_done);
|
||||
tftSendLn(AC_msg_bed_heating_done);
|
||||
hotbed_state = AC_heater_temp_reached;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChironTFT::SendFileList(int8_t startindex) {
|
||||
void ChironTFT::sendFileList(int8_t startindex) {
|
||||
// Respond to panel request for 4 files starting at index
|
||||
#if ACDEBUG(AC_INFO)
|
||||
SERIAL_ECHOLNPGM("## SendFileList ## ", startindex);
|
||||
DEBUG_ECHOLNPGM("## sendFileList ## ", startindex);
|
||||
#endif
|
||||
SendtoTFTLN(F("FN "));
|
||||
tftSendLn(F("FN "));
|
||||
filenavigator.getFiles(startindex, panel_type, 4);
|
||||
SendtoTFTLN(F("END"));
|
||||
tftSendLn(F("END"));
|
||||
}
|
||||
|
||||
void ChironTFT::SelectFile() {
|
||||
void ChironTFT::selectFile() {
|
||||
if (panel_type <= AC_panel_new) {
|
||||
strncpy(selectedfile, panel_command + 4, command_len - 3);
|
||||
selectedfile[command_len - 4] = '\0';
|
||||
@ -443,50 +447,50 @@ void ChironTFT::SelectFile() {
|
||||
selectedfile[command_len - 5] = '\0';
|
||||
}
|
||||
#if ACDEBUG(AC_FILE)
|
||||
SERIAL_ECHOLNPGM(" Selected File: ",selectedfile);
|
||||
DEBUG_ECHOLNPGM(" Selected File: ",selectedfile);
|
||||
#endif
|
||||
switch (selectedfile[0]) {
|
||||
case '/': // Valid file selected
|
||||
SendtoTFTLN(AC_msg_sd_file_open_success);
|
||||
tftSendLn(AC_msg_sd_file_open_success);
|
||||
break;
|
||||
|
||||
case '<': // .. (go up folder level)
|
||||
filenavigator.upDIR();
|
||||
SendtoTFTLN(AC_msg_sd_file_open_failed);
|
||||
SendFileList( 0 );
|
||||
tftSendLn(AC_msg_sd_file_open_failed);
|
||||
sendFileList( 0 );
|
||||
break;
|
||||
default: // enter sub folder
|
||||
// for new panel remove the '.GCO' tag that was added to the end of the path
|
||||
if (panel_type <= AC_panel_new)
|
||||
selectedfile[strlen(selectedfile) - 4] = '\0';
|
||||
filenavigator.changeDIR(selectedfile);
|
||||
SendtoTFTLN(AC_msg_sd_file_open_failed);
|
||||
SendFileList( 0 );
|
||||
tftSendLn(AC_msg_sd_file_open_failed);
|
||||
sendFileList( 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ChironTFT::ProcessPanelRequest() {
|
||||
void ChironTFT::processPanelRequest() {
|
||||
// Break these up into logical blocks // as its easier to navigate than one huge switch case!
|
||||
int8_t tpos = FindToken('A');
|
||||
int8_t tpos = findToken('A');
|
||||
// Panel request are 'A0' - 'A36'
|
||||
if (tpos >= 0) {
|
||||
const int8_t req = atoi(&panel_command[tpos + 1]);
|
||||
|
||||
// Information requests A0 - A8 and A33
|
||||
if (req <= 8 || req == 33) PanelInfo(req);
|
||||
if (req <= 8 || req == 33) panelInfo(req);
|
||||
|
||||
// Simple Actions A9 - A28
|
||||
else if (req <= 28) PanelAction(req);
|
||||
else if (req <= 28) panelAction(req);
|
||||
|
||||
// Process Initiation
|
||||
else if (req <= 36) PanelProcess(req);
|
||||
else if (req <= 36) panelProcess(req);
|
||||
}
|
||||
else {
|
||||
#if AUTO_DETECT_CHIRON_TFT
|
||||
// This may be a response to a panel type detection query
|
||||
if (panel_type == AC_panel_unknown) {
|
||||
tpos = FindToken('S'); // old panel will respond to 'SIZE' with 'SXY 480 320'
|
||||
tpos = findToken('S'); // old panel will respond to 'SIZE' with 'SXY 480 320'
|
||||
if (tpos >= 0) {
|
||||
if (panel_command[tpos + 1] == 'X' && panel_command[tpos + 2] =='Y') {
|
||||
panel_type = AC_panel_standard;
|
||||
@ -496,7 +500,7 @@ void ChironTFT::ProcessPanelRequest() {
|
||||
else {
|
||||
// new panel will respond to 'J200' with '[0]=0'
|
||||
// it seems only after a power cycle so detection assumes a new panel
|
||||
tpos = FindToken('[');
|
||||
tpos = findToken('[');
|
||||
if (tpos >= 0) {
|
||||
if (panel_command[tpos + 1] == '0' && panel_command[tpos + 2] ==']') {
|
||||
panel_type = AC_panel_new;
|
||||
@ -508,94 +512,94 @@ void ChironTFT::ProcessPanelRequest() {
|
||||
}
|
||||
#endif
|
||||
|
||||
SendtoTFTLN(); // Ignore unknown requests
|
||||
tftSendLn(); // Ignore unknown requests
|
||||
}
|
||||
}
|
||||
|
||||
void ChironTFT::PanelInfo(uint8_t req) {
|
||||
void ChironTFT::panelInfo(uint8_t req) {
|
||||
// information requests A0-A8 and A33
|
||||
switch (req) {
|
||||
case 0: // A0 Get HOTEND Temp
|
||||
SendtoTFT(F("A0V "));
|
||||
tftSend(F("A0V "));
|
||||
TFTSer.println(getActualTemp_celsius(E0));
|
||||
break;
|
||||
|
||||
case 1: // A1 Get HOTEND Target Temp
|
||||
SendtoTFT(F("A1V "));
|
||||
tftSend(F("A1V "));
|
||||
TFTSer.println(getTargetTemp_celsius(E0));
|
||||
break;
|
||||
|
||||
case 2: // A2 Get BED Temp
|
||||
SendtoTFT(F("A2V "));
|
||||
tftSend(F("A2V "));
|
||||
TFTSer.println(getActualTemp_celsius(BED));
|
||||
break;
|
||||
|
||||
case 3: // A3 Get BED Target Temp
|
||||
SendtoTFT(F("A3V "));
|
||||
tftSend(F("A3V "));
|
||||
TFTSer.println(getTargetTemp_celsius(BED));
|
||||
break;
|
||||
|
||||
case 4: // A4 Get FAN Speed
|
||||
SendtoTFT(F("A4V "));
|
||||
tftSend(F("A4V "));
|
||||
TFTSer.println(getActualFan_percent(FAN0));
|
||||
break;
|
||||
|
||||
case 5: // A5 Get Current Coordinates
|
||||
SendtoTFT(F("A5V X: "));
|
||||
tftSend(F("A5V X: "));
|
||||
TFTSer.print(getAxisPosition_mm(X));
|
||||
SendtoTFT(F(" Y: "));
|
||||
tftSend(F(" Y: "));
|
||||
TFTSer.print(getAxisPosition_mm(Y));
|
||||
SendtoTFT(F(" Z: "));
|
||||
tftSend(F(" Z: "));
|
||||
TFTSer.println(getAxisPosition_mm(Z));
|
||||
break;
|
||||
|
||||
case 6: // A6 Get printing progress
|
||||
if (isPrintingFromMedia()) {
|
||||
SendtoTFT(F("A6V "));
|
||||
tftSend(F("A6V "));
|
||||
TFTSer.println(ui8tostr2(getProgress_percent()));
|
||||
}
|
||||
else
|
||||
SendtoTFTLN(F("A6V ---"));
|
||||
tftSendLn(F("A6V ---"));
|
||||
break;
|
||||
|
||||
case 7: { // A7 Get Printing Time
|
||||
uint32_t time = getProgress_seconds_elapsed() / 60;
|
||||
SendtoTFT(F("A7V "));
|
||||
tftSend(F("A7V "));
|
||||
TFTSer.print(ui8tostr2(time / 60));
|
||||
SendtoTFT(F(" H "));
|
||||
tftSend(F(" H "));
|
||||
TFTSer.print(ui8tostr2(time % 60));
|
||||
SendtoTFT(F(" M"));
|
||||
tftSend(F(" M"));
|
||||
#if ACDEBUG(AC_ALL)
|
||||
SERIAL_ECHOLNPGM("Print time ", ui8tostr2(time / 60), ":", ui8tostr2(time % 60));
|
||||
DEBUG_ECHOLNPGM("Print time ", ui8tostr2(time / 60), ":", ui8tostr2(time % 60));
|
||||
#endif
|
||||
} break;
|
||||
|
||||
case 8: // A8 Get SD Card list A8 S0
|
||||
if (!isMediaInserted()) safe_delay(500);
|
||||
if (!isMediaInserted()) // Make sure the card is removed
|
||||
SendtoTFTLN(AC_msg_no_sd_card);
|
||||
tftSendLn(AC_msg_no_sd_card);
|
||||
else if (panel_command[3] == 'S')
|
||||
SendFileList( atoi( &panel_command[4] ) );
|
||||
sendFileList( atoi( &panel_command[4] ) );
|
||||
break;
|
||||
|
||||
case 33: // A33 Get firmware info
|
||||
SendtoTFT(F("J33 "));
|
||||
tftSend(F("J33 "));
|
||||
// If there is an error recorded, show that instead of the FW version
|
||||
if (!GetLastError()) SendtoTFTLN(F(SHORT_BUILD_VERSION));
|
||||
if (!getLastError()) tftSendLn(F(SHORT_BUILD_VERSION));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ChironTFT::PanelAction(uint8_t req) {
|
||||
void ChironTFT::panelAction(uint8_t req) {
|
||||
switch (req) {
|
||||
case 9: // A9 Pause SD print
|
||||
if (isPrintingFromMedia()) {
|
||||
SendtoTFTLN(AC_msg_pause);
|
||||
tftSendLn(AC_msg_pause);
|
||||
pausePrint();
|
||||
printer_state = AC_printer_pausing;
|
||||
}
|
||||
else
|
||||
SendtoTFTLN(AC_msg_stop);
|
||||
tftSendLn(AC_msg_stop);
|
||||
break;
|
||||
|
||||
case 10: // A10 Resume SD Print
|
||||
@ -613,7 +617,7 @@ void ChironTFT::PanelAction(uint8_t req) {
|
||||
else {
|
||||
if (printer_state == AC_printer_resuming_from_power_outage)
|
||||
injectCommands(F("M1000 C")); // Cancel recovery
|
||||
SendtoTFTLN(AC_msg_stop);
|
||||
tftSendLn(AC_msg_stop);
|
||||
printer_state = AC_printer_idle;
|
||||
}
|
||||
break;
|
||||
@ -623,7 +627,7 @@ void ChironTFT::PanelAction(uint8_t req) {
|
||||
break;
|
||||
|
||||
case 13: // A13 Select file
|
||||
SelectFile();
|
||||
selectFile();
|
||||
break;
|
||||
|
||||
case 14: // A14 Start Printing
|
||||
@ -632,11 +636,9 @@ void ChironTFT::PanelAction(uint8_t req) {
|
||||
injectCommands(F("M1000 C")); // Cancel recovery
|
||||
printer_state = AC_printer_idle;
|
||||
}
|
||||
#if ACDebugLevel >= 1
|
||||
SERIAL_ECHOLNPGM("Print: ", selectedfile);
|
||||
#endif
|
||||
DEBUG_ECHOLNPGM("Print: ", selectedfile);
|
||||
printFile(selectedfile);
|
||||
SendtoTFTLN(AC_msg_print_from_sd_card);
|
||||
tftSendLn(AC_msg_print_from_sd_card);
|
||||
break;
|
||||
|
||||
case 15: // A15 Resuming from outage
|
||||
@ -671,7 +673,7 @@ void ChironTFT::PanelAction(uint8_t req) {
|
||||
case 19: // A19 Motors off
|
||||
if (!isPrinting()) {
|
||||
stepper.disable_all_steppers();
|
||||
SendtoTFTLN(AC_msg_ready);
|
||||
tftSendLn(AC_msg_ready);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -679,7 +681,7 @@ void ChironTFT::PanelAction(uint8_t req) {
|
||||
if (panel_command[4] == 'S')
|
||||
setFeedrate_percent(atoi(&panel_command[5]));
|
||||
else {
|
||||
SendtoTFT(F("A20V "));
|
||||
tftSend(F("A20V "));
|
||||
TFTSer.println(getFeedrate_percent());
|
||||
}
|
||||
break;
|
||||
@ -707,7 +709,7 @@ void ChironTFT::PanelAction(uint8_t req) {
|
||||
char MoveCmnd[30];
|
||||
sprintf_P(MoveCmnd, PSTR("G91\nG0%s\nG90"), panel_command + 3);
|
||||
#if ACDEBUG(AC_ACTION)
|
||||
SERIAL_ECHOLNPGM("Move: ", MoveCmnd);
|
||||
DEBUG_ECHOLNPGM("Move: ", MoveCmnd);
|
||||
#endif
|
||||
setSoftEndstopState(true); // enable endstops
|
||||
injectCommands(MoveCmnd);
|
||||
@ -720,7 +722,7 @@ void ChironTFT::PanelAction(uint8_t req) {
|
||||
// Temps defined in configuration.h
|
||||
setTargetTemp_celsius(PREHEAT_1_TEMP_BED, BED);
|
||||
setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, E0);
|
||||
SendtoTFTLN();
|
||||
tftSendLn();
|
||||
hotbed_state = AC_heater_temp_set;
|
||||
hotend_state = AC_heater_temp_set;
|
||||
}
|
||||
@ -731,7 +733,7 @@ void ChironTFT::PanelAction(uint8_t req) {
|
||||
if (!isPrinting()) {
|
||||
setTargetTemp_celsius(PREHEAT_2_TEMP_BED, BED);
|
||||
setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, E0);
|
||||
SendtoTFTLN();
|
||||
tftSendLn();
|
||||
hotbed_state = AC_heater_temp_set;
|
||||
hotend_state = AC_heater_temp_set;
|
||||
}
|
||||
@ -742,7 +744,7 @@ void ChironTFT::PanelAction(uint8_t req) {
|
||||
if (!isPrinting()) {
|
||||
setTargetTemp_celsius(0, E0);
|
||||
setTargetTemp_celsius(0, BED);
|
||||
SendtoTFTLN(AC_msg_ready);
|
||||
tftSendLn(AC_msg_ready);
|
||||
hotbed_state = AC_heater_off;
|
||||
hotend_state = AC_heater_off;
|
||||
}
|
||||
@ -761,21 +763,21 @@ void ChironTFT::PanelAction(uint8_t req) {
|
||||
case 28: // A28 Filament set A28 O/C
|
||||
// Ignore request if printing
|
||||
if (isPrinting()) break;
|
||||
SendtoTFTLN();
|
||||
tftSendLn();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ChironTFT::PanelProcess(uint8_t req) {
|
||||
void ChironTFT::panelProcess(uint8_t req) {
|
||||
switch (req) {
|
||||
case 29: { // A29 Read Mesh Point A29 X1 Y1
|
||||
xy_uint8_t pos;
|
||||
float pos_z;
|
||||
pos.x = atoi(&panel_command[FindToken('X')+1]);
|
||||
pos.y = atoi(&panel_command[FindToken('Y')+1]);
|
||||
pos.x = atoi(&panel_command[findToken('X')+1]);
|
||||
pos.y = atoi(&panel_command[findToken('Y')+1]);
|
||||
pos_z = getMeshPoint(pos);
|
||||
|
||||
SendtoTFT(F("A29V "));
|
||||
tftSend(F("A29V "));
|
||||
TFTSer.println(pos_z * 100);
|
||||
if (!isPrinting()) {
|
||||
setSoftEndstopState(true); // disable endstops
|
||||
@ -786,7 +788,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
||||
|
||||
if (isPositionKnown()) {
|
||||
#if ACDEBUG(AC_INFO)
|
||||
SERIAL_ECHOLNPGM("Moving to mesh point at x: ", pos.x, " y: ", pos.y, " z: ", pos_z);
|
||||
DEBUG_ECHOLNPGM("Moving to mesh point at x: ", pos.x, " y: ", pos.y, " z: ", pos_z);
|
||||
#endif
|
||||
// Go up before moving
|
||||
setAxisPosition_mm(3.0,Z);
|
||||
@ -795,7 +797,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
||||
setAxisPosition_mm(20 + (93 * pos.y), Y);
|
||||
setAxisPosition_mm(0.0, Z);
|
||||
#if ACDEBUG(AC_INFO)
|
||||
SERIAL_ECHOLNPGM("Current Z: ", getAxisPosition_mm(Z));
|
||||
DEBUG_ECHOLNPGM("Current Z: ", getAxisPosition_mm(Z));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -805,24 +807,24 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
||||
} break;
|
||||
|
||||
case 30: // A30 Auto leveling
|
||||
if (FindToken('S') >= 0) { // Start probing New panel adds spaces..
|
||||
if (findToken('S') >= 0) { // Start probing New panel adds spaces..
|
||||
// Ignore request if printing
|
||||
if (isPrinting())
|
||||
SendtoTFTLN(AC_msg_probing_not_allowed); // forbid auto leveling
|
||||
tftSendLn(AC_msg_probing_not_allowed); // forbid auto leveling
|
||||
else {
|
||||
SendtoTFTLN(AC_msg_start_probing);
|
||||
tftSendLn(AC_msg_start_probing);
|
||||
injectCommands(F("G28\nG29"));
|
||||
printer_state = AC_printer_probing;
|
||||
}
|
||||
}
|
||||
else
|
||||
SendtoTFTLN(AC_msg_start_probing); // Just enter levelling menu
|
||||
tftSendLn(AC_msg_start_probing); // Just enter levelling menu
|
||||
break;
|
||||
|
||||
case 31: // A31 Adjust all Probe Points
|
||||
// The tokens can occur in different places on the new panel so we need to find it.
|
||||
|
||||
if (FindToken('C') >= 0) { // Restore and apply original offsets
|
||||
if (findToken('C') >= 0) { // Restore and apply original offsets
|
||||
if (!isPrinting()) {
|
||||
injectCommands(F("M501\nM420 S1"));
|
||||
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
||||
@ -830,7 +832,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
||||
}
|
||||
}
|
||||
|
||||
else if (FindToken('D') >= 0) { // Save Z Offset tables and restore leveling state
|
||||
else if (findToken('D') >= 0) { // Save Z Offset tables and restore leveling state
|
||||
if (!isPrinting()) {
|
||||
setAxisPosition_mm(1.0,Z); // Lift nozzle before any further movements are made
|
||||
injectCommands(F("M500"));
|
||||
@ -839,8 +841,8 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
||||
}
|
||||
}
|
||||
|
||||
else if (FindToken('G') >= 0) { // Get current offset
|
||||
SendtoTFT(F("A31V "));
|
||||
else if (findToken('G') >= 0) { // Get current offset
|
||||
tftSend(F("A31V "));
|
||||
// When printing use the live z Offset position
|
||||
// we will use babystepping to move the print head
|
||||
if (isPrinting())
|
||||
@ -852,7 +854,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
||||
}
|
||||
|
||||
else {
|
||||
int8_t tokenpos = FindToken('S');
|
||||
int8_t tokenpos = findToken('S');
|
||||
if (tokenpos >= 0) { // Set offset (adjusts all points by value)
|
||||
float Zshift = atof(&panel_command[tokenpos+1]);
|
||||
setSoftEndstopState(false); // disable endstops
|
||||
@ -860,22 +862,22 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
||||
// From the leveling panel use the all points UI to adjust the print pos.
|
||||
if (isPrinting()) {
|
||||
#if ACDEBUG(AC_INFO)
|
||||
SERIAL_ECHOLNPGM("Change Zoffset from:", live_Zoffset, " to ", live_Zoffset + Zshift);
|
||||
DEBUG_ECHOLNPGM("Change Zoffset from:", live_Zoffset, " to ", live_Zoffset + Zshift);
|
||||
#endif
|
||||
if (isAxisPositionKnown(Z)) {
|
||||
#if ACDEBUG(AC_INFO)
|
||||
const float currZpos = getAxisPosition_mm(Z);
|
||||
SERIAL_ECHOLNPGM("Nudge Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
|
||||
DEBUG_ECHOLNPGM("Nudge Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
|
||||
#endif
|
||||
// Use babystepping to adjust the head position
|
||||
int16_t steps = mmToWholeSteps(constrain(Zshift,-0.05,0.05), Z);
|
||||
#if ACDEBUG(AC_INFO)
|
||||
SERIAL_ECHOLNPGM("Steps to move Z: ", steps);
|
||||
DEBUG_ECHOLNPGM("Steps to move Z: ", steps);
|
||||
#endif
|
||||
babystepAxis_steps(steps, Z);
|
||||
live_Zoffset += Zshift;
|
||||
}
|
||||
SendtoTFT(F("A31V "));
|
||||
tftSend(F("A31V "));
|
||||
TFTSer.println(live_Zoffset);
|
||||
}
|
||||
else {
|
||||
@ -884,23 +886,23 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
||||
const float currval = getMeshPoint(pos);
|
||||
setMeshPoint(pos, constrain(currval + Zshift, AC_LOWEST_MESHPOINT_VAL, 2));
|
||||
#if ACDEBUG(AC_INFO)
|
||||
SERIAL_ECHOLNPGM("Change mesh point X", x," Y",y ," from ", currval, " to ", getMeshPoint(pos) );
|
||||
DEBUG_ECHOLNPGM("Change mesh point X", x," Y",y ," from ", currval, " to ", getMeshPoint(pos) );
|
||||
#endif
|
||||
}
|
||||
const float currZOffset = getZOffset_mm();
|
||||
#if ACDEBUG(AC_INFO)
|
||||
SERIAL_ECHOLNPGM("Change probe offset from ", currZOffset, " to ", currZOffset + Zshift);
|
||||
DEBUG_ECHOLNPGM("Change probe offset from ", currZOffset, " to ", currZOffset + Zshift);
|
||||
#endif
|
||||
|
||||
setZOffset_mm(currZOffset + Zshift);
|
||||
SendtoTFT(F("A31V "));
|
||||
tftSend(F("A31V "));
|
||||
TFTSer.println(getZOffset_mm());
|
||||
|
||||
if (isAxisPositionKnown(Z)) {
|
||||
// Move Z axis
|
||||
const float currZpos = getAxisPosition_mm(Z);
|
||||
#if ACDEBUG(AC_INFO)
|
||||
SERIAL_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
|
||||
DEBUG_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
|
||||
#endif
|
||||
setAxisPosition_mm(currZpos+constrain(Zshift,-0.05,0.05),Z);
|
||||
}
|
||||
@ -916,7 +918,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
||||
//TFTSer.println();
|
||||
break;
|
||||
|
||||
// A33 firmware info request see PanelInfo()
|
||||
// A33 firmware info request see panelInfo()
|
||||
|
||||
case 34: // A34 Adjust single mesh point A34 C/S X1 Y1 V123
|
||||
if (panel_command[3] == 'C') { // Restore original offsets
|
||||
@ -932,8 +934,8 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
||||
float currmesh = getMeshPoint(pos);
|
||||
float newval = atof(&panel_command[11])/100;
|
||||
#if ACDEBUG(AC_INFO)
|
||||
SERIAL_ECHOLNPGM("Change mesh point x:", pos.x, " y:", pos.y);
|
||||
SERIAL_ECHOLNPGM("from ", currmesh, " to ", newval);
|
||||
DEBUG_ECHOLNPGM("Change mesh point x:", pos.x, " y:", pos.y);
|
||||
DEBUG_ECHOLNPGM("from ", currmesh, " to ", newval);
|
||||
#endif
|
||||
// Update Meshpoint
|
||||
setMeshPoint(pos,newval);
|
||||
@ -944,7 +946,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
||||
setSoftEndstopState(false);
|
||||
float currZpos = getAxisPosition_mm(Z);
|
||||
#if ACDEBUG(AC_INFO)
|
||||
SERIAL_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(newval - currmesh, -0.05, 0.05));
|
||||
DEBUG_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(newval - currmesh, -0.05, 0.05));
|
||||
#endif
|
||||
setAxisPosition_mm(currZpos + constrain(newval - currmesh, -0.05, 0.05), Z);
|
||||
}
|
||||
@ -953,19 +955,19 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
||||
break;
|
||||
|
||||
case 36: // A36 Auto leveling for new TFT bet that was a typo in the panel code!
|
||||
SendtoTFTLN(AC_msg_start_probing);
|
||||
tftSendLn(AC_msg_start_probing);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChironTFT::GetLastError() {
|
||||
bool ChironTFT::getLastError() {
|
||||
switch (last_error) {
|
||||
case AC_error_abnormal_temp_bed: SendtoTFTLN(AC_msg_error_bed_temp); break;
|
||||
case AC_error_abnormal_temp_t0: SendtoTFTLN(AC_msg_error_hotend_temp); break;
|
||||
case AC_error_noSD: SendtoTFTLN(AC_msg_error_sd_card); break;
|
||||
case AC_error_powerloss: SendtoTFTLN(AC_msg_power_loss); break;
|
||||
case AC_error_EEPROM: SendtoTFTLN(AC_msg_eeprom_version); break;
|
||||
case AC_error_filament_runout: SendtoTFTLN(AC_msg_filament_out); break;
|
||||
case AC_error_abnormal_temp_bed: tftSendLn(AC_msg_error_bed_temp); break;
|
||||
case AC_error_abnormal_temp_t0: tftSendLn(AC_msg_error_hotend_temp); break;
|
||||
case AC_error_noSD: tftSendLn(AC_msg_error_sd_card); break;
|
||||
case AC_error_powerloss: tftSendLn(AC_msg_power_loss); break;
|
||||
case AC_error_EEPROM: tftSendLn(AC_msg_eeprom_version); break;
|
||||
case AC_error_filament_runout: tftSendLn(AC_msg_filament_out); break;
|
||||
default: return false;
|
||||
}
|
||||
last_error = AC_error_none;
|
||||
|
@ -57,32 +57,32 @@ class ChironTFT {
|
||||
static float live_Zoffset;
|
||||
static file_menu_t file_menu;
|
||||
public:
|
||||
static void Startup();
|
||||
static void IdleLoop();
|
||||
static void PrinterKilled(FSTR_P, FSTR_P);
|
||||
static void MediaEvent(media_event_t);
|
||||
static void TimerEvent(timer_event_t);
|
||||
static void FilamentRunout();
|
||||
static void ConfirmationRequest(const char * const);
|
||||
static void StatusChange(const char * const);
|
||||
static void PowerLossRecovery();
|
||||
static void PrintComplete();
|
||||
static void SendtoTFT(FSTR_P const=nullptr);
|
||||
static void SendtoTFTLN(FSTR_P const=nullptr);
|
||||
static void startup();
|
||||
static void idleLoop();
|
||||
static void printerKilled(FSTR_P, FSTR_P);
|
||||
static void mediaEvent(media_event_t);
|
||||
static void timerEvent(timer_event_t);
|
||||
static void filamentRunout();
|
||||
static void confirmationRequest(const char * const);
|
||||
static void statusChange(const char * const);
|
||||
static void powerLossRecovery();
|
||||
static void printComplete();
|
||||
static void tftSend(FSTR_P const=nullptr);
|
||||
static void tftSendLn(FSTR_P const=nullptr);
|
||||
private:
|
||||
static void DetectPanelType();
|
||||
static bool ReadTFTCommand();
|
||||
static int8_t FindToken(char);
|
||||
static void CheckHeaters();
|
||||
static void SendFileList(int8_t);
|
||||
static void SelectFile();
|
||||
static void ProcessPanelRequest();
|
||||
static void PanelInfo(uint8_t);
|
||||
static void PanelAction(uint8_t);
|
||||
static void PanelProcess(uint8_t);
|
||||
static bool GetLastError();
|
||||
static void detectPanelType();
|
||||
static bool readTFTCommand();
|
||||
static int8_t findToken(char);
|
||||
static void checkHeaters();
|
||||
static void sendFileList(int8_t);
|
||||
static void selectFile();
|
||||
static void processPanelRequest();
|
||||
static void panelInfo(uint8_t);
|
||||
static void panelAction(uint8_t);
|
||||
static void panelProcess(uint8_t);
|
||||
static bool getLastError();
|
||||
};
|
||||
|
||||
extern ChironTFT Chiron;
|
||||
extern ChironTFT chiron;
|
||||
|
||||
} // Anycubic namespace
|
||||
|
@ -35,20 +35,20 @@
|
||||
|
||||
namespace ExtUI {
|
||||
|
||||
void onStartup() { AnycubicTFT.OnSetup(); }
|
||||
void onIdle() { AnycubicTFT.OnCommandScan(); }
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const component) { AnycubicTFT.OnKillTFT(); }
|
||||
void onMediaInserted() { AnycubicTFT.OnSDCardStateChange(true); }
|
||||
void onMediaError() { AnycubicTFT.OnSDCardError(); }
|
||||
void onMediaRemoved() { AnycubicTFT.OnSDCardStateChange(false); }
|
||||
void onStartup() { anycubicTFT.onSetup(); }
|
||||
void onIdle() { anycubicTFT.onCommandScan(); }
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const component) { anycubicTFT.onKillTFT(); }
|
||||
void onMediaInserted() { anycubicTFT.onSDCardStateChange(true); }
|
||||
void onMediaError() { anycubicTFT.onSDCardError(); }
|
||||
void onMediaRemoved() { anycubicTFT.onSDCardStateChange(false); }
|
||||
void onPlayTone(const uint16_t frequency, const uint16_t duration) {
|
||||
TERN_(SPEAKER, ::tone(BEEPER_PIN, frequency, duration));
|
||||
}
|
||||
void onPrintTimerStarted() { AnycubicTFT.OnPrintTimerStarted(); }
|
||||
void onPrintTimerPaused() { AnycubicTFT.OnPrintTimerPaused(); }
|
||||
void onPrintTimerStopped() { AnycubicTFT.OnPrintTimerStopped(); }
|
||||
void onFilamentRunout(const extruder_t extruder) { AnycubicTFT.OnFilamentRunout(); }
|
||||
void onUserConfirmRequired(const char * const msg) { AnycubicTFT.OnUserConfirmRequired(msg); }
|
||||
void onPrintTimerStarted() { anycubicTFT.onPrintTimerStarted(); }
|
||||
void onPrintTimerPaused() { anycubicTFT.onPrintTimerPaused(); }
|
||||
void onPrintTimerStopped() { anycubicTFT.onPrintTimerStopped(); }
|
||||
void onFilamentRunout(const extruder_t extruder) { anycubicTFT.onFilamentRunout(); }
|
||||
void onUserConfirmRequired(const char * const msg) { anycubicTFT.onUserConfirmRequired(msg); }
|
||||
void onStatusChanged(const char * const msg) {}
|
||||
|
||||
void onHomingStart() {}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -48,48 +48,45 @@ enum AnycubicMediaPauseState {
|
||||
class AnycubicTFTClass {
|
||||
public:
|
||||
AnycubicTFTClass();
|
||||
static void OnSetup();
|
||||
static void OnCommandScan();
|
||||
static void OnKillTFT();
|
||||
static void OnSDCardStateChange(bool);
|
||||
static void OnSDCardError();
|
||||
static void OnFilamentRunout();
|
||||
static void OnUserConfirmRequired(const char *);
|
||||
static void OnPrintTimerStarted();
|
||||
static void OnPrintTimerPaused();
|
||||
static void OnPrintTimerStopped();
|
||||
static void onSetup();
|
||||
static void onCommandScan();
|
||||
static void onKillTFT();
|
||||
static void onSDCardStateChange(bool);
|
||||
static void onSDCardError();
|
||||
static void onFilamentRunout();
|
||||
static void onUserConfirmRequired(const char *);
|
||||
static void onPrintTimerStarted();
|
||||
static void onPrintTimerPaused();
|
||||
static void onPrintTimerStopped();
|
||||
|
||||
private:
|
||||
static char TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
|
||||
static int TFTbuflen, TFTbufindr, TFTbufindw;
|
||||
static char serial3_char;
|
||||
static int serial3_count;
|
||||
static char *TFTstrchr_pointer;
|
||||
static uint8_t SpecialMenu;
|
||||
static char tftCommands[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
|
||||
static int tftBufLen, tftBufIndR, tftBufIndW;
|
||||
static char *tftStrchrPtr;
|
||||
static uint8_t specialMenu;
|
||||
static AnycubicMediaPrintState mediaPrintingState;
|
||||
static AnycubicMediaPauseState mediaPauseState;
|
||||
|
||||
static float CodeValue();
|
||||
static bool CodeSeen(char);
|
||||
static bool IsNozzleHomed();
|
||||
static void RenderCurrentFileList();
|
||||
static void RenderSpecialMenu(uint16_t);
|
||||
static void RenderCurrentFolder(uint16_t);
|
||||
static void GetCommandFromTFT();
|
||||
static void CheckSDCardChange();
|
||||
static void CheckPauseState();
|
||||
static void CheckPrintCompletion();
|
||||
static void HandleSpecialMenu();
|
||||
static void DoSDCardStateCheck();
|
||||
static void DoFilamentRunoutCheck();
|
||||
static void StartPrint();
|
||||
static void PausePrint();
|
||||
static void ResumePrint();
|
||||
static void StopPrint();
|
||||
static float codeValue();
|
||||
static bool codeSeen(char);
|
||||
static bool isNozzleHomed();
|
||||
static void renderCurrentFileList();
|
||||
static void renderSpecialMenu(uint16_t);
|
||||
static void renderCurrentFolder(uint16_t);
|
||||
static void getCommandFromTFT();
|
||||
static void checkSDCardChange();
|
||||
static void checkPauseState();
|
||||
static void handleSpecialMenu();
|
||||
static void doSDCardStateCheck();
|
||||
static void doFilamentRunoutCheck();
|
||||
static void startPrint();
|
||||
static void pausePrint();
|
||||
static void resumePrint();
|
||||
static void stopPrint();
|
||||
|
||||
static char SelectedDirectory[30];
|
||||
static char SelectedFile[FILENAME_LENGTH];
|
||||
static char selectedDirectory[30];
|
||||
static char selectedFile[FILENAME_LENGTH];
|
||||
};
|
||||
|
||||
extern AnycubicTFTClass AnycubicTFT;
|
||||
extern AnycubicTFTClass anycubicTFT;
|
||||
extern const char G28_STR[];
|
||||
|
@ -40,8 +40,8 @@ using namespace ExtUI;
|
||||
|
||||
namespace Anycubic {
|
||||
|
||||
FileList FileNavigator::filelist; // Instance of the Marlin file API
|
||||
char FileNavigator::currentfoldername[MAX_PATH_LEN + 1]; // Current folder path
|
||||
FileList FileNavigator::filelist; // ExtUI file API
|
||||
char FileNavigator::currentDirPath[MAX_PATH_LEN + 1]; // Current folder path
|
||||
uint16_t FileNavigator::lastindex;
|
||||
uint8_t FileNavigator::folderdepth;
|
||||
uint16_t FileNavigator::currentindex; // override the panel request
|
||||
@ -51,7 +51,7 @@ namespace Anycubic {
|
||||
FileNavigator::FileNavigator() { reset(); }
|
||||
|
||||
void FileNavigator::reset() {
|
||||
currentfoldername[0] = '\0';
|
||||
currentDirPath[0] = '\0';
|
||||
folderdepth = 0;
|
||||
currentindex = 0;
|
||||
lastindex = 0;
|
||||
@ -94,7 +94,7 @@ namespace Anycubic {
|
||||
DgusTFT::SendTxtToTFT(filelist.longFilename(), TXT_FILE_0 + file_num*0x30);
|
||||
|
||||
#if ACDEBUG(AC_FILE)
|
||||
SERIAL_ECHOLNPGM("seek: ", _seek, " '", filelist.longFilename(), "' '", currentfoldername, "", filelist.shortFilename(), "'\n");
|
||||
SERIAL_ECHOLNPGM("seek: ", _seek, " '", filelist.longFilename(), "' '", currentDirPath, "", filelist.shortFilename(), "'\n");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
@ -120,11 +120,11 @@ namespace Anycubic {
|
||||
|
||||
void FileNavigator::changeDIR(char *folder) {
|
||||
#if ACDEBUG(AC_FILE)
|
||||
SERIAL_ECHOLNPGM("currentfolder: ", currentfoldername, " New: ", folder);
|
||||
SERIAL_ECHOLNPGM("currentfolder: ", currentDirPath, " New: ", folder);
|
||||
#endif
|
||||
if (folderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth
|
||||
strcat(currentfoldername, folder);
|
||||
strcat(currentfoldername, "/");
|
||||
strcat(currentDirPath, folder);
|
||||
strcat(currentDirPath, "/");
|
||||
filelist.changeDir(folder);
|
||||
refresh();
|
||||
folderdepth++;
|
||||
@ -138,22 +138,22 @@ namespace Anycubic {
|
||||
currentindex = 0;
|
||||
// Remove the last child folder from the stored path
|
||||
if (folderdepth == 0) {
|
||||
currentfoldername[0] = '\0';
|
||||
currentDirPath[0] = '\0';
|
||||
reset();
|
||||
}
|
||||
else {
|
||||
char *pos = nullptr;
|
||||
for (uint8_t f = 0; f < folderdepth; f++)
|
||||
pos = strchr(currentfoldername, '/');
|
||||
pos = strchr(currentDirPath, '/');
|
||||
|
||||
*(pos + 1) = '\0';
|
||||
}
|
||||
#if ACDEBUG(AC_FILE)
|
||||
SERIAL_ECHOLNPGM("depth: ", folderdepth, " currentfoldername: ", currentfoldername);
|
||||
SERIAL_ECHOLNPGM("depth: ", folderdepth, " currentDirPath: ", currentDirPath);
|
||||
#endif
|
||||
}
|
||||
|
||||
char* FileNavigator::getCurrentFolderName() { return currentfoldername; }
|
||||
char* FileNavigator::getCurrentDirPath() { return currentDirPath; }
|
||||
|
||||
uint16_t FileNavigator::getFileNum() { return filelist.count(); }
|
||||
}
|
||||
|
@ -43,13 +43,13 @@ namespace Anycubic {
|
||||
static void changeDIR(char *);
|
||||
static void sendFile();
|
||||
static void refresh();
|
||||
static char* getCurrentFolderName();
|
||||
static char* getCurrentDirPath();
|
||||
static uint16_t getFileNum();
|
||||
private:
|
||||
static uint16_t lastindex;
|
||||
static uint16_t currentindex;
|
||||
static uint8_t folderdepth;
|
||||
static char currentfoldername[MAX_PATH_LEN + 1];
|
||||
static char currentDirPath[MAX_PATH_LEN + 1];
|
||||
};
|
||||
|
||||
extern FileNavigator filenavigator;
|
||||
|
@ -111,10 +111,10 @@ namespace Anycubic {
|
||||
uint8_t pop_up_index_saved;
|
||||
uint32_t key_value_saved;
|
||||
|
||||
void DEBUG_PRINT_PAUSED_STATE(FSTR_P const msg, paused_state_t state);
|
||||
void DEBUG_PRINT_PRINTER_STATE(FSTR_P const msg, printer_state_t state);
|
||||
void DEBUG_PRINT_TIMER_EVENT(FSTR_P const msg, timer_event_t event);
|
||||
void DEBUG_PRINT_MEDIA_EVENT(FSTR_P const msg, media_event_t event);
|
||||
void DEBUG_PRINT_PAUSED_STATE(const paused_state_t state, FSTR_P const msg=nullptr);
|
||||
void DEBUG_PRINT_PRINTER_STATE(const printer_state_t state, FSTR_P const msg=nullptr);
|
||||
void DEBUG_PRINT_TIMER_EVENT(const timer_event_t event, FSTR_P const msg=nullptr);
|
||||
void DEBUG_PRINT_MEDIA_EVENT(const media_event_t event, FSTR_P const msg=nullptr);
|
||||
|
||||
DgusTFT Dgus;
|
||||
|
||||
@ -127,9 +127,9 @@ namespace Anycubic {
|
||||
feedrate_back = -1;
|
||||
}
|
||||
|
||||
void DgusTFT::Startup() {
|
||||
void DgusTFT::startup() {
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_ECHOLNPGM("DgusTFT::Startup()");
|
||||
DEBUG_ECHOLNPGM("DgusTFT::startup()");
|
||||
#endif
|
||||
selectedfile[0] = '\0';
|
||||
panel_command[0] = '\0';
|
||||
@ -148,16 +148,16 @@ namespace Anycubic {
|
||||
TFTSer.begin(115200);
|
||||
|
||||
// Signal Board has reset
|
||||
SendtoTFTLN(AC_msg_main_board_has_reset);
|
||||
tftSendLn(AC_msg_main_board_has_reset);
|
||||
|
||||
// Enable levelling and Disable end stops during print
|
||||
// as Z home places nozzle above the bed so we need to allow it past the end stops
|
||||
injectCommands(AC_cmnd_enable_leveling);
|
||||
|
||||
#if ACDEBUGLEVEL
|
||||
DEBUG_ECHOLNPGM("Startup AC Debug Level ", ACDEBUGLEVEL);
|
||||
DEBUG_ECHOLNPGM("startup AC Debug Level ", ACDEBUGLEVEL);
|
||||
#endif
|
||||
SendtoTFTLN(AC_msg_ready);
|
||||
tftSendLn(AC_msg_ready);
|
||||
}
|
||||
|
||||
void DgusTFT::ParamInit() {
|
||||
@ -188,15 +188,15 @@ namespace Anycubic {
|
||||
RequestValueFromTFT(0x14); // get page ID
|
||||
}
|
||||
|
||||
void DgusTFT::IdleLoop() {
|
||||
if (ReadTFTCommand()) {
|
||||
ProcessPanelRequest();
|
||||
void DgusTFT::idleLoop() {
|
||||
if (readTFTCommand()) {
|
||||
processPanelRequest();
|
||||
command_len = 0;
|
||||
}
|
||||
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
if (key_value) {
|
||||
DEBUG_ECHOLNPGM("IdleLoop page: ", page_index_now);
|
||||
DEBUG_ECHOLNPGM("idleLoop page: ", page_index_now);
|
||||
DEBUG_ECHOLNPGM("key: ", key_value);
|
||||
}
|
||||
#endif
|
||||
@ -266,7 +266,7 @@ namespace Anycubic {
|
||||
pop_up_manager();
|
||||
key_value = 0;
|
||||
|
||||
CheckHeaters();
|
||||
checkHeaters();
|
||||
}
|
||||
|
||||
uint8_t FSHlength(FSTR_P FSHinput) {
|
||||
@ -276,7 +276,7 @@ namespace Anycubic {
|
||||
return stringLength;
|
||||
}
|
||||
|
||||
void DgusTFT::PrinterKilled(FSTR_P error_p, FSTR_P component_p) {
|
||||
void DgusTFT::printerKilled(FSTR_P error_p, FSTR_P component_p) {
|
||||
|
||||
// copy string in FLASH to RAM for strcmp_P
|
||||
|
||||
@ -288,9 +288,9 @@ namespace Anycubic {
|
||||
char component[FSHlength(component_p) + 1];
|
||||
memcpy_P(component, component_p, textLength + 1); // +1 for the null terminator
|
||||
|
||||
SendtoTFTLN(AC_msg_kill_lcd);
|
||||
tftSendLn(AC_msg_kill_lcd);
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_ECHOLNPGM("PrinterKilled()\nerror: ", error, "\ncomponent: ", component);
|
||||
DEBUG_ECHOLNPGM("printerKilled()\nerror: ", error, "\ncomponent: ", component);
|
||||
#endif
|
||||
|
||||
if (strcmp_P(error, PSTR("Heating Failed")) == 0) {
|
||||
@ -364,9 +364,9 @@ namespace Anycubic {
|
||||
SendColorToTFT(color, TXT_DESCRIPT_0 + 0x30 * (index - 1));
|
||||
}
|
||||
|
||||
void DgusTFT::MediaEvent(media_event_t event) {
|
||||
void DgusTFT::mediaEvent(media_event_t event) {
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_PRINT_MEDIA_EVENT(F("ProcessMediaStatus() "), event);
|
||||
DEBUG_PRINT_MEDIA_EVENT(event);
|
||||
#endif
|
||||
switch (event) {
|
||||
case AC_media_inserted:
|
||||
@ -379,12 +379,12 @@ namespace Anycubic {
|
||||
lcd_txtbox_index = 0;
|
||||
}
|
||||
|
||||
SendFileList(lcd_txtbox_index);
|
||||
sendFileList(lcd_txtbox_index);
|
||||
|
||||
break;
|
||||
|
||||
case AC_media_removed:
|
||||
SendtoTFTLN(AC_msg_sd_card_removed);
|
||||
tftSendLn(AC_msg_sd_card_removed);
|
||||
|
||||
filenavigator.reset();
|
||||
|
||||
@ -394,33 +394,33 @@ namespace Anycubic {
|
||||
lcd_txtbox_index = 0;
|
||||
}
|
||||
|
||||
SendFileList(lcd_txtbox_index);
|
||||
sendFileList(lcd_txtbox_index);
|
||||
break;
|
||||
|
||||
case AC_media_error:
|
||||
SendtoTFTLN(AC_msg_no_sd_card);
|
||||
tftSendLn(AC_msg_no_sd_card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DgusTFT::TimerEvent(timer_event_t event) {
|
||||
void DgusTFT::timerEvent(timer_event_t event) {
|
||||
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_PRINT_TIMER_EVENT(F("TimerEvent() "), event);
|
||||
DEBUG_PRINT_PRINTER_STATE(F("Printer State: "), printer_state);
|
||||
DEBUG_PRINT_TIMER_EVENT(event);
|
||||
DEBUG_PRINT_PRINTER_STATE(printer_state);
|
||||
#endif
|
||||
|
||||
switch (event) {
|
||||
case AC_timer_started:
|
||||
setSoftEndstopState(false); // disable endstops to print
|
||||
printer_state = AC_printer_printing;
|
||||
SendtoTFTLN(AC_msg_print_from_sd_card);
|
||||
tftSendLn(AC_msg_print_from_sd_card);
|
||||
break;
|
||||
|
||||
case AC_timer_paused:
|
||||
//printer_state = AC_printer_paused;
|
||||
//pause_state = AC_paused_idle;
|
||||
SendtoTFTLN(AC_msg_paused);
|
||||
tftSendLn(AC_msg_paused);
|
||||
break;
|
||||
|
||||
case AC_timer_stopped:
|
||||
@ -438,7 +438,7 @@ namespace Anycubic {
|
||||
sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60));
|
||||
SendTxtToTFT(str_buf, TXT_FINISH_TIME);
|
||||
ChangePageOfTFT(PAGE_PRINT_FINISH);
|
||||
SendtoTFTLN(AC_msg_print_complete);
|
||||
tftSendLn(AC_msg_print_complete);
|
||||
pop_up_index = 100;
|
||||
}
|
||||
}
|
||||
@ -449,12 +449,12 @@ namespace Anycubic {
|
||||
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
|
||||
void DgusTFT::FilamentRunout() {
|
||||
void DgusTFT::filamentRunout() {
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_PRINT_PRINTER_STATE(F("FilamentRunout() printer_state "), printer_state);
|
||||
DEBUG_PRINT_PRINTER_STATE(printer_state, F("filamentRunout() "));
|
||||
|
||||
// 1 Signal filament out
|
||||
SendtoTFTLN(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block);
|
||||
tftSendLn(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block);
|
||||
//printer_state = AC_printer_filament_out;
|
||||
|
||||
DEBUG_ECHOLNPGM("getFilamentRunoutState: ", getFilamentRunoutState());
|
||||
@ -477,13 +477,13 @@ namespace Anycubic {
|
||||
|
||||
#endif // FILAMENT_RUNOUT_SENSOR
|
||||
|
||||
void DgusTFT::ConfirmationRequest(const char * const msg) {
|
||||
void DgusTFT::confirmationRequest(const char * const msg) {
|
||||
// M108 continue
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_ECHOLNPGM("HomingComplete, line: ", __LINE__);
|
||||
DEBUG_ECHOLNPGM("ConfirmationRequest() ", msg);
|
||||
DEBUG_PRINT_PRINTER_STATE(F("printer_state: " ), printer_state);
|
||||
DEBUG_PRINT_PAUSED_STATE(F("pause_state: "), pause_state);
|
||||
DEBUG_ECHOLNPGM("confirmationRequest() ", msg);
|
||||
DEBUG_PRINT_PRINTER_STATE(printer_state);
|
||||
DEBUG_PRINT_PAUSED_STATE(pause_state);
|
||||
#endif
|
||||
|
||||
switch (printer_state) {
|
||||
@ -504,7 +504,7 @@ namespace Anycubic {
|
||||
// Heater timout, send acknowledgement
|
||||
if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) {
|
||||
pause_state = AC_paused_heater_timed_out;
|
||||
SendtoTFTLN(AC_msg_paused); // enable continue button
|
||||
tftSendLn(AC_msg_paused); // enable continue button
|
||||
PlayTune(HeaterTimeout);
|
||||
}
|
||||
// Reheat finished, send acknowledgement
|
||||
@ -517,12 +517,12 @@ namespace Anycubic {
|
||||
if (pause_state != AC_paused_filament_lack)
|
||||
pause_state = AC_paused_idle;
|
||||
|
||||
SendtoTFTLN(AC_msg_paused); // enable continue button
|
||||
tftSendLn(AC_msg_paused); // enable continue button
|
||||
}
|
||||
// Filament Purging, send acknowledgement enter run mode
|
||||
else if (strcmp_P(msg, MARLIN_msg_filament_purging) == 0) {
|
||||
pause_state = AC_paused_purging_filament;
|
||||
SendtoTFTLN(AC_msg_paused); // enable continue button
|
||||
tftSendLn(AC_msg_paused); // enable continue button
|
||||
}
|
||||
else if (strcmp_P(msg, MARLIN_msg_nozzle_parked) == 0) {
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
@ -540,11 +540,11 @@ namespace Anycubic {
|
||||
}
|
||||
}
|
||||
|
||||
void DgusTFT::StatusChange(const char * const msg) {
|
||||
void DgusTFT::statusChange(const char * const msg) {
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_ECHOLNPGM("StatusChange() ", msg);
|
||||
DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state);
|
||||
DEBUG_PRINT_PAUSED_STATE(F("pause_state: "), pause_state);
|
||||
DEBUG_ECHOLNPGM("statusChange() ", msg);
|
||||
DEBUG_PRINT_PRINTER_STATE(printer_state);
|
||||
DEBUG_PRINT_PAUSED_STATE(pause_state);
|
||||
#endif
|
||||
bool msg_matched = false;
|
||||
|
||||
@ -579,7 +579,7 @@ namespace Anycubic {
|
||||
PlayTune(BeepBeepBeeep);
|
||||
injectCommands(F("G1 Z50 F500"));
|
||||
ChangePageOfTFT(PAGE_CHS_ABNORMAL_LEVELING_SENSOR);
|
||||
SendtoTFTLN(AC_msg_probing_complete);
|
||||
tftSendLn(AC_msg_probing_complete);
|
||||
printer_state = AC_printer_idle;
|
||||
msg_matched = true;
|
||||
}
|
||||
@ -595,7 +595,7 @@ namespace Anycubic {
|
||||
|
||||
case AC_printer_printing:
|
||||
if (strcmp_P(msg, MARLIN_msg_reheating) == 0) {
|
||||
SendtoTFTLN(AC_msg_paused); // enable continue button
|
||||
tftSendLn(AC_msg_paused); // enable continue button
|
||||
ChangePageOfTFT(PAGE_STATUS2);
|
||||
msg_matched = true;
|
||||
}
|
||||
@ -652,14 +652,14 @@ namespace Anycubic {
|
||||
if (!msg_matched) {
|
||||
#if HAS_HOTEND
|
||||
if (strcmp_P(msg, MARLIN_msg_extruder_heating) == 0) {
|
||||
SendtoTFTLN(AC_msg_nozzle_heating);
|
||||
tftSendLn(AC_msg_nozzle_heating);
|
||||
hotend_state = AC_heater_temp_set;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
if (strcmp_P(msg, MARLIN_msg_bed_heating) == 0) {
|
||||
SendtoTFTLN(AC_msg_bed_heating);
|
||||
tftSendLn(AC_msg_bed_heating);
|
||||
hotbed_state = AC_heater_temp_set;
|
||||
}
|
||||
#endif
|
||||
@ -675,7 +675,7 @@ namespace Anycubic {
|
||||
LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]);
|
||||
}
|
||||
|
||||
void DgusTFT::PowerLossRecovery() {
|
||||
void DgusTFT::powerLossRecovery() {
|
||||
printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover.
|
||||
}
|
||||
|
||||
@ -699,7 +699,7 @@ namespace Anycubic {
|
||||
ChangePageOfTFT(page_index_last);
|
||||
}
|
||||
|
||||
void DgusTFT::SendtoTFT(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel
|
||||
void DgusTFT::tftSend(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel
|
||||
#if ACDEBUG(AC_SOME)
|
||||
DEBUG_ECHOF(fstr);
|
||||
#endif
|
||||
@ -707,12 +707,12 @@ namespace Anycubic {
|
||||
while (const char c = pgm_read_byte(str++)) TFTSer.write(c);
|
||||
}
|
||||
|
||||
void DgusTFT::SendtoTFTLN(FSTR_P const fstr/*=nullptr*/) {
|
||||
void DgusTFT::tftSendLn(FSTR_P const fstr/*=nullptr*/) {
|
||||
if (fstr) {
|
||||
#if ACDEBUG(AC_SOME)
|
||||
DEBUG_ECHOPGM("> ");
|
||||
#endif
|
||||
SendtoTFT(fstr);
|
||||
tftSend(fstr);
|
||||
#if ACDEBUG(AC_SOME)
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
@ -804,7 +804,7 @@ namespace Anycubic {
|
||||
LOOP_L_N(i, 10) TFTSer.write(data[i]);
|
||||
}
|
||||
|
||||
bool DgusTFT::ReadTFTCommand() {
|
||||
bool DgusTFT::readTFTCommand() {
|
||||
static uint8_t length = 0, cnt = 0, tft_receive_steps = 0;
|
||||
uint8_t data;
|
||||
|
||||
@ -858,7 +858,7 @@ namespace Anycubic {
|
||||
|
||||
#if 0
|
||||
{
|
||||
//SERIAL_ECHOLNPGM("ReadTFTCommand: ", millis());
|
||||
//SERIAL_ECHOLNPGM("readTFTCommand: ", millis());
|
||||
//return -1;
|
||||
|
||||
bool command_ready = false;
|
||||
@ -888,7 +888,7 @@ namespace Anycubic {
|
||||
uint8_t req = atoi(&panel_command[1]);
|
||||
if (req > 7 && req != 20) {
|
||||
DEBUG_ECHOLNPGM("> ", panel_command);
|
||||
DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state);
|
||||
DEBUG_PRINT_PRINTER_STATE(printer_state);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -902,7 +902,7 @@ namespace Anycubic {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void DgusTFT::CheckHeaters() {
|
||||
void DgusTFT::checkHeaters() {
|
||||
static uint32_t time_last = 0;
|
||||
if (PENDING(millis(), time_last)) return;
|
||||
time_last = millis() + 500;
|
||||
@ -916,7 +916,7 @@ namespace Anycubic {
|
||||
if (!WITHIN(temp, HEATER_0_MINTEMP, HEATER_0_MAXTEMP)) {
|
||||
faultE0Duration++;
|
||||
if (faultE0Duration >= AC_HEATER_FAULT_VALIDATION_TIME) {
|
||||
SendtoTFTLN(AC_msg_nozzle_temp_abnormal);
|
||||
tftSendLn(AC_msg_nozzle_temp_abnormal);
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_ECHOLNPGM("Extruder temp abnormal! : ", temp);
|
||||
#endif
|
||||
@ -931,7 +931,7 @@ namespace Anycubic {
|
||||
if (!WITHIN(temp, BED_MINTEMP, BED_MAXTEMP)) {
|
||||
faultBedDuration++;
|
||||
if (faultBedDuration >= AC_HEATER_FAULT_VALIDATION_TIME) {
|
||||
SendtoTFTLN(AC_msg_bed_temp_abnormal);
|
||||
tftSendLn(AC_msg_bed_temp_abnormal);
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_ECHOLNPGM("Bed temp abnormal! : ", temp);
|
||||
#endif
|
||||
@ -944,7 +944,7 @@ namespace Anycubic {
|
||||
// Update panel with hotend heater status
|
||||
if (hotend_state != AC_heater_temp_reached) {
|
||||
if (WITHIN(getActualTemp_celsius(E0) - getTargetTemp_celsius(E0), -1, 1)) {
|
||||
SendtoTFTLN(AC_msg_nozzle_heating_done);
|
||||
tftSendLn(AC_msg_nozzle_heating_done);
|
||||
hotend_state = AC_heater_temp_reached;
|
||||
}
|
||||
}
|
||||
@ -952,22 +952,22 @@ namespace Anycubic {
|
||||
// Update panel with bed heater status
|
||||
if (hotbed_state != AC_heater_temp_reached) {
|
||||
if (WITHIN(getActualTemp_celsius(BED) - getTargetTemp_celsius(BED), -0.5, 0.5)) {
|
||||
SendtoTFTLN(AC_msg_bed_heating_done);
|
||||
tftSendLn(AC_msg_bed_heating_done);
|
||||
hotbed_state = AC_heater_temp_reached;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DgusTFT::SendFileList(int8_t startindex) {
|
||||
void DgusTFT::sendFileList(int8_t startindex) {
|
||||
// Respond to panel request for 4 files starting at index
|
||||
#if ACDEBUG(AC_INFO)
|
||||
DEBUG_ECHOLNPGM("## SendFileList ## ", startindex);
|
||||
DEBUG_ECHOLNPGM("## sendFileList ## ", startindex);
|
||||
#endif
|
||||
filenavigator.getFiles(startindex);
|
||||
}
|
||||
|
||||
void DgusTFT::SelectFile() {
|
||||
void DgusTFT::selectFile() {
|
||||
strncpy(selectedfile, panel_command + 4, command_len - 4);
|
||||
selectedfile[command_len - 5] = '\0';
|
||||
#if ACDEBUG(AC_FILE)
|
||||
@ -975,22 +975,22 @@ namespace Anycubic {
|
||||
#endif
|
||||
switch (selectedfile[0]) {
|
||||
case '/': // Valid file selected
|
||||
SendtoTFTLN(AC_msg_sd_file_open_success);
|
||||
tftSendLn(AC_msg_sd_file_open_success);
|
||||
break;
|
||||
case '<': // .. (go up folder level)
|
||||
filenavigator.upDIR();
|
||||
SendtoTFTLN(AC_msg_sd_file_open_failed);
|
||||
SendFileList(0);
|
||||
tftSendLn(AC_msg_sd_file_open_failed);
|
||||
sendFileList(0);
|
||||
break;
|
||||
default: // enter sub folder
|
||||
filenavigator.changeDIR(selectedfile);
|
||||
SendtoTFTLN(AC_msg_sd_file_open_failed);
|
||||
SendFileList(0);
|
||||
tftSendLn(AC_msg_sd_file_open_failed);
|
||||
sendFileList(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DgusTFT::ProcessPanelRequest() {
|
||||
void DgusTFT::processPanelRequest() {
|
||||
uint16_t control_index = 0;
|
||||
uint32_t control_value;
|
||||
uint16_t temp;
|
||||
@ -1080,7 +1080,7 @@ namespace Anycubic {
|
||||
|
||||
}
|
||||
else if (control_value == 0x010000) { // startup first gif
|
||||
// Startup tunes are defined in Tunes.h
|
||||
// startup tunes are defined in Tunes.h
|
||||
PlayTune(Anycubic_PowerOn); // takes 3500 ms
|
||||
}
|
||||
}
|
||||
@ -1112,15 +1112,15 @@ namespace Anycubic {
|
||||
int8_t req = atoi(&panel_command[1]);
|
||||
|
||||
// Information requests A0 - A8 and A33
|
||||
if (req <= 8 || req == 33) PanelInfo(req);
|
||||
if (req <= 8 || req == 33) panelInfo(req);
|
||||
|
||||
// Simple Actions A9 - A28
|
||||
else if (req <= 28) PanelAction(req);
|
||||
else if (req <= 28) panelAction(req);
|
||||
|
||||
// Process Initiation
|
||||
else if (req <= 34) PanelProcess(req);
|
||||
else if (req <= 34) panelProcess(req);
|
||||
|
||||
else SendtoTFTLN();
|
||||
else tftSendLn();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1187,7 +1187,7 @@ namespace Anycubic {
|
||||
lcd_txtbox_index = 0;
|
||||
}
|
||||
ChangePageOfTFT(PAGE_FILE);
|
||||
SendFileList(0);
|
||||
sendFileList(0);
|
||||
} break;
|
||||
|
||||
case 2: { // tool
|
||||
@ -1249,7 +1249,7 @@ namespace Anycubic {
|
||||
set_descript_color(COLOR_BLUE);
|
||||
lcd_txtbox_index = 0;
|
||||
|
||||
SendFileList(lcd_txtbox_page * 5);
|
||||
sendFileList(lcd_txtbox_page * 5);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1260,7 +1260,7 @@ namespace Anycubic {
|
||||
set_descript_color(COLOR_BLUE);
|
||||
lcd_txtbox_index = 0;
|
||||
|
||||
SendFileList(lcd_txtbox_page * 5);
|
||||
sendFileList(lcd_txtbox_page * 5);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1274,12 +1274,12 @@ namespace Anycubic {
|
||||
set_descript_color(COLOR_BLUE);
|
||||
lcd_txtbox_index = 0;
|
||||
}
|
||||
SendFileList(lcd_txtbox_index);
|
||||
sendFileList(lcd_txtbox_index);
|
||||
break;
|
||||
|
||||
case 5: // resume of outage(last power off)
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state);
|
||||
DEBUG_PRINT_PRINTER_STATE(printer_state);
|
||||
#endif
|
||||
if (lcd_txtbox_index > 0 && lcd_txtbox_index < 6) { // 1~5
|
||||
|
||||
@ -1398,8 +1398,8 @@ namespace Anycubic {
|
||||
|
||||
case 2: // resume print
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state);
|
||||
DEBUG_PRINT_PAUSED_STATE(F("pause_state :"), pause_state);
|
||||
DEBUG_PRINT_PRINTER_STATE(printer_state);
|
||||
DEBUG_PRINT_PAUSED_STATE(pause_state);
|
||||
#endif
|
||||
if ( pause_state == AC_paused_idle
|
||||
|| pause_state == AC_paused_filament_lack
|
||||
@ -2418,8 +2418,8 @@ namespace Anycubic {
|
||||
|
||||
case 1: // return
|
||||
#if ACDEBUG(AC_MARLIN)
|
||||
DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state);
|
||||
DEBUG_PRINT_PAUSED_STATE(F("pause_state: "), pause_state);
|
||||
DEBUG_PRINT_PRINTER_STATE(printer_state);
|
||||
DEBUG_PRINT_PAUSED_STATE(pause_state);
|
||||
#endif
|
||||
if (AC_printer_printing == printer_state)
|
||||
ChangePageOfTFT(PAGE_STATUS2); // show pause
|
||||
@ -3179,6 +3179,7 @@ namespace Anycubic {
|
||||
break;
|
||||
|
||||
case 15: // filament lack
|
||||
case 23:
|
||||
if (page_index_now != PAGE_FILAMENT_LACK)
|
||||
ChangePageOfTFT(PAGE_FILAMENT_LACK);
|
||||
pop_up_index = 100;
|
||||
@ -3194,12 +3195,6 @@ namespace Anycubic {
|
||||
pop_up_index = 100;
|
||||
break;
|
||||
|
||||
case 23: //
|
||||
if (page_index_now != PAGE_FILAMENT_LACK)
|
||||
ChangePageOfTFT(PAGE_FILAMENT_LACK);
|
||||
pop_up_index = 100;
|
||||
break;
|
||||
|
||||
case 24: { //
|
||||
uint32_t time = getProgress_seconds_elapsed() / 60;
|
||||
char str_buf[20];
|
||||
@ -3207,7 +3202,7 @@ namespace Anycubic {
|
||||
sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60));
|
||||
SendTxtToTFT(str_buf, TXT_FINISH_TIME);
|
||||
ChangePageOfTFT(PAGE_PRINT_FINISH);
|
||||
//SendtoTFTLN(AC_msg_print_complete); // no idea why this causes a compile error
|
||||
//tftSendLn(AC_msg_print_complete); // no idea why this causes a compile error
|
||||
pop_up_index = 100;
|
||||
} break;
|
||||
|
||||
@ -3218,84 +3213,56 @@ namespace Anycubic {
|
||||
}
|
||||
}
|
||||
|
||||
void DEBUG_PRINT_PAUSED_STATE(FSTR_P const msg, paused_state_t state) {
|
||||
DEBUG_ECHOPGM(msg, state);
|
||||
void DEBUG_PRINT_PAUSED_STATE(const paused_state_t state, FSTR_P const msg/*=nullptr*/) {
|
||||
if (msg) DEBUG_ECHOF(msg);
|
||||
DEBUG_ECHOPGM("Paused state: ", state, " ");
|
||||
switch (state) {
|
||||
case AC_paused_heater_timed_out:
|
||||
DEBUG_ECHOLNPGM(" AC_paused_heater_timed_out");
|
||||
break;
|
||||
case AC_paused_filament_lack:
|
||||
DEBUG_ECHOLNPGM(" AC_paused_filament_lack");
|
||||
break;
|
||||
case AC_paused_purging_filament:
|
||||
DEBUG_ECHOLNPGM(" AC_paused_purging_filament");
|
||||
break;
|
||||
case AC_paused_idle:
|
||||
DEBUG_ECHOLNPGM(" AC_paused_idle");
|
||||
break;
|
||||
case AC_paused_heater_timed_out: DEBUG_ECHOPGM("AC_paused_heater_timed_out"); break;
|
||||
case AC_paused_filament_lack: DEBUG_ECHOPGM("AC_paused_filament_lack"); break;
|
||||
case AC_paused_purging_filament: DEBUG_ECHOPGM("AC_paused_purging_filament"); break;
|
||||
case AC_paused_idle: DEBUG_ECHOPGM("AC_paused_idle"); break;
|
||||
}
|
||||
DEBUG_EOL();
|
||||
}
|
||||
|
||||
// routines to make the debug outputs human readable
|
||||
// Human-readable debugging
|
||||
|
||||
void DEBUG_PRINT_PRINTER_STATE(FSTR_P const msg, printer_state_t state) {
|
||||
DEBUG_ECHOPGM(msg, state);
|
||||
void DEBUG_PRINT_PRINTER_STATE(const printer_state_t state, FSTR_P const msg/*=nullptr*/) {
|
||||
if (msg) DEBUG_ECHOF(msg);
|
||||
DEBUG_ECHOPGM("Printer State: ", state, " ");
|
||||
switch (state) {
|
||||
case AC_printer_idle:
|
||||
DEBUG_ECHOLNPGM(" AC_printer_idle");
|
||||
break;
|
||||
case AC_printer_probing:
|
||||
DEBUG_ECHOLNPGM(" AC_printer_probing");
|
||||
break;
|
||||
case AC_printer_printing:
|
||||
DEBUG_ECHOLNPGM(" AC_printer_printing");
|
||||
break;
|
||||
case AC_printer_pausing:
|
||||
DEBUG_ECHOLNPGM(" AC_printer_pausing");
|
||||
break;
|
||||
case AC_printer_paused:
|
||||
DEBUG_ECHOLNPGM(" AC_printer_paused");
|
||||
break;
|
||||
case AC_printer_stopping:
|
||||
DEBUG_ECHOLNPGM(" AC_printer_stopping");
|
||||
break;
|
||||
case AC_printer_stopping_from_media_remove:
|
||||
DEBUG_ECHOLNPGM(" AC_printer_stopping_from_media_remove");
|
||||
break;
|
||||
case AC_printer_resuming_from_power_outage:
|
||||
DEBUG_ECHOLNPGM(" AC_printer_resuming_from_power_outage");
|
||||
break;
|
||||
case AC_printer_idle: DEBUG_ECHOPGM("AC_printer_idle"); break;
|
||||
case AC_printer_probing: DEBUG_ECHOPGM("AC_printer_probing"); break;
|
||||
case AC_printer_printing: DEBUG_ECHOPGM("AC_printer_printing"); break;
|
||||
case AC_printer_pausing: DEBUG_ECHOPGM("AC_printer_pausing"); break;
|
||||
case AC_printer_paused: DEBUG_ECHOPGM("AC_printer_paused"); break;
|
||||
case AC_printer_stopping: DEBUG_ECHOPGM("AC_printer_stopping"); break;
|
||||
case AC_printer_stopping_from_media_remove: DEBUG_ECHOPGM("AC_printer_stopping_from_media_remove"); break;
|
||||
case AC_printer_resuming_from_power_outage: DEBUG_ECHOPGM("AC_printer_resuming_from_power_outage"); break;
|
||||
}
|
||||
DEBUG_EOL();
|
||||
}
|
||||
|
||||
void DEBUG_PRINT_TIMER_EVENT(FSTR_P const msg, timer_event_t event) {
|
||||
DEBUG_ECHOPGM(msg, event);
|
||||
void DEBUG_PRINT_TIMER_EVENT(const timer_event_t event, FSTR_P const msg/*=nullptr*/) {
|
||||
if (msg) DEBUG_ECHOPGM(msg, event);
|
||||
DEBUG_ECHOPGM("timerEvent() ", event, " ");
|
||||
switch (event) {
|
||||
case AC_timer_started:
|
||||
DEBUG_ECHOLNPGM(" AC_timer_started");
|
||||
break;
|
||||
case AC_timer_paused:
|
||||
DEBUG_ECHOLNPGM(" AC_timer_paused");
|
||||
break;
|
||||
case AC_timer_stopped:
|
||||
DEBUG_ECHOLNPGM(" AC_timer_stopped");
|
||||
break;
|
||||
case AC_timer_started: DEBUG_ECHOPGM("AC_timer_started"); break;
|
||||
case AC_timer_paused: DEBUG_ECHOPGM("AC_timer_paused"); break;
|
||||
case AC_timer_stopped: DEBUG_ECHOPGM("AC_timer_stopped"); break;
|
||||
}
|
||||
DEBUG_EOL();
|
||||
}
|
||||
|
||||
void DEBUG_PRINT_MEDIA_EVENT(FSTR_P const msg, media_event_t event) {
|
||||
DEBUG_ECHOPGM(msg, event);
|
||||
void DEBUG_PRINT_MEDIA_EVENT(const media_event_t event, FSTR_P const msg/*=nullptr*/) {
|
||||
if (msg) DEBUG_ECHOPGM(msg, event);
|
||||
DEBUG_ECHOPGM("ProcessMediaStatus() ", event, " ");
|
||||
switch (event) {
|
||||
case AC_media_inserted:
|
||||
DEBUG_ECHOLNPGM(" AC_media_inserted");
|
||||
break;
|
||||
case AC_media_removed:
|
||||
DEBUG_ECHOLNPGM(" AC_media_removed");
|
||||
break;
|
||||
case AC_media_error:
|
||||
DEBUG_ECHOLNPGM(" AC_media_error");
|
||||
break;
|
||||
case AC_media_inserted: DEBUG_ECHOPGM("AC_media_inserted"); break;
|
||||
case AC_media_removed: DEBUG_ECHOPGM("AC_media_removed"); break;
|
||||
case AC_media_error: DEBUG_ECHOPGM("AC_media_error"); break;
|
||||
}
|
||||
DEBUG_EOL();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -356,17 +356,17 @@ namespace Anycubic {
|
||||
static lcd_info_t lcd_info, lcd_info_back;
|
||||
static uint16_t page_index_now;
|
||||
|
||||
static void Startup();
|
||||
static void startup();
|
||||
static void ParamInit();
|
||||
static void IdleLoop();
|
||||
static void PrinterKilled(FSTR_P,FSTR_P);
|
||||
static void MediaEvent(media_event_t);
|
||||
static void TimerEvent(timer_event_t);
|
||||
static void FilamentRunout();
|
||||
static void ConfirmationRequest(const char * const);
|
||||
static void StatusChange(const char * const);
|
||||
static void idleLoop();
|
||||
static void printerKilled(FSTR_P,FSTR_P);
|
||||
static void mediaEvent(media_event_t);
|
||||
static void timerEvent(timer_event_t);
|
||||
static void filamentRunout();
|
||||
static void confirmationRequest(const char * const);
|
||||
static void statusChange(const char * const);
|
||||
static void PowerLoss();
|
||||
static void PowerLossRecovery();
|
||||
static void powerLossRecovery();
|
||||
static void HomingStart();
|
||||
static void HomingComplete();
|
||||
|
||||
@ -450,17 +450,17 @@ namespace Anycubic {
|
||||
|
||||
static void pop_up_manager();
|
||||
|
||||
static void SendtoTFT(FSTR_P const=nullptr);
|
||||
static void SendtoTFTLN(FSTR_P const=nullptr);
|
||||
static bool ReadTFTCommand();
|
||||
static void tftSend(FSTR_P const=nullptr);
|
||||
static void tftSendLn(FSTR_P const=nullptr);
|
||||
static bool readTFTCommand();
|
||||
static int8_t Findcmndpos(const char *, const char);
|
||||
static void CheckHeaters();
|
||||
static void SendFileList(int8_t);
|
||||
static void SelectFile();
|
||||
static void ProcessPanelRequest();
|
||||
static void PanelInfo(uint8_t);
|
||||
static void PanelAction(uint8_t);
|
||||
static void PanelProcess(uint8_t);
|
||||
static void checkHeaters();
|
||||
static void sendFileList(int8_t);
|
||||
static void selectFile();
|
||||
static void processPanelRequest();
|
||||
static void panelInfo(uint8_t);
|
||||
static void panelAction(uint8_t);
|
||||
static void panelProcess(uint8_t);
|
||||
|
||||
static void SendValueToTFT(const uint16_t value, const uint16_t address);
|
||||
static void RequestValueFromTFT(const uint16_t address);
|
||||
|
@ -37,17 +37,17 @@ using namespace Anycubic;
|
||||
|
||||
namespace ExtUI {
|
||||
|
||||
void onStartup() { Dgus.Startup(); }
|
||||
void onStartup() { Dgus.startup(); }
|
||||
|
||||
void onIdle() { Dgus.IdleLoop(); }
|
||||
void onIdle() { Dgus.idleLoop(); }
|
||||
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
|
||||
Dgus.PrinterKilled(error, component);
|
||||
Dgus.printerKilled(error, component);
|
||||
}
|
||||
|
||||
void onMediaInserted() { Dgus.MediaEvent(AC_media_inserted); }
|
||||
void onMediaError() { Dgus.MediaEvent(AC_media_error); }
|
||||
void onMediaRemoved() { Dgus.MediaEvent(AC_media_removed); }
|
||||
void onMediaInserted() { Dgus.mediaEvent(AC_media_inserted); }
|
||||
void onMediaError() { Dgus.mediaEvent(AC_media_error); }
|
||||
void onMediaRemoved() { Dgus.mediaEvent(AC_media_removed); }
|
||||
|
||||
void onPlayTone(const uint16_t frequency, const uint16_t duration) {
|
||||
#if ENABLED(SPEAKER)
|
||||
@ -55,15 +55,15 @@ namespace ExtUI {
|
||||
#endif
|
||||
}
|
||||
|
||||
void onPrintTimerStarted() { Dgus.TimerEvent(AC_timer_started); }
|
||||
void onPrintTimerPaused() { Dgus.TimerEvent(AC_timer_paused); }
|
||||
void onPrintTimerStopped() { Dgus.TimerEvent(AC_timer_stopped); }
|
||||
void onPrintTimerStarted() { Dgus.timerEvent(AC_timer_started); }
|
||||
void onPrintTimerPaused() { Dgus.timerEvent(AC_timer_paused); }
|
||||
void onPrintTimerStopped() { Dgus.timerEvent(AC_timer_stopped); }
|
||||
void onPrintDone() {}
|
||||
|
||||
void onFilamentRunout(const extruder_t) { Dgus.FilamentRunout(); }
|
||||
void onFilamentRunout(const extruder_t) { Dgus.filamentRunout(); }
|
||||
|
||||
void onUserConfirmRequired(const char * const msg) { Dgus.ConfirmationRequest(msg); }
|
||||
void onStatusChanged(const char * const msg) { Dgus.StatusChange(msg); }
|
||||
void onUserConfirmRequired(const char * const msg) { Dgus.confirmationRequest(msg); }
|
||||
void onStatusChanged(const char * const msg) { Dgus.statusChange(msg); }
|
||||
|
||||
void onHomingStart() { Dgus.HomingStart(); }
|
||||
void onHomingDone() { Dgus.HomingComplete(); }
|
||||
@ -129,7 +129,7 @@ namespace ExtUI {
|
||||
// Called when power-loss state is detected
|
||||
void onPowerLoss() { /* handled internally */ }
|
||||
// Called on resume from power-loss
|
||||
void onPowerLossResume() { Dgus.PowerLossRecovery(); }
|
||||
void onPowerLossResume() { Dgus.powerLossRecovery(); }
|
||||
#endif
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
|
@ -220,7 +220,7 @@ void DGUSDisplay::ProcessRx() {
|
||||
}
|
||||
}
|
||||
|
||||
size_t DGUSDisplay::GetFreeTxBuffer() { return SERIAL_GET_TX_BUFFER_FREE(); }
|
||||
size_t DGUSDisplay::GetFreeTxBuffer() { return LCD_SERIAL_TX_BUFFER_FREE(); }
|
||||
|
||||
void DGUSDisplay::WriteHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen) {
|
||||
LCD_SERIAL.write(DGUS_HEADER1);
|
||||
|
@ -157,7 +157,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
}
|
||||
#endif
|
||||
char axiscode;
|
||||
uint16_t speed = manual_feedrate_mm_m[X_AXIS]; // Default feedrate for manual moves
|
||||
uint16_t speed = manual_feedrate_mm_m.x; // Default feedrate for manual moves
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
@ -172,7 +172,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#if HAS_Y_AXIS
|
||||
case VP_MOVE_Y:
|
||||
axiscode = 'Y';
|
||||
speed = manual_feedrate_mm_m[Y_AXIS];
|
||||
speed = manual_feedrate_mm_m.y;
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove;
|
||||
break;
|
||||
#endif
|
||||
@ -180,7 +180,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#if HAS_Z_AXIS
|
||||
case VP_MOVE_Z:
|
||||
axiscode = 'Z';
|
||||
speed = manual_feedrate_mm_m[Z_AXIS];
|
||||
speed = manual_feedrate_mm_m.z;
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove;
|
||||
break;
|
||||
#endif
|
||||
|
@ -157,7 +157,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
}
|
||||
#endif
|
||||
char axiscode;
|
||||
uint16_t speed = manual_feedrate_mm_m[X_AXIS]; // Default feedrate for manual moves
|
||||
uint16_t speed = manual_feedrate_mm_m.x; // Default feedrate for manual moves
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
@ -172,7 +172,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#if HAS_Y_AXIS
|
||||
case VP_MOVE_Y:
|
||||
axiscode = 'Y';
|
||||
speed = manual_feedrate_mm_m[Y_AXIS];
|
||||
speed = manual_feedrate_mm_m.y;
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove;
|
||||
break;
|
||||
#endif
|
||||
@ -180,7 +180,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#if HAS_Z_AXIS
|
||||
case VP_MOVE_Z:
|
||||
axiscode = 'Z';
|
||||
speed = manual_feedrate_mm_m[Z_AXIS];
|
||||
speed = manual_feedrate_mm_m.z;
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove;
|
||||
break;
|
||||
#endif
|
||||
|
@ -739,7 +739,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
return;
|
||||
|
||||
char axiscode;
|
||||
uint16_t speed = manual_feedrate_mm_m[X_AXIS]; // Default feedrate for manual moves
|
||||
uint16_t speed = manual_feedrate_mm_m.x; // Default feedrate for manual moves
|
||||
|
||||
switch (var.VP) { // switch X Y Z or Home
|
||||
default: return;
|
||||
@ -753,7 +753,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#if HAS_Y_AXIS
|
||||
case VP_MOVE_Y:
|
||||
axiscode = 'Y';
|
||||
speed = manual_feedrate_mm_m[Y_AXIS];
|
||||
speed = manual_feedrate_mm_m.y;
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove;
|
||||
break;
|
||||
#endif
|
||||
@ -761,7 +761,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#if HAS_Z_AXIS
|
||||
case VP_MOVE_Z:
|
||||
axiscode = 'Z';
|
||||
speed = manual_feedrate_mm_m[Z_AXIS];
|
||||
speed = manual_feedrate_mm_m.z;
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove;
|
||||
break;
|
||||
#endif
|
||||
|
@ -157,7 +157,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
}
|
||||
#endif
|
||||
char axiscode;
|
||||
uint16_t speed = manual_feedrate_mm_m[X_AXIS]; // Default feedrate for manual moves
|
||||
uint16_t speed = manual_feedrate_mm_m.x; // Default feedrate for manual moves
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
@ -172,7 +172,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#if HAS_Y_AXIS
|
||||
case VP_MOVE_Y:
|
||||
axiscode = 'Y';
|
||||
speed = manual_feedrate_mm_m[Y_AXIS];
|
||||
speed = manual_feedrate_mm_m.y;
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove;
|
||||
break;
|
||||
#endif
|
||||
@ -180,7 +180,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#if HAS_Z_AXIS
|
||||
case VP_MOVE_Z:
|
||||
axiscode = 'Z';
|
||||
speed = manual_feedrate_mm_m[Z_AXIS];
|
||||
speed = manual_feedrate_mm_m.z;
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove;
|
||||
break;
|
||||
#endif
|
||||
|
@ -111,7 +111,7 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) {
|
||||
dgus_screen_handler.TriggerFullUpdate();
|
||||
}
|
||||
|
||||
void DGUSRxHandler::SelectFile(DGUS_VP &vp, void *data_ptr) {
|
||||
void DGUSRxHandler::selectFile(DGUS_VP &vp, void *data_ptr) {
|
||||
UNUSED(vp);
|
||||
|
||||
const uint8_t index = ((uint8_t*)data_ptr)[1];
|
||||
|
@ -30,7 +30,7 @@ namespace DGUSRxHandler {
|
||||
|
||||
#if HAS_MEDIA
|
||||
void Scroll(DGUS_VP &, void *);
|
||||
void SelectFile(DGUS_VP &, void *);
|
||||
void selectFile(DGUS_VP &, void *);
|
||||
void PrintFile(DGUS_VP &, void *);
|
||||
#endif
|
||||
|
||||
|
@ -148,7 +148,7 @@ void DGUSScreenHandler::Loop() {
|
||||
dgus_display.Loop();
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::PrinterKilled(FSTR_P const error, FSTR_P const component) {
|
||||
void DGUSScreenHandler::printerKilled(FSTR_P const error, FSTR_P const component) {
|
||||
SetMessageLine(error, 1);
|
||||
SetMessageLine(component, 2);
|
||||
SetMessageLinePGM(NUL_STR, 3);
|
||||
@ -271,7 +271,7 @@ void DGUSScreenHandler::PrintTimerStopped() {
|
||||
TriggerScreenChange(DGUS_Screen::PRINT_FINISHED);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::FilamentRunout(const ExtUI::extruder_t extruder) {
|
||||
void DGUSScreenHandler::filamentRunout(const ExtUI::extruder_t extruder) {
|
||||
char buffer[21];
|
||||
|
||||
snprintf_P(buffer, sizeof(buffer), GET_TEXT(DGUS_MSG_FILAMENT_RUNOUT), extruder);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
static void Ready();
|
||||
static void Loop();
|
||||
|
||||
static void PrinterKilled(FSTR_P const error, FSTR_P const component);
|
||||
static void printerKilled(FSTR_P const error, FSTR_P const component);
|
||||
static void UserConfirmRequired(const char * const msg);
|
||||
static void SettingsReset();
|
||||
static void StoreSettings(char *buff);
|
||||
@ -50,7 +50,7 @@ public:
|
||||
static void PrintTimerStarted();
|
||||
static void PrintTimerPaused();
|
||||
static void PrintTimerStopped();
|
||||
static void FilamentRunout(const ExtUI::extruder_t extruder);
|
||||
static void filamentRunout(const ExtUI::extruder_t extruder);
|
||||
|
||||
#if HAS_MEDIA
|
||||
/// Marlin informed us that a new SD has been inserted.
|
||||
|
@ -81,7 +81,7 @@ const struct DGUS_VP vp_list[] PROGMEM = {
|
||||
VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_Printing, &DGUSRxHandler::ScreenChange),
|
||||
|
||||
#if HAS_MEDIA
|
||||
VP_HELPER_RX(DGUS_Addr::SD_SelectFile, &DGUSRxHandler::SelectFile),
|
||||
VP_HELPER_RX(DGUS_Addr::SD_SelectFile, &DGUSRxHandler::selectFile),
|
||||
VP_HELPER_RX(DGUS_Addr::SD_Scroll, &DGUSRxHandler::Scroll),
|
||||
VP_HELPER_RX_NODATA(DGUS_Addr::SD_Print, &DGUSRxHandler::PrintFile),
|
||||
#endif
|
||||
|
@ -47,7 +47,7 @@ namespace ExtUI {
|
||||
}
|
||||
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
|
||||
dgus_screen_handler.PrinterKilled(error, component);
|
||||
dgus_screen_handler.printerKilled(error, component);
|
||||
}
|
||||
|
||||
void onMediaInserted() { TERN_(HAS_MEDIA, dgus_screen_handler.SDCardInserted()); }
|
||||
@ -71,7 +71,7 @@ namespace ExtUI {
|
||||
}
|
||||
|
||||
void onFilamentRunout(const extruder_t extruder) {
|
||||
dgus_screen_handler.FilamentRunout(extruder);
|
||||
dgus_screen_handler.filamentRunout(extruder);
|
||||
}
|
||||
|
||||
void onUserConfirmRequired(const char * const msg) {
|
||||
|
@ -33,23 +33,23 @@
|
||||
|
||||
#if DGUS_LCD_UI_IA_CREALITY
|
||||
|
||||
#include "ia_creality_extui.h"
|
||||
#include "ia_creality_rts.h"
|
||||
#include "FileNavigator.h"
|
||||
|
||||
using namespace ExtUI;
|
||||
#include <WString.h>
|
||||
|
||||
FileList FileNavigator::filelist; // Instance of the Marlin file API
|
||||
char FileNavigator::currentfoldername[MAX_PATH_LEN]; // Current folder path
|
||||
ExtUI::FileList FileNavigator::filelist; // ExtUI file API
|
||||
char FileNavigator::currentDirPath[MAX_PATH_LEN]; // Current folder path
|
||||
uint16_t FileNavigator::lastindex;
|
||||
uint8_t FileNavigator::folderdepth;
|
||||
uint16_t FileNavigator::currentindex; // override the panel request
|
||||
uint16_t FileNavigator::currentindex; // override the panel request
|
||||
|
||||
FileNavigator filenavigator;
|
||||
|
||||
FileNavigator::FileNavigator() { reset(); }
|
||||
|
||||
void FileNavigator::reset() {
|
||||
currentfoldername[0] = '\0';
|
||||
currentDirPath[0] = '\0';
|
||||
folderdepth = 0;
|
||||
currentindex = 0;
|
||||
lastindex = 0;
|
||||
@ -136,7 +136,7 @@ void FileNavigator::getFiles(uint16_t index) {
|
||||
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");
|
||||
SERIAL_ECHOLNPGM("-", seek, " '", filelist.filename(), "' '", currentDirPath, "", filelist.shortFilename(), "'\n");
|
||||
fcnt++;
|
||||
}
|
||||
}
|
||||
@ -144,8 +144,8 @@ void FileNavigator::getFiles(uint16_t index) {
|
||||
|
||||
void FileNavigator::changeDIR(char *folder) {
|
||||
if (folderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth
|
||||
strcat(currentfoldername, folder);
|
||||
strcat(currentfoldername, "/");
|
||||
strcat(currentDirPath, folder);
|
||||
strcat(currentDirPath, "/");
|
||||
filelist.changeDir(folder);
|
||||
refresh();
|
||||
folderdepth++;
|
||||
@ -159,17 +159,17 @@ void FileNavigator::upDIR() {
|
||||
currentindex = 0;
|
||||
// Remove the last child folder from the stored path
|
||||
if (folderdepth == 0) {
|
||||
currentfoldername[0] = '\0';
|
||||
currentDirPath[0] = '\0';
|
||||
reset();
|
||||
}
|
||||
else {
|
||||
char *pos = nullptr;
|
||||
for (uint8_t f = 0; f < folderdepth; f++)
|
||||
pos = strchr(currentfoldername, '/');
|
||||
pos = strchr(currentDirPath, '/');
|
||||
pos[1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
char* FileNavigator::getCurrentFolderName() { return currentfoldername; }
|
||||
char* FileNavigator::getCurrentDirPath() { return currentDirPath; }
|
||||
|
||||
#endif // DGUS_LCD_UI_IA_CREALITY
|
||||
|
@ -30,13 +30,12 @@
|
||||
* Written by Insanity Automation
|
||||
* ***************************************/
|
||||
|
||||
#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();
|
||||
@ -45,15 +44,15 @@ class FileNavigator {
|
||||
static void upDIR();
|
||||
static void changeDIR(char *);
|
||||
static void refresh();
|
||||
static char* getCurrentFolderName();
|
||||
static char* getCurrentDirPath();
|
||||
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 ExtUI::FileList filelist;
|
||||
static char currentDirPath[MAX_PATH_LEN];
|
||||
static uint16_t lastindex;
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
1730
Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp
Normal file
1730
Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -22,18 +22,18 @@
|
||||
#pragma once
|
||||
|
||||
/* ****************************************
|
||||
* lcd/extui/ia_creality/ia_creality_extui.h
|
||||
* lcd/extui/ia_creality/ia_creality_rts.h
|
||||
* ****************************************
|
||||
* Extensible_UI implementation for Creality DWIN
|
||||
* 10SPro, Max, CRX, and others
|
||||
* Based original Creality release, ported to ExtUI for Marlin 2.0
|
||||
* Based original Creality release
|
||||
* Written by Insanity Automation, sponsored by Tiny Machines 3D
|
||||
*
|
||||
* ***************************************/
|
||||
|
||||
#include "../ui_api.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <WString.h>
|
||||
|
||||
/*********************************/
|
||||
#define FHONE (0x5A)
|
||||
@ -211,7 +211,7 @@ struct creality_dwin_settings_t {
|
||||
bool display_sound;
|
||||
int8_t screen_rotation;
|
||||
int16_t display_volume;
|
||||
uint8_t standby_screen_brightness;
|
||||
uint8_t standby_brightness;
|
||||
uint8_t screen_brightness;
|
||||
int16_t standby_time_seconds;
|
||||
};
|
||||
@ -297,3 +297,19 @@ void RTS_Update();
|
||||
#else
|
||||
#define MEASURING_GCODE MAIN_MENU_ITEM_1_GCODE
|
||||
#endif
|
||||
|
||||
// Data shared by RTS and ExtUI
|
||||
extern uint16_t fileIndex;
|
||||
extern uint8_t recordcount;
|
||||
extern uint8_t startprogress;
|
||||
extern char waitway;
|
||||
extern char printerStatusKey[2]; // [0] = 0:ready [1] = 0:keep temperature, 1:heating, 2:cooling, 3:printing
|
||||
extern bool show_status;
|
||||
extern bool tpShowStatus; // true: opening time/percentage, false: closing time/percentage
|
||||
extern uint8_t lastPauseMsgState;
|
||||
extern creality_dwin_settings_t dwin_settings;
|
||||
extern bool no_reentry;
|
||||
#if HAS_PID_HEATING
|
||||
extern uint16_t pid_hotendAutoTemp;
|
||||
extern uint16_t pid_bedAutoTemp;
|
||||
#endif
|
@ -137,7 +137,6 @@ void tft_lvgl_init() {
|
||||
#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
|
||||
uint16_t usb_flash_loop = 1000;
|
||||
#if ENABLED(MULTI_VOLUME) && !HAS_SD_HOST_DRIVE
|
||||
SET_INPUT_PULLUP(SD_DETECT_PIN);
|
||||
if (IS_SD_INSERTED())
|
||||
card.changeMedia(&card.media_driver_sdcard);
|
||||
else
|
||||
|
@ -39,18 +39,18 @@ using namespace ExtUI;
|
||||
#define DEBUG_OUT NEXDEBUGLEVEL
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
FileList FileNavigator::filelist; // Instance of the Marlin file API
|
||||
char FileNavigator::currentfoldername[MAX_PATH_LEN]; // Current folder path
|
||||
FileList FileNavigator::filelist; // ExtUI file API
|
||||
char FileNavigator::currentDirPath[MAX_PATH_LEN]; // Current folder path
|
||||
uint16_t FileNavigator::lastindex;
|
||||
uint8_t FileNavigator::folderdepth;
|
||||
uint16_t FileNavigator::currentindex; // override the panel request
|
||||
uint16_t FileNavigator::currentindex; // override the panel request
|
||||
|
||||
FileNavigator filenavigator;
|
||||
|
||||
FileNavigator::FileNavigator() { reset(); }
|
||||
|
||||
void FileNavigator::reset() {
|
||||
currentfoldername[0] = '\0';
|
||||
currentDirPath[0] = '\0';
|
||||
folderdepth = 0;
|
||||
currentindex = 0;
|
||||
lastindex = 0;
|
||||
@ -83,51 +83,51 @@ void FileNavigator::getFiles(uint16_t index) {
|
||||
#endif
|
||||
|
||||
if (currentindex == 0 && folderdepth > 0) { // Add a link to go up a folder
|
||||
nextion.SendtoTFT(F("vis p0,1"));
|
||||
nextion.SendtoTFT(F("\xFF\xFF\xFF"));
|
||||
nextion.tftSend(F("vis p0,1"));
|
||||
nextion.tftSend(F("\xFF\xFF\xFF"));
|
||||
SEND_VAL("tmpUP", "0");
|
||||
files--;
|
||||
}
|
||||
else {
|
||||
nextion.SendtoTFT(F("vis p0,0"));
|
||||
nextion.SendtoTFT(F("\xFF\xFF\xFF"));
|
||||
nextion.tftSend(F("vis p0,0"));
|
||||
nextion.tftSend(F("\xFF\xFF\xFF"));
|
||||
}
|
||||
|
||||
for (uint16_t seek = currentindex; seek < currentindex + files; seek++) {
|
||||
if (filelist.seek(seek)) {
|
||||
nextion.SendtoTFT(F("s"));
|
||||
nextion.tftSend(F("s"));
|
||||
LCD_SERIAL.print(fcnt);
|
||||
nextion.SendtoTFT(F(".txt=\""));
|
||||
nextion.tftSend(F(".txt=\""));
|
||||
if (filelist.isDir()) {
|
||||
LCD_SERIAL.print(filelist.shortFilename());
|
||||
nextion.SendtoTFT(F("/\""));
|
||||
nextion.SendtoTFT(F("\xFF\xFF\xFF"));
|
||||
nextion.tftSend(F("/\""));
|
||||
nextion.tftSend(F("\xFF\xFF\xFF"));
|
||||
|
||||
nextion.SendtoTFT(F("l"));
|
||||
nextion.tftSend(F("l"));
|
||||
LCD_SERIAL.print(fcnt);
|
||||
nextion.SendtoTFT(F(".txt=\""));
|
||||
nextion.tftSend(F(".txt=\""));
|
||||
LCD_SERIAL.print(filelist.filename());
|
||||
nextion.SendtoTFT(F("\""));
|
||||
nextion.SendtoTFT(F("\xFF\xFF\xFF"));
|
||||
nextion.tftSend(F("\""));
|
||||
nextion.tftSend(F("\xFF\xFF\xFF"));
|
||||
SEND_PCO2("l", fcnt, "1055");
|
||||
}
|
||||
else {
|
||||
LCD_SERIAL.print(currentfoldername);
|
||||
LCD_SERIAL.print(currentDirPath);
|
||||
LCD_SERIAL.print(filelist.shortFilename());
|
||||
nextion.SendtoTFT(F("\""));
|
||||
nextion.SendtoTFT(F("\xFF\xFF\xFF"));
|
||||
nextion.tftSend(F("\""));
|
||||
nextion.tftSend(F("\xFF\xFF\xFF"));
|
||||
|
||||
nextion.SendtoTFT(F("l"));
|
||||
nextion.tftSend(F("l"));
|
||||
LCD_SERIAL.print(fcnt);
|
||||
nextion.SendtoTFT(F(".txt=\""));
|
||||
nextion.tftSend(F(".txt=\""));
|
||||
LCD_SERIAL.print(filelist.longFilename());
|
||||
nextion.SendtoTFT(F("\""));
|
||||
nextion.SendtoTFT(F("\xFF\xFF\xFF"));
|
||||
nextion.tftSend(F("\""));
|
||||
nextion.tftSend(F("\xFF\xFF\xFF"));
|
||||
}
|
||||
fcnt++;
|
||||
fseek = seek;
|
||||
#if NEXDEBUG(AC_FILE)
|
||||
DEBUG_ECHOLNPGM("-", seek, " '", filelist.longFilename(), "' '", currentfoldername, "", filelist.shortFilename(), "'\n");
|
||||
DEBUG_ECHOLNPGM("-", seek, " '", filelist.longFilename(), "' '", currentDirPath, "", filelist.shortFilename(), "'\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -137,11 +137,11 @@ void FileNavigator::getFiles(uint16_t index) {
|
||||
|
||||
void FileNavigator::changeDIR(char *folder) {
|
||||
#if NEXDEBUG(AC_FILE)
|
||||
DEBUG_ECHOLNPGM("currentfolder: ", currentfoldername, " New: ", folder);
|
||||
DEBUG_ECHOLNPGM("currentfolder: ", currentDirPath, " New: ", folder);
|
||||
#endif
|
||||
if (folderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth
|
||||
strcat(currentfoldername, folder);
|
||||
strcat(currentfoldername, "/");
|
||||
strcat(currentDirPath, folder);
|
||||
strcat(currentDirPath, "/");
|
||||
filelist.changeDir(folder);
|
||||
refresh();
|
||||
folderdepth++;
|
||||
@ -155,20 +155,20 @@ void FileNavigator::upDIR() {
|
||||
currentindex = 0;
|
||||
// Remove the last child folder from the stored path
|
||||
if (folderdepth == 0) {
|
||||
currentfoldername[0] = '\0';
|
||||
currentDirPath[0] = '\0';
|
||||
reset();
|
||||
}
|
||||
else {
|
||||
char *pos = nullptr;
|
||||
for (uint8_t f = 0; f < folderdepth; f++)
|
||||
pos = strchr(currentfoldername, '/');
|
||||
pos = strchr(currentDirPath, '/');
|
||||
pos[1] = '\0';
|
||||
}
|
||||
#if NEXDEBUG(AC_FILE)
|
||||
DEBUG_ECHOLNPGM("depth: ", folderdepth, " currentfoldername: ", currentfoldername);
|
||||
DEBUG_ECHOLNPGM("depth: ", folderdepth, " currentDirPath: ", currentDirPath);
|
||||
#endif
|
||||
}
|
||||
|
||||
char* FileNavigator::getCurrentFolderName() { return currentfoldername; }
|
||||
char* FileNavigator::getCurrentDirPath() { return currentDirPath; }
|
||||
|
||||
#endif // NEXTION_TFT
|
||||
|
@ -41,10 +41,10 @@ class FileNavigator {
|
||||
static void upDIR();
|
||||
static void changeDIR(char *);
|
||||
static void refresh();
|
||||
static char* getCurrentFolderName();
|
||||
static char* getCurrentDirPath();
|
||||
private:
|
||||
static FileList filelist;
|
||||
static char currentfoldername[MAX_PATH_LEN];
|
||||
static char currentDirPath[MAX_PATH_LEN];
|
||||
static uint16_t lastindex;
|
||||
static uint8_t folderdepth;
|
||||
static uint16_t currentindex;
|
||||
|
@ -35,9 +35,9 @@
|
||||
|
||||
namespace ExtUI {
|
||||
|
||||
void onStartup() { nextion.Startup(); }
|
||||
void onIdle() { nextion.IdleLoop(); }
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const component) { nextion.PrinterKilled(error, component); }
|
||||
void onStartup() { nextion.startup(); }
|
||||
void onIdle() { nextion.idleLoop(); }
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const component) { nextion.printerKilled(error, component); }
|
||||
void onMediaInserted() {}
|
||||
void onMediaError() {}
|
||||
void onMediaRemoved() {}
|
||||
@ -46,8 +46,8 @@ namespace ExtUI {
|
||||
void onPrintTimerPaused() {}
|
||||
void onPrintTimerStopped() {}
|
||||
void onFilamentRunout(const extruder_t) {}
|
||||
void onUserConfirmRequired(const char * const msg) { nextion.ConfirmationRequest(msg); }
|
||||
void onStatusChanged(const char * const msg) { nextion.StatusChange(msg); }
|
||||
void onUserConfirmRequired(const char * const msg) { nextion.confirmationRequest(msg); }
|
||||
void onStatusChanged(const char * const msg) { nextion.statusChange(msg); }
|
||||
|
||||
void onHomingStart() {}
|
||||
void onHomingDone() {}
|
||||
@ -117,7 +117,7 @@ namespace ExtUI {
|
||||
#if HAS_PID_HEATING
|
||||
void onPidTuning(const result_t rst) {
|
||||
// Called for temperature PID tuning result
|
||||
nextion.PanelInfo(37);
|
||||
nextion.panelInfo(37);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -53,7 +53,7 @@ NextionTFT nextion;
|
||||
|
||||
NextionTFT::NextionTFT() {}
|
||||
|
||||
void NextionTFT::Startup() {
|
||||
void NextionTFT::startup() {
|
||||
selectedfile[0] = '\0';
|
||||
nextion_command[0] = '\0';
|
||||
command_len = 0;
|
||||
@ -76,15 +76,15 @@ void NextionTFT::Startup() {
|
||||
DEBUG_ECHOLNPGM("Nextion Debug Level ", NEXDEBUGLEVEL);
|
||||
}
|
||||
|
||||
void NextionTFT::IdleLoop() {
|
||||
if (ReadTFTCommand()) {
|
||||
ProcessPanelRequest();
|
||||
void NextionTFT::idleLoop() {
|
||||
if (readTFTCommand()) {
|
||||
processPanelRequest();
|
||||
command_len = 0;
|
||||
}
|
||||
UpdateOnChange();
|
||||
}
|
||||
|
||||
void NextionTFT::PrinterKilled(FSTR_P const error, FSTR_P const component) {
|
||||
void NextionTFT::printerKilled(FSTR_P const error, FSTR_P const component) {
|
||||
SEND_TXT_END("page error");
|
||||
SEND_TXT_F("t3", F("Error"));
|
||||
SEND_TXT_F("t4", component);
|
||||
@ -96,21 +96,21 @@ void NextionTFT::PrintFinished() {
|
||||
SEND_TXT_END("page printfinished");
|
||||
}
|
||||
|
||||
void NextionTFT::ConfirmationRequest(const char * const msg) {
|
||||
void NextionTFT::confirmationRequest(const char * const msg) {
|
||||
SEND_VALasTXT("tmppage.M117", msg);
|
||||
#if NEXDEBUG(N_MARLIN)
|
||||
DEBUG_ECHOLNPGM("ConfirmationRequest() ", msg, " printer_state:", printer_state);
|
||||
DEBUG_ECHOLNPGM("confirmationRequest() ", msg, " printer_state:", printer_state);
|
||||
#endif
|
||||
}
|
||||
|
||||
void NextionTFT::StatusChange(const char * const msg) {
|
||||
void NextionTFT::statusChange(const char * const msg) {
|
||||
#if NEXDEBUG(N_MARLIN)
|
||||
DEBUG_ECHOLNPGM("StatusChange() ", msg, "\nprinter_state:", printer_state);
|
||||
DEBUG_ECHOLNPGM("statusChange() ", msg, "\nprinter_state:", printer_state);
|
||||
#endif
|
||||
SEND_VALasTXT("tmppage.M117", msg);
|
||||
}
|
||||
|
||||
void NextionTFT::SendtoTFT(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel
|
||||
void NextionTFT::tftSend(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel
|
||||
#if NEXDEBUG(N_SOME)
|
||||
DEBUG_ECHOF(fstr);
|
||||
#endif
|
||||
@ -118,7 +118,7 @@ void NextionTFT::SendtoTFT(FSTR_P const fstr/*=nullptr*/) { // A helper to print
|
||||
while (const char c = pgm_read_byte(str++)) LCD_SERIAL.write(c);
|
||||
}
|
||||
|
||||
bool NextionTFT::ReadTFTCommand() {
|
||||
bool NextionTFT::readTFTCommand() {
|
||||
bool command_ready = false;
|
||||
while ((LCD_SERIAL.available() > 0) && (command_len < MAX_CMND_LEN)) {
|
||||
nextion_command[command_len] = LCD_SERIAL.read();
|
||||
@ -149,15 +149,15 @@ bool NextionTFT::ReadTFTCommand() {
|
||||
return command_ready;
|
||||
}
|
||||
|
||||
void NextionTFT::SendFileList(int8_t startindex) {
|
||||
void NextionTFT::sendFileList(int8_t startindex) {
|
||||
// respond to panel request for 7 files starting at index
|
||||
#if NEXDEBUG(N_INFO)
|
||||
DEBUG_ECHOLNPGM("## SendFileList ## ", startindex);
|
||||
DEBUG_ECHOLNPGM("## sendFileList ## ", startindex);
|
||||
#endif
|
||||
filenavigator.getFiles(startindex);
|
||||
}
|
||||
|
||||
void NextionTFT::SelectFile() {
|
||||
void NextionTFT::selectFile() {
|
||||
strncpy(selectedfile, nextion_command + 4, command_len - 4);
|
||||
selectedfile[command_len - 5] = '\0';
|
||||
#if NEXDEBUG(N_FILE)
|
||||
@ -169,11 +169,11 @@ void NextionTFT::SelectFile() {
|
||||
break;
|
||||
case '<': // .. (go up folder level)
|
||||
filenavigator.upDIR();
|
||||
SendFileList(0);
|
||||
sendFileList(0);
|
||||
break;
|
||||
default: // enter sub folder
|
||||
filenavigator.changeDIR(selectedfile);
|
||||
SendFileList(0);
|
||||
sendFileList(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -188,24 +188,24 @@ void NextionTFT::_format_time(char *outstr, uint32_t time) {
|
||||
sprintf_P(outstr, PSTR("%02d:%02ds"), min, sec);
|
||||
}
|
||||
|
||||
void NextionTFT::ProcessPanelRequest() {
|
||||
void NextionTFT::processPanelRequest() {
|
||||
// Break these up into logical blocks as its easier to navigate than one huge switch case!
|
||||
if (nextion_command[0] == 'X') {
|
||||
int8_t req = atoi(&nextion_command[1]);
|
||||
|
||||
// Information requests
|
||||
if (req <= 49)
|
||||
PanelInfo(req);
|
||||
panelInfo(req);
|
||||
|
||||
// Simple Actions
|
||||
else if (req >= 50)
|
||||
PanelAction(req);
|
||||
panelAction(req);
|
||||
}
|
||||
}
|
||||
|
||||
#define SEND_NA(A) SEND_TXT(A, "n/a")
|
||||
|
||||
void NextionTFT::PanelInfo(uint8_t req) {
|
||||
void NextionTFT::panelInfo(uint8_t req) {
|
||||
switch (req) {
|
||||
case 0: break;
|
||||
|
||||
@ -216,7 +216,7 @@ void NextionTFT::PanelInfo(uint8_t req) {
|
||||
//SEND_TXT("tmppage.M117", msg_no_sd_card);
|
||||
}
|
||||
else if (nextion_command[3] == 'S')
|
||||
SendFileList(atoi(&nextion_command[4]));
|
||||
sendFileList(atoi(&nextion_command[4]));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -488,7 +488,7 @@ void NextionTFT::PanelInfo(uint8_t req) {
|
||||
}
|
||||
}
|
||||
|
||||
void NextionTFT::PanelAction(uint8_t req) {
|
||||
void NextionTFT::panelAction(uint8_t req) {
|
||||
switch (req) {
|
||||
|
||||
case 50: // Pause SD print
|
||||
@ -512,7 +512,7 @@ void NextionTFT::PanelAction(uint8_t req) {
|
||||
break;
|
||||
|
||||
case 54: // A13 Select file
|
||||
SelectFile();
|
||||
selectFile();
|
||||
break;
|
||||
|
||||
case 65: // Cool Down
|
||||
|
@ -40,23 +40,23 @@ class NextionTFT {
|
||||
|
||||
public:
|
||||
NextionTFT();
|
||||
static void Startup();
|
||||
static void IdleLoop();
|
||||
static void PrinterKilled(FSTR_P const, FSTR_P const);
|
||||
static void ConfirmationRequest(const char * const);
|
||||
static void StatusChange(const char * const);
|
||||
static void SendtoTFT(FSTR_P const=nullptr);
|
||||
//static void SendtoTFTLN(FSTR_P const=nullptr);
|
||||
static void startup();
|
||||
static void idleLoop();
|
||||
static void printerKilled(FSTR_P const, FSTR_P const);
|
||||
static void confirmationRequest(const char * const);
|
||||
static void statusChange(const char * const);
|
||||
static void tftSend(FSTR_P const=nullptr);
|
||||
//static void tftSendLn(FSTR_P const=nullptr);
|
||||
static void UpdateOnChange();
|
||||
static void PrintFinished();
|
||||
static void PanelInfo(uint8_t);
|
||||
static void panelInfo(uint8_t);
|
||||
|
||||
private:
|
||||
static bool ReadTFTCommand();
|
||||
static void SendFileList(int8_t);
|
||||
static void SelectFile();
|
||||
static void ProcessPanelRequest();
|
||||
static void PanelAction(uint8_t);
|
||||
static bool readTFTCommand();
|
||||
static void sendFileList(int8_t);
|
||||
static void selectFile();
|
||||
static void processPanelRequest();
|
||||
static void panelAction(uint8_t);
|
||||
static void _format_time(char *, uint32_t);
|
||||
};
|
||||
|
||||
|
@ -54,10 +54,10 @@
|
||||
// TFT panel commands
|
||||
#define msg_welcome MACHINE_NAME " Ready."
|
||||
|
||||
#define SEND_TEMP(x,y,t,z) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(F(t)), LCD_SERIAL.print(z), nextion.SendtoTFT(F("\"\xFF\xFF\xFF")))
|
||||
#define SEND_VAL(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".val=")), LCD_SERIAL.print(y), nextion.SendtoTFT(F("\xFF\xFF\xFF")))
|
||||
#define SEND_TXT(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), nextion.SendtoTFT(F(y)), nextion.SendtoTFT(F("\"\xFF\xFF\xFF")))
|
||||
#define SEND_TXT_F(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), nextion.SendtoTFT(y), nextion.SendtoTFT(F("\"\xFF\xFF\xFF")))
|
||||
#define SEND_VALasTXT(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(F("\"\xFF\xFF\xFF")))
|
||||
#define SEND_TXT_END(x) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F("\xFF\xFF\xFF")))
|
||||
#define SEND_PCO2(x,y,z) (nextion.SendtoTFT(F(x)), LCD_SERIAL.print(y), nextion.SendtoTFT(F(".pco=")), nextion.SendtoTFT(F(z)), nextion.SendtoTFT(F("\xFF\xFF\xFF")))
|
||||
#define SEND_TEMP(x,y,t,z) (nextion.tftSend(F(x)), nextion.tftSend(F(".txt=\"")), LCD_SERIAL.print(y), nextion.tftSend(F(t)), LCD_SERIAL.print(z), nextion.tftSend(F("\"\xFF\xFF\xFF")))
|
||||
#define SEND_VAL(x,y) (nextion.tftSend(F(x)), nextion.tftSend(F(".val=")), LCD_SERIAL.print(y), nextion.tftSend(F("\xFF\xFF\xFF")))
|
||||
#define SEND_TXT(x,y) (nextion.tftSend(F(x)), nextion.tftSend(F(".txt=\"")), nextion.tftSend(F(y)), nextion.tftSend(F("\"\xFF\xFF\xFF")))
|
||||
#define SEND_TXT_F(x,y) (nextion.tftSend(F(x)), nextion.tftSend(F(".txt=\"")), nextion.tftSend(y), nextion.tftSend(F("\"\xFF\xFF\xFF")))
|
||||
#define SEND_VALasTXT(x,y) (nextion.tftSend(F(x)), nextion.tftSend(F(".txt=\"")), LCD_SERIAL.print(y), nextion.tftSend(F("\"\xFF\xFF\xFF")))
|
||||
#define SEND_TXT_END(x) (nextion.tftSend(F(x)), nextion.tftSend(F("\xFF\xFF\xFF")))
|
||||
#define SEND_PCO2(x,y,z) (nextion.tftSend(F(x)), LCD_SERIAL.print(y), nextion.tftSend(F(".pco=")), nextion.tftSend(F(z)), nextion.tftSend(F("\xFF\xFF\xFF")))
|
||||
|
@ -748,9 +748,9 @@ namespace Language_en {
|
||||
LSTR MSG_MMU2_EJECT_FILAMENT = _UxGT("MMU Eject");
|
||||
LSTR MSG_MMU2_EJECT_FILAMENT_N = _UxGT("MMU Eject ~");
|
||||
LSTR MSG_MMU2_UNLOAD_FILAMENT = _UxGT("MMU Unload");
|
||||
LSTR MSG_MMU2_LOADING_FILAMENT = _UxGT("Loading Fil. %i...");
|
||||
LSTR MSG_MMU2_EJECTING_FILAMENT = _UxGT("Ejecting Fil. ...");
|
||||
LSTR MSG_MMU2_UNLOADING_FILAMENT = _UxGT("Unloading Fil....");
|
||||
LSTR MSG_MMU2_LOADING_FILAMENT = _UxGT("Filament %i Load...");
|
||||
LSTR MSG_MMU2_EJECTING_FILAMENT = _UxGT("Filament Eject...");
|
||||
LSTR MSG_MMU2_UNLOADING_FILAMENT = _UxGT("Filament Unload...");
|
||||
LSTR MSG_MMU2_ALL = _UxGT("All");
|
||||
LSTR MSG_MMU2_FILAMENT_N = _UxGT("Filament ~");
|
||||
LSTR MSG_MMU2_RESET = _UxGT("Reset MMU");
|
||||
|
Loading…
Reference in New Issue
Block a user