🩹 Fix IA Creality IDEX case

This commit is contained in:
Scott Lahteine 2024-01-25 13:41:39 -06:00
parent a215bc2ca3
commit ffbf4a6a90

View file

@ -459,12 +459,13 @@ int16_t RTS::receiveData() {
} }
/* AutoUpload, (and answer to) Command 0x83 : /* AutoUpload, (and answer to) Command 0x83 :
| tmp[0 1 2 3 4 ... ] * tmp[0 1 2 3 4 ... ]
| Example 5A A5 06 83 20 01 01 78 01 * Example 5A A5 06 83 20 01 01 78 01
| / / | | \ / | \ \ * / / | | \ / | \ \
| Header | | | | \_____\_ DATA (Words!) * Header | | | | \_____\_ DATA (Words!)
| DatagramLen / VPAdr | * DatagramLen / VPAdr |
| Command DataLen (in Words) */ * Command DataLen (in Words)
*/
if (command == VarAddr_R) { if (command == VarAddr_R) {
const uint16_t vp = tmp[0] << 8 | tmp[1]; const uint16_t vp = tmp[0] << 8 | tmp[1];
@ -478,7 +479,6 @@ int16_t RTS::receiveData() {
rx_datagram_state = DGUS_IDLE; rx_datagram_state = DGUS_IDLE;
return 2; return 2;
break;
} }
// discard anything else // discard anything else
@ -637,7 +637,7 @@ void RTS::handleData() {
recdat.head[1] = FHTWO; recdat.head[1] = FHTWO;
return; return;
} }
for (int16_t i = 0; Addrbuf[i] != 0; i++) for (int16_t i = 0; Addrbuf[i] != 0; i++) {
if (recdat.addr == Addrbuf[i]) { if (recdat.addr == Addrbuf[i]) {
if (Addrbuf[i] == NzBdSet || Addrbuf[i] == NozzlePreheat || Addrbuf[i] == BedPreheat || Addrbuf[i] == Flowrate) if (Addrbuf[i] == NzBdSet || Addrbuf[i] == NozzlePreheat || Addrbuf[i] == BedPreheat || Addrbuf[i] == Flowrate)
Checkkey = ManualSetTemp; Checkkey = ManualSetTemp;
@ -651,6 +651,7 @@ void RTS::handleData() {
Checkkey = i; Checkkey = i;
break; break;
} }
}
switch (recdat.addr) { switch (recdat.addr) {
case Flowrate: case Flowrate:
@ -662,7 +663,7 @@ void RTS::handleData() {
case HotendPID_P ... HotendPID_D: case HotendPID_P ... HotendPID_D:
case BedPID_P ... BedPID_D: case BedPID_P ... BedPID_D:
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
case T2Offset_X ... T2Offset_Z case T2Offset_X ... T2Offset_Z:
#if ENABLED(EDITABLE_STEPS_PER_UNIT) #if ENABLED(EDITABLE_STEPS_PER_UNIT)
case T2StepMM_E: case T2StepMM_E:
#endif #endif
@ -700,7 +701,8 @@ void RTS::handleData() {
#endif #endif
switch (Checkkey) { switch (Checkkey) {
case Printfile:
case Printfile: {
if (recdat.data[0] == 1) { // card if (recdat.data[0] == 1) { // card
show_status = false; show_status = false;
filenavigator.getFiles(0); filenavigator.getFiles(0);
@ -734,9 +736,9 @@ void RTS::handleData() {
else if (recdat.data[0] == 4) { // Settings else if (recdat.data[0] == 4) { // Settings
show_status = false; show_status = false;
} }
break; } break;
case Adjust: case Adjust: {
if (recdat.data[0] == 1) { if (recdat.data[0] == 1) {
show_status = false; show_status = false;
} }
@ -752,13 +754,13 @@ void RTS::handleData() {
else if (recdat.data[0] == 3) else if (recdat.data[0] == 3)
setTargetFan_percent(getTargetFan_percent((fan_t)getActiveTool()) != 0 ? 100 : 0, FAN0); setTargetFan_percent(getTargetFan_percent((fan_t)getActiveTool()) != 0 ? 100 : 0, FAN0);
break; } break;
case Feedrate: case Feedrate: {
setFeedrate_percent(recdat.data[0]); setFeedrate_percent(recdat.data[0]);
break; } break;
case PrintChoice: case PrintChoice: {
if (recdat.addr == Stopprint) { if (recdat.addr == Stopprint) {
if (recdat.data[0] == 240) { // no if (recdat.data[0] == 240) { // no
sendData(ExchangePageBase + 53, ExchangepageAddr); sendData(ExchangePageBase + 53, ExchangepageAddr);
@ -792,11 +794,11 @@ void RTS::handleData() {
show_status = true; show_status = true;
sendData(ExchangePageBase + 82, ExchangepageAddr); sendData(ExchangePageBase + 82, ExchangepageAddr);
} }
break; } break;
#if HAS_BED_PROBE #if HAS_BED_PROBE
case Zoffset: case Zoffset: {
float tmp_zprobe_offset; float tmp_zprobe_offset;
if (recdat.data[0] >= 32768) if (recdat.data[0] >= 32768)
tmp_zprobe_offset = (float(recdat.data[0]) - 65536) / 100; tmp_zprobe_offset = (float(recdat.data[0]) - 65536) / 100;
@ -815,11 +817,11 @@ void RTS::handleData() {
} }
sendData(getZOffset_mm() * 100, ProbeOffset_Z); sendData(getZOffset_mm() * 100, ProbeOffset_Z);
break; } break;
#endif // HAS_BED_PROBE #endif // HAS_BED_PROBE
case TempControl: case TempControl: {
if (recdat.data[0] == 0) { if (recdat.data[0] == 0) {
show_status = true; show_status = true;
tpShowStatus = false; tpShowStatus = false;
@ -868,9 +870,9 @@ void RTS::handleData() {
sendData(ExchangePageBase + 57, ExchangepageAddr); sendData(ExchangePageBase + 57, ExchangepageAddr);
printerStatusKey[1] = 2; printerStatusKey[1] = 2;
} }
break; } break;
case ManualSetTemp: case ManualSetTemp: {
if (recdat.addr == NzBdSet) { if (recdat.addr == NzBdSet) {
if (recdat.data[0] == 0) { if (recdat.data[0] == 0) {
if (getTargetFan_percent((fan_t)getActiveTool()) == 0) if (getTargetFan_percent((fan_t)getActiveTool()) == 0)
@ -942,11 +944,9 @@ void RTS::handleData() {
setTargetFan_percent(uint16_t(recdat.data[0]), (fan_t)getActiveTool()); setTargetFan_percent(uint16_t(recdat.data[0]), (fan_t)getActiveTool());
} }
else { else {
float tmp_float_handling; float tmp_float_handling = float(recdat.data[0]);
if (recdat.data[0] >= 32768) if (tmp_float_handling >= 32768) tmp_float_handling -= 65536;
tmp_float_handling = (float(recdat.data[0]) - 65536) / 100; tmp_float_handling /= 100;
else
tmp_float_handling = float(recdat.data[0]) / 100;
if (false) {} if (false) {}
@ -1053,9 +1053,9 @@ void RTS::handleData() {
#endif #endif
#endif // HAS_PID_HEATING #endif // HAS_PID_HEATING
} }
break; } break;
case Setting: case Setting: {
if (recdat.data[0] == 0) { // return to main page if (recdat.data[0] == 0) { // return to main page
show_status = true; show_status = true;
tpShowStatus = false; tpShowStatus = false;
@ -1108,29 +1108,27 @@ void RTS::handleData() {
injectCommands(F("M84")); injectCommands(F("M84"));
sendData(11, FilenameIcon); sendData(11, FilenameIcon);
} }
break; } break;
case ReturnBack: case ReturnBack: {
if (recdat.data[0] == 1) { // return to the tool page if (recdat.data[0] == 1) { // return to the tool page
show_status = false; show_status = false;
sendData(ExchangePageBase + 63, ExchangepageAddr); sendData(ExchangePageBase + 63, ExchangepageAddr);
} }
if (recdat.data[0] == 2) // return to the Level mode page else if (recdat.data[0] == 2) // return to the Level mode page
sendData(ExchangePageBase + 64, ExchangepageAddr); sendData(ExchangePageBase + 64, ExchangepageAddr);
break; } break;
case Bedlevel: case Bedlevel: {
switch (recdat.data[0]) { switch (recdat.data[0]) {
case 1: { // Z-axis to home case 1: // Z-axis to home
// Disallow Z homing if X or Y are unknown // Disallow Z homing if X or Y are unknown
injectCommands(isAxisPositionKnown(axis_t(X)) && isAxisPositionKnown(axis_t(Y)) ? F("G28Z\nG1F1500Z0.0") : F("G28\nG1F1500Z0.0")); injectCommands(isAxisPositionKnown(axis_t(X)) && isAxisPositionKnown(axis_t(Y)) ? F("G28Z\nG1F1500Z0.0") : F("G28\nG1F1500Z0.0"));
sendData(getZOffset_mm() * 100, ProbeOffset_Z); sendData(getZOffset_mm() * 100, ProbeOffset_Z);
break; break;
}
#if HAS_BED_PROBE #if HAS_BED_PROBE
case 2: // Z-axis to Up
case 2: { // Z-axis to Up
if (WITHIN((getZOffset_mm() + 0.1), PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX)) { if (WITHIN((getZOffset_mm() + 0.1), PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX)) {
smartAdjustAxis_steps(getAxisSteps_per_mm(Z) / 10, axis_t(Z), false); smartAdjustAxis_steps(getAxisSteps_per_mm(Z) / 10, axis_t(Z), false);
//setZOffset_mm(getZOffset_mm() + 0.1); //setZOffset_mm(getZOffset_mm() + 0.1);
@ -1138,8 +1136,8 @@ void RTS::handleData() {
onStatusChanged(MString<20>(GET_TEXT_F(MSG_UBL_Z_OFFSET), p_float_t(getZOffset_mm(), 3))); onStatusChanged(MString<20>(GET_TEXT_F(MSG_UBL_Z_OFFSET), p_float_t(getZOffset_mm(), 3)));
} }
break; break;
}
case 3: { // Z-axis to Down case 3: // Z-axis to Down
if (WITHIN((getZOffset_mm() - 0.1), PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX)) { if (WITHIN((getZOffset_mm() - 0.1), PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX)) {
smartAdjustAxis_steps(-getAxisSteps_per_mm(Z) / 10, axis_t(Z), false); smartAdjustAxis_steps(-getAxisSteps_per_mm(Z) / 10, axis_t(Z), false);
//babystepAxis_steps(int16_t(-getAxisSteps_per_mm(Z)) / 10, axis_t(Z)); //babystepAxis_steps(int16_t(-getAxisSteps_per_mm(Z)) / 10, axis_t(Z));
@ -1148,17 +1146,15 @@ void RTS::handleData() {
onStatusChanged(MString<20>(GET_TEXT_F(MSG_UBL_Z_OFFSET), p_float_t(getZOffset_mm(), 3))); onStatusChanged(MString<20>(GET_TEXT_F(MSG_UBL_Z_OFFSET), p_float_t(getZOffset_mm(), 3)));
} }
break; break;
}
#endif // HAS_BED_PROBE #endif // HAS_BED_PROBE
case 4: { // Assistant Level case 4: // Assistant Level
TERN_(HAS_MESH, setLevelingActive(false)); TERN_(HAS_MESH, setLevelingActive(false));
injectCommands(isPositionKnown() ? F("G1 F1000 Z0.0") : F("G28\nG1 F1000 Z0.0")); injectCommands(isPositionKnown() ? F("G1 F1000 Z0.0") : F("G28\nG1 F1000 Z0.0"));
waitway = 2; waitway = 2;
sendData(ExchangePageBase + 84, ExchangepageAddr); sendData(ExchangePageBase + 84, ExchangepageAddr);
break; break;
}
case 5: { // AutoLevel "Measuring" Button case 5: { // AutoLevel "Measuring" Button
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
sendData(ExchangePageBase + 93, ExchangepageAddr); sendData(ExchangePageBase + 93, ExchangepageAddr);
@ -1173,45 +1169,44 @@ void RTS::handleData() {
sendData(ExchangePageBase + 64, ExchangepageAddr); sendData(ExchangePageBase + 64, ExchangepageAddr);
injectCommands(F(MEASURING_GCODE)); injectCommands(F(MEASURING_GCODE));
#endif #endif
break; } break;
}
#if ENABLED(LCD_BED_TRAMMING) #if ENABLED(LCD_BED_TRAMMING)
case 6: { // Bed Tramming, Centre 1 case 6: // Bed Tramming, Centre 1
setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z));
setAxisPosition_mm(X_CENTER, axis_t(X)); setAxisPosition_mm(X_CENTER, axis_t(X));
setAxisPosition_mm(Y_CENTER, axis_t(Y)); setAxisPosition_mm(Y_CENTER, axis_t(Y));
waitway = 6; waitway = 6;
break; break;
}
case 7: { // Bed Tramming, Front Left 2 case 7: // Bed Tramming, Front Left 2
setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z));
setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X)); setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X));
setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y)); setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y));
waitway = 6; waitway = 6;
break; break;
}
case 8: { // Bed Tramming, Front Right 3 case 8: // Bed Tramming, Front Right 3
setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z));
setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X)); setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X));
setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y)); setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y));
waitway = 6; waitway = 6;
break; break;
}
case 9: { // Bed Tramming, Back Right 4 case 9: // Bed Tramming, Back Right 4
setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z));
setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X)); setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X));
setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y)); setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y));
waitway = 6; waitway = 6;
break; break;
}
case 10: { // Bed Tramming, Back Left 5 case 10: // Bed Tramming, Back Left 5
setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z));
setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X)); setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X));
setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y)); setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y));
waitway = 6; waitway = 6;
break; break;
}
#endif // LCD_BED_TRAMMING #endif // LCD_BED_TRAMMING
case 11: { // Autolevel switch case 11: { // Autolevel switch
@ -1223,113 +1218,92 @@ void RTS::handleData() {
#if HAS_BED_PROBE #if HAS_BED_PROBE
sendData(getZOffset_mm() * 100, ProbeOffset_Z); sendData(getZOffset_mm() * 100, ProbeOffset_Z);
#endif #endif
break; } break;
}
#if ENABLED(G26_MESH_VALIDATION) #if ENABLED(G26_MESH_VALIDATION)
case 12: { case 12:
injectCommands(F("G26R255")); injectCommands(F("G26R255"));
onStatusChanged(F("Beginning G26.. Heating")); onStatusChanged(F("Beginning G26.. Heating"));
break; break;
}
#endif #endif
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
case 13: { case 13:
injectCommands(F("G29S1")); injectCommands(F("G29S1"));
onStatusChanged(F("Begin Manual Mesh")); onStatusChanged(F("Begin Manual Mesh"));
break; break;
} case 14:
case 14: {
injectCommands(F("G29S2")); injectCommands(F("G29S2"));
onStatusChanged(F("Moving to Next Mesh Point")); onStatusChanged(F("Moving to Next Mesh Point"));
break; break;
}
#endif #endif
case 15: { case 15:
injectCommands(F("M211S0\nG91\nG1Z-0.025\nG90\nM211S1")); injectCommands(F("M211S0\nG91\nG1Z-0.025\nG90\nM211S1"));
onStatusChanged(F("Moved down 0.025")); onStatusChanged(F("Moved down 0.025"));
break; break;
} case 16:
case 16: {
injectCommands(F("M211S0\nG91\nG1Z0.025\nG90\nM211S1")); injectCommands(F("M211S0\nG91\nG1Z0.025\nG90\nM211S1"));
onStatusChanged(F("Moved up 0.025")); onStatusChanged(F("Moved up 0.025"));
break; break;
} case 17:
case 17: {
dwin_settings.display_volume = 0; dwin_settings.display_volume = 0;
dwin_settings.display_sound = false; dwin_settings.display_sound = false;
setTouchScreenConfiguration(); setTouchScreenConfiguration();
break; break;
} case 18:
case 18: {
dwin_settings.display_volume = 255; dwin_settings.display_volume = 255;
dwin_settings.display_sound = true; dwin_settings.display_sound = true;
setTouchScreenConfiguration(); setTouchScreenConfiguration();
break; break;
} case 19:
case 19: {
dwin_settings.screen_brightness = 10; dwin_settings.screen_brightness = 10;
setTouchScreenConfiguration(); setTouchScreenConfiguration();
break; break;
} case 20:
case 20: {
dwin_settings.screen_brightness = 100; dwin_settings.screen_brightness = 100;
setTouchScreenConfiguration(); setTouchScreenConfiguration();
break; break;
} case 21:
case 21: {
dwin_settings.display_standby ^= true; dwin_settings.display_standby ^= true;
setTouchScreenConfiguration(); setTouchScreenConfiguration();
break; break;
} case 22:
case 22: { dwin_settings.screen_rotation = 10 - dwin_settings.screen_rotation == 10 ? 0 : 10;
dwin_settings.screen_rotation = dwin_settings.screen_rotation == 10 ? 0 : 10;
setTouchScreenConfiguration(); setTouchScreenConfiguration();
break; break;
} case 23: // Set IDEX Autopark
case 23: { // Set IDEX Autopark
injectCommands(F("M605S1\nG28X\nG1X0")); injectCommands(F("M605S1\nG28X\nG1X0"));
break; break;
} case 24: // Set IDEX Duplication
case 24: { // Set IDEX Duplication
injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0")); injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0"));
break; break;
} case 25: // Set IDEX Mirrored Duplication
case 25: { // Set IDEX Mirrored Duplication
injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0\nM605S3")); injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0\nM605S3"));
break; break;
} case 26: // Set IDEX Full Control
case 26: { // Set IDEX Full Control
injectCommands(F("M605S0\nG28X")); injectCommands(F("M605S0\nG28X"));
break; break;
} case 27: // Change Tool
case 27: { // Change Tool
setActiveTool(getActiveTool() == E0 ? E1 : E0, !isAxisPositionKnown(X)); setActiveTool(getActiveTool() == E0 ? E1 : E0, !isAxisPositionKnown(X));
break; break;
}
default: break; default: break;
} }
sendData(10, FilenameIcon); sendData(10, FilenameIcon);
break; } break;
case XYZEaxis: { case XYZEaxis: {
axis_t axis = X; axis_t axis = X;
float min = 0.0f, max = 0.0f; float min = 0.0f, max = 0.0f;
waitway = 4; waitway = 4;
if (recdat.addr == DisplayXaxis) { if (recdat.addr == DisplayXaxis) {
axis = X; axis = X; min = X_MIN_POS; max = X_MAX_POS;
min = X_MIN_POS;
max = X_MAX_POS;
} }
else if (recdat.addr == DisplayYaxis) { else if (recdat.addr == DisplayYaxis) {
axis = Y; axis = Y; min = Y_MIN_POS; max = Y_MAX_POS;
min = Y_MIN_POS;
max = Y_MAX_POS;
} }
else if (recdat.addr == DisplayZaxis) { else if (recdat.addr == DisplayZaxis) {
axis = Z; axis = Z; min = Z_MIN_POS; max = Z_MAX_POS;
min = Z_MIN_POS;
max = Z_MAX_POS;
} }
else if (recdat.addr == AutoZero) { else if (recdat.addr == AutoZero) {
if (recdat.data[0] == 3) { // autohome if (recdat.data[0] == 3) { // autohome
@ -1343,19 +1317,16 @@ void RTS::handleData() {
axisPageNum = recdat.data[0]; axisPageNum = recdat.data[0];
waitway = 0; waitway = 0;
} }
break; } break;
}
float targetPos = float(recdat.data[0]) / 10; float targetPos = float(recdat.data[0]) / 10;
LIMIT(targetPos, min, max); LIMIT(targetPos, min, max);
setAxisPosition_mm(targetPos, axis); setAxisPosition_mm(targetPos, axis);
waitway = 0; waitway = 0;
sendData(10, FilenameIcon); sendData(10, FilenameIcon);
break; } break;
}
case Filament:
case Filament: {
uint16_t IconTemp; uint16_t IconTemp;
if (recdat.addr == Exchfilament) { if (recdat.addr == Exchfilament) {
if (getActualTemp_celsius(getActiveTool()) < EXTRUDE_MINTEMP && recdat.data[0] < 5) { if (getActualTemp_celsius(getActiveTool()) < EXTRUDE_MINTEMP && recdat.data[0] < 5) {
@ -1366,23 +1337,23 @@ void RTS::handleData() {
} }
switch (recdat.data[0]) { switch (recdat.data[0]) {
case 1: { // Unload filament1 case 1: // Unload filament1
setAxisPosition_mm(getAxisPosition_mm(E0) - changeMaterialBuf[0], E0); setAxisPosition_mm(getAxisPosition_mm(E0) - changeMaterialBuf[0], E0);
break; break;
}
case 2: { // Load filament1 case 2: // Load filament1
setAxisPosition_mm(getAxisPosition_mm(E0) + changeMaterialBuf[0], E0); setAxisPosition_mm(getAxisPosition_mm(E0) + changeMaterialBuf[0], E0);
break; break;
}
case 3: { // Unload filament2 case 3: // Unload filament2
setAxisPosition_mm(getAxisPosition_mm(E1) - changeMaterialBuf[1], E1); setAxisPosition_mm(getAxisPosition_mm(E1) - changeMaterialBuf[1], E1);
break; break;
}
case 4: { // Load filament2 case 4: // Load filament2
setAxisPosition_mm(getAxisPosition_mm(E1) + changeMaterialBuf[1], E1); setAxisPosition_mm(getAxisPosition_mm(E1) + changeMaterialBuf[1], E1);
break; break;
}
case 5: { // sure to heat case 5: // sure to heat
nozzleTempStatus[0] = 1; nozzleTempStatus[0] = 1;
setTargetTemp_celsius((PREHEAT_1_TEMP_HOTEND + 10), getActiveTool()); setTargetTemp_celsius((PREHEAT_1_TEMP_HOTEND + 10), getActiveTool());
@ -1397,17 +1368,17 @@ void RTS::handleData() {
delay_ms(5); delay_ms(5);
sendData(ExchangePageBase + 68, ExchangepageAddr); sendData(ExchangePageBase + 68, ExchangepageAddr);
break; break;
}
case 6: { // cancel to heat case 6: // cancel to heat
sendData(ExchangePageBase + 65, ExchangepageAddr); sendData(ExchangePageBase + 65, ExchangepageAddr);
break; break;
}
case 0xF1: { // Sure to cancel heating case 0xF1: // Sure to cancel heating
nozzleTempStatus[0] = 0; nozzleTempStatus[0] = 0;
delay_ms(1); delay_ms(1);
sendData(ExchangePageBase + 65, ExchangepageAddr); sendData(ExchangePageBase + 65, ExchangepageAddr);
break; break;
}
case 0xF0: // not to cancel heating case 0xF0: // not to cancel heating
break; break;
} }
@ -1420,57 +1391,53 @@ void RTS::handleData() {
else if (recdat.addr == FilamentUnit2) { else if (recdat.addr == FilamentUnit2) {
changeMaterialBuf[1] = float(recdat.data[0]) / 10; changeMaterialBuf[1] = float(recdat.data[0]) / 10;
} }
break; } break;
case LanguageChoice: case LanguageChoice: {
//if (recdat.data[0] == 1) settings.save(); else injectCommands(F("M300")); //if (recdat.data[0] == 1) settings.save(); else injectCommands(F("M300"));
// may at some point use language change screens to save eeprom explicitly // may at some point use language change screens to save eeprom explicitly
switch (recdat.data[0]) { switch (recdat.data[0]) {
case 0: { case 0:
injectCommands(F("M500")); injectCommands(F("M500"));
break; break;
}
case 1: { case 1:
sendData(ExchangePageBase + 94, ExchangepageAddr); sendData(ExchangePageBase + 94, ExchangepageAddr);
break; break;
}
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
case 2: { case 2:
onStatusChanged(F("Hotend PID Started")); onStatusChanged(F("Hotend PID Started"));
startPIDTune(static_cast<celsius_t>(pid_hotendAutoTemp), getActiveTool()); startPIDTune(static_cast<celsius_t>(pid_hotendAutoTemp), getActiveTool());
break; break;
}
#endif #endif
case 3: { case 3:
injectCommands(F("M502\nM500")); injectCommands(F("M502\nM500"));
break; break;
}
case 4: { case 4:
injectCommands(F("M999\nM280P0S160")); injectCommands(F("M999\nM280P0S160"));
break; break;
}
#if ENABLED(PIDTEMPBED) #if ENABLED(PIDTEMPBED)
case 5: { case 5:
onStatusChanged(F("Bed PID Started")); onStatusChanged(F("Bed PID Started"));
startBedPIDTune(static_cast<celsius_t>(pid_bedAutoTemp)); startBedPIDTune(static_cast<celsius_t>(pid_bedAutoTemp));
break; break;
}
#endif #endif
case 6: { case 6:
injectCommands(F("M500")); injectCommands(F("M500"));
break; break;
}
default: break; default: break;
} }
break; } break;
case No_Filament: case No_Filament: {
if (recdat.data[0] == 1) { // Filament is out, resume / resume selected on screen if (recdat.data[0] == 1) { // Filament is out, resume / resume selected on screen
if (ExtUI::pauseModeStatus != PAUSE_MESSAGE_PURGE && ExtUI::pauseModeStatus != PAUSE_MESSAGE_OPTION) { if (ExtUI::pauseModeStatus != PAUSE_MESSAGE_PURGE && ExtUI::pauseModeStatus != PAUSE_MESSAGE_OPTION) {
// setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT); // setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT);
@ -1507,7 +1474,7 @@ void RTS::handleData() {
setUserConfirmed(); setUserConfirmed();
} }
} }
break; } break;
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
case PwrOffNoF: case PwrOffNoF:
@ -1518,14 +1485,8 @@ void RTS::handleData() {
break; break;
#endif #endif
case Volume: case Volume: {
if (recdat.data[0] < 0) dwin_settings.display_volume = constrain(recdat.data[0], 0, 255);
dwin_settings.display_volume = 0;
else if (recdat.data[0] > 255)
dwin_settings.display_volume = 0xFF;
else
dwin_settings.display_volume = recdat.data[0];
if (dwin_settings.display_volume == 0) { if (dwin_settings.display_volume == 0) {
sendData(0, VolumeIcon); sendData(0, VolumeIcon);
sendData(9, SoundIcon); sendData(9, SoundIcon);
@ -1535,9 +1496,9 @@ void RTS::handleData() {
sendData(8, SoundIcon); sendData(8, SoundIcon);
} }
sendData(dwin_settings.display_volume << 8, SoundAddr + 1); sendData(dwin_settings.display_volume << 8, SoundAddr + 1);
break; } break;
case Filename: case Filename: {
if (isMediaInserted() && recdat.addr == FilenameChs) { if (isMediaInserted() && recdat.addr == FilenameChs) {
recordcount = recdat.data[0] - 1; recordcount = recdat.data[0] - 1;
@ -1616,7 +1577,7 @@ void RTS::handleData() {
tpShowStatus = false; tpShowStatus = false;
} }
} }
break; } break;
case VolumeDisplay: { case VolumeDisplay: {
if (recdat.data[0] == 0) { if (recdat.data[0] == 0) {
@ -1632,8 +1593,7 @@ void RTS::handleData() {
dwin_settings.display_sound = true; dwin_settings.display_sound = true;
} }
setTouchScreenConfiguration(); setTouchScreenConfiguration();
break; } break;
}
case DisplayBrightness: { case DisplayBrightness: {
if (recdat.data[0] < 10) if (recdat.data[0] < 10)
@ -1643,8 +1603,7 @@ void RTS::handleData() {
else else
dwin_settings.screen_brightness = (uint8_t)recdat.data[0]; dwin_settings.screen_brightness = (uint8_t)recdat.data[0];
setTouchScreenConfiguration(); setTouchScreenConfiguration();
break; } break;
}
case DisplayStandbyBrightness: { case DisplayStandbyBrightness: {
if (recdat.data[0] < 10) if (recdat.data[0] < 10)
@ -1654,8 +1613,7 @@ void RTS::handleData() {
else else
dwin_settings.standby_brightness = (uint8_t)recdat.data[0]; dwin_settings.standby_brightness = (uint8_t)recdat.data[0];
setTouchScreenConfiguration(); setTouchScreenConfiguration();
break; } break;
}
case DisplayStandbySeconds: { case DisplayStandbySeconds: {
if (recdat.data[0] < 5) if (recdat.data[0] < 5)
@ -1665,8 +1623,7 @@ void RTS::handleData() {
else else
dwin_settings.standby_time_seconds = (uint8_t)recdat.data[0]; dwin_settings.standby_time_seconds = (uint8_t)recdat.data[0];
setTouchScreenConfiguration(); setTouchScreenConfiguration();
break; } break;
}
case AutolevelVal: { case AutolevelVal: {
uint8_t meshPoint = (recdat.addr - AutolevelVal) / 2, uint8_t meshPoint = (recdat.addr - AutolevelVal) / 2,
@ -1680,8 +1637,7 @@ void RTS::handleData() {
xy_uint8_t point = { xPnt, yPnt }; xy_uint8_t point = { xPnt, yPnt };
setMeshPoint(point, meshVal); setMeshPoint(point, meshVal);
sendData(meshVal * 1000, recdat.addr); sendData(meshVal * 1000, recdat.addr);
break; } break;
}
default: break; default: break;
} }