From bd6eb832500478c9e3be55f1126d0139aa013bb0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 1 Dec 2023 09:19:13 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20some=20minor=20issues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/ESP32/HAL.cpp | 2 +- Marlin/src/HAL/SAMD51/HAL.cpp | 59 +++++++++---------- Marlin/src/HAL/STM32F1/HAL.cpp | 4 +- Marlin/src/HAL/STM32F1/HAL.h | 2 - Marlin/src/HAL/STM32F1/onboard_sd.cpp | 3 - Marlin/src/inc/Conditionals_adv.h | 2 +- Marlin/src/inc/Warnings.cpp | 2 +- Marlin/src/lcd/e3v2/common/encoder.h | 2 +- Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp | 2 +- .../dgus_reloaded/dgus_reloaded_extui.cpp | 2 +- Marlin/src/lcd/menu/menu_bed_leveling.cpp | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V521.h | 2 +- Marlin/src/pins/stm32f4/pins_TRONXY_V10.h | 2 +- .../sublime/MarlinFirmware.sublime-project | 3 +- ini/stm32f1-maple.ini | 2 - 15 files changed, 42 insertions(+), 49 deletions(-) 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/SAMD51/HAL.cpp b/Marlin/src/HAL/SAMD51/HAL.cpp index beace8126cbf..a3c871ce516a 100644 --- a/Marlin/src/HAL/SAMD51/HAL.cpp +++ b/Marlin/src/HAL/SAMD51/HAL.cpp @@ -47,27 +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_SOC_ADC() TERN(HAS_TEMP_ADC_SOC, PIN_TO_ADC(TEMP_SOC_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 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 \ @@ -162,10 +162,10 @@ enum ADCIndex { POWERMON_CURRENT, #endif #if GET_POWERMON_ADC_VOLTS() == 0 - POWERMON_VOLTS, + POWERMON_VOLTAGE, #endif - // Use later indexes for ADC index 1 + // Indexes for ADC1 after those for ADC0 #if GET_TEMP_0_ADC() == 1 TEMP_0, @@ -228,9 +228,8 @@ enum ADCIndex { POWERMON_CURRENT, #endif #if GET_POWERMON_ADC_VOLTS() == 1 - POWERMON_VOLTS, + POWERMON_VOLTAGE, #endif - ADC_COUNT }; @@ -351,10 +350,10 @@ enum ADCIndex { POWER_MONITOR_CURRENT_PIN, #endif #if GET_POWERMON_ADC_VOLTS() == 0 - POWER_MONITOR_VOLTS_PIN, + POWER_MONITOR_VOLTAGE_PIN, #endif - // ADC1 pins + // Pins for ADC1 after ADC0 #if GET_TEMP_0_ADC() == 1 TEMP_0_PIN, @@ -417,7 +416,7 @@ enum ADCIndex { POWER_MONITOR_CURRENT_PIN, #endif #if GET_POWERMON_ADC_VOLTS() == 1 - POWER_MONITOR_VOLTS_PIN, + POWER_MONITOR_VOLTAGE_PIN, #endif }; @@ -488,7 +487,7 @@ enum ADCIndex { { PIN_TO_INPUTCTRL(POWER_MONITOR_CURRENT_PIN) }, #endif #if GET_POWERMON_ADC_VOLTS() == 0 - { PIN_TO_INPUTCTRL(POWER_MONITOR_VOLTS_PIN) }, + { PIN_TO_INPUTCTRL(POWER_MONITOR_VOLTAGE_PIN) }, #endif }; @@ -560,7 +559,7 @@ enum ADCIndex { { PIN_TO_INPUTCTRL(POWER_MONITOR_CURRENT_PIN) }, #endif #if GET_POWERMON_ADC_VOLTS() == 1 - { PIN_TO_INPUTCTRL(POWER_MONITOR_VOLTS_PIN) }, + { PIN_TO_INPUTCTRL(POWER_MONITOR_VOLTAGE_PIN) }, #endif }; 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/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/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/proui/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp index 853da8532e12..7c71b8fc5974 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp @@ -127,7 +127,7 @@ void dwinWriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data) dwinWord(i, addr + indx); // start address of the data block ++i; for (uint8_t j = 0; j < i; ++j) { LCD_SERIAL.write(dwinSendBuf[j]); delayMicroseconds(1); } // Buf header - for (uint16_t j = indx; j <= indx + to_send - 1; j++) LCD_SERIAL.write(*(data + j)); delayMicroseconds(1); // write block of data + for (uint16_t j = indx; j <= indx + to_send - 1; j++) { LCD_SERIAL.write(*(data + j)); delayMicroseconds(1); } // write block of data for (uint8_t j = 0; j < 4; ++j) { LCD_SERIAL.write(dwinBufTail[j]); delayMicroseconds(1); } block++; pending -= to_send; 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/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/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/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/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/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