Browse Source

🧑‍💻 Define isr_float_t to assert a non-FPU float (#23969)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
FB4S_WIFI
John Robertson 3 years ago
committed by Scott Lahteine
parent
commit
b0d621d8b9
  1. 2
      Marlin/src/HAL/AVR/HAL.h
  2. 2
      Marlin/src/HAL/DUE/HAL.h
  3. 3
      Marlin/src/HAL/ESP32/HAL.cpp
  4. 3
      Marlin/src/HAL/ESP32/HAL.h
  5. 2
      Marlin/src/HAL/LPC1768/HAL.h
  6. 2
      Marlin/src/HAL/NATIVE_SIM/HAL.h
  7. 2
      Marlin/src/HAL/SAMD51/HAL.h
  8. 4
      Marlin/src/HAL/STM32/HAL.h
  9. 2
      Marlin/src/HAL/STM32F1/HAL.h
  10. 2
      Marlin/src/HAL/TEENSY31_32/HAL.h
  11. 2
      Marlin/src/HAL/TEENSY35_36/HAL.h
  12. 2
      Marlin/src/HAL/TEENSY40_41/HAL.h
  13. 8
      Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp

2
Marlin/src/HAL/AVR/HAL.h

@ -229,7 +229,7 @@ public:
SBI(DIDR0, ch);
}
// Begin ADC sampling on the given channel
// Begin ADC sampling on the given channel. Called from Temperature::isr!
static void adc_start(const uint8_t ch) {
#ifdef MUX5
ADCSRB = ch > 7 ? _BV(MUX5) : 0;

2
Marlin/src/HAL/DUE/HAL.h

@ -209,7 +209,7 @@ public:
// Called by Temperature::init for each sensor at startup
static void adc_enable(const uint8_t ch) {}
// Begin ADC sampling on the given channel
// Begin ADC sampling on the given channel. Called from Temperature::isr!
static void adc_start(const uint8_t ch) { adc_result = analogRead(ch); }
// Is the ADC ready for reading?

3
Marlin/src/HAL/ESP32/HAL.cpp

@ -244,7 +244,8 @@ void MarlinHAL::adc_start(const pin_t pin) {
const adc1_channel_t chan = get_channel(pin);
uint32_t mv;
esp_adc_cal_get_voltage((adc_channel_t)chan, &characteristics[attenuations[chan]], &mv);
adc_result = mv * 1023.0f / float(ADC_REFERENCE_VOLTAGE) / 1000.0f;
adc_result = mv * isr_float_t(1023) / isr_float_t(ADC_REFERENCE_VOLTAGE) / isr_float_t(1000);
// Change the attenuation level based on the new reading
adc_atten_t atten;

3
Marlin/src/HAL/ESP32/HAL.h

@ -74,6 +74,7 @@
// Types
// ------------------------
typedef double isr_float_t; // FPU ops are used for single-precision, so use double for ISRs.
typedef int16_t pin_t;
class Servo;
@ -205,7 +206,7 @@ public:
// Called by Temperature::init for each sensor at startup
static void adc_enable(const pin_t pin) {}
// Begin ADC sampling on the given channel
// Begin ADC sampling on the given pin. Called from Temperature::isr!
static void adc_start(const pin_t pin);
// Is the ADC ready for reading?

2
Marlin/src/HAL/LPC1768/HAL.h

@ -234,7 +234,7 @@ public:
FilteredADC::enable_channel(pin);
}
// Begin ADC sampling on the given pin
// Begin ADC sampling on the given pin. Called from Temperature::isr!
static uint32_t adc_result;
static void adc_start(const pin_t pin) {
adc_result = FilteredADC::read(pin) >> (16 - HAL_ADC_RESOLUTION); // returns 16bit value, reduce to required bits

2
Marlin/src/HAL/NATIVE_SIM/HAL.h

@ -242,7 +242,7 @@ public:
// Called by Temperature::init for each sensor at startup
static void adc_enable(const uint8_t ch);
// Begin ADC sampling on the given channel
// Begin ADC sampling on the given channel. Called from Temperature::isr!
static void adc_start(const uint8_t ch);
// Is the ADC ready for reading?

2
Marlin/src/HAL/SAMD51/HAL.h

@ -190,7 +190,7 @@ public:
// Called by Temperature::init for each sensor at startup
static void adc_enable(const uint8_t ch) {}
// Begin ADC sampling on the given channel
// Begin ADC sampling on the given pin. Called from Temperature::isr!
static void adc_start(const pin_t pin);
// Is the ADC ready for reading?

4
Marlin/src/HAL/STM32/HAL.h

@ -127,6 +127,8 @@
// Types
// ------------------------
typedef double isr_float_t; // FPU ops are used for single-precision, so use double for ISRs.
#ifdef STM32G0B1xx
typedef int32_t pin_t;
#else
@ -241,7 +243,7 @@ public:
// Called by Temperature::init for each sensor at startup
static void adc_enable(const pin_t pin) { pinMode(pin, INPUT); }
// Begin ADC sampling on the given channel
// Begin ADC sampling on the given pin. Called from Temperature::isr!
static void adc_start(const pin_t pin) { adc_result = analogRead(pin); }
// Is the ADC ready for reading?

2
Marlin/src/HAL/STM32F1/HAL.h

@ -280,7 +280,7 @@ public:
// Called by Temperature::init for each sensor at startup
static void adc_enable(const pin_t pin) { pinMode(pin, INPUT_ANALOG); }
// Begin ADC sampling on the given channel
// Begin ADC sampling on the given pin. Called from Temperature::isr!
static void adc_start(const pin_t pin);
// Is the ADC ready for reading?

2
Marlin/src/HAL/TEENSY31_32/HAL.h

@ -166,7 +166,7 @@ public:
// Called by Temperature::init for each sensor at startup
static void adc_enable(const pin_t ch) {}
// Begin ADC sampling on the given channel
// Begin ADC sampling on the given channel. Called from Temperature::isr!
static void adc_start(const pin_t ch);
// Is the ADC ready for reading?

2
Marlin/src/HAL/TEENSY35_36/HAL.h

@ -173,7 +173,7 @@ public:
// Called by Temperature::init for each sensor at startup
static void adc_enable(const pin_t) {}
// Begin ADC sampling on the given channel
// Begin ADC sampling on the given pin. Called from Temperature::isr!
static void adc_start(const pin_t pin);
// Is the ADC ready for reading?

2
Marlin/src/HAL/TEENSY40_41/HAL.h

@ -195,7 +195,7 @@ public:
// Called by Temperature::init for each sensor at startup
static void adc_enable(const pin_t pin) {}
// Begin ADC sampling on the given channel
// Begin ADC sampling on the given pin. Called from Temperature::isr!
static void adc_start(const pin_t pin);
// Is the ADC ready for reading?

8
Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp

@ -196,13 +196,13 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x
#else
#define HOTEND_STATS 1
#endif
static celsius_t old_temp[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, 500),
old_target[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, 500);
static bool old_on[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, false);
static celsius_t old_temp[HOTEND_STATS] = { 0 },
old_target[HOTEND_STATS] = { 0 };
static bool old_on[HOTEND_STATS] = { false };
#endif
#if HAS_HEATED_BED
static celsius_t old_bed_temp = 500, old_bed_target = 500;
static celsius_t old_bed_temp = 0, old_bed_target = 0;
static bool old_bed_on = false;
#if HAS_LEVELING
static bool old_leveling_on = false;

Loading…
Cancel
Save