🧑💻 Define isr_float_t to assert a non-FPU float (#23969)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
995221e68e
commit
b0d621d8b9
|
@ -229,7 +229,7 @@ public:
|
||||||
SBI(DIDR0, ch);
|
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) {
|
static void adc_start(const uint8_t ch) {
|
||||||
#ifdef MUX5
|
#ifdef MUX5
|
||||||
ADCSRB = ch > 7 ? _BV(MUX5) : 0;
|
ADCSRB = ch > 7 ? _BV(MUX5) : 0;
|
||||||
|
|
|
@ -209,7 +209,7 @@ public:
|
||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const uint8_t ch) {}
|
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); }
|
static void adc_start(const uint8_t ch) { adc_result = analogRead(ch); }
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|
|
@ -244,7 +244,8 @@ void MarlinHAL::adc_start(const pin_t pin) {
|
||||||
const adc1_channel_t chan = get_channel(pin);
|
const adc1_channel_t chan = get_channel(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 * 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
|
// Change the attenuation level based on the new reading
|
||||||
adc_atten_t atten;
|
adc_atten_t atten;
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
// 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;
|
||||||
|
|
||||||
class Servo;
|
class Servo;
|
||||||
|
@ -205,7 +206,7 @@ public:
|
||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const pin_t pin) {}
|
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);
|
static void adc_start(const pin_t pin);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|
|
@ -234,7 +234,7 @@ public:
|
||||||
FilteredADC::enable_channel(pin);
|
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 uint32_t adc_result;
|
||||||
static void adc_start(const pin_t pin) {
|
static void adc_start(const pin_t pin) {
|
||||||
adc_result = FilteredADC::read(pin) >> (16 - HAL_ADC_RESOLUTION); // returns 16bit value, reduce to required bits
|
adc_result = FilteredADC::read(pin) >> (16 - HAL_ADC_RESOLUTION); // returns 16bit value, reduce to required bits
|
||||||
|
|
|
@ -242,7 +242,7 @@ public:
|
||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const uint8_t ch);
|
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);
|
static void adc_start(const uint8_t ch);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|
|
@ -190,7 +190,7 @@ public:
|
||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const uint8_t ch) {}
|
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);
|
static void adc_start(const pin_t pin);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|
|
@ -127,6 +127,8 @@
|
||||||
// Types
|
// Types
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
|
typedef double isr_float_t; // FPU ops are used for single-precision, so use double for ISRs.
|
||||||
|
|
||||||
#ifdef STM32G0B1xx
|
#ifdef STM32G0B1xx
|
||||||
typedef int32_t pin_t;
|
typedef int32_t pin_t;
|
||||||
#else
|
#else
|
||||||
|
@ -241,7 +243,7 @@ public:
|
||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const pin_t pin) { pinMode(pin, INPUT); }
|
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); }
|
static void adc_start(const pin_t pin) { adc_result = analogRead(pin); }
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|
|
@ -280,7 +280,7 @@ public:
|
||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const pin_t pin) { pinMode(pin, INPUT_ANALOG); }
|
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);
|
static void adc_start(const pin_t pin);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|
|
@ -166,7 +166,7 @@ public:
|
||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const pin_t ch) {}
|
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);
|
static void adc_start(const pin_t ch);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|
|
@ -173,7 +173,7 @@ public:
|
||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const pin_t) {}
|
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);
|
static void adc_start(const pin_t pin);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|
|
@ -195,7 +195,7 @@ public:
|
||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const pin_t pin) {}
|
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);
|
static void adc_start(const pin_t pin);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|
|
@ -196,13 +196,13 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x
|
||||||
#else
|
#else
|
||||||
#define HOTEND_STATS 1
|
#define HOTEND_STATS 1
|
||||||
#endif
|
#endif
|
||||||
static celsius_t old_temp[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, 500),
|
static celsius_t old_temp[HOTEND_STATS] = { 0 },
|
||||||
old_target[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, 500);
|
old_target[HOTEND_STATS] = { 0 };
|
||||||
static bool old_on[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, false);
|
static bool old_on[HOTEND_STATS] = { false };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_HEATED_BED
|
#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;
|
static bool old_bed_on = false;
|
||||||
#if HAS_LEVELING
|
#if HAS_LEVELING
|
||||||
static bool old_leveling_on = false;
|
static bool old_leveling_on = false;
|
||||||
|
|
Loading…
Reference in a new issue