diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 52bac0cd04bd..e0ee13af0778 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,6 +1,7 @@ name: 🪲 Report a bug description: Create a bug report to help improve Marlin Firmware title: "[BUG] (bug summary)" +labels: ["Bug: Potential ?"] body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index b64383cd48b2..2e8607142ca8 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,7 +1,7 @@ name: ✨ Request a feature description: Request a new Marlin Firmware feature title: "[FR] (feature summary)" -labels: 'T: Feature Request' +labels: ["T: Feature Request"] body: - type: markdown attributes: diff --git a/.github/code_of_conduct.md b/.github/code_of_conduct.md index 888c2ccf76fd..5fd9e0c8eeb5 100644 --- a/.github/code_of_conduct.md +++ b/.github/code_of_conduct.md @@ -30,7 +30,7 @@ Project maintainers have the right and responsibility to remove, edit, or reject ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by messaging @MarlinFirmware/moderators on the relevant issue, [or privately](//github.com/orgs/MarlinFirmware/teams/moderators). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by following GitHub's [reporting abuse or spam article](https://docs.github.com/en/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. ## Attribution diff --git a/.github/contributing.md b/.github/contributing.md index f3825d208112..c9b31998e99d 100644 --- a/.github/contributing.md +++ b/.github/contributing.md @@ -26,11 +26,12 @@ The following is a set of guidelines for contributing to Marlin, hosted by the [ ## Code of Conduct -This project and everyone participating in it is governed by the [Marlin Code of Conduct](code_of_conduct.md). By participating, you are expected to uphold this code. Please report unacceptable behavior by messaging @MarlinFirmware/moderators on the relevant issue, [or privately](//github.com/orgs/MarlinFirmware/teams/moderators). +This project and everyone participating in it is governed by the [Marlin Code of Conduct](code_of_conduct.md). By participating, you are expected to uphold this code. Please report unacceptable behavior by following GitHub's [reporting abuse or spam article](https://docs.github.com/en/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam). ## I don't want to read this whole thing I just have a question!!! -> **Note:** Please don't file an issue to ask a question. You'll get faster results by using the resources below. +> [!NOTE] +> Please don't file an issue to ask a question. You'll get faster results by using the resources below. We have a Message Board and a Facebook group where our knowledgable user community can provide helpful advice if you have questions. @@ -55,7 +56,8 @@ This section guides you through submitting a Bug Report for Marlin. Following th Before creating a Bug Report, please test the "nightly" development branch, as you might find out that you don't need to create one. When you are creating a Bug Report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](ISSUE_TEMPLATE/bug_report.yml), the information it asks for helps us resolve issues faster. -> **Note:** Regressions can happen. If you find a **Closed** issue that seems like your issue, go ahead and open a new issue and include a link to the original issue in the body of your new one. All you need to create a link is the issue number, preceded by #. For example, #8888. +> [!NOTE] +> Regressions can happen. If you find a **Closed** issue that seems like your issue, go ahead and open a new issue and include a link to the original issue in the body of your new one. All you need to create a link is the issue number, preceded by #. For example, #8888. #### How Do I Submit A (Good) Bug Report? diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml new file mode 100644 index 000000000000..c69e6c4fade9 --- /dev/null +++ b/.github/workflows/auto-label.yml @@ -0,0 +1,41 @@ +# +# auto-label.yml +# - Find all open issues without a label and a title containing "[BUG]". +# - Apply the label "Bug: Potential ?" to these issues. +# + +name: Label Old Bugs + +on: + schedule: + - cron: "30 8 * * *" + +jobs: + autolabel: + name: Auto Label + if: github.repository == 'MarlinFirmware/Marlin' + runs-on: ubuntu-latest + steps: + - name: Auto Label for [BUG] + uses: actions/github-script@v7 + with: + script: | + // Get all open issues in this repository + const issueList = await github.rest.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open' + }); + // Filter issues without labels that have a title containing '[BUG]'. + const matchingIssues = issueList.data.filter( + issue => issue.title.includes('[BUG]') && issue.labels.length === 0 + ); + // Process the first 50 + for (const issue of matchingIssues.slice(0, 50)) { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + labels: ['Bug: Potential ?'] + }); + } diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index abb0d44706d3..2b15067f5156 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -12,7 +12,6 @@ on: - 1.0.x - 1.1.x - 2.0.x - - 2.1.x jobs: bad_target: diff --git a/.github/workflows/clean-closed.yml b/.github/workflows/clean-closed.yml index 2eab285aeeab..318d083dfae3 100644 --- a/.github/workflows/clean-closed.yml +++ b/.github/workflows/clean-closed.yml @@ -23,6 +23,7 @@ jobs: - "S: Please Merge" - "S: Please Test" - "help wanted" + - "Bug: Potential ?" - "Needs: Discussion" - "Needs: Documentation" - "Needs: More Data" diff --git a/.github/workflows/close-stale.yml b/.github/workflows/close-stale.yml index ef1b33b4eb17..397f9b5ea6c2 100644 --- a/.github/workflows/close-stale.yml +++ b/.github/workflows/close-stale.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/stale@v3 + - uses: actions/stale@v8 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: | diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 057fa8b75f19..7c62b5af6c54 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -9,6 +9,7 @@ on: pull_request: branches: - bugfix-2.1.x + - 2.1.x paths-ignore: - config/** - data/** @@ -17,6 +18,7 @@ on: push: branches: - bugfix-2.1.x + - 2.1.x paths-ignore: - config/** - data/** diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 0639f432c518..4d0351bb493c 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1758,10 +1758,13 @@ */ //#define Z_IDLE_HEIGHT Z_HOME_POS -//#define Z_CLEARANCE_FOR_HOMING 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... - // Be sure to have this much clearance over your Z_MAX_POS to prevent grinding. +//#define Z_CLEARANCE_FOR_HOMING 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... + // You'll need this much clearance above Z_MAX_POS to avoid grinding. -//#define Z_AFTER_HOMING 10 // (mm) Height to move to after homing (if Z was homed) +//#define Z_AFTER_HOMING 10 // (mm) Height to move to after homing (if Z was homed) +//#define XY_AFTER_HOMING { 10, 10 } // (mm) Move to an XY position after homing (and raising Z) + +//#define EVENT_GCODE_AFTER_HOMING "M300 P440 S200" // Commands to run after G28 (and move to XY_AFTER_HOMING) // Direction of endstops when homing; 1=MAX, -1=MIN // :[-1,1] @@ -2246,8 +2249,8 @@ //#define Z_SAFE_HOMING #if ENABLED(Z_SAFE_HOMING) - #define Z_SAFE_HOMING_X_POINT X_CENTER // X point for Z homing - #define Z_SAFE_HOMING_Y_POINT Y_CENTER // Y point for Z homing + #define Z_SAFE_HOMING_X_POINT X_CENTER // (mm) X point for Z homing + #define Z_SAFE_HOMING_Y_POINT Y_CENTER // (mm) Y point for Z homing //#define Z_SAFE_HOMING_POINT_ABSOLUTE // Ignore home offsets (M206) for Z homing position #endif diff --git a/Marlin/Version.h b/Marlin/Version.h index d3b4d058ff64..67d8329c38a3 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-11-27" +//#define STRING_DISTRIBUTION_DATE "2023-12-04" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/config.ini b/Marlin/config.ini index 17ff3bec7efb..fed2a5c68c0a 100644 --- a/Marlin/config.ini +++ b/Marlin/config.ini @@ -3,10 +3,50 @@ # config.ini - Options to apply before the build # [config:base] +# +# ini_use_config - A comma-separated list of actions to apply to the Configuration files. +# The actions will be applied in the listed order. +# - none +# Ignore this file and don't apply any configuration options +# +# - base +# Just apply the options in config:base to the configuration +# +# - minimal +# Just apply the options in config:minimal to the configuration +# +# - all +# Apply all 'config:*' sections in this file to the configuration +# +# - another.ini +# Load another INI file with a path relative to this config.ini file (i.e., within Marlin/) +# +# - https://me.myserver.com/path/to/configs +# Fetch configurations from any URL. +# +# - example/Creality/Ender-5 Plus @ bugfix-2.1.x +# Fetch example configuration files from the MarlinFirmware/Configurations repository +# https://raw.githubusercontent.com/MarlinFirmware/Configurations/bugfix-2.1.x/config/examples/Creality/Ender-5%20Plus/ +# +# - example/default @ release-2.0.9.7 +# Fetch default configuration files from the MarlinFirmware/Configurations repository +# https://raw.githubusercontent.com/MarlinFirmware/Configurations/release-2.0.9.7/config/default/ +# +# - [disable] +# Comment out all #defines in both Configuration.h and Configuration_adv.h. This is useful +# to start with a clean slate before applying any config: options, so only the options explicitly +# set in config.ini will be enabled in the configuration. +# +# - [flatten] (Not yet implemented) +# Produce a flattened set of Configuration.h and Configuration_adv.h files with only the enabled +# #defines and no comments. A clean look, but context-free. +# ini_use_config = none # Load all config: sections in this file ;ini_use_config = all +# Disable everything and apply subsequent config:base options +;ini_use_config = [disable], base # Load config file relative to Marlin/ ;ini_use_config = another.ini # Download configurations from GitHub diff --git a/Marlin/src/HAL/ESP32/HAL.cpp b/Marlin/src/HAL/ESP32/HAL.cpp index 27f6516f9ae8..4890972b0193 100644 --- a/Marlin/src/HAL/ESP32/HAL.cpp +++ b/Marlin/src/HAL/ESP32/HAL.cpp @@ -175,7 +175,7 @@ uint8_t MarlinHAL::get_reset_source() { return rtc_get_reset_reason(1); } void MarlinHAL::reboot() { ESP.restart(); } -void _delay_ms(int delay_ms) { delay(delay_ms); } +void _delay_ms(const int ms) { delay(ms); } // return free memory between end of heap (or end bss) and whatever is current int MarlinHAL::freeMemory() { return ESP.getFreeHeap(); } diff --git a/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp b/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp index 6c00a4cae0b2..a737266c6811 100644 --- a/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp +++ b/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp @@ -78,7 +78,7 @@ bool XPT2046::getRawPoint(int16_t * const x, int16_t * const y) { if (isBusy() || !isTouched()) return false; *x = getRawData(XPT2046_X); *y = getRawData(XPT2046_Y); - return true; + return isTouched(); } uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) { diff --git a/Marlin/src/HAL/SAMD51/HAL.cpp b/Marlin/src/HAL/SAMD51/HAL.cpp index 8ec5d5a86c4b..a3c871ce516a 100644 --- a/Marlin/src/HAL/SAMD51/HAL.cpp +++ b/Marlin/src/HAL/SAMD51/HAL.cpp @@ -47,24 +47,27 @@ #endif #endif -#define GET_TEMP_0_ADC() TERN(HAS_TEMP_ADC_0, PIN_TO_ADC(TEMP_0_PIN), -1) -#define GET_TEMP_1_ADC() TERN(HAS_TEMP_ADC_1, PIN_TO_ADC(TEMP_1_PIN), -1) -#define GET_TEMP_2_ADC() TERN(HAS_TEMP_ADC_2, PIN_TO_ADC(TEMP_2_PIN), -1) -#define GET_TEMP_3_ADC() TERN(HAS_TEMP_ADC_3, PIN_TO_ADC(TEMP_3_PIN), -1) -#define GET_TEMP_4_ADC() TERN(HAS_TEMP_ADC_4, PIN_TO_ADC(TEMP_4_PIN), -1) -#define GET_TEMP_5_ADC() TERN(HAS_TEMP_ADC_5, PIN_TO_ADC(TEMP_5_PIN), -1) -#define GET_TEMP_6_ADC() TERN(HAS_TEMP_ADC_6, PIN_TO_ADC(TEMP_6_PIN), -1) -#define GET_TEMP_7_ADC() TERN(HAS_TEMP_ADC_7, PIN_TO_ADC(TEMP_7_PIN), -1) -#define GET_BED_ADC() TERN(HAS_TEMP_ADC_BED, PIN_TO_ADC(TEMP_BED_PIN), -1) -#define GET_CHAMBER_ADC() TERN(HAS_TEMP_ADC_CHAMBER, PIN_TO_ADC(TEMP_CHAMBER_PIN), -1) -#define GET_PROBE_ADC() TERN(HAS_TEMP_ADC_PROBE, PIN_TO_ADC(TEMP_PROBE_PIN), -1) -#define GET_COOLER_ADC() TERN(HAS_TEMP_ADC_COOLER, PIN_TO_ADC(TEMP_COOLER_PIN), -1) -#define GET_BOARD_ADC() TERN(HAS_TEMP_ADC_BOARD, PIN_TO_ADC(TEMP_BOARD_PIN), -1) -#define GET_FILAMENT_WIDTH_ADC() TERN(FILAMENT_WIDTH_SENSOR, PIN_TO_ADC(FILWIDTH_PIN), -1) -#define GET_BUTTONS_ADC() TERN(HAS_ADC_BUTTONS, PIN_TO_ADC(ADC_KEYPAD_PIN), -1) -#define GET_JOY_ADC_X() TERN(HAS_JOY_ADC_X, PIN_TO_ADC(JOY_X_PIN), -1) -#define GET_JOY_ADC_Y() TERN(HAS_JOY_ADC_Y, PIN_TO_ADC(JOY_Y_PIN), -1) -#define GET_JOY_ADC_Z() TERN(HAS_JOY_ADC_Z, PIN_TO_ADC(JOY_Z_PIN), -1) +#define GET_TEMP_0_ADC() TERN(HAS_TEMP_ADC_0, PIN_TO_ADC(TEMP_0_PIN), -1) +#define GET_TEMP_1_ADC() TERN(HAS_TEMP_ADC_1, PIN_TO_ADC(TEMP_1_PIN), -1) +#define GET_TEMP_2_ADC() TERN(HAS_TEMP_ADC_2, PIN_TO_ADC(TEMP_2_PIN), -1) +#define GET_TEMP_3_ADC() TERN(HAS_TEMP_ADC_3, PIN_TO_ADC(TEMP_3_PIN), -1) +#define GET_TEMP_4_ADC() TERN(HAS_TEMP_ADC_4, PIN_TO_ADC(TEMP_4_PIN), -1) +#define GET_TEMP_5_ADC() TERN(HAS_TEMP_ADC_5, PIN_TO_ADC(TEMP_5_PIN), -1) +#define GET_TEMP_6_ADC() TERN(HAS_TEMP_ADC_6, PIN_TO_ADC(TEMP_6_PIN), -1) +#define GET_TEMP_7_ADC() TERN(HAS_TEMP_ADC_7, PIN_TO_ADC(TEMP_7_PIN), -1) +#define GET_BED_ADC() TERN(HAS_TEMP_ADC_BED, PIN_TO_ADC(TEMP_BED_PIN), -1) +#define GET_CHAMBER_ADC() TERN(HAS_TEMP_ADC_CHAMBER, PIN_TO_ADC(TEMP_CHAMBER_PIN), -1) +#define GET_PROBE_ADC() TERN(HAS_TEMP_ADC_PROBE, PIN_TO_ADC(TEMP_PROBE_PIN), -1) +#define GET_COOLER_ADC() TERN(HAS_TEMP_ADC_COOLER, PIN_TO_ADC(TEMP_COOLER_PIN), -1) +#define GET_BOARD_ADC() TERN(HAS_TEMP_ADC_BOARD, PIN_TO_ADC(TEMP_BOARD_PIN), -1) +#define GET_SOC_ADC() TERN(HAS_TEMP_ADC_BOARD, PIN_TO_ADC(TEMP_BOARD_PIN), -1) +#define GET_FILAMENT_WIDTH_ADC() TERN(FILAMENT_WIDTH_SENSOR, PIN_TO_ADC(FILWIDTH_PIN), -1) +#define GET_BUTTONS_ADC() TERN(HAS_ADC_BUTTONS, PIN_TO_ADC(ADC_KEYPAD_PIN), -1) +#define GET_JOY_ADC_X() TERN(HAS_JOY_ADC_X, PIN_TO_ADC(JOY_X_PIN), -1) +#define GET_JOY_ADC_Y() TERN(HAS_JOY_ADC_Y, PIN_TO_ADC(JOY_Y_PIN), -1) +#define GET_JOY_ADC_Z() TERN(HAS_JOY_ADC_Z, PIN_TO_ADC(JOY_Z_PIN), -1) +#define GET_POWERMON_ADC_CURRENT() TERN(POWER_MONITOR_CURRENT, PIN_TO_ADC(POWER_MONITOR_CURRENT_PIN), -1) +#define GET_POWERMON_ADC_VOLTS() TERN(POWER_MONITOR_VOLTAGE, PIN_TO_ADC(POWER_MONITOR_VOLTAGE_PIN), -1) #define IS_ADC_REQUIRED(n) ( \ GET_TEMP_0_ADC() == n || GET_TEMP_1_ADC() == n || GET_TEMP_2_ADC() == n || GET_TEMP_3_ADC() == n \ @@ -73,10 +76,11 @@ || GET_CHAMBER_ADC() == n \ || GET_PROBE_ADC() == n \ || GET_COOLER_ADC() == n \ - || GET_BOARD_ADC() == n \ + || GET_BOARD_ADC() == n || GET_SOC_ADC() == n \ || GET_FILAMENT_WIDTH_ADC() == n \ || GET_BUTTONS_ADC() == n \ || GET_JOY_ADC_X() == n || GET_JOY_ADC_Y() == n || GET_JOY_ADC_Z() == n \ + || GET_POWERMON_ADC_CURRENT() == n || GET_POWERMON_ADC_VOLTS() == n \ ) #if IS_ADC_REQUIRED(0) @@ -136,6 +140,9 @@ enum ADCIndex { #if GET_BOARD_ADC() == 0 TEMP_BOARD, #endif + #if GET_SOC_ADC() == 0 + TEMP_SOC, + #endif #if GET_FILAMENT_WIDTH_ADC() == 0 FILWIDTH, #endif @@ -151,6 +158,15 @@ enum ADCIndex { #if GET_JOY_ADC_Z() == 0 JOY_Z, #endif + #if GET_POWERMON_ADC_CURRENT() == 0 + POWERMON_CURRENT, + #endif + #if GET_POWERMON_ADC_VOLTS() == 0 + POWERMON_VOLTAGE, + #endif + + // Indexes for ADC1 after those for ADC0 + #if GET_TEMP_0_ADC() == 1 TEMP_0, #endif @@ -190,6 +206,9 @@ enum ADCIndex { #if GET_BOARD_ADC() == 1 TEMP_BOARD, #endif + #if GET_SOC_ADC() == 1 + TEMP_SOC, + #endif #if GET_FILAMENT_WIDTH_ADC() == 1 FILWIDTH, #endif @@ -205,6 +224,12 @@ enum ADCIndex { #if GET_JOY_ADC_Z() == 1 JOY_Z, #endif + #if GET_POWERMON_ADC_CURRENT() == 1 + POWERMON_CURRENT, + #endif + #if GET_POWERMON_ADC_VOLTS() == 1 + POWERMON_VOLTAGE, + #endif ADC_COUNT }; @@ -303,6 +328,9 @@ enum ADCIndex { #if GET_BOARD_ADC() == 0 TEMP_BOARD_PIN, #endif + #if GET_SOC_ADC() == 0 + TEMP_SOC_PIN, + #endif #if GET_FILAMENT_WIDTH_ADC() == 0 FILWIDTH_PIN, #endif @@ -318,7 +346,15 @@ enum ADCIndex { #if GET_JOY_ADC_Z() == 0 JOY_Z_PIN, #endif - // ADC1 pins + #if GET_POWERMON_ADC_CURRENT() == 0 + POWER_MONITOR_CURRENT_PIN, + #endif + #if GET_POWERMON_ADC_VOLTS() == 0 + POWER_MONITOR_VOLTAGE_PIN, + #endif + + // Pins for ADC1 after ADC0 + #if GET_TEMP_0_ADC() == 1 TEMP_0_PIN, #endif @@ -358,6 +394,9 @@ enum ADCIndex { #if GET_BOARD_ADC() == 1 TEMP_BOARD_PIN, #endif + #if GET_SOC_ADC() == 1 + TEMP_SOC_PIN, + #endif #if GET_FILAMENT_WIDTH_ADC() == 1 FILWIDTH_PIN, #endif @@ -373,6 +412,12 @@ enum ADCIndex { #if GET_JOY_ADC_Z() == 1 JOY_Z_PIN, #endif + #if GET_POWERMON_ADC_CURRENT() == 1 + POWER_MONITOR_CURRENT_PIN, + #endif + #if GET_POWERMON_ADC_VOLTS() == 1 + POWER_MONITOR_VOLTAGE_PIN, + #endif }; static uint16_t adc_results[ADC_COUNT]; @@ -420,6 +465,9 @@ enum ADCIndex { #if GET_BOARD_ADC() == 0 { PIN_TO_INPUTCTRL(TEMP_BOARD_PIN) }, #endif + #if GET_SOC_ADC() == 0 + { PIN_TO_INPUTCTRL(TEMP_SOC_PIN) }, + #endif #if GET_FILAMENT_WIDTH_ADC() == 0 { PIN_TO_INPUTCTRL(FILWIDTH_PIN) }, #endif @@ -435,6 +483,12 @@ enum ADCIndex { #if GET_JOY_ADC_Z() == 0 { PIN_TO_INPUTCTRL(JOY_Z_PIN) }, #endif + #if GET_POWERMON_ADC_CURRENT() == 0 + { PIN_TO_INPUTCTRL(POWER_MONITOR_CURRENT_PIN) }, + #endif + #if GET_POWERMON_ADC_VOLTS() == 0 + { PIN_TO_INPUTCTRL(POWER_MONITOR_VOLTAGE_PIN) }, + #endif }; #define ADC0_AINCOUNT COUNT(adc0_dma_regs_list) @@ -483,6 +537,9 @@ enum ADCIndex { #if GET_BOARD_ADC() == 1 { PIN_TO_INPUTCTRL(TEMP_BOARD_PIN) }, #endif + #if GET_SOC_ADC() == 1 + { PIN_TO_INPUTCTRL(TEMP_SOC_PIN) }, + #endif #if GET_FILAMENT_WIDTH_ADC() == 1 { PIN_TO_INPUTCTRL(FILWIDTH_PIN) }, #endif @@ -498,6 +555,12 @@ enum ADCIndex { #if GET_JOY_ADC_Z() == 1 { PIN_TO_INPUTCTRL(JOY_Z_PIN) }, #endif + #if GET_POWERMON_ADC_CURRENT() == 1 + { PIN_TO_INPUTCTRL(POWER_MONITOR_CURRENT_PIN) }, + #endif + #if GET_POWERMON_ADC_VOLTS() == 1 + { PIN_TO_INPUTCTRL(POWER_MONITOR_VOLTAGE_PIN) }, + #endif }; #define ADC1_AINCOUNT COUNT(adc1_dma_regs_list) diff --git a/Marlin/src/HAL/STM32/tft/xpt2046.cpp b/Marlin/src/HAL/STM32/tft/xpt2046.cpp index 57c50653c9ce..c5645ad79c4a 100644 --- a/Marlin/src/HAL/STM32/tft/xpt2046.cpp +++ b/Marlin/src/HAL/STM32/tft/xpt2046.cpp @@ -123,7 +123,7 @@ bool XPT2046::getRawPoint(int16_t * const x, int16_t * const y) { if (isBusy() || !isTouched()) return false; *x = getRawData(XPT2046_X); *y = getRawData(XPT2046_Y); - return true; + return isTouched(); } uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) { diff --git a/Marlin/src/HAL/STM32F1/HAL.cpp b/Marlin/src/HAL/STM32F1/HAL.cpp index a83c3a23bf7d..376778a2b3b2 100644 --- a/Marlin/src/HAL/STM32F1/HAL.cpp +++ b/Marlin/src/HAL/STM32F1/HAL.cpp @@ -313,7 +313,7 @@ enum ADCIndex : uint8_t { OPTITEM(HAS_JOY_ADC_Y, JOY_Y) OPTITEM(HAS_JOY_ADC_Z, JOY_Z) OPTITEM(POWER_MONITOR_CURRENT, POWERMON_CURRENT) - OPTITEM(POWER_MONITOR_VOLTAGE, POWERMON_VOLTS) + OPTITEM(POWER_MONITOR_VOLTAGE, POWERMON_VOLTAGE) ADC_COUNT }; @@ -381,7 +381,7 @@ void MarlinHAL::adc_start(const pin_t pin) { _TCASE(FILAMENT_WIDTH_SENSOR, FILWIDTH_PIN, FILWIDTH) _TCASE(HAS_ADC_BUTTONS, ADC_KEYPAD_PIN, ADC_KEY) _TCASE(POWER_MONITOR_CURRENT, POWER_MONITOR_CURRENT_PIN, POWERMON_CURRENT) - _TCASE(POWER_MONITOR_VOLTAGE, POWER_MONITOR_VOLTAGE_PIN, POWERMON_VOLTS) + _TCASE(POWER_MONITOR_VOLTAGE, POWER_MONITOR_VOLTAGE_PIN, POWERMON_VOLTAGE) } adc_result = (adc_results[(int)pin_index] & 0xFFF) >> (12 - HAL_ADC_RESOLUTION); // shift out unused bits } diff --git a/Marlin/src/HAL/STM32F1/HAL.h b/Marlin/src/HAL/STM32F1/HAL.h index c4b90db68a19..52d3b805e611 100644 --- a/Marlin/src/HAL/STM32F1/HAL.h +++ b/Marlin/src/HAL/STM32F1/HAL.h @@ -221,8 +221,6 @@ void flashFirmware(const int16_t); // Memory related #define __bss_end __bss_end__ -void _delay_ms(const int ms); - extern "C" char* _sbrk(int incr); #pragma GCC diagnostic push diff --git a/Marlin/src/HAL/STM32F1/onboard_sd.cpp b/Marlin/src/HAL/STM32F1/onboard_sd.cpp index df5549217d98..a3d8dcb2d57e 100644 --- a/Marlin/src/HAL/STM32F1/onboard_sd.cpp +++ b/Marlin/src/HAL/STM32F1/onboard_sd.cpp @@ -5,9 +5,6 @@ * Copyright (c) 2019 BigTreeTech [https://github.com/bigtreetech] * Copyright (C) 2015, ChaN, all right reserved. * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * * This software is a free software and there is NO WARRANTY. * No restriction on use. You can use, modify and redistribute it for * personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY. diff --git a/Marlin/src/HAL/STM32F1/tft/xpt2046.cpp b/Marlin/src/HAL/STM32F1/tft/xpt2046.cpp index 3428110c127e..475290de45b2 100644 --- a/Marlin/src/HAL/STM32F1/tft/xpt2046.cpp +++ b/Marlin/src/HAL/STM32F1/tft/xpt2046.cpp @@ -90,7 +90,7 @@ bool XPT2046::getRawPoint(int16_t * const x, int16_t * const y) { if (isBusy() || !isTouched()) return false; *x = getRawData(XPT2046_X); *y = getRawData(XPT2046_Y); - return true; + return isTouched(); } uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) { diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index cf590724b588..0c685460bf08 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -462,6 +462,7 @@ #define BOARD_I3DBEEZ9_V1 5247 // I3DBEEZ9 V1 (STM32F407ZG) #define BOARD_MELLOW_FLY_E3_V2 5248 // Mellow Fly E3 V2 (STM32F407VG) #define BOARD_FYSETC_CHEETAH_V30 5249 // FYSETC Cheetah V3.0 (STM32F446RC) +#define BOARD_BLACKBEEZMINI_V1 5250 // BlackBeezMini V1 (STM32F401CCU6) // // ARM Cortex-M7 diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 531dc5b558b0..dbdbdc5affee 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -263,7 +263,7 @@ void GcodeSuite::G28() { #if ENABLED(DEBUG_LEVELING_FEATURE) auto debug_current = [](FSTR_P const s, const int16_t a, const int16_t b) { - if (DEBUGGING(LEVELING)) { DEBUG_ECHOF(s); DEBUG_ECHOLNPGM(" current: ", a, " -> ", b); } + if (DEBUGGING(LEVELING)) { DEBUG_ECHOLN(s, F(" current: "), a, F(" -> "), b); } }; #else #define debug_current(...) @@ -638,6 +638,11 @@ void GcodeSuite::G28() { tool_change(old_tool_index, TERN(PARKING_EXTRUDER, !pe_final_change_must_unpark, DISABLED(DUAL_X_CARRIAGE))); // Do move if one of these #endif + #ifdef XY_AFTER_HOMING + constexpr xy_pos_t xy_after XY_AFTER_HOMING; + do_blocking_move_to(xy_after); + #endif + restore_feedrate_and_scaling(); if (ENABLED(NANODLP_Z_SYNC) && (ENABLED(NANODLP_ALL_AXIS) || TERN0(HAS_Z_AXIS, doZ))) @@ -654,4 +659,8 @@ void GcodeSuite::G28() { TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(old_grblstate)); + #ifdef EVENT_GCODE_AFTER_HOMING + gcode.process_subcommands_now(F(EVENT_GCODE_AFTER_HOMING)); + #endif + } diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 634652c9bf99..44a87dbb1a0d 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1256,7 +1256,7 @@ * currently HAL.h must be included ahead of pins.h. */ #if LCD_IS_SERIAL_HOST && !defined(LCD_SERIAL_PORT) - #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_E3_TURBO, BTT_OCTOPUS_V1_1, AQUILA_V101) + #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_MINI_E3_V3_0_1, BTT_SKR_E3_TURBO, BTT_OCTOPUS_V1_1, AQUILA_V101) #define LCD_SERIAL_PORT 1 #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_F401RE, CREALITY_V423, MKS_ROBIN, PANOWIN_CUTLASS, KODAMA_BARDO) #define LCD_SERIAL_PORT 2 diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index f28395a6c957..00848ef9e115 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-11-27" + #define STRING_DISTRIBUTION_DATE "2023-12-04" #endif /** diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 26ecfbf533a5..606d308c08cf 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -707,7 +707,7 @@ /** * Maple environment */ -#ifdef __STM32F1__ +#if defined(__STM32F1__) && DISABLED(NO_MAPLE_WARNING) #warning "Maple build environments are deprecated. Please use a non-Maple build environment. Report issues to the Marlin Firmware project." #endif diff --git a/Marlin/src/lcd/e3v2/common/encoder.h b/Marlin/src/lcd/e3v2/common/encoder.h index 72d37108dcf2..ce431c9811b1 100644 --- a/Marlin/src/lcd/e3v2/common/encoder.h +++ b/Marlin/src/lcd/e3v2/common/encoder.h @@ -45,7 +45,7 @@ typedef enum { ENCODER_DIFF_ENTER = 3 // click } EncoderState; -#define ENCODER_WAIT_MS 20 +#define ENCODER_WAIT_MS TERN(DWIN_LCD_PROUI, 10, 20) // Encoder initialization void encoderConfiguration(); diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 6e7898a389f9..be8605e3bba0 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -389,9 +389,9 @@ class TextScroller { // Draw value text on if (viewer_print_value) { - xy_uint_t offset { 0, cell_height_px / 2 - 6 }; + const int8_t offset_y = cell_height_px / 2 - 6; if (isnan(bedlevel.z_values[x][y])) { // undefined - dwinDrawString(false, font6x12, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + cell_width_px / 2 - 5, start_y_px + offset.y, F("X")); + dwinDrawString(false, font6x12, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); } else { // has value MString<12> msg; @@ -399,10 +399,10 @@ class TextScroller { msg.set(p_float_t(abs(bedlevel.z_values[x][y]), 2)); else msg.setf(F("%02i"), uint16_t(abs(bedlevel.z_values[x][y] - int16_t(bedlevel.z_values[x][y])) * 100)); - offset.x = cell_width_px / 2 - 3 * msg.length() - 2; + const int8_t offset_x = cell_width_px / 2 - 3 * msg.length() - 2; if (GRID_MAX_POINTS_X >= 10) - dwinDrawString(false, font6x12, COLOR_WHITE, COLOR_BG_BLUE, start_x_px - 2 + offset.x, start_y_px + offset.y /*+ square / 2 - 6*/, F(".")); - dwinDrawString(false, font6x12, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + 1 + offset.x, start_y_px + offset.y /*+ square / 2 - 6*/, msg); + dwinDrawString(false, font6x12, COLOR_WHITE, COLOR_BG_BLUE, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F(".")); + dwinDrawString(false, font6x12, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + 1 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, msg); } safe_delay(10); LCD_SERIAL.flushTX(); diff --git a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp index a58233220e72..0b20dcc35cb8 100644 --- a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp @@ -248,9 +248,9 @@ bool BedLevelTools::meshValidate() { // Draw value text on const uint8_t fs = DWINUI::fontWidth(meshfont); if (viewer_print_value) { - xy_uint_t offset { 0, cell_height_px / 2 - fs }; + const int8_t offset_y = cell_height_px / 2 - fs; if (isnan(bedlevel.z_values[x][y])) { // undefined - dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + cell_width_px / 2 - 5, start_y_px + offset.y, F("X")); + dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); } else { // has value MString<12> msg; @@ -258,10 +258,10 @@ bool BedLevelTools::meshValidate() { msg.set(p_float_t(abs(bedlevel.z_values[x][y]), 2)); else msg.setf(F("%02i"), uint16_t(abs(bedlevel.z_values[x][y] - int16_t(bedlevel.z_values[x][y])) * 100)); - offset.x = cell_width_px / 2 - (fs / 2) * msg.length() - 2; + const int8_t offset_x = cell_width_px / 2 - (fs / 2) * msg.length() - 2; if ((GRID_MAX_POINTS_X) >= TERN(TJC_DISPLAY, 8, 10)) - dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px - 2 + offset.x, start_y_px + offset.y, F(".")); - dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + 1 + offset.x, start_y_px + offset.y, msg); + dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px - 2 + offset_x, start_y_px + offset_y, F(".")); + dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + 1 + offset_x, start_y_px + offset_y, msg); } safe_delay(10); LCD_SERIAL.flushTX(); diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 899c6d19efc4..42d2932c1ea1 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -1722,7 +1722,7 @@ void dwinPrintAborted() { ); } #endif - hostui.notify("Print Aborted"); + TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PRINT_ABORTED))); dwinPrintFinished(); } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp index 3434bdf8c366..68e405776e9d 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -21,7 +21,7 @@ */ /** - * lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp + * lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp */ #include "../../../inc/MarlinConfigPre.h" diff --git a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp index 7adce94c2fa6..ba898162d1f7 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -305,35 +305,28 @@ uint16_t getTickDiff(const uint16_t curTick, const uint16_t lastTick) { return (TICK_CYCLE) * (lastTick <= curTick ? (curTick - lastTick) : (0xFFFFFFFF - lastTick + curTick)); } -static bool get_point(xy_int_t &point) { - if (!touch.getRawPoint(&point.x, &point.y)) return false; +static bool get_point(int16_t * const x, int16_t * const y) { + if (!touch.getRawPoint(x, y)) return false; #if ENABLED(TOUCH_SCREEN_CALIBRATION) const calibrationState state = touch_calibration.get_calibration_state(); if (WITHIN(state, CALIBRATION_TOP_LEFT, CALIBRATION_BOTTOM_LEFT)) { - if (touch_calibration.handleTouch(point)) lv_update_touch_calibration_screen(); + if (touch_calibration.handleTouch(*x, *y)) lv_update_touch_calibration_screen(); return false; } #endif - point.x = int16_t((int32_t(point.x) * _TOUCH_CALIBRATION_X) >> 16) + _TOUCH_OFFSET_X; - point.y = int16_t((int32_t(point.y) * _TOUCH_CALIBRATION_Y) >> 16) + _TOUCH_OFFSET_Y; + *x = int16_t((int32_t(*x) * _TOUCH_CALIBRATION_X) >> 16) + _TOUCH_OFFSET_X; + *y = int16_t((int32_t(*y) * _TOUCH_CALIBRATION_Y) >> 16) + _TOUCH_OFFSET_Y; return true; } bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) { static xy_int_t last { 0, 0 }; - if (get_point(last)) { - data->point.x = (TFT_ROTATION == TFT_ROTATE_180) ? TFT_WIDTH - last.x : last.x; - data->point.y = (TFT_ROTATION == TFT_ROTATE_180) ? TFT_HEIGHT - last.y : last.y; - data->state = LV_INDEV_STATE_PR; - } - else { - data->point.x = (TFT_ROTATION == TFT_ROTATE_180) ? TFT_WIDTH - last.x : last.x; - data->point.y = (TFT_ROTATION == TFT_ROTATE_180) ? TFT_HEIGHT - last.y : last.y; - data->state = LV_INDEV_STATE_REL; - } + data->state = get_point(&last.x, &last.y) ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL; + data->point.x = (TFT_ROTATION == TFT_ROTATE_180) ? TFT_WIDTH - last.x : last.x; + data->point.y = (TFT_ROTATION == TFT_ROTATE_180) ? TFT_HEIGHT - last.y : last.y; return false; // Return `false` since no data is buffering or left to read } diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 90a37ed5199c..1d95961f3b7b 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -371,8 +371,8 @@ void menu_backlash(); #define _MPC_EDIT_ITEMS(N) \ MPC_t &mpc = thermalManager.temp_hotend[MenuItemBase::itemIndex].mpc; \ - EDIT_ITEM_FAST_N(float31sign, N, MSG_MPC_POWER_E, &mpc.heater_power, 1, 200); \ - EDIT_ITEM_FAST_N(float31sign, N, MSG_MPC_BLOCK_HEAT_CAPACITY_E, &mpc.block_heat_capacity, 0, 40); \ + EDIT_ITEM_FAST_N(float41, N, MSG_MPC_POWER_E, &mpc.heater_power, 1, 200); \ + EDIT_ITEM_FAST_N(float31, N, MSG_MPC_BLOCK_HEAT_CAPACITY_E, &mpc.block_heat_capacity, 0, 40); \ EDIT_ITEM_FAST_N(float43, N, MSG_SENSOR_RESPONSIVENESS_E, &mpc.sensor_responsiveness, 0, 1); \ EDIT_ITEM_FAST_N(float43, N, MSG_MPC_AMBIENT_XFER_COEFF_E, &mpc.ambient_xfer_coeff_fan0, 0, 1) @@ -563,7 +563,7 @@ void menu_backlash(); editable.decimal = stepper.get_shaping_frequency(X_AXIS); if (editable.decimal) { ACTION_ITEM_N(X_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(X_AXIS, 0.0f); }); - EDIT_ITEM_FAST_N(float61, X_AXIS, MSG_SHAPING_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(X_AXIS, editable.decimal); }); + EDIT_ITEM_FAST_N(float41, X_AXIS, MSG_SHAPING_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(X_AXIS, editable.decimal); }); editable.decimal = stepper.get_shaping_damping_ratio(X_AXIS); EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_SHAPING_ZETA, &editable.decimal, 0.0f, 1.0f, []{ stepper.set_shaping_damping_ratio(X_AXIS, editable.decimal); }); } @@ -574,7 +574,7 @@ void menu_backlash(); editable.decimal = stepper.get_shaping_frequency(Y_AXIS); if (editable.decimal) { ACTION_ITEM_N(Y_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(Y_AXIS, 0.0f); }); - EDIT_ITEM_FAST_N(float61, Y_AXIS, MSG_SHAPING_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(Y_AXIS, editable.decimal); }); + EDIT_ITEM_FAST_N(float41, Y_AXIS, MSG_SHAPING_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(Y_AXIS, editable.decimal); }); editable.decimal = stepper.get_shaping_damping_ratio(Y_AXIS); EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_SHAPING_ZETA, &editable.decimal, 0.0f, 1.0f, []{ stepper.set_shaping_damping_ratio(Y_AXIS, editable.decimal); }); } diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index f4d5a269af69..9fb9813ee504 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -138,7 +138,7 @@ // void _lcd_level_bed_moving() { if (ui.should_draw()) { - MString<9> msg; + MString<10> msg; msg.setf(F(" %i / %u"), int(manual_probe_index + 1), total_probe_points); MenuItem_static::draw(LCD_HEIGHT / 2, GET_TEXT_F(MSG_LEVEL_BED_NEXT_POINT), SS_CENTER, msg); } diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index 4d3e33db4c5a..11f78d25d5da 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -150,10 +150,19 @@ DEFINE_MENU_EDIT_ITEM_TYPE(uint16_5 ,uint16_t ,ui16tostr5rj , 0.01f DEFINE_MENU_EDIT_ITEM_TYPE(float3 ,float ,ftostr3rj , 1 ); // 123 right-justified DEFINE_MENU_EDIT_ITEM_TYPE(float42_52 ,float ,ftostr42_52 , 100 , + 0.001f ); // _2.34, 12.34, -2.34 or 123.45, -23.45 DEFINE_MENU_EDIT_ITEM_TYPE(float43 ,float ,ftostr43sign ,1000 , + 0.0001f); // -1.234, _1.234, +1.234 +DEFINE_MENU_EDIT_ITEM_TYPE(float53 ,float ,ftostr53sign ,1000 , + 0.0001f); // -12.345, _2.345, +2.345 +DEFINE_MENU_EDIT_ITEM_TYPE(float54 ,float ,ftostr54sign ,10000 , + 0.00001f); // -1.2345, _1.2345, +1.2345 DEFINE_MENU_EDIT_ITEM_TYPE(float4 ,float ,ftostr4sign , 1 ); // 1234 right-justified DEFINE_MENU_EDIT_ITEM_TYPE(float5 ,float ,ftostr5rj , 1 ); // 12345 right-justified DEFINE_MENU_EDIT_ITEM_TYPE(float5_25 ,float ,ftostr5rj , 0.04f ); // 12345 right-justified (25 increment) +DEFINE_MENU_EDIT_ITEM_TYPE(float31 ,float ,ftostr31rj , 10 , + 0.01f ); // 45.6 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(float41 ,float ,ftostr41rj , 10 , + 0.01f ); // 345.6 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(float51 ,float ,ftostr51rj , 10 , + 0.01f ); // 1234.5 right-justified DEFINE_MENU_EDIT_ITEM_TYPE(float61 ,float ,ftostr61rj , 10 , + 0.01f ); // 12345.6 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(float32 ,float ,ftostr32rj , 100 , + 0.001f ); // 1.23 +DEFINE_MENU_EDIT_ITEM_TYPE(float42 ,float ,ftostr42rj , 100 , + 0.001f ); // 12.34 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(float52 ,float ,ftostr52rj , 100 , + 0.001f ); // 123.45 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(float62 ,float ,ftostr62rj , 100 , + 0.001f ); // 1234.56 right-justified DEFINE_MENU_EDIT_ITEM_TYPE(float72 ,float ,ftostr72rj , 100 , + 0.001f ); // 12345.67 right-justified DEFINE_MENU_EDIT_ITEM_TYPE(float31sign ,float ,ftostr31sign , 10 , + 0.01f ); // +12.3 DEFINE_MENU_EDIT_ITEM_TYPE(float41sign ,float ,ftostr41sign , 10 , + 0.01f ); // +123.4 diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index 8e79e397adea..3c0b21ba8fd3 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -39,7 +39,7 @@ #include "tft.h" bool Touch::enabled = true; -xy_int_t Touch::point; +int16_t Touch::x, Touch::y; touch_control_t Touch::controls[]; touch_control_t *Touch::current_control; uint16_t Touch::controls_count; @@ -67,13 +67,17 @@ void Touch::add_control(TouchControlType type, uint16_t x, uint16_t y, uint16_t if (controls_count == MAX_CONTROLS) return; controls[controls_count].type = type; - controls[controls_count].pos.set(x, y); - controls[controls_count].size.set(width, height); + controls[controls_count].x = x; + controls[controls_count].y = y; + controls[controls_count].width = width; + controls[controls_count].height = height; controls[controls_count].data = data; controls_count++; } void Touch::idle() { + int16_t _x, _y; + if (!enabled) return; // Return if Touch::idle is called within the same millisecond @@ -81,8 +85,7 @@ void Touch::idle() { if (now <= next_touch_ms) return; next_touch_ms = now; - xy_int_t got_point; - if (get_point(got_point)) { + if (get_point(&_x, &_y)) { #if HAS_RESUME_CONTINUE // UI is waiting for a click anywhere? if (wait_for_user) { @@ -106,13 +109,11 @@ void Touch::idle() { if (time_to_hold == 0) time_to_hold = now + MINIMUM_HOLD_TIME; if (PENDING(now, time_to_hold)) return; - if (bool(point)) { + if (x != 0 && y != 0) { if (current_control) { - if ( WITHIN(point.x, current_control->pos.x - FREE_MOVE_RANGE, current_control->pos.x + current_control->size.x + FREE_MOVE_RANGE) - && WITHIN(point.y, current_control->pos.y - FREE_MOVE_RANGE, current_control->pos.y + current_control->size.y + FREE_MOVE_RANGE) - ) { - LIMIT(point.x, current_control->pos.x, current_control->pos.x + current_control->size.x); - LIMIT(point.y, current_control->pos.y, current_control->pos.y + current_control->size.y); + if (WITHIN(x, current_control->x - FREE_MOVE_RANGE, current_control->x + current_control->width + FREE_MOVE_RANGE) && WITHIN(y, current_control->y - FREE_MOVE_RANGE, current_control->y + current_control->height + FREE_MOVE_RANGE)) { + LIMIT(x, current_control->x, current_control->x + current_control->width); + LIMIT(y, current_control->y, current_control->y + current_control->height); touch(current_control); } else @@ -120,10 +121,7 @@ void Touch::idle() { } else { for (uint16_t i = 0; i < controls_count; i++) { - if (TERN0(TOUCH_SCREEN_CALIBRATION, controls[i].type == CALIBRATE) - || ( WITHIN(point.x, controls[i].pos.x, controls[i].pos.x + controls[i].size.x) - && WITHIN(point.y, controls[i].pos.y, controls[i].pos.y + controls[i].size.y)) - ) { + if ((WITHIN(x, controls[i].x, controls[i].x + controls[i].width) && WITHIN(y, controls[i].y, controls[i].y + controls[i].height)) || (TERN(TOUCH_SCREEN_CALIBRATION, controls[i].type == CALIBRATE, false))) { touch_control_type = controls[i].type; touch(&controls[i]); break; @@ -134,10 +132,11 @@ void Touch::idle() { if (!current_control) touch_time = now; } - point = got_point; + x = _x; + y = _y; } else { - point.reset(); + x = y = 0; current_control = nullptr; touch_time = 0; touch_control_type = NONE; @@ -150,7 +149,7 @@ void Touch::touch(touch_control_t *control) { switch (control->type) { #if ENABLED(TOUCH_SCREEN_CALIBRATION) case CALIBRATE: - if (touch_calibration.handleTouch(point)) ui.refresh(); + if (touch_calibration.handleTouch(x, y)) ui.refresh(); break; #endif @@ -177,7 +176,7 @@ void Touch::touch(touch_control_t *control) { ui.encoderPosition = ui.encoderPosition + LCD_HEIGHT < (uint32_t)screen_items ? ui.encoderPosition + LCD_HEIGHT : screen_items; ui.refresh(); break; - case SLIDER: hold(control); ui.encoderPosition = (point.x - control->pos.x) * control->data / control->size.x; break; + case SLIDER: hold(control); ui.encoderPosition = (x - control->x) * control->data / control->width; break; case INCREASE: hold(control, repeat_delay - 5); TERN(AUTO_BED_LEVELING_UBL, ui.external_control ? bedlevel.encoder_diff++ : ui.encoderPosition++, ui.encoderPosition++); break; case DECREASE: hold(control, repeat_delay - 5); TERN(AUTO_BED_LEVELING_UBL, ui.external_control ? bedlevel.encoder_diff-- : ui.encoderPosition--, ui.encoderPosition--); break; case HEATER: @@ -263,16 +262,19 @@ void Touch::hold(touch_control_t *control, millis_t delay) { ui.refresh(); } -bool Touch::get_point(xy_int_t &point) { - bool is_touched = false; +bool Touch::get_point(int16_t * const x, int16_t * const y) { #if ANY(TFT_TOUCH_DEVICE_XPT2046, TFT_TOUCH_DEVICE_GT911) - is_touched = (TOUCH_ORIENTATION_NONE != _TOUCH_ORIENTATION) - && (TOUCH_PORTRAIT == _TOUCH_ORIENTATION - ? io.getRawPoint(&point.y, &point.x) - : io.getRawPoint(&point.x, &point.y)); - #if ENABLED(TFT_TOUCH_DEVICE_XPT2046) - point.x = uint16_t((uint32_t(point.x) * _TOUCH_CALIBRATION_X) >> 16) + _TOUCH_OFFSET_X; - point.y = uint16_t((uint32_t(point.y) * _TOUCH_CALIBRATION_Y) >> 16) + _TOUCH_OFFSET_Y; + const bool is_touched = TOUCH_PORTRAIT == _TOUCH_ORIENTATION ? io.getRawPoint(y, x) : io.getRawPoint(x, y); + #endif + #if ENABLED(TFT_TOUCH_DEVICE_XPT2046) + #if ENABLED(TOUCH_SCREEN_CALIBRATION) + if (is_touched && TOUCH_ORIENTATION_NONE != _TOUCH_ORIENTATION) { + *x = int16_t((int32_t(*x) * _TOUCH_CALIBRATION_X) >> 16) + _TOUCH_OFFSET_X; + *y = int16_t((int32_t(*y) * _TOUCH_CALIBRATION_Y) >> 16) + _TOUCH_OFFSET_Y; + } + #else + *x = uint16_t((uint32_t(*x) * _TOUCH_CALIBRATION_X) >> 16) + _TOUCH_OFFSET_X; + *y = uint16_t((uint32_t(*y) * _TOUCH_CALIBRATION_Y) >> 16) + _TOUCH_OFFSET_Y; #endif #endif diff --git a/Marlin/src/lcd/tft/touch.h b/Marlin/src/lcd/tft/touch.h index 6c0ff88f4674..93f9327a15b3 100644 --- a/Marlin/src/lcd/tft/touch.h +++ b/Marlin/src/lcd/tft/touch.h @@ -57,8 +57,10 @@ enum TouchControlType : uint16_t { typedef struct __attribute__((__packed__)) { TouchControlType type; - xy_uint_t pos; - xy_uint_t size; + uint16_t x; + uint16_t y; + uint16_t width; + uint16_t height; intptr_t data; } touch_control_t; @@ -75,7 +77,7 @@ typedef struct __attribute__((__packed__)) { class Touch { private: static TOUCH_DRIVER_CLASS io; - static xy_int_t point; + static int16_t x, y; static bool enabled; static touch_control_t controls[MAX_CONTROLS]; @@ -85,7 +87,7 @@ class Touch { static millis_t next_touch_ms, time_to_hold, repeat_delay, touch_time; static TouchControlType touch_control_type; - static bool get_point(xy_int_t &point); + static bool get_point(int16_t * const x, int16_t * const y); static void touch(touch_control_t *control); static void hold(touch_control_t *control, millis_t delay=0); diff --git a/Marlin/src/lcd/tft_io/touch_calibration.cpp b/Marlin/src/lcd/tft_io/touch_calibration.cpp index b1cdfe6cda94..f76c29eb49f2 100644 --- a/Marlin/src/lcd/tft_io/touch_calibration.cpp +++ b/Marlin/src/lcd/tft_io/touch_calibration.cpp @@ -58,18 +58,18 @@ void TouchCalibration::validate_calibration() { #define CP(N) calibration_points[CALIBRATION_##N] if (landscape) { calibration_state = CALIBRATION_SUCCESS; - calibration.x = ((CP(TOP_RIGHT).x - CP(TOP_LEFT).x) << 17) / (CP(BOTTOM_RIGHT).raw.x + CP(TOP_RIGHT).raw.x - CP(BOTTOM_LEFT).raw.x - CP(TOP_LEFT).raw.x); - calibration.y = ((CP(BOTTOM_LEFT).y - CP(TOP_LEFT).y) << 17) / (CP(BOTTOM_RIGHT).raw.y - CP(TOP_RIGHT).raw.y + CP(BOTTOM_LEFT).raw.y - CP(TOP_LEFT).raw.y); - calibration.offset.x = CP(TOP_LEFT).x - int16_t(((CP(TOP_LEFT).raw.x + CP(BOTTOM_LEFT).raw.x) * calibration.x) >> 17); - calibration.offset.y = CP(TOP_LEFT).y - int16_t(((CP(TOP_LEFT).raw.y + CP(TOP_RIGHT).raw.y) * calibration.y) >> 17); + calibration.x = ((CP(TOP_RIGHT).x - CP(TOP_LEFT).x) << 17) / (CP(BOTTOM_RIGHT).raw_x + CP(TOP_RIGHT).raw_x - CP(BOTTOM_LEFT).raw_x - CP(TOP_LEFT).raw_x); + calibration.y = ((CP(BOTTOM_LEFT).y - CP(TOP_LEFT).y) << 17) / (CP(BOTTOM_RIGHT).raw_y - CP(TOP_RIGHT).raw_y + CP(BOTTOM_LEFT).raw_y - CP(TOP_LEFT).raw_y); + calibration.offset_x = CP(TOP_LEFT).x - int16_t(((CP(TOP_LEFT).raw_x + CP(BOTTOM_LEFT).raw_x) * calibration.x) >> 17); + calibration.offset_y = CP(TOP_LEFT).y - int16_t(((CP(TOP_LEFT).raw_y + CP(TOP_RIGHT).raw_y) * calibration.y) >> 17); calibration.orientation = TOUCH_LANDSCAPE; } else if (portrait) { calibration_state = CALIBRATION_SUCCESS; - calibration.x = ((CP(TOP_RIGHT).x - CP(TOP_LEFT).x) << 17) / (CP(BOTTOM_RIGHT).raw.y + CP(TOP_RIGHT).raw.y - CP(BOTTOM_LEFT).raw.y - CP(TOP_LEFT).raw.y); - calibration.y = ((CP(BOTTOM_LEFT).y - CP(TOP_LEFT).y) << 17) / (CP(BOTTOM_RIGHT).raw.x - CP(TOP_RIGHT).raw.x + CP(BOTTOM_LEFT).raw.x - CP(TOP_LEFT).raw.x); - calibration.offset.x = CP(TOP_LEFT).x - int16_t(((CP(TOP_LEFT).raw.y + CP(BOTTOM_LEFT).raw.y) * calibration.x) >> 17); - calibration.offset.y = CP(TOP_LEFT).y - int16_t(((CP(TOP_LEFT).raw.x + CP(TOP_RIGHT).raw.x) * calibration.y) >> 17); + calibration.x = ((CP(TOP_RIGHT).x - CP(TOP_LEFT).x) << 17) / (CP(BOTTOM_RIGHT).raw_y + CP(TOP_RIGHT).raw_y - CP(BOTTOM_LEFT).raw_y - CP(TOP_LEFT).raw_y); + calibration.y = ((CP(BOTTOM_LEFT).y - CP(TOP_LEFT).y) << 17) / (CP(BOTTOM_RIGHT).raw_x - CP(TOP_RIGHT).raw_x + CP(BOTTOM_LEFT).raw_x - CP(TOP_LEFT).raw_x); + calibration.offset_x = CP(TOP_LEFT).x - int16_t(((CP(TOP_LEFT).raw_y + CP(BOTTOM_LEFT).raw_y) * calibration.x) >> 17); + calibration.offset_y = CP(TOP_LEFT).y - int16_t(((CP(TOP_LEFT).raw_x + CP(TOP_RIGHT).raw_x) * calibration.y) >> 17); calibration.orientation = TOUCH_PORTRAIT; } else { @@ -83,23 +83,23 @@ void TouchCalibration::validate_calibration() { SERIAL_ECHOLNPGM("Touch screen calibration completed"); SERIAL_ECHOLN(F("#define TOUCH_"), F("CALIBRATION_X "), calibration.x); SERIAL_ECHOLN(F("#define TOUCH_"), F("CALIBRATION_Y "), calibration.y); - SERIAL_ECHOLN(F("#define TOUCH_"), F("OFFSET_X "), calibration.offset.x); - SERIAL_ECHOLN(F("#define TOUCH_"), F("OFFSET_Y "), calibration.offset.y); + SERIAL_ECHOLN(F("#define TOUCH_"), F("OFFSET_X "), calibration.offset_x); + SERIAL_ECHOLN(F("#define TOUCH_"), F("OFFSET_Y "), calibration.offset_y); SERIAL_ECHO(F("#define TOUCH_")); SERIAL_ECHO_TERNARY(calibration.orientation == TOUCH_LANDSCAPE, "ORIENTATION ", "TOUCH_LANDSCAPE", "TOUCH_PORTRAIT", "\n"); TERN_(TOUCH_CALIBRATION_AUTO_SAVE, settings.save()); } } -bool TouchCalibration::handleTouch(const xy_int_t &point) { +bool TouchCalibration::handleTouch(const uint16_t x, const uint16_t y) { const millis_t now = millis(); + if (next_touch_update_ms && PENDING(now, next_touch_update_ms)) return false; next_touch_update_ms = now + BUTTON_DELAY_MENU; if (calibration_state < CALIBRATION_SUCCESS) { - calibration_points[calibration_state].raw = point; - DEBUG_ECHOLNPGM("TouchCalibration - State: ", calibration_state, - ", x: ", calibration_points[calibration_state].x, ", raw.x: ", point.x, - ", y: ", calibration_points[calibration_state].y, ", raw.y: ", point.y); + calibration_points[calibration_state].raw_x = x; + calibration_points[calibration_state].raw_y = y; + DEBUG_ECHOLNPGM("TouchCalibration - State: ", calibration_state, ", x: ", calibration_points[calibration_state].x, ", raw_x: ", x, ", y: ", calibration_points[calibration_state].y, ", raw_y: ", y); } switch (calibration_state) { diff --git a/Marlin/src/lcd/tft_io/touch_calibration.h b/Marlin/src/lcd/tft_io/touch_calibration.h index be226db224cc..5e15f85cb570 100644 --- a/Marlin/src/lcd/tft_io/touch_calibration.h +++ b/Marlin/src/lcd/tft_io/touch_calibration.h @@ -27,8 +27,8 @@ #define _TOUCH_CALIBRATION_X touch_calibration.calibration.x #define _TOUCH_CALIBRATION_Y touch_calibration.calibration.y -#define _TOUCH_OFFSET_X touch_calibration.calibration.offset.x -#define _TOUCH_OFFSET_Y touch_calibration.calibration.offset.y +#define _TOUCH_OFFSET_X touch_calibration.calibration.offset_x +#define _TOUCH_OFFSET_Y touch_calibration.calibration.offset_y #define _TOUCH_ORIENTATION touch_calibration.calibration.orientation #ifndef TOUCH_SCREEN_CALIBRATION_PRECISION @@ -38,22 +38,15 @@ #define TOUCH_SCREEN_HOLD_TO_CALIBRATE_MS 2500 #endif -typedef struct __attribute__((__packed__)) TouchCal : xy_long_t { - xy_int_t offset; +typedef struct __attribute__((__packed__)) { + int32_t x, y; + int16_t offset_x, offset_y; uint8_t orientation; - TouchCal() { set(xy_long_t({ 0, 0 }), xy_int_t({ 0, 0 }), TOUCH_ORIENTATION_NONE); } - void set(const xy_long_t &xy, const xy_int_t &hv, const uint8_t o) { - xy_long_t::set(xy); offset = hv; orientation = o; - } - void reset() { - set(xy_long_t({ TOUCH_CALIBRATION_X, TOUCH_CALIBRATION_Y }), - xy_int_t({ TOUCH_OFFSET_X, TOUCH_OFFSET_Y }), - TOUCH_ORIENTATION); - } } touch_calibration_t; -typedef struct __attribute__((__packed__)) : xy_uint_t { - xy_int_t raw; +typedef struct __attribute__((__packed__)) { + uint16_t x, y; + int16_t raw_x, raw_y; } touch_calibration_point_t; enum calibrationState : uint8_t { @@ -72,24 +65,28 @@ class TouchCalibration { static touch_calibration_point_t calibration_points[4]; static millis_t next_touch_update_ms; - static bool validate_precision(int32_t a, int32_t b) { return (a > b ? (100 * b) / a : (100 * a) / b) > (TOUCH_SCREEN_CALIBRATION_PRECISION); } - static bool validate_precision_x(uint8_t a, uint8_t b) { return validate_precision(calibration_points[a].raw.x, calibration_points[b].raw.x); } - static bool validate_precision_y(uint8_t a, uint8_t b) { return validate_precision(calibration_points[a].raw.y, calibration_points[b].raw.y); } + static bool validate_precision(int32_t a, int32_t b) { return (a > b ? (100 * b) / a : (100 * a) / b) > TOUCH_SCREEN_CALIBRATION_PRECISION; } + static bool validate_precision_x(uint8_t a, uint8_t b) { return validate_precision(calibration_points[a].raw_x, calibration_points[b].raw_x); } + static bool validate_precision_y(uint8_t a, uint8_t b) { return validate_precision(calibration_points[a].raw_y, calibration_points[b].raw_y); } static void validate_calibration(); static touch_calibration_t calibration; static uint8_t failed_count; - static void calibration_reset() { calibration.set(xy_long_t({ TOUCH_CALIBRATION_X, TOUCH_CALIBRATION_Y }), xy_int_t({ TOUCH_OFFSET_X, TOUCH_OFFSET_Y }), TOUCH_ORIENTATION); } - static bool need_calibration() { return !(calibration.offset.x || calibration.offset.y || calibration.x || calibration.y); } + static void calibration_reset() { calibration = { TOUCH_CALIBRATION_X, TOUCH_CALIBRATION_Y, TOUCH_OFFSET_X, TOUCH_OFFSET_Y, TOUCH_ORIENTATION }; } + static bool need_calibration() { return !calibration.offset_x && !calibration.offset_y && !calibration.x && !calibration.y; } static calibrationState calibration_start() { next_touch_update_ms = millis() + 750UL; - calibration.reset(); + calibration = { 0, 0, 0, 0, TOUCH_ORIENTATION_NONE }; calibration_state = CALIBRATION_TOP_LEFT; - calibration_points[CALIBRATION_TOP_LEFT].set(30, 30); - calibration_points[CALIBRATION_TOP_RIGHT].set(TFT_WIDTH - 31, 30); - calibration_points[CALIBRATION_BOTTOM_RIGHT].set(TFT_WIDTH - 31, TFT_HEIGHT - 31); - calibration_points[CALIBRATION_BOTTOM_LEFT].set(30, TFT_HEIGHT - 31); + calibration_points[CALIBRATION_TOP_LEFT].x = 30; + calibration_points[CALIBRATION_TOP_LEFT].y = 30; + calibration_points[CALIBRATION_TOP_RIGHT].x = TFT_WIDTH - 31; + calibration_points[CALIBRATION_TOP_RIGHT].y = 30; + calibration_points[CALIBRATION_BOTTOM_RIGHT].x = TFT_WIDTH - 31; + calibration_points[CALIBRATION_BOTTOM_RIGHT].y = TFT_HEIGHT - 31; + calibration_points[CALIBRATION_BOTTOM_LEFT].x = 30; + calibration_points[CALIBRATION_BOTTOM_LEFT].y = TFT_HEIGHT - 31; failed_count = 0; return calibration_state; } @@ -100,12 +97,12 @@ class TouchCalibration { return !need_calibration(); } - static bool handleTouch(const xy_int_t &point); + static bool handleTouch(const uint16_t x, const uint16_t y); }; extern TouchCalibration touch_calibration; -#else // TOUCH_SCREEN_CALIBRATION +#else // !TOUCH_SCREEN_CALIBRATION #define _TOUCH_CALIBRATION_X (TOUCH_CALIBRATION_X) #define _TOUCH_CALIBRATION_Y (TOUCH_CALIBRATION_Y) diff --git a/Marlin/src/lcd/touch/touch_buttons.cpp b/Marlin/src/lcd/touch/touch_buttons.cpp index 636a31dafa41..7d31b21c04a6 100644 --- a/Marlin/src/lcd/touch/touch_buttons.cpp +++ b/Marlin/src/lcd/touch/touch_buttons.cpp @@ -66,6 +66,7 @@ uint8_t TouchButtons::read_buttons() { int16_t x, y; #if ENABLED(TFT_TOUCH_DEVICE_XPT2046) + const bool is_touched = TOUCH_PORTRAIT == _TOUCH_ORIENTATION ? touchIO.getRawPoint(&y, &x) : touchIO.getRawPoint(&x, &y); @@ -88,13 +89,16 @@ uint8_t TouchButtons::read_buttons() { #if ENABLED(TOUCH_SCREEN_CALIBRATION) const calibrationState state = touch_calibration.get_calibration_state(); if (WITHIN(state, CALIBRATION_TOP_LEFT, CALIBRATION_BOTTOM_LEFT)) { - if (!no_touch && touch_calibration.handleTouch(xy_int_t({x, y}))) ui.refresh(); + if (!no_touch && touch_calibration.handleTouch(x, y)) ui.refresh(); no_touch = true; return 0; } + x = int16_t((int32_t(x) * _TOUCH_CALIBRATION_X) >> 16) + _TOUCH_OFFSET_X; + y = int16_t((int32_t(y) * _TOUCH_CALIBRATION_Y) >> 16) + _TOUCH_OFFSET_Y; + #else + x = uint16_t((uint32_t(x) * _TOUCH_CALIBRATION_X) >> 16) + _TOUCH_OFFSET_X; + y = uint16_t((uint32_t(y) * _TOUCH_CALIBRATION_Y) >> 16) + _TOUCH_OFFSET_Y; #endif - x = uint16_t((uint32_t(x) * _TOUCH_CALIBRATION_X) >> 16) + _TOUCH_OFFSET_X; - y = uint16_t((uint32_t(y) * _TOUCH_CALIBRATION_Y) >> 16) + _TOUCH_OFFSET_Y; #elif ENABLED(TFT_TOUCH_DEVICE_GT911) diff --git a/Marlin/src/libs/numtostr.cpp b/Marlin/src/libs/numtostr.cpp index e27373263556..3efbf68217e6 100644 --- a/Marlin/src/libs/numtostr.cpp +++ b/Marlin/src/libs/numtostr.cpp @@ -45,7 +45,7 @@ constexpr long UINTFLOAT(const float V, const int N) { char conv[9] = { 0 }; -// Format uint8_t (0-100) as rj string with 123% / _12% / __1% format +// Format uint8_t (0-100) as rj string with __3% / _23% / 123% format const char* pcttostrpctrj(const uint8_t i) { conv[4] = RJDIGIT(i, 100); conv[5] = RJDIGIT(i, 10); @@ -59,7 +59,7 @@ const char* ui8tostr4pctrj(const uint8_t i) { return pcttostrpctrj(ui8_to_percent(i)); } -// Convert unsigned 8bit int to string 123 format +// Convert unsigned 8bit int to string with __3 / _23 / 123 format const char* ui8tostr3rj(const uint8_t i) { conv[5] = RJDIGIT(i, 100); conv[6] = RJDIGIT(i, 10); @@ -74,7 +74,7 @@ const char* ui8tostr2(const uint8_t i) { return &conv[6]; } -// Convert signed 8bit int to rj string with 123 or -12 format +// Convert signed 8bit int to rj string with __3 / _23 / 123 / -_3 / -23 format const char* i8tostr3rj(const int8_t x) { int xx = x; conv[5] = MINUSOR(xx, RJDIGIT(xx, 100)); @@ -105,32 +105,26 @@ const char* i8tostr3rj(const int8_t x) { } #endif -// Convert unsigned 16bit int to string 12345 format -const char* ui16tostr5rj(const uint16_t xx) { - conv[3] = RJDIGIT(xx, 10000); - conv[4] = RJDIGIT(xx, 1000); - conv[5] = RJDIGIT(xx, 100); - conv[6] = RJDIGIT(xx, 10); +// Convert unsigned 16bit int to right-justified string +inline const char* ui16tostrXrj(const uint16_t xx, const int index) { + switch (index) { + case 0 ... 3: conv[3] = RJDIGIT(xx, 10000); + case 4: conv[4] = RJDIGIT(xx, 1000); + case 5: conv[5] = RJDIGIT(xx, 100); + case 6: conv[6] = RJDIGIT(xx, 10); + } conv[7] = DIGIMOD(xx, 1); - return &conv[3]; + return &conv[index]; } -// Convert unsigned 16bit int to string 1234 format -const char* ui16tostr4rj(const uint16_t xx) { - conv[4] = RJDIGIT(xx, 1000); - conv[5] = RJDIGIT(xx, 100); - conv[6] = RJDIGIT(xx, 10); - conv[7] = DIGIMOD(xx, 1); - return &conv[4]; -} +// Convert unsigned 16bit int to string with 12345 format +const char* ui16tostr5rj(const uint16_t xx) { return ui16tostrXrj(xx, 8 - 5); } -// Convert unsigned 16bit int to string 123 format -const char* ui16tostr3rj(const uint16_t xx) { - conv[5] = RJDIGIT(xx, 100); - conv[6] = RJDIGIT(xx, 10); - conv[7] = DIGIMOD(xx, 1); - return &conv[5]; -} +// Convert unsigned 16bit int to string with 1234 format +const char* ui16tostr4rj(const uint16_t xx) { return ui16tostrXrj(xx, 8 - 4); } + +// Convert unsigned 16bit int to string with 123 format +const char* ui16tostr3rj(const uint16_t xx) { return ui16tostrXrj(xx, 8 - 3); } // Convert signed 16bit int to rj string with 123 or -12 format const char* i16tostr3rj(const int16_t x) { @@ -222,7 +216,7 @@ const char* ftostr41ns(const_float_t f) { return &conv[3]; } -// Convert signed float to fixed-length string with 12.34 / _2.34 / -2.34 or -23.45 / 123.45 format +// Convert float to fixed-length string with 12.34 / _2.34 / -2.34 or -23.45 / 123.45 format const char* ftostr42_52(const_float_t f) { if (f <= -10 || f >= 100) return ftostr52(f); // -23.45 / 123.45 long i = INTFLOAT(f, 2); @@ -234,7 +228,7 @@ const char* ftostr42_52(const_float_t f) { return &conv[3]; } -// Convert signed float to fixed-length string with 023.45 / -23.45 format +// Convert float to fixed-length string with 023.45 / -23.45 format const char* ftostr52(const_float_t f) { long i = INTFLOAT(f, 2); conv[2] = MINUSOR(i, DIGIMOD(i, 10000)); @@ -246,7 +240,7 @@ const char* ftostr52(const_float_t f) { return &conv[2]; } -// Convert signed float to fixed-length string with 12.345 / _2.345 / -2.345 or -23.45 / 123.45 format +// Convert float to fixed-length string with 12.345 / _2.345 / -2.345 or -23.45 / 123.45 format const char* ftostr53_63(const_float_t f) { if (f <= -10 || f >= 100) return ftostr63(f); // -23.456 / 123.456 long i = INTFLOAT(f, 3); @@ -259,7 +253,7 @@ const char* ftostr53_63(const_float_t f) { return &conv[2]; } -// Convert signed float to fixed-length string with 023.456 / -23.456 format +// Convert float to fixed-length string with 023.456 / -23.456 format const char* ftostr63(const_float_t f) { long i = INTFLOAT(f, 3); conv[1] = MINUSOR(i, DIGIMOD(i, 100000)); @@ -289,42 +283,58 @@ const char* ftostr63(const_float_t f) { #endif -// Convert float to fixed-length string with +12.3 / -12.3 format -const char* ftostr31sign(const_float_t f) { - int i = INTFLOAT(f, 1); - conv[3] = MINUSOR(i, '+'); - conv[4] = DIGIMOD(i, 100); +// +// Convert float to fixed-length string with +/- and a single decimal place +// +inline const char* ftostrX1sign(const_float_t f, const int index) { + long i = INTFLOAT(f, 1); + conv[index] = MINUSOR(i, '+'); + switch (index + 1) { + case 1: conv[1] = DIGIMOD(i, 100000); + case 2: conv[2] = DIGIMOD(i, 10000); + case 3: conv[3] = DIGIMOD(i, 1000); + case 4: conv[4] = DIGIMOD(i, 100); + } conv[5] = DIGIMOD(i, 10); conv[6] = '.'; conv[7] = DIGIMOD(i, 1); - return &conv[3]; + return &conv[index]; } +// Convert float to fixed-length string with +12.3 / -12.3 format +const char* ftostr31sign(const_float_t f) { return ftostrX1sign(f, 3); } + // Convert float to fixed-length string with +123.4 / -123.4 format -const char* ftostr41sign(const_float_t f) { - int i = INTFLOAT(f, 1); - conv[2] = MINUSOR(i, '+'); - conv[3] = DIGIMOD(i, 1000); - conv[4] = DIGIMOD(i, 100); - conv[5] = DIGIMOD(i, 10); - conv[6] = '.'; - conv[7] = DIGIMOD(i, 1); - return &conv[2]; -} +const char* ftostr41sign(const_float_t f) { return ftostrX1sign(f, 2); } -// Convert signed float to string (6 digit) with -1.234 / _0.000 / +1.234 format -const char* ftostr43sign(const_float_t f, char plus/*=' '*/) { - long i = INTFLOAT(f, 3); - conv[2] = i ? MINUSOR(i, plus) : ' '; +// Convert float to fixed-length string with +1234.5 / +1234.5 format +const char* ftostr51sign(const_float_t f) { return ftostrX1sign(f, 1); } + +// +// Convert float to string with +/ /- and 3 decimal places +// +inline const char* ftostrX3sign(const_float_t f, const int index, char plus/*=' '*/) { + long i = INTFLOAT(f, 1); + conv[index] = i ? MINUSOR(i, plus) : ' '; + switch (index + 1) { + case 1: conv[1] = DIGIMOD(i, 100000); + case 2: conv[2] = DIGIMOD(i, 10000); + } conv[3] = DIGIMOD(i, 1000); conv[4] = '.'; conv[5] = DIGIMOD(i, 100); conv[6] = DIGIMOD(i, 10); conv[7] = DIGIMOD(i, 1); - return &conv[2]; + return &conv[index]; } -// Convert signed float to string (5 digit) with -1.2345 / _0.0000 / +1.2345 format +// Convert float to string (6 chars) with -1.234 / _0.000 / +1.234 format +const char* ftostr43sign(const_float_t f, char plus/*=' '*/) { return ftostrX3sign(f, 2, plus); } + +// Convert float to string (7 chars) with -12.345 / _00.000 / +12.345 format +const char* ftostr53sign(const_float_t f, char plus/*=' '*/) { return ftostrX3sign(f, 1, plus); } + +// Convert float to string (7 chars) with -1.2345 / _0.0000 / +1.2345 format const char* ftostr54sign(const_float_t f, char plus/*=' '*/) { long i = INTFLOAT(f, 4); conv[1] = i ? MINUSOR(i, plus) : ' '; @@ -343,19 +353,6 @@ const char* ftostr5rj(const_float_t f) { return ui16tostr5rj(i); } -// Convert signed float to string with +1234.5 format -const char* ftostr51sign(const_float_t f) { - long i = INTFLOAT(f, 1); - conv[1] = MINUSOR(i, '+'); - conv[2] = DIGIMOD(i, 10000); - conv[3] = DIGIMOD(i, 1000); - conv[4] = DIGIMOD(i, 100); - conv[5] = DIGIMOD(i, 10); - conv[6] = '.'; - conv[7] = DIGIMOD(i, 1); - return &conv[1]; -} - // Convert signed float to string with +123.45 format const char* ftostr52sign(const_float_t f) { long i = INTFLOAT(f, 2); @@ -369,47 +366,66 @@ const char* ftostr52sign(const_float_t f) { return &conv[1]; } -// Convert signed float to string with +12.345 format -const char* ftostr53sign(const_float_t f) { - long i = INTFLOAT(f, 3); - conv[1] = MINUSOR(i, '+'); - conv[2] = DIGIMOD(i, 10000); - conv[3] = DIGIMOD(i, 1000); - conv[4] = '.'; - conv[5] = DIGIMOD(i, 100); - conv[6] = DIGIMOD(i, 10); - conv[7] = DIGIMOD(i, 1); - return &conv[1]; -} - -// Convert unsigned float to string with ____5.6, ___45.6, __345.6, _2345.6, 12345.6 format -const char* ftostr61rj(const_float_t f) { +// Convert unsigned float to string with a single digit precision +inline const char* ftostrX1rj(const_float_t f, const int index=1) { const long i = UINTFLOAT(f, 1); - conv[1] = RJDIGIT(i, 100000); - conv[2] = RJDIGIT(i, 10000); - conv[3] = RJDIGIT(i, 1000); - conv[4] = RJDIGIT(i, 100); + switch (index) { + case 0: conv[0] = RJDIGIT(i, 1000000); + case 1: conv[1] = RJDIGIT(i, 100000); + case 2: conv[2] = RJDIGIT(i, 10000); + case 3: conv[3] = RJDIGIT(i, 1000); + case 4: conv[4] = RJDIGIT(i, 100); + } conv[5] = DIGIMOD(i, 10); conv[6] = '.'; conv[7] = DIGIMOD(i, 1); - return &conv[1]; + return &conv[index]; } -// Convert unsigned float to string with ____5.67, ___45.67, __345.67, _2345.67, 12345.67 format -const char* ftostr72rj(const_float_t f) { +// Convert unsigned float to string with _2.3 / 12.3 format +const char* ftostr31rj(const_float_t f) { return ftostrX1rj(f, 7 - 3); } + +// Convert unsigned float to string with __3.4 / _23.4 / 123.4 format +const char* ftostr41rj(const_float_t f) { return ftostrX1rj(f, 7 - 4); } + +// Convert unsigned float to string with ___4.5 / __34.5 / _234.5 / 1234.5 format +const char* ftostr51rj(const_float_t f) { return ftostrX1rj(f, 7 - 5); } + +// Convert unsigned float to string with ____5.6 / ___45.6 / __345.6 / _2345.6 / 12345.6 format +const char* ftostr61rj(const_float_t f) { return ftostrX1rj(f, 7 - 6); } + +// Convert unsigned float to string with two digit precision +inline const char* ftostrX2rj(const_float_t f, const int index=1) { const long i = UINTFLOAT(f, 2); - conv[0] = RJDIGIT(i, 1000000); - conv[1] = RJDIGIT(i, 100000); - conv[2] = RJDIGIT(i, 10000); - conv[3] = RJDIGIT(i, 1000); - conv[4] = DIGIMOD(i, 100); + switch (index) { + case 0: conv[0] = RJDIGIT(i, 1000000); + case 1: conv[1] = RJDIGIT(i, 100000); + case 2: conv[2] = RJDIGIT(i, 10000); + case 3: conv[3] = RJDIGIT(i, 1000); + case 4: conv[4] = RJDIGIT(i, 100); + } conv[5] = '.'; conv[6] = DIGIMOD(i, 10); conv[7] = DIGIMOD(i, 1); - return conv; + return &conv[index]; } -// Convert signed float to space-padded string with -_23.4_ format +// Convert unsigned float to string with 1.23 format +const char* ftostr32rj(const_float_t f) { return ftostrX2rj(f, 4); } + +// Convert unsigned float to string with _2.34, 12.34 format +const char* ftostr42rj(const_float_t f) { return ftostrX2rj(f, 3); } + +// Convert unsigned float to string with __3.45, _23.45, 123.45 format +const char* ftostr52rj(const_float_t f) { return ftostrX2rj(f, 2); } + +// Convert unsigned float to string with ___4.56, __34.56, _234.56, 1234.56 format +const char* ftostr62rj(const_float_t f) { return ftostrX2rj(f, 1); } + +// Convert unsigned float to string with ____5.67, ___45.67, __345.67, _2345.67, 12345.67 format +const char* ftostr72rj(const_float_t f) { return ftostrX2rj(f, 0); } + +// Convert float to space-padded string with -_23.4_ format const char* ftostr52sp(const_float_t f) { long i = INTFLOAT(f, 2); uint8_t dig; @@ -418,17 +434,17 @@ const char* ftostr52sp(const_float_t f) { conv[3] = RJDIGIT(i, 1000); conv[4] = DIGIMOD(i, 100); - if ((dig = i % 10)) { // second digit after decimal point? + if ((dig = i % 10)) { // Second digit after decimal point? conv[5] = '.'; conv[6] = DIGIMOD(i, 10); conv[7] = DIGIT(dig); } else { - if ((dig = (i / 10) % 10)) { // first digit after decimal point? + if ((dig = (i / 10) % 10)) { // First digit after decimal point? conv[5] = '.'; conv[6] = DIGIT(dig); } - else // nothing after decimal point + else // Nothing after decimal point conv[5] = conv[6] = ' '; conv[7] = ' '; } @@ -440,7 +456,7 @@ const char* utostr3(const uint16_t x) { return i16tostr3left(_MIN(x, 999U)); } -// Convert signed float to space-padded string with 1.23, 12.34, 123.45 format +// Convert float to space-padded string with 1.23, 12.34, 123.45 format const char* ftostr52sprj(const_float_t f) { long i = INTFLOAT(f, 2); LIMIT(i, -99999, 99999); // cap to -999.99 - 999.99 range diff --git a/Marlin/src/libs/numtostr.h b/Marlin/src/libs/numtostr.h index f8af09ebeeca..fde07e836846 100644 --- a/Marlin/src/libs/numtostr.h +++ b/Marlin/src/libs/numtostr.h @@ -40,7 +40,7 @@ const char* ui8tostr3rj(const uint8_t i); const char* i8tostr3rj(const int8_t x); #if HAS_PRINT_PROGRESS_PERMYRIAD - // Convert 16-bit unsigned permyriad value to percent: 100 / 23 / 23.4 / 3.45 + // Convert 16-bit unsigned permyriad value to percent: _100 / __23 / 23.4 / 3.45 const char* permyriadtostr4(const uint16_t xx); #endif @@ -86,22 +86,34 @@ const char* ftostr53_63(const_float_t x); // Convert signed float to fixed-length string with 023.456 / -23.456 format const char* ftostr63(const_float_t x); -// Convert float to fixed-length string with +12.3 / -12.3 format +// Convert signed float to fixed-length string with +12.3 / -12.3 format const char* ftostr31sign(const_float_t x); -// Convert float to fixed-length string with +123.4 / -123.4 format +// Convert signed float to fixed-length string with +123.4 / -123.4 format const char* ftostr41sign(const_float_t x); +// Convert signed float to fixed-length string with +1234.5 / +1234.5 format +const char* ftostr51sign(const_float_t x); + // Convert signed float to string (6 digit) with -1.234 / _0.000 / +1.234 format const char* ftostr43sign(const_float_t x, char plus=' '); +// Convert signed float to string (7 chars) with -12.345 / _00.000 / +12.345 format +const char* ftostr53sign(const_float_t x, char plus=' '); + // Convert signed float to string (5 digit) with -1.2345 / _0.0000 / +1.2345 format const char* ftostr54sign(const_float_t x, char plus=' '); // Convert unsigned float to rj string with 12345 format const char* ftostr5rj(const_float_t x); -// Convert signed float to string with +1234.5 format +// Convert signed float to fixed-length string with +12.3 / -12.3 format +const char* ftostr31sign(const_float_t x); + +// Convert signed float to fixed-length string with +123.4 / -123.4 format +const char* ftostr41sign(const_float_t x); + +// Convert signed float to fixed-length string with +1234.5 format const char* ftostr51sign(const_float_t x); // Convert signed float to space-padded string with -_23.4_ format @@ -110,23 +122,41 @@ const char* ftostr52sp(const_float_t x); // Convert signed float to string with +123.45 format const char* ftostr52sign(const_float_t x); -// Convert signed float to string with +12.345 format -const char* ftostr53sign(const_float_t f); +// Convert unsigned float to string with _2.3 / 12.3 format +const char* ftostr31rj(const_float_t x); -// Convert unsigned float to string with 12345.6 format omitting trailing zeros +// Convert unsigned float to string with __3.4 / _23.4 / 123.4 format +const char* ftostr41rj(const_float_t x); + +// Convert unsigned float to string with ___4.5 / __34.5 / _234.5 / 1234.5 format +const char* ftostr51rj(const_float_t x); + +// Convert unsigned float to string with ____5.6 / ___45.6 / __345.6 / _2345.6 / 12345.6 format const char* ftostr61rj(const_float_t x); -// Convert unsigned float to string with 12345.67 format omitting trailing zeros +// Convert unsigned float to string with 1.23 format +const char* ftostr32rj(const_float_t f); + +// Convert unsigned float to string with _2.34, 12.34 format +const char* ftostr42rj(const_float_t f); + +// Convert unsigned float to string with __3.45, _23.45, 123.45 format +const char* ftostr52rj(const_float_t f); + +// Convert unsigned float to string with ___4.56, __34.56, _234.56, 1234.56 format +const char* ftostr62rj(const_float_t f); + +// Convert unsigned float to string with ____5.67, ___45.67, __345.67, _2345.67, 12345.67 format const char* ftostr72rj(const_float_t x); -// Convert float to rj string with 123 or -12 format +// Convert signed float to rj string with 123 or -12 format FORCE_INLINE const char* ftostr3rj(const_float_t x) { return i16tostr3rj(int16_t(x + (x < 0 ? -0.5f : 0.5f))); } #if ENABLED(LCD_DECIMAL_SMALL_XY) - // Convert float to rj string with 1234, _123, 12.3, _1.2, -123, _-12, or -1.2 format + // Convert signed float to rj string with 1234, _123, 12.3, _1.2, -123, _-12, or -1.2 format const char* ftostr4sign(const_float_t fx); #else - // Convert float to rj string with 1234, _123, -123, __12, _-12, ___1, or __-1 format + // Convert signed float to rj string with 1234, _123, -123, __12, _-12, ___1, or __-1 format FORCE_INLINE const char* ftostr4sign(const_float_t x) { return i16tostr4signrj(int16_t(x + (x < 0 ? -0.5f : 0.5f))); } #endif diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 0f060f572048..9c6a3c011cca 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -1360,7 +1360,7 @@ void Endstops::update() { #if ENABLED(DEBUG_LEVELING_FEATURE) auto debug_current = [](FSTR_P const s, const int16_t a, const int16_t b) { - if (DEBUGGING(LEVELING)) { DEBUG_ECHOF(s); DEBUG_ECHOLNPGM(" current: ", a, " -> ", b); } + if (DEBUGGING(LEVELING)) { DEBUG_ECHOLN(s, F(" current: "), a, F(" -> "), b); } }; #else #define debug_current(...) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index deeb53942ba3..0bd83bc3ac10 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -596,11 +596,15 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { thermalManager.wait_for_hotend_heating(active_extruder); #endif - // Ensure the BLTouch is deployed. Does nothing if already deployed. - if (TERN0(BLTOUCH, bltouch.deploy())) return true; + #if ENABLED(BLTOUCH) + // Ensure the BLTouch is deployed. (Does nothing if already deployed.) + // Don't deploy with high_speed_mode enabled. The probe already re-deploys itself. + if (TERN(MEASURE_BACKLASH_WHEN_PROBING, true, !bltouch.high_speed_mode) && bltouch.deploy()) + return true; + #endif #if HAS_Z_SERVO_PROBE && (ENABLED(Z_SERVO_INTERMEDIATE_STOW) || defined(Z_SERVO_MEASURE_ANGLE)) - probe_specific_action(true); // Always re-deploy in this case + probe_specific_action(true); // Always re-deploy in this case #endif // Disable stealthChop if used. Enable diag1 pin on driver. diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 01cd8272d097..e1e917a286d8 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -810,6 +810,8 @@ #include "stm32f4/pins_I3DBEEZ9.h" // STM32F4 env:I3DBEEZ9_V1 #elif MB(MELLOW_FLY_E3_V2) #include "stm32f4/pins_MELLOW_FLY_E3_V2.h" // STM32F4 env:FLY_E3_V2 +#elif MB(BLACKBEEZMINI_V1) + #include "stm32f4/pins_BLACKBEEZMINI.h" // STM32F4 env:BLACKBEEZMINI_V1 // // ARM Cortex-M7 diff --git a/Marlin/src/pins/stm32f1/pins_BEAST.h b/Marlin/src/pins/stm32f1/pins_BEAST.h index b136ca52cd70..cf64ff1c6a29 100644 --- a/Marlin/src/pins/stm32f1/pins_BEAST.h +++ b/Marlin/src/pins/stm32f1/pins_BEAST.h @@ -24,7 +24,7 @@ #include "env_validate.h" /** - * 21017 Victor Perez Marlin for stm32f1 test + * 2017 Victor Perez Marlin for stm32f1 test */ #define BOARD_INFO_NAME "Beast STM32" diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V521.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V521.h index d555c0aaa12d..2660b6e50518 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V521.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V521.h @@ -135,7 +135,7 @@ #define FAN0_PIN PB14 // FAN #define FAN1_PIN PB12 // FAN -#define FAN_SOFT_PWM +#define FAN_SOFT_PWM_REQUIRED // // SD Card diff --git a/Marlin/src/pins/stm32f1/pins_STM32F1R.h b/Marlin/src/pins/stm32f1/pins_STM32F1R.h index a2efa632f8c8..9cbc69149cd5 100644 --- a/Marlin/src/pins/stm32f1/pins_STM32F1R.h +++ b/Marlin/src/pins/stm32f1/pins_STM32F1R.h @@ -24,7 +24,7 @@ #include "env_validate.h" /** - * 21017 Victor Perez Marlin for stm32f1 test + * 2017 Victor Perez Marlin for stm32f1 test */ #define BOARD_INFO_NAME "Misc. STM32F1R" diff --git a/Marlin/src/pins/stm32f1/pins_STM3R_MINI.h b/Marlin/src/pins/stm32f1/pins_STM3R_MINI.h index b4cf21ee7f04..e5b16460f010 100644 --- a/Marlin/src/pins/stm32f1/pins_STM3R_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_STM3R_MINI.h @@ -24,7 +24,7 @@ #include "env_validate.h" /** - * 10 Dec 2017 Victor Perez Marlin for stm32f1 test + * 2017 Victor Perez Marlin for stm32f1 test */ #define BOARD_INFO_NAME "STM3R Mini" diff --git a/Marlin/src/pins/stm32f4/pins_BLACKBEEZMINI.h b/Marlin/src/pins/stm32f4/pins_BLACKBEEZMINI.h new file mode 100644 index 000000000000..33b2219655ea --- /dev/null +++ b/Marlin/src/pins/stm32f4/pins_BLACKBEEZMINI.h @@ -0,0 +1,176 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#if NOT_TARGET(STM32F4) + #error "Oops! Select an STM32F4 board in 'Tools > Board.'" +#elif HOTENDS > 1 || E_STEPPERS > 1 + #error "STM32F401CCU6 boards support one hotend / E-steppers only." +#endif + +#include "env_validate.h" + +#ifndef DEFAULT_MACHINE_NAME + #define DEFAULT_MACHINE_NAME "I3DBEE BP_01" +#endif + +#define TEMP_TIMER 5 + +//#define DISABLE_DEBUG // DISABLE_(DEBUG|JTAG) is not supported for STM32F4. +//#define DISABLE_JTAG +//#define ALLOW_STM32F4 +//#define BOARD_NO_NATIVE_USB + +// +// EEPROM +// +#if NO_EEPROM_SELECTED + #define FLASH_EEPROM_EMULATION + #define FLASH_EEPROM_LEVELING + #define FLASH_SECTOR (FLASH_SECTOR_TOTAL - 1) + #define FLASH_UNIT_SIZE 0x4000 // 16kB + #define MARLIN_EEPROM_SIZE FLASH_UNIT_SIZE + #undef NO_EEPROM_SELECTED +#endif + +/* +#if NO_EEPROM_SELECTED + #define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 + #define SDCARD_EEPROM_EMULATION +#endif +*/ + +// +// Limit Switches +// +#define X_STOP_PIN PB9 +#define Y_STOP_PIN PB3 +#define Z_STOP_PIN PA9 + +// +// Steppers +// +#define X_STEP_PIN PB7 +#define X_DIR_PIN PB6 +#define X_ENABLE_PIN PB8 + +#define Y_STEP_PIN PB5 +#define Y_DIR_PIN PB4 +#define Y_ENABLE_PIN X_ENABLE_PIN + +#define Z_STEP_PIN PA15 +#define Z_DIR_PIN PA10 +#define Z_ENABLE_PIN X_ENABLE_PIN + +#define E0_STEP_PIN PA8 +#define E0_DIR_PIN PB15 +#define E0_ENABLE_PIN X_ENABLE_PIN + +// +// Temperature Sensors +// +#define TEMP_0_PIN PB1 // Analog Input (HOTEND thermistor) +#define TEMP_BED_PIN PB0 // Analog Input (BED thermistor) + +// +// Heaters / Fans +// +#define HEATER_0_PIN PA2 // HOTEND MOSFET +#define HEATER_BED_PIN PA0 // BED MOSFET + +#define FAN1_PIN PA1 // FAN1 header on board - PRINT FAN + +// +// SD Card +// +#define SDSS PA4 +#define SD_DETECT_PIN -1 +#define SD_SCK_PIN PA5 +#define SD_MISO_PIN PA6 +#define SD_MOSI_PIN PA7 + +/** + * ------ ------ + * (BEEPER) PB10 | 1 2 | PC13 (BTN_ENC) (MISO) PA6 | 1 2 | PA5 (SCK) + * (LCD_EN) PB13 | 3 4 | PB12 (LCD_RS) (BTN_EN1) PC15 | 3 4 | PA4 (SD_SS) + * (LCD_D4) PB14 5 6 | PA3 (LCD_D5) (BTN_EN2) PC14 5 6 | PA7 (MOSI) + * (LCD_D6) - | 7 8 | - (LCD_D7) (SD_DET) - | 7 8 | RESET + * GND | 9 10 | 5V GND | 9 10 | - + * ------ ------ + * EXP1 EXP2 + */ +#define EXP1_01_PIN PB10 // BEEPER +#define EXP1_02_PIN PC13 // ENC +#define EXP1_03_PIN PB13 // EN +#define EXP1_04_PIN PB12 // RS +#define EXP1_05_PIN PB14 // D4 +#define EXP1_06_PIN PA3 // D5 +#define EXP1_07_PIN -1 +#define EXP1_08_PIN -1 + +#define EXP2_01_PIN PA6 // MISO +#define EXP2_02_PIN PA5 // SCK +#define EXP2_03_PIN PC15 // EN1 +#define EXP2_04_PIN PA4 // SS +#define EXP2_05_PIN PC14 // EN2 +#define EXP2_06_PIN PA7 // MOSI +#define EXP2_07_PIN -1 +#define EXP2_08_PIN -1 // RESET +#define EXP2_10_PIN -1 + +// +// LCD / Controller +// +#if HAS_WIRED_LCD + #define BEEPER_PIN EXP1_01_PIN + + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN + #define BTN_ENC EXP1_02_PIN + + #define LCD_PINS_RS EXP1_04_PIN + #define LCD_PINS_EN EXP1_03_PIN + #define LCD_PINS_D4 EXP1_05_PIN + #define LCD_PINS_D5 EXP1_06_PIN + + #if ENABLED(FYSETC_MINI_12864) + #define DOGLCD_CS EXP1_03_PIN + #define DOGLCD_A0 EXP1_04_PIN + //#define LCD_BACKLIGHT_PIN -1 + #define LCD_RESET_PIN EXP1_05_PIN // Must be high or open for LCD to operate normally. + #if ENABLED(FYSETC_MINI_12864_2_1) + #define NEOPIXEL_PIN EXP1_06_PIN + #endif + #endif + + // + // GLCD features + // + //#define LCD_CONTRAST 190 + + // + // Dcreen orientation + // + //#define LCD_SCREEN_ROT_90 + //#define LCD_SCREEN_ROT_180 + //#define LCD_SCREEN_ROT_270 +#endif diff --git a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h index bc80720916fb..d7196b75fc34 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h @@ -201,16 +201,14 @@ #endif /** - * ---------------------------------BTT002 V1.0--------------------------------- - * ------ ------ | - * (BEEPER) PE7 | 1 2 | PB1 (BTN_ENC) (MISO) PA6 | 1 2 | PA5 (SCK) | - * (LCD_EN) PE9 | 3 4 | PE8 (LCD_RS) (BTN_EN1) PC5 | 3 4 | PA4 (SD_SS) | - * (LCD_D4) PE10 5 6 | PE11 (LCD_D5) (BTN_EN2) PB0 5 6 | PA7 (MOSI) | - * (LCD_D6) PE12 | 7 8 | PE13 (LCD_D7) (SD_DET) PC4 | 7 8 | RESET | - * GND | 9 10 | 5V GND | 9 10 | PA3 | - * ------ ------ | - * EXP1 EXP2 | - * ------------------------------------------------------------------------------ + * ------ ------ + * (BEEPER) PE7 | 1 2 | PB1 (BTN_ENC) (MISO) PA6 | 1 2 | PA5 (SCK) + * (LCD_EN) PE9 | 3 4 | PE8 (LCD_RS) (BTN_EN1) PC5 | 3 4 | PA4 (SD_SS) + * (LCD_D4) PE10 5 6 | PE11 (LCD_D5) (BTN_EN2) PB0 5 6 | PA7 (MOSI) + * (LCD_D6) PE12 | 7 8 | PE13 (LCD_D7) (SD_DET) PC4 | 7 8 | RESET + * GND | 9 10 | 5V GND | 9 10 | PA3 + * ------ ------ + * EXP1 EXP2 */ #define EXP1_01_PIN PE7 #define EXP1_02_PIN PB1 diff --git a/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h b/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h index e9e069583afe..97580bf618f9 100644 --- a/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h +++ b/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h @@ -157,7 +157,7 @@ #define FAN2_PIN PG9 // FAN2 #define FAN3_PIN PF10 // FAN3 #define CONTROLLER_FAN_PIN PD7 // BOARD FAN -#define FAN_SOFT_PWM +#define FAN_SOFT_PWM_REQUIRED // // Laser / Spindle diff --git a/buildroot/share/PlatformIO/scripts/configuration.py b/buildroot/share/PlatformIO/scripts/configuration.py old mode 100644 new mode 100755 index 496af8a76930..e0387a219da4 --- a/buildroot/share/PlatformIO/scripts/configuration.py +++ b/buildroot/share/PlatformIO/scripts/configuration.py @@ -1,8 +1,9 @@ +#!/usr/bin/env python3 # # configuration.py # Apply options from config.ini to the existing Configuration headers # -import re, shutil, configparser +import re, shutil, configparser, datetime from pathlib import Path verbose = 0 @@ -43,6 +44,7 @@ def apply_opt(name, val, conf=None): if val in ("on", "", None): newline = re.sub(r'^(\s*)//+\s*(#define)(\s{1,3})?(\s*)', r'\1\2 \4', line) elif val == "off": + # TODO: Comment more lines in a multi-line define with \ continuation newline = re.sub(r'^(\s*)(#define)(\s{1,3})?(\s*)', r'\1//\2 \4', line) else: # For options with values, enable and set the value @@ -88,9 +90,38 @@ def apply_opt(name, val, conf=None): elif not isdef: break linenum += 1 - lines.insert(linenum, f"{prefix}#define {added:30} // Added by config.ini\n") + currtime = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + lines.insert(linenum, f"{prefix}#define {added:30} // Added by config.ini {currtime}\n") fullpath.write_text(''.join(lines), encoding='utf-8') +# Disable all (most) defined options in the configuration files. +# Everything in the named sections. Section hint for exceptions may be added. +def disable_all_options(): + # Create a regex to match the option and capture parts of the line + regex = re.compile(r'^(\s*)(#define\s+)([A-Z0-9_]+\b)(\s?)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE) + + # Disable all enabled options in both Config files + for file in ("Configuration.h", "Configuration_adv.h"): + fullpath = config_path(file) + lines = fullpath.read_text(encoding='utf-8').split('\n') + found = False + for i in range(len(lines)): + line = lines[i] + match = regex.match(line) + if match: + name = match[3].upper() + if name in ('CONFIGURATION_H_VERSION', 'CONFIGURATION_ADV_H_VERSION'): continue + if name.startswith('_'): continue + found = True + # Comment out the define + # TODO: Comment more lines in a multi-line define with \ continuation + lines[i] = re.sub(r'^(\s*)(#define)(\s{1,3})?(\s*)', r'\1//\2 \4', line) + blab(f"Disable {name}") + + # If the option was found, write the modified lines + if found: + fullpath.write_text('\n'.join(lines), encoding='utf-8') + # Fetch configuration files from GitHub given the path. # Return True if any files were fetched. def fetch_example(url): @@ -130,7 +161,7 @@ def fetch_example(url): def section_items(cp, sectkey): return cp.items(sectkey) if sectkey in cp.sections() else [] -# Apply all items from a config section +# Apply all items from a config section. Ignore ini_ items outside of config:base and config:root. def apply_ini_by_name(cp, sect): iniok = True if sect in ('config:base', 'config:root'): @@ -206,7 +237,17 @@ def apply_config_ini(cp): fetch_example(ckey) ckey = 'base' - if ckey == 'all': + # + # [flatten] Write out Configuration.h and Configuration_adv.h files with + # just the enabled options and all other content removed. + # + #if ckey == '[flatten]': + # write_flat_configs() + + if ckey == '[disable]': + disable_all_options() + + elif ckey == 'all': apply_sections(cp) else: diff --git a/buildroot/share/PlatformIO/scripts/offset_and_rename.py b/buildroot/share/PlatformIO/scripts/offset_and_rename.py index 20f2b78024b8..353518600853 100644 --- a/buildroot/share/PlatformIO/scripts/offset_and_rename.py +++ b/buildroot/share/PlatformIO/scripts/offset_and_rename.py @@ -1,7 +1,7 @@ # # offset_and_rename.py # -# - If 'build.offset' is provided, either by JSON or by the environment... +# - If 'board_build.offset' is provided, either by JSON or by the environment... # - Set linker flag LD_FLASH_OFFSET and relocate the VTAB based on 'build.offset'. # - Set linker flag LD_MAX_DATA_SIZE based on 'build.maximum_ram_size'. # - Define STM32_FLASH_SIZE from 'upload.maximum_size' for use by Flash-based EEPROM emulation. diff --git a/buildroot/share/PlatformIO/scripts/schema.py b/buildroot/share/PlatformIO/scripts/schema.py index 535a8f671e94..80ba70a29812 100755 --- a/buildroot/share/PlatformIO/scripts/schema.py +++ b/buildroot/share/PlatformIO/scripts/schema.py @@ -2,8 +2,14 @@ # # schema.py # -# Used by signature.py via common-dependencies.py to generate a schema file during the PlatformIO build. -# This script can also be run standalone from within the Marlin repo to generate all schema files. +# Used by signature.py via common-dependencies.py to generate a schema file during the PlatformIO build +# when CONFIG_EXPORT is defined in the configuration. +# +# This script can also be run standalone from within the Marlin repo to generate JSON and YAML schema files. +# +# This script is a companion to abm/js/schema.js in the MarlinFirmware/AutoBuildMarlin project, which has +# been extended to evaluate conditions and can determine what options are actually enabled, not just which +# options are uncommented. That will be migrated to this script for standalone migration. # import re,json from pathlib import Path @@ -95,6 +101,8 @@ class Parse: sch_out = { 'basic':{}, 'advanced':{} } # Regex for #define NAME [VALUE] [COMMENT] with sanitized line defgrep = re.compile(r'^(//)?\s*(#define)\s+([A-Za-z0-9_]+)\s*(.*?)\s*(//.+)?$') + # Pattern to match a float value + flt = r'[-+]?\s*(\d+\.|\d*\.\d+)([eE][-+]?\d+)?[fF]?' # Defines to ignore ignore = ('CONFIGURATION_H_VERSION', 'CONFIGURATION_ADV_H_VERSION', 'CONFIG_EXAMPLES_DIR', 'CONFIG_EXPORT') # Start with unknown state @@ -314,26 +322,27 @@ def atomize(s): } # Type is based on the value - if val == '': - value_type = 'switch' - elif re.match(r'^(true|false)$', val): - value_type = 'bool' - val = val == 'true' - elif re.match(r'^[-+]?\s*\d+$', val): - value_type = 'int' - val = int(val) - elif re.match(r'[-+]?\s*(\d+\.|\d*\.\d+)([eE][-+]?\d+)?[fF]?', val): - value_type = 'float' - val = float(val.replace('f','')) - else: - value_type = 'string' if val[0] == '"' \ - else 'char' if val[0] == "'" \ - else 'state' if re.match(r'^(LOW|HIGH)$', val) \ - else 'enum' if re.match(r'^[A-Za-z0-9_]{3,}$', val) \ - else 'int[]' if re.match(r'^{(\s*[-+]?\s*\d+\s*(,\s*)?)+}$', val) \ - else 'float[]' if re.match(r'^{(\s*[-+]?\s*(\d+\.|\d*\.\d+)([eE][-+]?\d+)?[fF]?\s*(,\s*)?)+}$', val) \ - else 'array' if val[0] == '{' \ - else '' + value_type = \ + 'switch' if val == '' \ + else 'bool' if re.match(r'^(true|false)$', val) \ + else 'int' if re.match(r'^[-+]?\s*\d+$', val) \ + else 'ints' if re.match(r'^([-+]?\s*\d+)(\s*,\s*[-+]?\s*\d+)+$', val) \ + else 'floats' if re.match(rf'({flt}(\s*,\s*{flt})+)', val) \ + else 'float' if re.match(f'^({flt})$', val) \ + else 'string' if val[0] == '"' \ + else 'char' if val[0] == "'" \ + else 'state' if re.match(r'^(LOW|HIGH)$', val) \ + else 'enum' if re.match(r'^[A-Za-z0-9_]{3,}$', val) \ + else 'int[]' if re.match(r'^{\s*[-+]?\s*\d+(\s*,\s*[-+]?\s*\d+)*\s*}$', val) \ + else 'float[]' if re.match(r'^{{\s*{flt}(\s*,\s*{flt})*\s*}}$', val) \ + else 'array' if val[0] == '{' \ + else '' + + val = (val == 'true') if value_type == 'bool' \ + else int(val) if value_type == 'int' \ + else val.replace('f','') if value_type == 'floats' \ + else float(val.replace('f','')) if value_type == 'float' \ + else val if val != '': define_info['value'] = val if value_type != '': define_info['type'] = value_type @@ -402,25 +411,35 @@ def main(): if schema: - # Get the first command line argument + # Get the command line arguments after the script name import sys - if len(sys.argv) > 1: - arg = sys.argv[1] - else: - arg = 'some' + args = sys.argv[1:] + if len(args) == 0: args = ['some'] + + # Does the given array intersect at all with args? + def inargs(c): return len(set(args) & set(c)) > 0 + + # Help / Unknown option + unk = not inargs(['some','json','jsons','group','yml','yaml']) + if (unk): print(f"Unknown option: '{args[0]}'") + if inargs(['-h', '--help']) or unk: + print("Usage: schema.py [some|json|jsons|group|yml|yaml]...") + print(" some = json + yml") + print(" jsons = json + group") + return # JSON schema - if arg in ['some', 'json', 'jsons']: + if inargs(['some', 'json', 'jsons']): print("Generating JSON ...") dump_json(schema, Path('schema.json')) # JSON schema (wildcard names) - if arg in ['group', 'jsons']: + if inargs(['group', 'jsons']): group_options(schema) dump_json(schema, Path('schema_grouped.json')) # YAML - if arg in ['some', 'yml', 'yaml']: + if inargs(['some', 'yml', 'yaml']): try: import yaml except ImportError: diff --git a/buildroot/share/PlatformIO/scripts/signature.py b/buildroot/share/PlatformIO/scripts/signature.py old mode 100644 new mode 100755 index 84312da01bd9..ab1a46bae523 --- a/buildroot/share/PlatformIO/scripts/signature.py +++ b/buildroot/share/PlatformIO/scripts/signature.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # # signature.py # @@ -44,35 +45,35 @@ def compress_file(filepath, storedname, outpath): zipf.write(filepath, arcname=storedname, compress_type=zipfile.ZIP_BZIP2, compresslevel=9) # -# Compute the build signature. The idea is to extract all defines in the configuration headers -# to build a unique reversible signature from this build so it can be included in the binary -# We can reverse the signature to get a 1:1 equivalent configuration file +# Compute the build signature by extracting all configuration settings and +# building a unique reversible signature that can be included in the binary. +# The signature can be reversed to get a 1:1 equivalent configuration file. # def compute_build_signature(env): if 'BUILD_SIGNATURE' in env: return + build_path = Path(env['PROJECT_BUILD_DIR'], env['PIOENV']) + marlin_json = build_path / 'marlin_config.json' + marlin_zip = build_path / 'mc.zip' + # Definitions from these files will be kept files_to_keep = [ 'Marlin/Configuration.h', 'Marlin/Configuration_adv.h' ] - build_path = Path(env['PROJECT_BUILD_DIR'], env['PIOENV']) - # Check if we can skip processing hashes = '' for header in files_to_keep: hashes += get_file_sha256sum(header)[0:10] - marlin_json = build_path / 'marlin_config.json' - marlin_zip = build_path / 'mc.zip' - - # Read existing config file + # Read a previously exported JSON file + # Same configuration, skip recomputing the build signature + same_hash = False try: with marlin_json.open() as infile: conf = json.load(infile) - if conf['__INITIAL_HASH'] == hashes: - # Same configuration, skip recomputing the building signature + same_hash = conf['__INITIAL_HASH'] == hashes + if same_hash: compress_file(marlin_json, 'marlin_config.json', marlin_zip) - return except: pass @@ -125,9 +126,6 @@ def compute_build_signature(env): # Remove all boards now if key.startswith("BOARD_") and key != "BOARD_INFO_NAME": continue - # Remove all keys ending by "_NAME" as it does not make a difference to the configuration - if key.endswith("_NAME") and key != "CUSTOM_MACHINE_NAME": - continue # Remove all keys ending by "_T_DECLARED" as it's a copy of extraneous system stuff if key.endswith("_T_DECLARED"): continue @@ -196,7 +194,7 @@ def tryint(key): outfile.write(ini_fmt.format(key.lower(), ' = ' + val)) # - # Produce a schema.json file if CONFIG_EXPORT == 3 + # CONFIG_EXPORT 3 = schema.json, 4 = schema.yml # if config_dump >= 3: try: @@ -207,7 +205,7 @@ def tryint(key): if conf_schema: # - # Produce a schema.json file if CONFIG_EXPORT == 3 + # 3 = schema.json # if config_dump in (3, 13): print("Generating schema.json ...") @@ -217,7 +215,7 @@ def tryint(key): schema.dump_json(conf_schema, build_path / 'schema_grouped.json') # - # Produce a schema.yml file if CONFIG_EXPORT == 4 + # 4 = schema.yml # elif config_dump == 4: print("Generating schema.yml ...") @@ -243,8 +241,9 @@ def tryint(key): # # Produce a JSON file for CONFIGURATION_EMBEDDING or CONFIG_EXPORT == 1 + # Skip if an identical JSON file was already present. # - if config_dump == 1 or 'CONFIGURATION_EMBEDDING' in defines: + if not same_hash and (config_dump == 1 or 'CONFIGURATION_EMBEDDING' in defines): with marlin_json.open('w') as outfile: json.dump(data, outfile, separators=(',', ':')) @@ -255,9 +254,10 @@ def tryint(key): return # Compress the JSON file as much as we can - compress_file(marlin_json, 'marlin_config.json', marlin_zip) + if not same_hash: + compress_file(marlin_json, 'marlin_config.json', marlin_zip) - # Generate a C source file for storing this array + # Generate a C source file containing the entire ZIP file as an array with open('Marlin/src/mczip.h','wb') as result_file: result_file.write( b'#ifndef NO_CONFIGURATION_EMBEDDING_WARNING\n' @@ -274,3 +274,8 @@ def tryint(key): if count % 16: result_file.write(b'\n') result_file.write(b'};\n') + +if __name__ == "__main__": + # Build required. From command line just explain usage. + print("Use schema.py to export JSON and YAML from the command-line.") + print("Build Marlin with CONFIG_EXPORT 2 to export 'config.ini'.") diff --git a/buildroot/share/sublime/MarlinFirmware.sublime-project b/buildroot/share/sublime/MarlinFirmware.sublime-project index 11808dd45df0..62607ac0c6d1 100644 --- a/buildroot/share/sublime/MarlinFirmware.sublime-project +++ b/buildroot/share/sublime/MarlinFirmware.sublime-project @@ -30,6 +30,7 @@ "ensure_newline_at_eof_on_save": true, "tab_size": 2, "translate_tabs_to_spaces": true, - "trim_trailing_white_space_on_save": true + "trim_trailing_white_space_on_save": true, + "uncrustify_config" : "${project_dir}/../extras/uncrustify.cfg" } } diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index 46de664e43b6..d647a6ddb16c 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -94,6 +94,7 @@ opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO MIXING_STEPPERS 5 LCD_LANGUAGE ru \ FIL_RUNOUT2_PIN 16 FIL_RUNOUT3_PIN 17 FIL_RUNOUT4_PIN 4 FIL_RUNOUT5_PIN 5 opt_enable MIXING_EXTRUDER GRADIENT_MIX GRADIENT_VTOOL CR10_STOCKDISPLAY \ USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE CONTROLLER_FAN_IGNORE_Z \ + XY_AFTER_HOMING EVENT_GCODE_AFTER_HOMING \ FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE INPUT_SHAPING_X INPUT_SHAPING_Y opt_disable DISABLE_OTHER_EXTRUDERS exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Input Shaping | Greek" "$3" diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index 34025a8a38b2..4c4d938fe6df 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -399,8 +399,6 @@ build_flags = ${STM32F1_maple.build_flags} -DTEMP_TIMER_CHAN=4 board_build.address = 0x08007000 board_build.ldscript = sovol.ld board_build.rename = firmware-{date}-{time}.bin -extra_scripts = ${STM32F1_maple.extra_scripts} - buildroot/share/PlatformIO/scripts/custom_board.py debug_tool = jlink upload_protocol = jlink diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index f094b96c9bd2..0ba6b66c3fed 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -820,6 +820,20 @@ build_flags = ${stm32_variant.build_flags} -DSTM32F407_5ZX debug_tool = stlink upload_protocol = stlink +# +# BlackBeezMini (blackpill_f401cc) +# +[env:BLACKBEEZMINI_V1] +platform = ststm32 +extends = common_stm32 +board = blackpill_f401cc +board_build.offset = 0x0000 +build_flags = ${common_stm32.build_flags} + -Os -DHAL_PCD_MODULE_ENABLED + -DHAL_UART_MODULE_ENABLED +monitor_speed = 250000 +upload_protocol = dfu + # # Mellow Fly E3 V2 (STM32F407VGT6 ARM Cortex-M4) #