🧑‍💻 IA Creality optional code

This commit is contained in:
Scott Lahteine
2023-10-13 09:48:14 -05:00
parent 251a84b741
commit 7944628400

View File

@@ -688,7 +688,9 @@ void RTS::handleData() {
return; return;
} }
#if ENABLED(LCD_BED_TRAMMING)
constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB; constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB;
#endif
switch (Checkkey) { switch (Checkkey) {
case Printfile: case Printfile:
@@ -785,6 +787,8 @@ void RTS::handleData() {
} }
break; break;
#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)
@@ -806,6 +810,8 @@ void RTS::handleData() {
sendData(getZOffset_mm() * 100, ProbeOffset_Z); sendData(getZOffset_mm() * 100, ProbeOffset_Z);
break; break;
#endif // HAS_BED_PROBE
case TempControl: case TempControl:
if (recdat.data[0] == 0) { if (recdat.data[0] == 0) {
show_status = true; show_status = true;
@@ -1106,14 +1112,15 @@ void RTS::handleData() {
sendData(getZOffset_mm() * 100, ProbeOffset_Z); sendData(getZOffset_mm() * 100, ProbeOffset_Z);
break; break;
} }
#if HAS_BED_PROBE
case 2: { // Z-axis to Up case 2: { // Z-axis to Up
if (WITHIN((getZOffset_mm() + 0.1), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { if (WITHIN((getZOffset_mm() + 0.1), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
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);
sendData(getZOffset_mm() * 100, ProbeOffset_Z); sendData(getZOffset_mm() * 100, ProbeOffset_Z);
char zOffs[20], tmp1[11]; onStatusChanged(MString<20>(GET_TEXT_F(MSG_UBL_Z_OFFSET), p_float_t(getZOffset_mm(), 3)));
sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1));
onStatusChanged(zOffs);
} }
break; break;
} }
@@ -1123,12 +1130,13 @@ void RTS::handleData() {
//babystepAxis_steps(int16_t(-getAxisSteps_per_mm(Z)) / 10, axis_t(Z)); //babystepAxis_steps(int16_t(-getAxisSteps_per_mm(Z)) / 10, axis_t(Z));
//setZOffset_mm(getZOffset_mm() - 0.1); //setZOffset_mm(getZOffset_mm() - 0.1);
sendData(getZOffset_mm() * 100, ProbeOffset_Z); sendData(getZOffset_mm() * 100, ProbeOffset_Z);
char zOffs[20], tmp1[11]; onStatusChanged(MString<20>(GET_TEXT_F(MSG_UBL_Z_OFFSET), p_float_t(getZOffset_mm(), 3)));
sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1));
onStatusChanged(zOffs);
} }
break; break;
} }
#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"));
@@ -1140,7 +1148,7 @@ void RTS::handleData() {
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
sendData(ExchangePageBase + 93, ExchangepageAddr); sendData(ExchangePageBase + 93, ExchangepageAddr);
#else #else
waitway = 3; // only for prohibiting to receive massage waitway = 3; // Only for prohibiting to receive message
sendData(3, AutolevelIcon); sendData(3, AutolevelIcon);
uint8_t abl_probe_index = 0; uint8_t abl_probe_index = 0;
while (abl_probe_index < 25) { while (abl_probe_index < 25) {
@@ -1153,55 +1161,63 @@ void RTS::handleData() {
break; break;
} }
case 6: { // Assitant Level , Centre 1 #if ENABLED(LCD_BED_TRAMMING)
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: { // Assitant Level , 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: { // Assitant Level , 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: { // Assitant Level , 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: { // Assitant Level , 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
case 11: { // Autolevel switch case 11: { // Autolevel switch
#if HAS_MESH #if HAS_MESH
const bool gla = !getLevelingActive(); const bool gla = !getLevelingActive();
setLevelingActive(gla); setLevelingActive(gla);
sendData(gla ? 3 : 2, AutoLevelIcon); sendData(gla ? 3 : 2, AutoLevelIcon);
#endif #endif
#if HAS_BED_PROBE
sendData(getZOffset_mm() * 100, ProbeOffset_Z); sendData(getZOffset_mm() * 100, ProbeOffset_Z);
#endif
break; break;
} }
#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
#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"));
@@ -1212,6 +1228,7 @@ void RTS::handleData() {
onStatusChanged(F("Moving to Next Mesh Point")); onStatusChanged(F("Moving to Next Mesh Point"));
break; break;
} }
#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"));
@@ -1422,13 +1439,14 @@ void RTS::handleData() {
break; break;
} }
case 5: {
#if ENABLED(PIDTEMPBED) #if ENABLED(PIDTEMPBED)
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));
#endif
break; break;
} }
#endif
case 6: { case 6: {
injectCommands(F("M500")); injectCommands(F("M500"));
break; break;