Skip to content

Commit

Permalink
followup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 28, 2023
1 parent 6778a50 commit d888ff6
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 28 deletions.
25 changes: 10 additions & 15 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,24 +378,19 @@

#ifdef __cplusplus

#ifndef _MINMAX_H_
#define _MINMAX_H_

extern "C++" {

// C++11 solution that is standards compliant. Return type is deduced automatically
template <class L, class R> static constexpr auto _MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) {
return lhs < rhs ? lhs : rhs;
}
template <class L, class R> static constexpr auto _MAX(const L lhs, const R rhs) -> decltype(lhs + rhs) {
return lhs > rhs ? lhs : rhs;
}
template<class T, class ... Ts> static constexpr const T _MIN(T V, Ts... Vs) { return _MIN(V, _MIN(Vs...)); }
template<class T, class ... Ts> static constexpr const T _MAX(T V, Ts... Vs) { return _MAX(V, _MAX(Vs...)); }
extern "C++" {

// C++11 solution that is standards compliant. Return type is deduced automatically
template <class L, class R> static constexpr auto _MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) {
return lhs < rhs ? lhs : rhs;
}
template <class L, class R> static constexpr auto _MAX(const L lhs, const R rhs) -> decltype(lhs + rhs) {
return lhs > rhs ? lhs : rhs;
}
template<class T, class ... Ts> static constexpr const T _MIN(T V, Ts... Vs) { return _MIN(V, _MIN(Vs...)); }
template<class T, class ... Ts> static constexpr const T _MAX(T V, Ts... Vs) { return _MAX(V, _MAX(Vs...)); }

#endif
}

// Allow manipulating enumeration value like flags without ugly cast everywhere
#define ENUM_FLAGS(T) \
Expand Down
16 changes: 9 additions & 7 deletions ini/lpc176x.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,20 @@ board = nxp_lpc1768
lib_ldf_mode = off
lib_compat_mode = strict
extra_scripts = ${common.extra_scripts}
Marlin/src/HAL/LPC1768/upload_extra_script.py
Marlin/src/HAL/LPC1768/upload_extra_script.py
build_src_filter = ${common.default_src_filter} +<src/HAL/LPC1768> -<src/HAL/LPC1768/tft> +<src/HAL/shared/backtrace>
lib_deps = ${common.lib_deps}
Servo
custom_marlin.USES_LIQUIDCRYSTAL = arduino-libraries/LiquidCrystal@~1.0.7
custom_marlin.NEOPIXEL_LED = Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/1.5.0.zip
Servo
build_flags = ${common.build_flags} -DU8G_HAL_LINKS -DPLATFORM_M997_SUPPORT
-IMarlin/src/HAL/LPC1768/include -IMarlin/src/HAL/LPC1768/u8g
# debug options for backtrace
#-funwind-tables
#-mpoke-function-name
# debug options for backtrace
#-funwind-tables
#-mpoke-function-name
build_src_flags = -std=gnu++20 -Wno-volatile
custom_marlin.USES_LIQUIDCRYSTAL = arduino-libraries/LiquidCrystal@~1.0.7
custom_marlin.NEOPIXEL_LED = Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/1.5.0.zip
custom_marlin.HAS_SPI_TFT = src_filter=+<src/HAL/LPC1768/tft/tft_spi.cpp>
custom_marlin.HAS_TFT_XPT2046 = src_filter=+<src/HAL/LPC1768/tft/xpt2046.cpp>

#
# NXP LPC176x ARM Cortex-M3
Expand Down
10 changes: 5 additions & 5 deletions ini/native.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ debug_build_flags = -fstack-protector-strong -g -g3 -ggdb
lib_compat_mode = off
build_src_filter = ${common.default_src_filter} +<src/HAL/NATIVE_SIM>
lib_deps = ${common.lib_deps}
MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/refs/heads/bugfix-2.1.x.zip
Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/marlin_sim_native.zip
LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/master.zip
extra_scripts = ${common.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/simulator.py
MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/refs/heads/bugfix-2.1.x.zip
Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/marlin_sim_native.zip
LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/master.zip
extra_scripts = ${common.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/simulator.py

[simulator_linux]
extends = simulator_common
Expand Down
3 changes: 3 additions & 0 deletions ini/stm32-common.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ build_unflags = -std=gnu++11
build_src_filter = ${common.default_src_filter} +<src/HAL/STM32> -<src/HAL/STM32/tft> +<src/HAL/shared/backtrace>
extra_scripts = ${common.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
custom_marlin.HAS_SPI_TFT = src_filter=+<src/HAL/STM32/tft/tft_spi.cpp>
custom_marlin.HAS_TFT_XPT2046 = src_filter=+<src/HAL/STM32/tft/xpt2046.cpp>
custom_marlin.TFT_TOUCH_DEVICE_GT911 = src_filter=+<src/HAL/STM32/tft/gt911.cpp>

# For the latest stuff. Latest as in: we test and then bump the version.
# Please test before upgrading.
Expand Down
4 changes: 3 additions & 1 deletion ini/stm32f1-maple.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ build_unflags = -std=gnu11 -std=gnu++11
build_src_filter = ${common.default_src_filter} +<src/HAL/STM32F1> -<src/HAL/STM32F1/tft>
lib_ignore = SPI, FreeRTOS701, FreeRTOS821
lib_deps = ${common.lib_deps}
SoftwareSerialM
SoftwareSerialM
platform_packages = tool-stm32duino, [email protected]
extra_scripts = ${common.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/fix_framework_weakness.py
pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
buildroot/share/PlatformIO/scripts/custom_board.py
buildroot/share/PlatformIO/scripts/offset_and_rename.py
custom_marlin.HAS_SPI_TFT = src_filter=+<src/HAL/STM32F1/tft/tft_spi.cpp>
custom_marlin.HAS_TFT_XPT2046 = src_filter=+<src/HAL/STM32F1/tft/xpt2046.cpp>

#
# Generic STM32F103RC environment
Expand Down

0 comments on commit d888ff6

Please sign in to comment.