diff --git a/.github/workflows/buildTest.yml b/.github/workflows/buildTest.yml index 2c946264fb..ce7b32de08 100644 --- a/.github/workflows/buildTest.yml +++ b/.github/workflows/buildTest.yml @@ -15,12 +15,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@master + uses: actions/setup-python@v3 with: - python-version: '3.x' + python-version: '3.7' - name: Install PlatformIO run: | diff --git a/README.md b/README.md index 6a214abb2b..b7598a5952 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ the following options must be enabled in Marlin firmware. `AUTO_REPORT_TEMPERATURES` (in Configuration_adv.h)
`AUTO_REPORT_POSITION` (in Configuration_adv.h)
`EXTENDED_CAPABILITIES_REPORT` (in Configuration_adv.h)
-`M115_GEOMETRY_REPORT` (in Configuration_adv.h)
+`MIN/MAX_SOFTWARE_ENDSTOPS` (in Configuration.h)
`M114_DETAIL` (in Configuration_adv.h)
`REPORT_FAN_CHANGE` (in Configuration_adv.h)
diff --git a/TFT/src/User/API/FanControl.c b/TFT/src/User/API/FanControl.c index 3a468c0c5a..776d9b7c71 100644 --- a/TFT/src/User/API/FanControl.c +++ b/TFT/src/User/API/FanControl.c @@ -27,7 +27,7 @@ bool fanIsValid(const uint8_t index) return false; else if (!infoSettings.ctrl_fan_en && index >= MAX_COOLING_FAN_COUNT) // controller cooling fan is disabled return false; - else if (index >= (MAX_COOLING_FAN_COUNT + MAX_CRTL_FAN_COUNT)) // invalid controller cooling fan index (not active/idle) + else if (index >= (MAX_COOLING_FAN_COUNT + MAX_CTRL_FAN_COUNT)) // invalid controller cooling fan index (not active/idle) return false; else return true; diff --git a/TFT/src/User/API/LevelingControl.c b/TFT/src/User/API/LevelingControl.c index 21cd6ce8ff..dae467469b 100644 --- a/TFT/src/User/API/LevelingControl.c +++ b/TFT/src/User/API/LevelingControl.c @@ -12,8 +12,8 @@ float probedZ = 0.0f; // last Z offset measured by probe int16_t setCoordValue(AXIS axis, ALIGN_POSITION align) { - return ((align == LEFT || align == BOTTOM) ? infoSettings.machine_size_min[axis] + infoSettings.level_edge - : infoSettings.machine_size_max[axis] - infoSettings.level_edge) - infoParameters.HomeOffset[axis]; + return ((align == LEFT || align == BOTTOM) ? infoSettings.level_edge + : infoSettings.bed_size[axis] - infoSettings.level_edge); } void levelingGetPointCoords(LEVELING_POINT_COORDS coords) diff --git a/TFT/src/User/API/Settings.c b/TFT/src/User/API/Settings.c index ac2a480535..ac0f21d32c 100644 --- a/TFT/src/User/API/Settings.c +++ b/TFT/src/User/API/Settings.c @@ -157,8 +157,13 @@ void initSettings(void) for (int i = 0; i < AXIS_NUM; i++) // x, y, z { - infoSettings.machine_size_min[i] = default_size_min[i]; - infoSettings.machine_size_max[i] = default_size_max[i]; + infoSettings.endstop_min[i] = default_size_min[i]; + infoSettings.endstop_max[i] = default_size_max[i]; + } + + for (int i = 0; i < AXIS_NUM - 1; i++) // x, y + { + infoSettings.bed_size[i] = default_size_max[i]; } for (int i = 0; i < SPEED_COUNT; i++) diff --git a/TFT/src/User/API/Settings.h b/TFT/src/User/API/Settings.h index 2dfa637a96..a945f22a00 100644 --- a/TFT/src/User/API/Settings.h +++ b/TFT/src/User/API/Settings.h @@ -14,10 +14,10 @@ extern "C" { // Config version support (format YYYYMMDD) // change if new elements/keywords are added/removed/changed in the Configuration.h // this number should match CONFIG_VERSION in Configuration.h -#define CONFIG_SUPPPORT 20230929 +#define CONFIG_SUPPPORT 20231001 #define FONT_FLASH_SIGN 20230821 // (YYYYMMDD) change if fonts require updating -#define CONFIG_FLASH_SIGN 20230929 // (YYYYMMDD) change if any keyword(s) in config.ini is added or removed +#define CONFIG_FLASH_SIGN 20231001 // (YYYYMMDD) change if any keyword(s) in config.ini is added or removed #define LANGUAGE_FLASH_SIGN 20230821 // (YYYYMMDD) change if any keyword(s) in language pack is added or removed #define ICON_FLASH_SIGN 20230821 // (YYYYMMDD) change if any icon(s) is added or removed @@ -34,8 +34,8 @@ extern "C" { #define MAX_HEATER_COUNT (MAX_HOTEND_COUNT + 2) // hotends + bed + chamber #define MAX_HEATER_PID_COUNT (MAX_HOTEND_COUNT + 1) // hotends + bed #define MAX_COOLING_FAN_COUNT 6 -#define MAX_CRTL_FAN_COUNT 2 -#define MAX_FAN_COUNT (MAX_COOLING_FAN_COUNT + MAX_CRTL_FAN_COUNT) +#define MAX_CTRL_FAN_COUNT 2 +#define MAX_FAN_COUNT (MAX_COOLING_FAN_COUNT + MAX_CTRL_FAN_COUNT) #define AXIS_NUM (TOTAL_AXIS - 1) #define SPEED_COUNT 3 @@ -222,8 +222,9 @@ typedef struct uint16_t max_temp[MAX_HEATER_COUNT]; // hotends + bed + chamber uint16_t min_ext_temp; uint8_t fan_max[MAX_FAN_COUNT]; - int16_t machine_size_min[AXIS_NUM]; // X, Y, Z - int16_t machine_size_max[AXIS_NUM]; // X, Y, Z + int16_t endstop_min[AXIS_NUM]; // X, Y, Z + int16_t endstop_max[AXIS_NUM]; // X, Y, Z + uint16_t bed_size[AXIS_NUM - 1]; // X, Y uint16_t xy_speed[SPEED_COUNT]; uint16_t z_speed[SPEED_COUNT]; uint16_t ext_speed[SPEED_COUNT]; diff --git a/TFT/src/User/API/config.c b/TFT/src/User/API/config.c index b5d05a67b1..9635a303d2 100644 --- a/TFT/src/User/API/config.c +++ b/TFT/src/User/API/config.c @@ -774,18 +774,22 @@ void parseConfigKey(uint16_t index) if (key_seen("CtI:")) SET_VALID_INT_VALUE(infoSettings.fan_max[7], MIN_FAN_SPEED, MAX_FAN_SPEED); break; - case C_INDEX_SIZE_MIN: - if (key_seen("X")) SET_VALID_INT_VALUE(infoSettings.machine_size_min[X_AXIS], MIN_SIZE_LIMIT, MAX_SIZE_LIMIT); - if (key_seen("Y")) SET_VALID_INT_VALUE(infoSettings.machine_size_min[Y_AXIS], MIN_SIZE_LIMIT, MAX_SIZE_LIMIT); - if (key_seen("Z")) SET_VALID_INT_VALUE(infoSettings.machine_size_min[Z_AXIS], MIN_SIZE_LIMIT, MAX_SIZE_LIMIT); + case C_INDEX_ENDSTOP_MIN: + if (key_seen("X")) SET_VALID_INT_VALUE(infoSettings.endstop_min[X_AXIS], MIN_SIZE_LIMIT, MAX_SIZE_LIMIT); + if (key_seen("Y")) SET_VALID_INT_VALUE(infoSettings.endstop_min[Y_AXIS], MIN_SIZE_LIMIT, MAX_SIZE_LIMIT); + if (key_seen("Z")) SET_VALID_INT_VALUE(infoSettings.endstop_min[Z_AXIS], MIN_SIZE_LIMIT, MAX_SIZE_LIMIT); break; - case C_INDEX_SIZE_MAX: - if (key_seen("X")) SET_VALID_INT_VALUE(infoSettings.machine_size_max[X_AXIS], MIN_SIZE_LIMIT, MAX_SIZE_LIMIT); - if (key_seen("Y")) SET_VALID_INT_VALUE(infoSettings.machine_size_max[Y_AXIS], MIN_SIZE_LIMIT, MAX_SIZE_LIMIT); - if (key_seen("Z")) SET_VALID_INT_VALUE(infoSettings.machine_size_max[Z_AXIS], MIN_SIZE_LIMIT, MAX_SIZE_LIMIT); + case C_INDEX_ENDSTOP_MAX: + if (key_seen("X")) SET_VALID_INT_VALUE(infoSettings.endstop_max[X_AXIS], MIN_SIZE_LIMIT, MAX_SIZE_LIMIT); + if (key_seen("Y")) SET_VALID_INT_VALUE(infoSettings.endstop_max[Y_AXIS], MIN_SIZE_LIMIT, MAX_SIZE_LIMIT); + if (key_seen("Z")) SET_VALID_INT_VALUE(infoSettings.endstop_max[Z_AXIS], MIN_SIZE_LIMIT, MAX_SIZE_LIMIT); break; + case C_INDEX_BED_SIZE: + if (key_seen("X")) SET_VALID_INT_VALUE(infoSettings.bed_size[X_AXIS], 0, MAX_SIZE_LIMIT); + if (key_seen("Y")) SET_VALID_INT_VALUE(infoSettings.bed_size[Y_AXIS], 0, MAX_SIZE_LIMIT); + case C_INDEX_XY_SPEED: if (key_seen("S")) SET_VALID_INT_VALUE(infoSettings.xy_speed[0], MIN_SPEED_LIMIT, MAX_SPEED_LIMIT); if (key_seen("N")) SET_VALID_INT_VALUE(infoSettings.xy_speed[1], MIN_SPEED_LIMIT, MAX_SPEED_LIMIT); diff --git a/TFT/src/User/API/config.h b/TFT/src/User/API/config.h index 2e1eddeedb..14c3fde638 100644 --- a/TFT/src/User/API/config.h +++ b/TFT/src/User/API/config.h @@ -69,8 +69,9 @@ extern "C" { #define CONFIG_MAX_TEMP "max_temp:" #define CONFIG_MIN_TEMP "min_temp:" #define CONFIG_FAN_MAX "fan_max:" -#define CONFIG_SIZE_MIN "size_min:" -#define CONFIG_SIZE_MAX "size_max:" +#define CONFIG_ENDSTOP_MIN "pos_min:" +#define CONFIG_ENDSTOP_MAX "pos_max:" +#define CONFIG_BED_SIZE "bed_size:" #define CONFIG_XY_SPEED "xy_speed:" #define CONFIG_Z_SPEED "z_speed:" #define CONFIG_EXT_SPEED "ext_speed:" diff --git a/TFT/src/User/API/config.inc b/TFT/src/User/API/config.inc index 35b9f35f65..67fd545f9a 100644 --- a/TFT/src/User/API/config.inc +++ b/TFT/src/User/API/config.inc @@ -62,8 +62,9 @@ X_CONFIG (CONTROLLER_FAN) X_CONFIG (MAX_TEMP) X_CONFIG (MIN_TEMP) X_CONFIG (FAN_MAX) -X_CONFIG (SIZE_MIN) -X_CONFIG (SIZE_MAX) +X_CONFIG (ENDSTOP_MIN) +X_CONFIG (ENDSTOP_MAX) +X_CONFIG (BED_SIZE) X_CONFIG (XY_SPEED) X_CONFIG (Z_SPEED) X_CONFIG (EXT_SPEED) diff --git a/TFT/src/User/API/interfaceCmd.c b/TFT/src/User/API/interfaceCmd.c index 69365ff968..7e56d9104c 100644 --- a/TFT/src/User/API/interfaceCmd.c +++ b/TFT/src/User/API/interfaceCmd.c @@ -801,7 +801,7 @@ void sendQueueCmd(void) Serial_Forward(cmd_port_index, buf); sprintf(buf, "Cap:FAN_NUM:%d\n", infoSettings.fan_count); Serial_Forward(cmd_port_index, buf); - sprintf(buf, "Cap:FAN_CTRL_NUM:%d\n", infoSettings.ctrl_fan_en ? MAX_CRTL_FAN_COUNT : 0); + sprintf(buf, "Cap:FAN_CTRL_NUM:%d\n", infoSettings.ctrl_fan_en ? MAX_CTRL_FAN_COUNT : 0); Serial_Forward(cmd_port_index, buf); Serial_Forward(cmd_port_index, "ok\n"); diff --git a/TFT/src/User/API/parseACK.c b/TFT/src/User/API/parseACK.c index 607d539cf1..10cc7b5288 100644 --- a/TFT/src/User/API/parseACK.c +++ b/TFT/src/User/API/parseACK.c @@ -787,22 +787,23 @@ void parseACK(void) // Tuning parsed responses //---------------------------------------- - // parse and store build volume size - else if (ack_seen("work:")) + // parse and store soft endstops (M211) + else if (GET_BIT(infoMachineSettings.softwareEndstops, 1)) // check "M211 seen" flag { - if (ack_continue_seen("min:")) + if (ack_seen("Min:")) { - if (ack_continue_seen("x:")) infoSettings.machine_size_min[X_AXIS] = ack_value(); - if (ack_continue_seen("y:")) infoSettings.machine_size_min[Y_AXIS] = ack_value(); - if (ack_continue_seen("z:")) infoSettings.machine_size_min[Z_AXIS] = ack_value(); - } + // check endstop minimum values + if (ack_continue_seen("X")) infoSettings.endstop_min[X_AXIS] = ack_value(); + if (ack_continue_seen("Y")) infoSettings.endstop_min[Y_AXIS] = ack_value(); + if (ack_continue_seen("Z")) infoSettings.endstop_min[Z_AXIS] = ack_value(); - if (ack_continue_seen("max:")) - { - if (ack_continue_seen("x:")) infoSettings.machine_size_max[X_AXIS] = ack_value(); - if (ack_continue_seen("y:")) infoSettings.machine_size_max[Y_AXIS] = ack_value(); - if (ack_continue_seen("z:")) infoSettings.machine_size_max[Z_AXIS] = ack_value(); + // check endstop maximum values + if (ack_continue_seen("X")) infoSettings.endstop_max[X_AXIS] = ack_value(); + if (ack_continue_seen("Y")) infoSettings.endstop_max[Y_AXIS] = ack_value(); + if (ack_continue_seen("Z")) infoSettings.endstop_max[Z_AXIS] = ack_value(); } + + SET_BIT_OFF(infoMachineSettings.softwareEndstops, 1); // clear "M211 seen" flag } // parse M48, repeatability test else if (ack_starts_with("Mean:")) @@ -811,22 +812,22 @@ void parseACK(void) sprintf(tmpMsg, "Mean: %0.5f", ack_value()); - if (ack_continue_seen("Min: ")) - sprintf(&tmpMsg[strlen(tmpMsg)], "\nMin: %0.5f", ack_value()); - if (ack_continue_seen("Max: ")) - sprintf(&tmpMsg[strlen(tmpMsg)], "\nMax: %0.5f", ack_value()); - if (ack_continue_seen("Range: ")) - sprintf(&tmpMsg[strlen(tmpMsg)], "\nRange: %0.5f", ack_value()); + if (ack_continue_seen("Min:")) + sprintf(strchr(tmpMsg, '\0'), "\nMin: %0.5f", ack_value()); + if (ack_continue_seen("Max:")) + sprintf(strchr(tmpMsg, '\0'), "\nMax: %0.5f", ack_value()); + if (ack_continue_seen("Range:")) + sprintf(strchr(tmpMsg, '\0'), "\nRange: %0.5f", ack_value()); popupReminder(DIALOG_TYPE_INFO, (uint8_t *)"Repeatability Test", (uint8_t *)tmpMsg); } // parse M48, standard deviation - else if (ack_seen("Standard Deviation: ")) + else if (ack_seen("Standard Deviation:")) { char tmpMsg[100]; char * dialogMsg = (char *)getDialogMsgStr(); - if (memcmp(dialogMsg, "Mean: ", 6) == 0) + if (memcmp(dialogMsg, "Mean:", 5) == 0) { levelingSetProbedPoint(-1, -1, ack_value()); // save probed Z value sprintf(tmpMsg, "%s\nStandard Deviation: %0.5f", dialogMsg, ack_value()); @@ -838,10 +839,12 @@ void parseACK(void) else if (ack_starts_with("M211") || ack_seen("Soft endstops")) { uint8_t curValue = infoMachineSettings.softwareEndstops; - infoMachineSettings.softwareEndstops = ack_continue_seen("ON"); + SET_BIT_VALUE(infoMachineSettings.softwareEndstops, 0, ack_continue_seen("ON")); // set ON/Off bit if (curValue != infoMachineSettings.softwareEndstops) // send a notification only if status is changed addToast(DIALOG_TYPE_INFO, ack_cache); + + SET_BIT_ON(infoMachineSettings.softwareEndstops, 1); // set "M211 seen" flag } // parse M303, PID autotune finished message else if (ack_starts_with("PID Autotune finished")) @@ -922,13 +925,20 @@ void parseACK(void) else if (ack_seen("Bed X:")) { float x = ack_value(); - float y = 0; if (ack_continue_seen("Y:")) - y = ack_value(); + { + float y = ack_value(); - if (ack_continue_seen("Z:")) - levelingSetProbedPoint(x, y, ack_value()); // save probed Z value + if (ack_continue_seen("Z:")) + levelingSetProbedPoint(x, y, ack_value()); // save probed Z value + } + } + // parse G30 coordinate unreachable message + else if (ack_seen("Z Probe Past Bed")) + { + levelingSetProbedPoint(-1, -1, 0); // cancel waiting for coordinates + BUZZER_PLAY(SOUND_ERROR); } #if DELTA_PROBE_TYPE != 0 // parse and store Delta calibration settings diff --git a/TFT/src/User/Configuration.h b/TFT/src/User/Configuration.h index efc9266f7a..d1d9abf701 100644 --- a/TFT/src/User/Configuration.h +++ b/TFT/src/User/Configuration.h @@ -1,7 +1,7 @@ #ifndef _CONFIGURATION_H_ #define _CONFIGURATION_H_ -#define CONFIG_VERSION 20230929 +#define CONFIG_VERSION 20231001 //==================================================================================================== //=============================== Settings Configurable On config.ini ================================ @@ -491,11 +491,11 @@ #define FAN_MAX {255, 255, 255, 255, 255, 255, 255, 255} // Default: {255, 255, 255, 255, 255, 255, 255, 255} /** - * Machine Size / Build Area - * The TFT will auto-detect the machine size (min and max) in Marlin firmware (requires - * enabling "M115_GEOMETRY_REPORT" in Configuration_adv.h in Marlin firmware). - * Format: [size_min: X Y Z] - * [size_max: X Y Z] + * Motion limits + * This sets the minimum and maximum motion limits. The TFT can autodetect it from an M211 respone. + * For this "MIN/MAX_SOFTWARE_ENDSTOPS" must be enabled in Marlin's "Configuration.h". + * Format: [pos_min: X Y Z] + * [pos_max: X Y Z] * Unit: [distance in mm] * Value range: [min: -2000, max: 2000] */ @@ -1431,7 +1431,7 @@ * Uncomment to enable a progress bar with 10% markers. * Comment to enable a standard progress bar. */ -#define MARKED_PROGRESS_BAR // Default: commented (disabled) +//#define MARKED_PROGRESS_BAR // Default: commented (disabled) /** * Live Text Common Color Layout (Status Screen menu) diff --git a/TFT/src/User/Menu/LevelCorner.c b/TFT/src/User/Menu/LevelCorner.c index df71ffa665..d322245374 100644 --- a/TFT/src/User/Menu/LevelCorner.c +++ b/TFT/src/User/Menu/LevelCorner.c @@ -1,91 +1,60 @@ #include "LevelCorner.h" #include "includes.h" -const uint8_t valIconIndex[LEVELING_POINT_COUNT] = {4, 5, 1, 0, 3}; +const uint8_t valIconIndex[] = {KEY_ICON_4, KEY_ICON_5, KEY_ICON_1, KEY_ICON_0}; // correlation between KEY position and measure point index -// buffer current Z value measured in Level Corner = {position 1, position 2, position 3, position 4, probe accuracy(M48)} -float levelCornerPosition[LEVELING_POINT_COUNT] = {0}; +// buffer current Z value measured in Level Corner = {position 1, position 2, position 3, position 4} +float levelCornerPosition[LEVELING_POINT_COUNT - 1] = {0}; int16_t origLevelEdge = -1; -uint8_t getLevelEdgeMin(void) +static uint8_t getLevelEdgeMin(void) { - // min edge limit for the probe with probe offset set in parseACK.c - int16_t maxXedge = getParameter(P_PROBE_OFFSET, AXIS_INDEX_X) + getParameter(P_HOME_OFFSET, AXIS_INDEX_X); - int16_t maxYedge = getParameter(P_PROBE_OFFSET, AXIS_INDEX_Y) + getParameter(P_HOME_OFFSET, AXIS_INDEX_Y); + uint16_t min_edge = 0; + int16_t single_edge; + int16_t probeOffset; + int16_t homeOffset; - maxXedge = ABS(maxXedge); - maxYedge = ABS(maxYedge); + // check edges of X axis + probeOffset = getParameter(P_PROBE_OFFSET, X_AXIS); + homeOffset = getParameter(P_HOME_OFFSET, X_AXIS); - return MAX(maxXedge, maxYedge) + 1; + single_edge = infoSettings.endstop_min[X_AXIS] + probeOffset + homeOffset; + if (single_edge > min_edge) min_edge = single_edge; + + single_edge = infoSettings.bed_size[X_AXIS] - infoSettings.endstop_max[X_AXIS] - probeOffset - homeOffset; + if (single_edge > min_edge) min_edge = single_edge; + + // check edges of Y axis + probeOffset = getParameter(P_PROBE_OFFSET, Y_AXIS); + homeOffset = getParameter(P_HOME_OFFSET, Y_AXIS); + + single_edge = infoSettings.endstop_min[Y_AXIS] + probeOffset + homeOffset; + if (single_edge > min_edge) min_edge = single_edge; + + single_edge = infoSettings.bed_size[Y_AXIS] - infoSettings.endstop_max[Y_AXIS] - probeOffset - homeOffset; + if (single_edge > min_edge) min_edge = single_edge; + + return min_edge + 1; } -uint8_t getLevelEdgeDefault(void) +static uint8_t getLevelEdgeDefault(void) { return MAX(origLevelEdge, getLevelEdgeMin()); } -void setLevelEdgeMin(void) +static void setLevelEdgeMin(void) { infoSettings.level_edge = getLevelEdgeMin(); } // draw values under icons -void refreshValue(MENUITEMS * levelItems, uint8_t index) +static void refreshValue(MENUITEMS * levelItems, uint8_t index) { - sprintf((char *)levelItems->items[valIconIndex[index]].label.address, "%.4f", levelCornerPosition[index]); + sprintf((char *)levelItems->items[valIconIndex[index]].label.address, "%.3f", levelCornerPosition[index]); menuDrawIconText(&levelItems->items[valIconIndex[index]], valIconIndex[index]); } -void checkRefreshValue(MENUITEMS * levelItems) -{ - LEVELING_POINT levelingPoint = levelingGetProbedPoint(); - - if (levelingPoint != LEVEL_NO_POINT) - { - levelCornerPosition[levelingPoint] = levelingGetProbedZ(); - refreshValue(levelItems, levelingPoint); - - levelingResetProbedPoint(); // reset to check for new updates - } -} - -// show M48 on icon -void drawProbeAccuracyIcon(MENUITEMS * levelItems) -{ - uint8_t index = 4; - GUI_POINT loc; - LIVE_INFO lvIcon; - char * str = "M48"; - - loc.x = 5; - loc.y = ICON_HEIGHT - 5; - - lvIcon.iconIndex = levelItems->items[valIconIndex[index]].icon; - lvIcon.enabled[0] = true; - lvIcon.enabled[1] = true; - lvIcon.enabled[2] = false; - - lvIcon.lines[0].h_align = LEFT; - lvIcon.lines[0].v_align = BOTTOM; - lvIcon.lines[0].fn_color = LC_VAL_COLOR; - lvIcon.lines[0].text_mode = GUI_TEXTMODE_TRANS; - lvIcon.lines[0].pos = loc; - lvIcon.lines[0].font = FONT_SIZE_NORMAL; - - lvIcon.lines[1].h_align = LEFT; - lvIcon.lines[1].v_align = BOTTOM; - lvIcon.lines[1].fn_color = LC_VAL_COLOR_2; - lvIcon.lines[1].text_mode = GUI_TEXTMODE_TRANS; - lvIcon.lines[1].pos = (GUI_POINT){loc.x - 2, loc.y - 2}; - lvIcon.lines[1].font = FONT_SIZE_NORMAL; - - lvIcon.lines[0].text = (uint8_t *)str; - lvIcon.lines[1].text = (uint8_t *)str; - - showLiveInfo(valIconIndex[index], &lvIcon, false); -} - void menuLevelCorner(void) { MENUITEMS levelCornerItems = { @@ -93,35 +62,32 @@ void menuLevelCorner(void) LABEL_LEVEL_CORNER, // icon label { - {ICON_POINT_4, LABEL_DYNAMIC}, - {ICON_POINT_3, LABEL_DYNAMIC}, + {ICON_POINT_4, LABEL_NULL}, + {ICON_POINT_3, LABEL_NULL}, {ICON_LEVEL_EDGE_DISTANCE, LABEL_DISTANCE}, - {ICON_BLTOUCH, LABEL_DYNAMIC}, - {ICON_POINT_1, LABEL_DYNAMIC}, - {ICON_POINT_2, LABEL_DYNAMIC}, + {ICON_Z_HOME, LABEL_HOME}, + {ICON_POINT_1, LABEL_NULL}, + {ICON_POINT_2, LABEL_NULL}, {ICON_RESUME, LABEL_START}, {ICON_BACK, LABEL_BACK}, } }; KEY_VALUES key_num = KEY_IDLE; - char iconText[LEVELING_POINT_COUNT][15]; + char iconText[LEVELING_POINT_COUNT - 1][5] = {"---", "---", "---", "---"}; - if (origLevelEdge < 0) // initialize leveling edge value to be used for leveling corner if not yet initialized (-1) + if (origLevelEdge < 0) // initialize leveling min_edge value to be used for leveling corner if not yet initialized (-1) { - origLevelEdge = infoSettings.level_edge; // save leveling edge value to restore after leveling corner completion - infoSettings.level_edge = getLevelEdgeDefault(); // set leveling edge value for leveling corner + origLevelEdge = infoSettings.level_edge; // save leveling min_edge value to restore after leveling corner completion + infoSettings.level_edge = getLevelEdgeDefault(); // set leveling min_edge value for leveling corner } - for (uint8_t i = 0; i < LEVELING_POINT_COUNT; i++) + for (uint8_t i = LEVEL_BOTTOM_LEFT; i <= LEVEL_TOP_LEFT; i++) { levelCornerItems.items[valIconIndex[i]].label.address = (uint8_t *)iconText[i]; - - refreshValue(&levelCornerItems, i); } menuDrawPage(&levelCornerItems); - drawProbeAccuracyIcon(&levelCornerItems); while (MENU_IS(menuLevelCorner)) { @@ -129,11 +95,25 @@ void menuLevelCorner(void) switch (key_num) { case KEY_ICON_0: - levelingProbePoint(LEVEL_TOP_LEFT); - break; - case KEY_ICON_1: - levelingProbePoint(LEVEL_TOP_RIGHT); + case KEY_ICON_4: + case KEY_ICON_5: + case KEY_ICON_6: + for (uint8_t lvlPoint = LEVEL_BOTTOM_LEFT; lvlPoint <= LEVEL_TOP_LEFT; lvlPoint++) + { + if (key_num < KEY_ICON_6 && key_num != valIconIndex[lvlPoint]) + continue; + + levelingProbePoint(lvlPoint); + + // wait until point probing is executed + TASK_LOOP_WHILE(levelingGetProbedPoint() == LEVEL_NO_POINT); + + levelCornerPosition[lvlPoint] = levelingGetProbedZ(); + refreshValue(&levelCornerItems, lvlPoint); + levelingResetProbedPoint(); // reset to check for new updates + } + break; case KEY_ICON_2: @@ -150,32 +130,11 @@ void menuLevelCorner(void) } case KEY_ICON_3: - mustStoreCmd("M48\n"); - - drawProbeAccuracyIcon(&levelCornerItems); - break; - - case KEY_ICON_4: - levelingProbePoint(LEVEL_BOTTOM_LEFT); - break; - - case KEY_ICON_5: - levelingProbePoint(LEVEL_BOTTOM_RIGHT); - break; - - case KEY_ICON_6: - for (int i = LEVEL_BOTTOM_LEFT; i <= LEVEL_TOP_LEFT; i++) - { - levelingProbePoint(i); - - // following loop needed to guarantee the value for each point beeing probed is updated at least one time on the menu - TASK_LOOP_WHILE(isNotEmptyCmdQueue(), checkRefreshValue(&levelCornerItems)); - } - + mustStoreCmd("G28 Z\n"); break; case KEY_ICON_7: - infoSettings.level_edge = origLevelEdge; // restore original leveling edge value + infoSettings.level_edge = origLevelEdge; // restore original leveling min_edge value origLevelEdge = -1; CLOSE_MENU(); break; @@ -185,7 +144,5 @@ void menuLevelCorner(void) } loopProcess(); - - checkRefreshValue(&levelCornerItems); } } diff --git a/TFT/src/User/Menu/Leveling.c b/TFT/src/User/Menu/Leveling.c index b949d4279a..6d3c44062a 100644 --- a/TFT/src/User/Menu/Leveling.c +++ b/TFT/src/User/Menu/Leveling.c @@ -1,37 +1,26 @@ #include "Leveling.h" #include "includes.h" -static uint8_t curSubmenu_index = 0; - void menuManualLeveling(void) { - ITEM itemSubmenu[] = { - // icon label - {ICON_DISABLE_STEPPERS, LABEL_XY_UNLOCK}, - {ICON_LEVEL_EDGE_DISTANCE, LABEL_DISTANCE}, - {ICON_BABYSTEP, LABEL_SHIM}, - }; - MENUITEMS manualLevelingItems = { // title LABEL_LEVELING, - // icon label + // icon label { - {ICON_POINT_4, LABEL_POINT_4}, - {ICON_POINT_3, LABEL_POINT_3}, - {ICON_PAGE_DOWN, LABEL_NEXT}, - {ICON_DISABLE_STEPPERS, LABEL_XY_UNLOCK}, - {ICON_POINT_1, LABEL_POINT_1}, - {ICON_POINT_2, LABEL_POINT_2}, - {ICON_POINT_5, LABEL_POINT_5}, - {ICON_BACK, LABEL_BACK}, + {ICON_POINT_4, LABEL_POINT_4}, + {ICON_POINT_3, LABEL_POINT_3}, + {ICON_LEVEL_EDGE_DISTANCE, LABEL_DISTANCE}, + {ICON_BABYSTEP, LABEL_SHIM}, + {ICON_POINT_1, LABEL_POINT_1}, + {ICON_POINT_2, LABEL_POINT_2}, + {ICON_POINT_5, LABEL_POINT_5}, + {ICON_BACK, LABEL_BACK}, } }; KEY_VALUES key_num = KEY_IDLE; - manualLevelingItems.items[KEY_ICON_3] = itemSubmenu[curSubmenu_index]; - menuDrawPage(&manualLevelingItems); while (MENU_IS(menuManualLeveling)) @@ -47,38 +36,16 @@ void menuManualLeveling(void) levelingMoveToPoint(LEVEL_TOP_RIGHT); break; - // change submenu + // set level edge distance case KEY_ICON_2: - curSubmenu_index = (curSubmenu_index + 1) % COUNT(itemSubmenu); - manualLevelingItems.items[KEY_ICON_3] = itemSubmenu[curSubmenu_index]; - - menuDrawItem(&manualLevelingItems.items[KEY_ICON_3], KEY_ICON_3); + infoSettings.level_edge = editIntValue(LEVELING_EDGE_DISTANCE_MIN, LEVELING_EDGE_DISTANCE_MAX, + LEVELING_EDGE_DISTANCE_DEFAULT, infoSettings.level_edge); break; - // handle submenu + // set level Z pos (shim) case KEY_ICON_3: - switch (curSubmenu_index) - { - // unlock XY axis - case 0: - storeCmd("M84 X Y E\n"); - break; - - // set level edge distance - case 1: - infoSettings.level_edge = editIntValue(LEVELING_EDGE_DISTANCE_MIN, LEVELING_EDGE_DISTANCE_MAX, - LEVELING_EDGE_DISTANCE_DEFAULT, infoSettings.level_edge); - break; - - // set level Z pos (shim) - case 2: - infoSettings.level_z_pos = editFloatValue(LEVELING_Z_POS_MIN, LEVELING_Z_POS_MAX, - LEVELING_Z_POS_DEFAULT, infoSettings.level_z_pos); - break; - - default: - break; - } + infoSettings.level_z_pos = editFloatValue(LEVELING_Z_POS_MIN, LEVELING_Z_POS_MAX, + LEVELING_Z_POS_DEFAULT, infoSettings.level_z_pos); break; case KEY_ICON_4: diff --git a/TFT/src/User/Menu/Popup.c b/TFT/src/User/Menu/Popup.c index 181c0380b2..7473032b08 100644 --- a/TFT/src/User/Menu/Popup.c +++ b/TFT/src/User/Menu/Popup.c @@ -62,7 +62,8 @@ void windowReDrawButton(uint8_t position, uint8_t pressed) void popupDrawPage(DIALOG_TYPE type, BUTTON * btn, const uint8_t * title, const uint8_t * context, const uint8_t * yes, const uint8_t * no) { - window.type = type; // window.type is used by GUI_DrawWindow() function so it must be set before the function invokation + TSC_ReDrawIcon = windowReDrawButton; + window.type = type; if (btn != NULL) { @@ -90,8 +91,6 @@ void popupDrawPage(DIALOG_TYPE type, BUTTON * btn, const uint8_t * title, const setMenuType(MENU_TYPE_SPLASH); } - - TSC_ReDrawIcon = windowReDrawButton; } void menuDialog(void) diff --git a/TFT/src/User/Menu/Terminal.c b/TFT/src/User/Menu/Terminal.c index 33adbb8b0a..688cb2f991 100644 --- a/TFT/src/User/Menu/Terminal.c +++ b/TFT/src/User/Menu/Terminal.c @@ -104,7 +104,7 @@ typedef enum #define COMMAND_START_ROW 0 // row number for text box and send button #define KB_START_ROW 1 // row number for keyboard -#define CRTL_START_ROW (KB_START_ROW + KB_ROW_COUNT) // row number for control bar +#define CTRL_START_ROW (KB_START_ROW + KB_ROW_COUNT) // row number for control bar // for text in terminal #define CURSOR_H_OFFSET 2 @@ -226,7 +226,7 @@ const GUI_RECT editorKeyRect[KEY_COUNT] = { const GUI_RECT editorAreaRect[3] = { {0, COMMAND_START_ROW * CTRL_HEIGHT, LCD_WIDTH, ROW_HEIGHT}, // text box + send area {0, ROW_HEIGHT, LCD_WIDTH, LCD_HEIGHT - CTRL_HEIGHT}, // keyboard area - {0, CRTL_START_ROW * CTRL_HEIGHT, LCD_WIDTH, LCD_HEIGHT} // control bar area + {0, CTRL_START_ROW * CTRL_HEIGHT, LCD_WIDTH, LCD_HEIGHT} // control bar area }; const GUI_RECT terminalKeyRect[TERM_KEY_COUNT] = { diff --git a/TFT/src/User/config.ini b/TFT/src/User/config.ini index 9d189db678..3a56869e86 100644 --- a/TFT/src/User/config.ini +++ b/TFT/src/User/config.ini @@ -43,7 +43,7 @@ # AUTO_REPORT_TEMPERATURES (in Configuration_adv.h) # AUTO_REPORT_POSITION (in Configuration_adv.h) # EXTENDED_CAPABILITIES_REPORT (in Configuration_adv.h) -# M115_GEOMETRY_REPORT (in Configuration_adv.h) +# MIN/MAX_SOFTWARE_ENDSTOPS (in Configuration.h) # M114_DETAIL (in Configuration_adv.h) # REPORT_FAN_CHANGE (in Configuration_adv.h) # @@ -503,15 +503,22 @@ min_temp:180 # Value range: [min: 25, max: 255] fan_max:F0:255 F1:255 F2:255 F3:255 F4:255 F5:255 CtA:255 CtI:255 -#### Machine Size / Build Area -# The TFT will auto-detect the machine size (min and max) in Marlin firmware (requires -# enabling "M115_GEOMETRY_REPORT" in Configuration_adv.h in Marlin firmware). -# Format: [size_min: X Y Z] -# [size_max: X Y Z] +#### Motion limits +# This sets the minimum and maximum motion limits. The TFT can autodetect it from an M211 respone. +# For this "MIN/MAX_SOFTWARE_ENDSTOPS" must be enabled in Marlin's "Configuration.h". +# Format: [pos_min: X Y Z] +# [pos_max: X Y Z] # Unit: [distance in mm] # Value range: [min: -2000, max: 2000] -size_min:X0 Y0 Z0 -size_max:X235 Y235 Z250 +pos_min:X0 Y0 Z0 +pos_max:X235 Y235 Z250 + +#### Bed size +# Set the bed X and Y size. +# Format: [bed_size: X Y] +# Unit: [size in mm] +# Value range: [min: 0, max: 2000] +bed_size: X235 Y235 #### X & Y Move Speeds/Feedrates # Move speeds used in Move menu to move X and Y axes. diff --git a/TFT/src/User/config_rrf.ini b/TFT/src/User/config_rrf.ini index 818af634c2..63157af755 100644 --- a/TFT/src/User/config_rrf.ini +++ b/TFT/src/User/config_rrf.ini @@ -466,15 +466,22 @@ min_temp:180 # Value range: [min: 25, max: 255] fan_max:F0:255 F1:255 F2:255 F3:255 F4:255 F5:255 CtA:255 CtI:255 -#### Machine Size / Build Area -# The TFT will auto-detect the machine size (min and max) in Marlin firmware (requires -# enabling "M115_GEOMETRY_REPORT" in Configuration_adv.h in Marlin firmware). -# Format: [size_min: X Y Z] -# [size_max: X Y Z] +#### Motion limits +# This sets the minimum and maximum motion limits. The TFT can autodetect it from an M211 respone. +# For this "MIN/MAX_SOFTWARE_ENDSTOPS" must be enabled in Marlin's "Configuration.h". +# Format: [pos_min: X Y Z] +# [pos_max: X Y Z] # Unit: [distance in mm] # Value range: [min: -2000, max: 2000] -size_min:X0 Y0 Z0 -size_max:X235 Y235 Z250 +pos_min:X0 Y0 Z0 +pos_max:X235 Y235 Z250 + +#### Bed size +# Set the bed X and Y size. +# Format: [bed_size: X Y] +# Unit: [size in mm] +# Value range: [min: 0, max: 2000] +bed_size: X235 Y235 #### X & Y Move Speeds/Feedrates # Move speeds used in Move menu to move X and Y axes.