Skip to content

Commit

Permalink
🩹 Fix some minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Dec 2, 2023
1 parent c484228 commit bd6eb83
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 49 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/HAL/ESP32/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down
59 changes: 29 additions & 30 deletions Marlin/src/HAL/SAMD51/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -228,9 +228,8 @@ enum ADCIndex {
POWERMON_CURRENT,
#endif
#if GET_POWERMON_ADC_VOLTS() == 1
POWERMON_VOLTS,
POWERMON_VOLTAGE,
#endif

ADC_COUNT
};

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
};

Expand Down Expand Up @@ -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
};

Expand Down Expand Up @@ -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
};

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/STM32F1/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 0 additions & 2 deletions Marlin/src/HAL/STM32F1/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions Marlin/src/HAL/STM32F1/onboard_sd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Warnings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/common/encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

/**
* lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp
* lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp
*/

#include "../../../inc/MarlinConfigPre.h"
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_bed_leveling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_CREALITY_V521.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f4/pins_TRONXY_V10.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion buildroot/share/sublime/MarlinFirmware.sublime-project
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
2 changes: 0 additions & 2 deletions ini/stm32f1-maple.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit bd6eb83

Please sign in to comment.