mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2026-01-17 05:15:32 -07:00
🔨 Single precision float
This commit is contained in:
parent
b99f5c3618
commit
89379cd373
9 changed files with 4 additions and 10 deletions
|
|
@ -271,7 +271,7 @@ void MarlinHAL::adc_start(const pin_t pin) {
|
||||||
uint32_t mv;
|
uint32_t mv;
|
||||||
esp_adc_cal_get_voltage((adc_channel_t)chan, &characteristics[attenuations[chan]], &mv);
|
esp_adc_cal_get_voltage((adc_channel_t)chan, &characteristics[attenuations[chan]], &mv);
|
||||||
|
|
||||||
adc_result = mv * isr_float_t(1023) / isr_float_t(ADC_REFERENCE_VOLTAGE) / isr_float_t(1000);
|
adc_result = (mv * 1023) * (1000.f / (ADC_REFERENCE_VOLTAGE));
|
||||||
|
|
||||||
// Change the attenuation level based on the new reading
|
// Change the attenuation level based on the new reading
|
||||||
adc_atten_t atten;
|
adc_atten_t atten;
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,6 @@
|
||||||
// Types
|
// Types
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
typedef double isr_float_t; // FPU ops are used for single-precision, so use double for ISRs.
|
|
||||||
typedef int16_t pin_t;
|
typedef int16_t pin_t;
|
||||||
|
|
||||||
typedef struct pwm_pin {
|
typedef struct pwm_pin {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@
|
||||||
#define __bss_end __bss_end__
|
#define __bss_end __bss_end__
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
typedef double isr_float_t; // FPU ops are used for single-precision, so use double for ISRs.
|
|
||||||
typedef uint8_t pin_t; // Parity with mfl platform
|
typedef uint8_t pin_t; // Parity with mfl platform
|
||||||
|
|
||||||
// Servo
|
// Servo
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,6 @@
|
||||||
// Types
|
// Types
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
typedef double isr_float_t; // FPU ops are used for single-precision, so use double for ISRs.
|
|
||||||
|
|
||||||
typedef int32_t pin_t; // Parity with platform/ststm32
|
typedef int32_t pin_t; // Parity with platform/ststm32
|
||||||
|
|
||||||
class libServo;
|
class libServo;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ if __name__ == "__main__":
|
||||||
"-fsigned-char",
|
"-fsigned-char",
|
||||||
"-fno-move-loop-invariants",
|
"-fno-move-loop-invariants",
|
||||||
"-fno-strict-aliasing",
|
"-fno-strict-aliasing",
|
||||||
"-fsingle-precision-constant",
|
|
||||||
|
|
||||||
"--specs=nano.specs",
|
"--specs=nano.specs",
|
||||||
"--specs=nosys.specs",
|
"--specs=nosys.specs",
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ if pioutil.is_pio_build():
|
||||||
# "-Wno-sign-compare",
|
# "-Wno-sign-compare",
|
||||||
"-fno-sized-deallocation"
|
"-fno-sized-deallocation"
|
||||||
]
|
]
|
||||||
if "teensy" not in env["PIOENV"]:
|
if "teensy" not in env["PIOENV"] and "esp32" not in env["PIOENV"]:
|
||||||
cxxflags += ["-Wno-register"]
|
cxxflags += ["-Wno-register"]
|
||||||
env.Append(CXXFLAGS=cxxflags)
|
env.Append(CXXFLAGS=cxxflags)
|
||||||
env.Append(CFLAGS=["-Wno-implicit-function-declaration"])
|
env.Append(CFLAGS=["-Wno-implicit-function-declaration"])
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ platform = espressif32@2.1.0
|
||||||
platform_packages = espressif/toolchain-xtensa-esp32s3
|
platform_packages = espressif/toolchain-xtensa-esp32s3
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
build_flags = ${common.build_flags} -DCORE_DEBUG_LEVEL=0 -std=gnu++17
|
build_flags = ${common.build_flags} -DCORE_DEBUG_LEVEL=0 -std=gnu++17
|
||||||
build_unflags = -std=gnu11 -std=gnu++11
|
build_unflags = -std=gnu11 -std=gnu++11 -fsingle-precision-constant -Wno-register
|
||||||
build_src_filter = ${common.default_src_filter} +<src/HAL/ESP32>
|
build_src_filter = ${common.default_src_filter} +<src/HAL/ESP32>
|
||||||
lib_ignore = NativeEthernet, AsyncTCP_RP2040W
|
lib_ignore = NativeEthernet, AsyncTCP_RP2040W
|
||||||
upload_speed = 500000
|
upload_speed = 500000
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ build_flags = ${gd32_base.build_flags}
|
||||||
-DSS_TIMER=3
|
-DSS_TIMER=3
|
||||||
-DTIMER_SERVO=4
|
-DTIMER_SERVO=4
|
||||||
-DTRANSFER_CLOCK_DIV=8
|
-DTRANSFER_CLOCK_DIV=8
|
||||||
-fsingle-precision-constant
|
|
||||||
extra_scripts = ${gd32_base.extra_scripts}
|
extra_scripts = ${gd32_base.extra_scripts}
|
||||||
buildroot/share/PlatformIO/scripts/offset_and_rename.py
|
buildroot/share/PlatformIO/scripts/offset_and_rename.py
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ extra_configs =
|
||||||
#
|
#
|
||||||
[common]
|
[common]
|
||||||
build_flags = -g3 -D__MARLIN_FIRMWARE__ -DNDEBUG
|
build_flags = -g3 -D__MARLIN_FIRMWARE__ -DNDEBUG
|
||||||
-fmax-errors=5
|
-fmax-errors=5 -fsingle-precision-constant
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
pre:buildroot/share/PlatformIO/scripts/configuration.py
|
pre:buildroot/share/PlatformIO/scripts/configuration.py
|
||||||
pre:buildroot/share/PlatformIO/scripts/common-dependencies.py
|
pre:buildroot/share/PlatformIO/scripts/common-dependencies.py
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue