8 Commits

Author SHA1 Message Date
Knutwurst
b3f22b2b11 Bump builddate. 2023-05-28 17:29:59 +02:00
Knutwurst
bb8d41c0e1 Disable BLTouch Highspeed Mode by default (can be enabled via M401 S1) 2023-05-28 17:28:12 +02:00
Knutwurst
ae82913d1f Fix special menu not shown, when SD card is not inserted (Fix for #463) 2023-05-28 17:13:20 +02:00
Knutwurst
22dedaeb81 Use M600 for FilamentChange instead of regular pause() 2023-05-26 18:39:22 +02:00
Knutwurst
2b57ebccaa Add Heater Error Check. 2023-05-26 10:08:06 +02:00
Knutwurst
4a3071aa56 Some thermalManager substitutions. 2023-05-26 10:03:24 +02:00
Knutwurst
595bdd00cc Use ExtUI injectCommands() instead of queue.inject_P for PSTR. 2023-05-26 09:50:26 +02:00
Knutwurst
d5aa1e1823 Massive code cleanup by using internal ExtUI methods. 2023-05-25 21:06:45 +02:00
3 changed files with 123 additions and 168 deletions

View File

@@ -989,7 +989,7 @@
*
* Set the default state here, change with 'M401 S' or UI, use M500 to save, M502 to reset.
*/
#define BLTOUCH_HS_MODE true
#define BLTOUCH_HS_MODE false
// Safety: Enable voltage mode settings in the LCD menu.
// #define BLTOUCH_LCD_VOLTAGE_MENU

View File

@@ -44,7 +44,7 @@
#define CUSTOM_BUILD_VERSION "1.5.0-b5"
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2023-05-24"
#define STRING_DISTRIBUTION_DATE "2023-05-28"
#endif
/**

View File

@@ -166,42 +166,6 @@
#endif
}
char *itostr2(const uint8_t &x) {
int xx = x;
_conv[0] = (xx / 10) % 10 + '0';
_conv[1] = (xx) % 10 + '0';
_conv[2] = 0;
return _conv;
}
#ifndef ULTRA_LCD
#define DIGIT(n) ('0' + (n))
#define DIGIMOD(n, f) DIGIT((n) / (f) % 10)
#define RJDIGIT(n, f) ((n) >= (f) ? DIGIMOD(n, f) : ' ')
#define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-'))
char *itostr3(const int x) {
int xx = x;
_conv[4] = MINUSOR(xx, RJDIGIT(xx, 100));
_conv[5] = RJDIGIT(xx, 10);
_conv[6] = DIGIMOD(xx, 1);
return &_conv[4];
}
// Convert signed float to fixed-length string with 023.45 / -23.45 format
char *ftostr32(const float &x) {
long xx = x * 100;
_conv[1] = MINUSOR(xx, DIGIMOD(xx, 10000));
_conv[2] = DIGIMOD(xx, 1000);
_conv[3] = DIGIMOD(xx, 100);
_conv[4] = '.';
_conv[5] = DIGIMOD(xx, 10);
_conv[6] = DIGIMOD(xx, 1);
return &_conv[1];
}
#endif
using namespace ExtUI;
AnycubicTouchscreenClass::AnycubicTouchscreenClass() {
@@ -249,9 +213,11 @@
setup_OutageTestPin();
setup_PowerOffPin();
SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Ready... J12"); // J12 Ready
SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Ready... J12");
CheckHeaterError();
DoFilamentRunoutCheck();
#ifdef STARTUP_CHIME
BUZZ(100, 554);
@@ -347,7 +313,7 @@
#if ENABLED(SDSUPPORT)
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
if (READ(FIL_RUNOUT_PIN)) {
#if ENABLED(ANYCUBIC_LCD_DEBUG)
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: Resume Print with filament sensor still tripped... ");
#endif
@@ -394,7 +360,7 @@
void AnycubicTouchscreenClass::HandleSpecialMenu() {
#if ENABLED(KNUTWURST_SPECIAL_MENU)
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("DEBUG: Special Menu Selection: ", currentTouchscreenSelection);
SERIAL_ECHOPGM("TFT Serial Debug: Special Menu Selection: ", currentTouchscreenSelection);
SERIAL_EOL();
#endif
if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_SPECIAL_MENU_L)) != NULL)
@@ -408,19 +374,19 @@
SERIAL_ECHOLNPGM("Special Menu: PID Tune Hotend");
#if ANY(KNUTWURST_MEGA, KNUTWURST_MEGA_S, KNUTWURST_MEGA_P)
queue.inject_P(PSTR("G28\nG90\nG1 Z20\nG1 X110 Y110 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
injectCommands(F("G28\nG90\nG1 Z20\nG1 X110 Y110 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
#endif
#if ENABLED(KNUTWURST_MEGA_X)
queue.inject_P(PSTR("G28\nG90\nG1 Z20\nG1 X155 Y155 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
injectCommands(F("G28\nG90\nG1 Z20\nG1 X155 Y155 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
#endif
#if ENABLED(KNUTWURST_CHIRON)
queue.inject_P(PSTR("G28\nG90\nG1 Z20\nG1 X205 Y205 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
injectCommands(F("G28\nG90\nG1 Z20\nG1 X205 Y205 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
#endif
#if ENABLED(KNUTWURST_4MAXP2)
queue.inject_P(PSTR("G28\nG90\nG1 Z20\nG1 X105 Y135 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
injectCommands(F("G28\nG90\nG1 Z20\nG1 X105 Y135 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
#endif
BUZZ(200, 1108);
@@ -432,7 +398,11 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_PID_BED_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: PID Tune Ultrabase");
queue.inject_P(PSTR("M303 E-1 S60 C6 U1\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
BUZZ(200, 1108);
BUZZ(200, 1661);
BUZZ(200, 1108);
BUZZ(600, 1661);
injectCommands(F("M303 E-1 S60 C6 U1\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
BUZZ(200, 1108);
BUZZ(200, 1661);
BUZZ(200, 1108);
@@ -461,7 +431,7 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_PREHEAT_BED_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Preheat Ultrabase");
queue.inject_P(PSTR("M140 S60"));
injectCommands(F("M140 S60"));
}
#if NONE(KNUTWURST_BLTOUCH, KNUTWURST_TFT_LEVELING)
@@ -474,49 +444,49 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_MESH_START_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Start Mesh Leveling");
queue.inject_P(PSTR("G28\nG29 S1"));
injectCommands(F("G28\nG29 S1"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_MESH_NEXT_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_MESH_NEXT_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Next Mesh Point");
queue.inject_P(PSTR("G29 S2"));
injectCommands(F("G29 S2"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_UP_01_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_UP_01_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.1");
queue.inject_P(PSTR("G91\nG1 Z+0.1\nG90"));
injectCommands(F("G91\nG1 Z+0.1\nG90"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_DN_01_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_DN_01_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.1");
queue.inject_P(PSTR("G91\nG1 Z-0.1\nG90"));
injectCommands(F("G91\nG1 Z-0.1\nG90"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_UP_002_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_UP_002_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.02");
queue.inject_P(PSTR("G91\nG1 Z+0.02\nG90"));
injectCommands(F("G91\nG1 Z+0.02\nG90"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_DN_002_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_DN_002_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.02");
queue.inject_P(PSTR("G91\nG1 Z-0.02\nG90"));
injectCommands(F("G91\nG1 Z-0.02\nG90"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_UP_001_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_UP_001_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.01");
queue.inject_P(PSTR("G91\nG1 Z+0.03\nG4 P250\nG1 Z-0.02\nG90"));
injectCommands(F("G91\nG1 Z+0.03\nG4 P250\nG1 Z-0.02\nG90"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_DN_001_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_DN_001_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.01");
queue.inject_P(PSTR("G91\nG1 Z+0.02\nG4 P250\nG1 Z-0.03\nG90"));
injectCommands(F("G91\nG1 Z+0.02\nG4 P250\nG1 Z-0.03\nG90"));
}
#endif // if NONE(KNUTWURST_BLTOUCH, KNUTWURST_TFT_LEVELING)
@@ -525,7 +495,7 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_BLTOUCH_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: BLTouch Leveling");
queue.inject_P(PSTR("G28\nG29\nM500\nG90\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300\nG1 Z30 F4000\nG1 X0 F4000\nG91\nM84\nM420 S1"));
injectCommands(F("G28\nG29\nM500\nG90\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300\nG1 Z30 F4000\nG1 X0 F4000\nG91\nM84\nM420 S1"));
BUZZ(105, 1108);
BUZZ(210, 1661);
}
@@ -547,7 +517,7 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_PAUSE_L)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Fil. Change Pause");
PausePrint();
injectCommands(F("M600"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_RESUME_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_RESUME_S)) != NULL)
@@ -559,7 +529,7 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIS_FILSENS_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Disable Filament Sensor");
queue.inject_P(PSTR("M412 H0 S0\nM500"));
injectCommands(F("M412 H0 S0\nM500"));
BUZZ(105, 1108);
BUZZ(105, 1108);
BUZZ(105, 1108);
@@ -568,7 +538,7 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_EN_FILSENS_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Enable Filament Sensor");
queue.inject_P(PSTR("M412 H0 S1\nM500"));
injectCommands(F("M412 H0 S1\nM500"));
BUZZ(105, 1108);
BUZZ(105, 1108);
}
@@ -656,32 +626,32 @@
) {
SERIAL_ECHOLNPGM("Special Menu: Enter Easy Level Menu");
LevelMenu = true;
queue.inject_P(PSTR("G28\nM420 S0\nG90\nG1 Z5\nG1 X15 Y15 F4000\nG1 Z0"));
injectCommands(F("G28\nM420 S0\nG90\nG1 Z5\nG1 X15 Y15 F4000\nG1 Z0"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_P1_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_P1_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Easy Level POINT 1");
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X15 Y15 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X15 Y15 F4000\nG1 Z0"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_P2_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_P2_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Easy Level POINT 2");
#if ANY(KNUTWURST_MEGA, KNUTWURST_MEGA_S, KNUTWURST_MEGA_P)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X205 Y15 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X205 Y15 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_MEGA_X)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X295 Y15 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X295 Y15 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_CHIRON)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X385 Y15 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X385 Y15 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_4MAXP2)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X255 Y15 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X255 Y15 F4000\nG1 Z0"));
#endif
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_P3_L)) != NULL)
@@ -689,19 +659,19 @@
) {
SERIAL_ECHOLNPGM("Special Menu: Easy Level POINT 3");
#if ANY(KNUTWURST_MEGA, KNUTWURST_MEGA_S, KNUTWURST_MEGA_P)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X205 Y200 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X205 Y200 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_MEGA_X)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X295 Y295 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X295 Y295 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_CHIRON)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X395 Y395 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X395 Y395 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_4MAXP2)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X255 Y195 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X255 Y195 F4000\nG1 Z0"));
#endif
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_P4_L)) != NULL)
@@ -709,19 +679,19 @@
) {
SERIAL_ECHOLNPGM("Special Menu: Easy Level POINT 4");
#if ANY(KNUTWURST_MEGA, KNUTWURST_MEGA_S, KNUTWURST_MEGA_P)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X15 Y200 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X15 Y200 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_MEGA_X)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X15 Y295 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X15 Y295 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_CHIRON)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X15 Y395 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X15 Y395 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_4MAXP2)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X15 Y195 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X15 Y195 F4000\nG1 Z0"));
#endif
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_EXIT_L)) != NULL)
@@ -729,7 +699,7 @@
) {
SERIAL_ECHOLNPGM("Special Menu: Exit Easy Level Menu");
LevelMenu = false;
queue.inject_P(PSTR("G90\nG1 Z10\nG1 X15 Y15 F4000\nM420 S1"));
injectCommands(F("G90\nG1 Z10\nG1 X15 Y15 F4000\nM420 S1"));
}
#endif // if ENABLED(KNUTWURST_SPECIAL_MENU)
}
@@ -796,7 +766,7 @@
zOffsetBuffer = SM_BLTZ_DISP_L;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("DEBUG: Current probe.offset.z: ", float(probe.offset.z));
SERIAL_ECHOPGM("TFT Serial Debug: Current probe.offset.z: ", float(probe.offset.z));
SERIAL_EOL();
#endif
@@ -1080,7 +1050,8 @@
}
void AnycubicTouchscreenClass::CheckHeaterError() {
if ((thermalManager.degHotend(0) < 5) || (thermalManager.degHotend(0) > 300)) {
if ( (getTargetTemp_celsius((extruder_t)E0) < 5)
|| (getTargetTemp_celsius((extruder_t)E0) > 300)) {
if (HeaterCheckCount > 600000) {
HeaterCheckCount = 0;
SENDLINE_DBG_PGM("J10", "TFT Serial Debug: Hotend temperature abnormal... J10");
@@ -1122,7 +1093,7 @@
}
void AnycubicTouchscreenClass::UserConfirmRequired(const char * const msg) {
#if ENABLED(ANYCUBIC_LCD_DEBUG)
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: OnUserConfirmRequired triggered... ", msg);
#endif
@@ -1153,10 +1124,6 @@
else if (strcmp_P(msg, PSTR("Filament Purging...")) == 0) {
mediaPrintingState = AMPRINTSTATE_PAUSED;
mediaPauseState = AMPAUSESTATE_FILAMENT_PURGING;
// TODO: JBA I don't think J05 just disables the continue button, i think it injects a rogue M25. So taking this out
// disable continue button
// SENDLINE_DBG_PGM("J05", "TFT Serial Debug: UserConfirm SD Filament Purging... J05"); // J05 printing pause
// enable continue button
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm Filament is purging... J18");
@@ -1235,30 +1202,23 @@
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindw], 'A');
switch ((int)((strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], NULL)))) {
case 0: // A0 GET HOTEND TEMP
SEND_PGM_VAL("A0V ", int(thermalManager.degHotend(0) + 0.5));
SEND_PGM_VAL("A0V ", int(getActualTemp_celsius(E0) + 0.5));
break;
case 1: // A1 GET HOTEND TARGET TEMP
SEND_PGM_VAL("A1V ", int(thermalManager.degTargetHotend(0) + 0.5));
SEND_PGM_VAL("A1V ", int(getTargetTemp_celsius(E0) + 0.5));
break;
case 2: // A2 GET HOTBED TEMP
SEND_PGM_VAL("A2V ", int(thermalManager.degBed() + 0.5));
SEND_PGM_VAL("A2V ", int(getActualTemp_celsius(BED) + 0.5));
break;
case 3: // A3 GET HOTBED TARGET TEMP
SEND_PGM_VAL("A3V ", int(thermalManager.degTargetBed() + 0.5));
SEND_PGM_VAL("A3V ", int(getTargetTemp_celsius(BED) + 0.5));
break;
case 4: // A4 GET FAN SPEED
{
unsigned int temp;
temp = ((thermalManager.fan_speed[0] * 100) / 255);
temp = constrain(temp, 0, 100);
SEND_PGM_VAL("A4V ", temp);
}
SEND_PGM_VAL("A4V ", int(getActualFan_percent(FAN0)));
break;
case 5: // A5 GET CURRENT COORDINATE
SEND_PGM("A5V X: "); LCD_SERIAL.print(current_position[X_AXIS]);
@@ -1269,16 +1229,16 @@
case 6: // A6 GET SD CARD PRINTING STATUS
#ifdef SDSUPPORT
if (card.isPrinting()) {
if (isPrintingFromMedia())
{
SEND_PGM("A6V ");
if (card.isMounted())
SENDLINE(itostr3(card.percentDone()));
if (isMediaInserted())
SENDLINE(ui8tostr3rj(getProgress_percent()));
else
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: SD Card initialized... J02");
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to return printing status... J02");
}
else {
else
SENDLINE_PGM("A6V ---");
}
#endif
break;
case 7: // A7 GET PRINTING TIME
@@ -1341,27 +1301,29 @@
case 13: // A13 SELECTION FILE
#if ENABLED(SDSUPPORT)
if (isMediaInserted()) {
{
starpos = (strchr(TFTstrchr_pointer + 4, '*'));
if (TFTstrchr_pointer[4] == '/') {
strcpy(currentTouchscreenSelection, TFTstrchr_pointer + 5);
currentFileOrDirectory[0] = 0;
SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected
SENDLINE_PGM("");
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("TFT Serial Debug: currentTouchscreenSelection: ", currentTouchscreenSelection);
SERIAL_EOL();
#endif
}
else if (TFTstrchr_pointer[4] == '<') {
strcpy(currentTouchscreenSelection, TFTstrchr_pointer + 4);
SpecialMenu = true;
currentFileOrDirectory[0] = 0;
SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected
SENDLINE_PGM("");
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("J21", "TFT Serial Debug: Clear file selection... J21 ");
SERIAL_EOL();
#endif
}
else {
currentTouchscreenSelection[0] = 0;
if (SpecialMenu == false)
currentTouchscreenSelection[0] = 0;
if (starpos) *(starpos - 1) = '\0';
strcpy(currentFileOrDirectory, TFTstrchr_pointer + 4);
if (starpos != NULL) *(starpos - 1) = '\0';
strcpy(currentFileOrDirectory, TFTstrchr_pointer + 4);
SENDLINE_DBG_PGM_VAL("J20", "TFT Serial Debug: File Selected... J20 ", currentFileOrDirectory); // J20 File Selected
}
}
@@ -1392,14 +1354,14 @@
unsigned int tempvalue;
if (CodeSeen('S')) {
tempvalue = constrain(CodeValue(), 0, 260);
if (thermalManager.degTargetHotend(0) <= 260)
thermalManager.setTargetHotend(tempvalue, 0); // do not set Temp from TFT if it is set via gcode
if (getTargetTemp_celsius((extruder_t)E0) <= 260)
setTargetTemp_celsius(tempvalue, (extruder_t)E0);; // do not set Temp from TFT if it is set via gcode
}
else if ((CodeSeen('C')) && (!planner.movesplanned())) {
if ((current_position[Z_AXIS] < 10))
queue.inject_P(PSTR("G1 Z10")); // RASE Z AXIS
else if ((CodeSeen('C')) && (!isPrinting())) {
if ((getAxisPosition_mm(Z) < 10))
injectCommands(F("G1 Z10")); // RASE Z AXIS
tempvalue = constrain(CodeValue(), 0, 260);
thermalManager.setTargetHotend(tempvalue, 0);
setTargetTemp_celsius(tempvalue, (extruder_t)E0);
}
}
break;
@@ -1408,36 +1370,33 @@
{
unsigned int tempbed;
if (CodeSeen('S')) {
tempbed = constrain(CodeValue(), 0, 115);
thermalManager.setTargetBed(tempbed);
if (thermalManager.degTargetBed() <= 100)
thermalManager.setTargetBed(tempbed); // do not set Temp from TFT if it is set via gcode
tempbed = constrain(CodeValue(), 0, 120);
if (getTargetTemp_celsius((heater_t)BED) <= 100)
setTargetTemp_celsius(tempbed, (heater_t)BED); // do not set Temp from TFT if it is set via gcode
}
}
break;
case 18: // A18 set fan speed
unsigned int temp;
float fanPercent;
if (CodeSeen('S')) {
temp = (CodeValue() * 255 / 100);
temp = constrain(temp, 0, 255);
thermalManager.set_fan_speed(0, temp);
fanPercent = CodeValue();
fanPercent = constrain(fanPercent, 0, 100);
setTargetFan_percent(fanPercent, FAN0);
}
else {
thermalManager.set_fan_speed(0, 255);
fanPercent = 100;
setTargetFan_percent(fanPercent, FAN0);
}
SENDLINE_PGM("");
break;
case 19: // A19 stop stepper drivers
if ((!planner.movesplanned())
#ifdef SDSUPPORT
&& (!card.isPrinting())
#endif
) {
if (!isPrinting()) {
quickstop_stepper();
stepper.disable_all_steppers();
}
SENDLINE_PGM("");
break;
@@ -1553,55 +1512,51 @@
break;
case 26: // A26 refresh SD
{
#ifdef SDSUPPORT
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM(" TFT Serial Debug: currentTouchscreenSelection: ", currentTouchscreenSelection);
SERIAL_ECHOPGM("TFT Serial Debug: currentTouchscreenSelection: ", currentTouchscreenSelection);
SERIAL_EOL();
#endif
if (isMediaInserted()) {
if (strlen(currentTouchscreenSelection) > 0) {
FileList currentFileList;
if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIR_UP_S)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIR_UP_L)) != NULL)
) {
if (strlen(currentTouchscreenSelection) > 0) {
FileList currentFileList;
if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIR_UP_S)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIR_UP_L)) != NULL)
) {
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Directory UP (cd ..)");
#endif
currentFileList.upDir();
}
else {
if (currentTouchscreenSelection[0] == '<') {
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Directory UP (cd ..)");
SERIAL_ECHOLNPGM("TFT Serial Debug: Enter Special Menu");
#endif
currentFileList.upDir();
HandleSpecialMenu();
}
else {
if (currentTouchscreenSelection[0] == '<') {
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Enter Special Menu");
#endif
HandleSpecialMenu();
}
else {
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Not a menu. Must be a directory!");
#endif
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Not a menu. Must be a directory!");
#endif
#if ENABLED(KNUTWURST_DGUS2_TFT)
strcpy(currentFileOrDirectory, currentTouchscreenSelection);
int currentFileLen = strlen(currentFileOrDirectory);
currentFileOrDirectory[currentFileLen - 4] = '\0';
card.cd(currentFileOrDirectory);
#else
currentFileList.changeDir(currentTouchscreenSelection);
#endif
}
#if ENABLED(KNUTWURST_DGUS2_TFT)
strcpy(currentFileOrDirectory, currentTouchscreenSelection);
int currentFileLen = strlen(currentFileOrDirectory);
currentFileOrDirectory[currentFileLen - 4] = '\0';
card.cd(currentFileOrDirectory);
#else
currentFileList.changeDir(currentTouchscreenSelection);
#endif
}
}
}
if (SpecialMenu == false)
currentTouchscreenSelection[0] = 0;
}
#endif // ifdef SDSUPPORT
break;
#ifdef SERVO_ENDSTOPS
case 27: // A27 servos angles adjust
break;
#endif
case 28: // A28 filament test
{
@@ -1633,7 +1588,7 @@
if (!isPrinting()) {
if (!all_axes_trusted()) {
queue.inject_P(PSTR("G28\n"));
injectCommands(F("G28\n"));
/*
set_axis_is_at_home(X_AXIS);
sync_plan_position();
@@ -1777,12 +1732,12 @@
case 42:
if (CaseLight == true) {
SERIAL_ECHOLNPGM("Case Light OFF");
queue.inject_P(PSTR("M355 S1 P0"));
injectCommands(F("M355 S1 P0"));
CaseLight = false;
}
else {
SERIAL_ECHOLNPGM("Case Light ON");
queue.inject_P(PSTR("M355 S1 P255"));
injectCommands(F("M355 S1 P255"));
CaseLight = true;
}
// break; <-- TODO: do we need it?
@@ -1993,7 +1948,7 @@
if (ELAPSED(ms, nextStopCheck)) {
nextStopCheck = ms + 1000UL;
if (mediaPrintingState == AMPRINTSTATE_STOP_REQUESTED) {
#if ENABLED(ANYCUBIC_LCD_DEBUG)
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: Finished stopping print, releasing motors ...");
#endif
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;