Clean up unused variables, add debug output on serial rx

This commit is contained in:
InsanityAutomation
2023-07-29 17:42:52 -04:00
parent a512f6b40a
commit b87f2a86c9
+11 -45
View File
@@ -60,8 +60,6 @@ namespace ExtUI
// PrinterStatusKey[0] value: 0 reprensents 3D printer ready
unsigned char AxisPagenum = 0; //0 for 10mm, 1 for 1mm, 2 for 0.1mm
bool InforShowStatus = true;
bool TPShowStatus = false; // true for only opening time and percentage, false for closing time and percentage.
int16_t userConfValidation = 0;
uint8_t lastPauseMsgState = 0;
@@ -249,7 +247,6 @@ if(idleThrottling == 300) {
{
case 1:
if(isPositionKnown()) {
InforShowStatus = true;
SERIAL_ECHOLNPGM_P(PSTR("==waitway 1=="));
rtscheck.RTS_SndData(ExchangePageBase + 54, ExchangepageAddr);
waitway = 0;
@@ -275,7 +272,6 @@ if(idleThrottling == 300) {
break;
case 5:
if(isPositionKnown() && !commandsInQueue()) {
InforShowStatus = true;
waitway = 0;
SERIAL_ECHOLNPGM_P(PSTR("==waitway 5=="));
rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); //exchange to 78 page
@@ -388,8 +384,6 @@ if(idleThrottling == 400) {
// injectCommands_P(PSTR("M22\nM21"));
startprogress = 254;
//SERIAL_ECHOLNPGM_P(PSTR(" startprogress "));
InforShowStatus = true;
TPShowStatus = false;
rtscheck.RTS_SndData(ExchangePageBase + 45, ExchangepageAddr);
reEntryPrevent = false;
return;
@@ -532,7 +526,6 @@ if(idleThrottling == 1700) {
{
//SERIAL_ECHOLNPGM("***NozzleTempStatus[2] =", (int)NozzleTempStatus[2]);
NozzleTempStatus[2] = 0;
TPShowStatus = true;
rtscheck.RTS_SndData(4, ExchFlmntIcon);
rtscheck.RTS_SndData(ExchangePageBase + 83, ExchangepageAddr);
}
@@ -598,6 +591,8 @@ RTSSHOW::RTSSHOW()
int RTSSHOW::RTS_RecData()
{
//if(!isPrinting())
//SERIAL_ECHOLNPGM("Receiving...");
uint8_t receivedbyte;
//#if ENABLED(DGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS)
if (!DWIN_SERIAL.available() && DWIN_SERIAL.buffer_overruns()) {
@@ -677,10 +672,10 @@ int RTSSHOW::RTS_RecData()
recdat.data[i/2]= (recdat.data[i/2] << 8 )| tmp[4+i];
}
//SERIAL_ECHOLNPGM("VP received: ", vp , " - len ", tmp[2]);
SERIAL_ECHOLNPGM("VP received: ", vp , " - len ", tmp[2]);
//SERIAL_ECHOLNPGM("d1: ", tmp[3] , " - d2 ", tmp[4]);
//SERIAL_ECHOLNPGM("d3: ", tmp[5] , " - d4 ", tmp[6]);
SERIAL_ECHOLNPGM("d1: ", tmp[3] , " - d2 ", tmp[4]);
SERIAL_ECHOLNPGM("d3: ", tmp[5] , " - d4 ", tmp[6]);
rx_datagram_state = DGUS_IDLE;
RTS_HandleData();
@@ -690,9 +685,15 @@ int RTSSHOW::RTS_RecData()
// discard anything else
rx_datagram_state = DGUS_IDLE;
if(!isPrinting())
SERIAL_ECHOLNPGM("Discard Return...");
return -1;
}
//if(!isPrinting())
//SERIAL_ECHOLNPGM("No Case Match...");
}
//if(!isPrinting())
//SERIAL_ECHOLNPGM("No Data...");
return -1;
}
@@ -1040,7 +1041,6 @@ void RTSSHOW::RTS_HandleData()
case Printfile:
if (recdat.data[0] == 1) // card
{
InforShowStatus = false;
//SERIAL_ECHOLNPGM_P(PSTR("Handle Data PrintFile Pre"));
filenavigator.getFiles(0);
fileIndex = 0;
@@ -1050,8 +1050,6 @@ void RTSSHOW::RTS_HandleData()
}
else if (recdat.data[0] == 2) // return after printing result.
{
InforShowStatus = true;
TPShowStatus = false;
stopPrint();
injectCommands_P(PSTR("M84"));
delay_ms(50);
@@ -1073,24 +1071,19 @@ void RTSSHOW::RTS_HandleData()
}
else if (recdat.data[0] == 3) // Temperature control
{
InforShowStatus = true;
TPShowStatus = false;
//SERIAL_ECHOLNPGM_P(PSTR("Handle Data PrintFile 3 Setting Screen "));
RTS_SndData(ExchangePageBase + 57, ExchangepageAddr); //exchange to 57 page, the fans on
}
else if (recdat.data[0] == 4) //Settings
InforShowStatus = false;
break;
case Ajust:
if (recdat.data[0] == 1)
{
InforShowStatus = false;
}
else if (recdat.data[0] == 2)
{
//SERIAL_ECHOLNPGM_P(PSTR("Handle Data Adjust 2 Setting Screen "));
InforShowStatus = true;
if (PrinterStatusKey[1] == 3) // during heating
{
RTS_SndData(ExchangePageBase + 53, ExchangepageAddr);
@@ -1182,7 +1175,6 @@ void RTSSHOW::RTS_HandleData()
resumePrint();
PrinterStatusKey[1] = 0;
InforShowStatus = true;
RTS_SndData(ExchangePageBase + 53, ExchangepageAddr);
}
@@ -1191,7 +1183,6 @@ void RTSSHOW::RTS_HandleData()
resumePrint();
NozzleTempStatus[2] = 1;
PrinterStatusKey[1] = 0;
InforShowStatus = true;
RTS_SndData(ExchangePageBase + 68, ExchangepageAddr);
}
break;
@@ -1235,8 +1226,6 @@ void RTSSHOW::RTS_HandleData()
case TempControl:
if (recdat.data[0] == 0)
{
InforShowStatus = true;
TPShowStatus = false;
}
else if (recdat.data[0] == 1)
{
@@ -1244,7 +1233,6 @@ void RTSSHOW::RTS_HandleData()
}
else if (recdat.data[0] == 2)
{
InforShowStatus = true;
}
else if (recdat.data[0] == 3)
{
@@ -1277,7 +1265,6 @@ void RTSSHOW::RTS_HandleData()
}
else if (recdat.data[0] == 0xF1)
{
//InforShowStatus = true;
#if FAN_COUNT > 0
for (uint8_t i = 0; i < FAN_COUNT; i++)
setTargetFan_percent(0, (fan_t)i);
@@ -1518,8 +1505,6 @@ void RTSSHOW::RTS_HandleData()
case Setting:
if (recdat.data[0] == 0) // return to main page
{
InforShowStatus = true;
TPShowStatus = false;
}
else if (recdat.data[0] == 1) //Bed Autoleveling
{
@@ -1557,8 +1542,6 @@ void RTSSHOW::RTS_HandleData()
}
else if (recdat.data[0] == 2) // Exchange filement
{
InforShowStatus = true;
TPShowStatus = false;
memset(ChangeMaterialbuf, 0, sizeof(ChangeMaterialbuf));
ChangeMaterialbuf[1] = ChangeMaterialbuf[0] = 10;
RTS_SndData(10 * ChangeMaterialbuf[0], FilementUnit1); //It's ChangeMaterialbuf for show,instead of current_position[E_AXIS] in them.
@@ -1599,7 +1582,6 @@ void RTSSHOW::RTS_HandleData()
SERIAL_ECHOPGM("Return : ", recdat.data[0]);
if (recdat.data[0] == 1) // return to the tool page
{
InforShowStatus = false;
RTS_SndData(ExchangePageBase + 63, ExchangepageAddr);
}
if (recdat.data[0] == 2) // return to the Level mode page
@@ -1950,7 +1932,6 @@ void RTSSHOW::RTS_HandleData()
{
waitway = 4;
injectCommands_P((PSTR("G28\nG1 F1000 Z10")));
InforShowStatus = true;
RTS_SndData(10, FilenameIcon);
}
else
@@ -2245,7 +2226,6 @@ void RTSSHOW::RTS_HandleData()
delay_ms(2);
RTS_SndData(ExchangePageBase + 53, ExchangepageAddr);
TPShowStatus = InforShowStatus = true;
PrinterStatusKey[0] = 1;
PrinterStatusKey[1] = 3;
fileIndex = 0;
@@ -2279,11 +2259,6 @@ void RTSSHOW::RTS_HandleData()
//SERIAL_ECHOLNPGM_P(PSTR("Refresh"));
injectCommands_P(PSTR("M22\nM21"));
}
else if (recdat.data[0] == 0) // return to main page
{
InforShowStatus = true;
TPShowStatus = false;
}
}
break;
@@ -2543,7 +2518,6 @@ void onPrintTimerStarted()
if ( waitway == 7 )
return;
PrinterStatusKey[1] = 3;
InforShowStatus = true;
delay_ms(1);
rtscheck.RTS_SndData(ExchangePageBase + 53, ExchangepageAddr);
}
@@ -2566,8 +2540,6 @@ void onPrintTimerStopped()
#endif
PrinterStatusKey[0] = 0;
InforShowStatus = true;
TPShowStatus = false;
rtscheck.RTS_SndData(ExchangePageBase + 51, ExchangepageAddr);
}
@@ -2575,20 +2547,17 @@ void onFilamentRunout()
{
//SERIAL_ECHOLNPGM_P(PSTR("==onFilamentRunout=="));
PrinterStatusKey[1] = 4;
TPShowStatus = false;
rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr);
}
void onFilamentRunout(extruder_t extruder)
{
//SERIAL_ECHOLNPGM_P(PSTR("==onFilamentRunout=="));
PrinterStatusKey[1] = 4;
TPShowStatus = false;
rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr);
}
void onUserConfirmRequired(const char *const msg)
{
PrinterStatusKey[1] = 4;
TPShowStatus = false;
if(lastPauseMsgState==ExtUI::pauseModeStatus && msg == (const char*)GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD))
return;
@@ -2712,7 +2681,6 @@ void onFactoryReset()
Settings.screen_rotation = 0;
onStartup();
startprogress = 0;
InforShowStatus = true;
//SERIAL_ECHOLNPGM_P(PSTR("==onFactoryReset=="));
}
@@ -2843,8 +2811,6 @@ void onSettingsLoaded(bool success)
void onPowerLossResume() {
//SERIAL_ECHOLNPGM_P(PSTR("==OnPowerLossResume=="));
startprogress = 254;
InforShowStatus = true;
TPShowStatus = false;
reEntryPrevent = false;
rtscheck.RTS_SndData(ExchangePageBase + 76, ExchangepageAddr);
}