Use uint8_t for all fan speeds (#12032)
This commit is contained in:
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
// Change EEPROM version if the structure changes
|
||||
#define EEPROM_VERSION "V59"
|
||||
#define EEPROM_VERSION "V60"
|
||||
#define EEPROM_OFFSET 0
|
||||
|
||||
// Check the integrity of data offsets.
|
||||
@ -214,8 +214,8 @@ typedef struct SettingsDataStruct {
|
||||
// ULTIPANEL
|
||||
//
|
||||
int16_t lcd_preheat_hotend_temp[2], // M145 S0 H
|
||||
lcd_preheat_bed_temp[2], // M145 S0 B
|
||||
lcd_preheat_fan_speed[2]; // M145 S0 F
|
||||
lcd_preheat_bed_temp[2]; // M145 S0 B
|
||||
uint8_t lcd_preheat_fan_speed[2]; // M145 S0 F
|
||||
|
||||
//
|
||||
// PIDTEMP
|
||||
@ -630,8 +630,8 @@ void MarlinSettings::postprocess() {
|
||||
|
||||
#if DISABLED(ULTIPANEL)
|
||||
constexpr int16_t lcd_preheat_hotend_temp[2] = { PREHEAT_1_TEMP_HOTEND, PREHEAT_2_TEMP_HOTEND },
|
||||
lcd_preheat_bed_temp[2] = { PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED },
|
||||
lcd_preheat_fan_speed[2] = { PREHEAT_1_FAN_SPEED, PREHEAT_2_FAN_SPEED };
|
||||
lcd_preheat_bed_temp[2] = { PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED };
|
||||
constexpr uint8_t lcd_preheat_fan_speed[2] = { PREHEAT_1_FAN_SPEED, PREHEAT_2_FAN_SPEED };
|
||||
#endif
|
||||
|
||||
EEPROM_WRITE(lcd_preheat_hotend_temp);
|
||||
@ -1238,17 +1238,13 @@ void MarlinSettings::postprocess() {
|
||||
_FIELD_TEST(lcd_preheat_hotend_temp);
|
||||
|
||||
#if DISABLED(ULTIPANEL)
|
||||
int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
|
||||
int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2];
|
||||
uint8_t lcd_preheat_fan_speed[2];
|
||||
#endif
|
||||
EEPROM_READ(lcd_preheat_hotend_temp); // 2 floats
|
||||
EEPROM_READ(lcd_preheat_bed_temp); // 2 floats
|
||||
EEPROM_READ(lcd_preheat_fan_speed); // 2 floats
|
||||
|
||||
//EEPROM_ASSERT(
|
||||
// WITHIN(lcd_preheat_fan_speed, 0, 255),
|
||||
// "lcd_preheat_fan_speed out of range"
|
||||
//);
|
||||
|
||||
//
|
||||
// Hotend PID
|
||||
//
|
||||
@ -2489,7 +2485,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
|
||||
SERIAL_ECHOPAIR_P(port, " M145 S", (int)i);
|
||||
SERIAL_ECHOPAIR_P(port, " H", TEMP_UNIT(lcd_preheat_hotend_temp[i]));
|
||||
SERIAL_ECHOPAIR_P(port, " B", TEMP_UNIT(lcd_preheat_bed_temp[i]));
|
||||
SERIAL_ECHOLNPAIR_P(port, " F", lcd_preheat_fan_speed[i]);
|
||||
SERIAL_ECHOLNPAIR_P(port, " F", int(lcd_preheat_fan_speed[i]));
|
||||
}
|
||||
#endif // ULTIPANEL
|
||||
|
||||
|
@ -1187,8 +1187,8 @@ void Planner::recalculate() {
|
||||
* Maintain fans, paste extruder pressure,
|
||||
*/
|
||||
void Planner::check_axes_activity() {
|
||||
unsigned char axis_active[NUM_AXIS] = { 0 },
|
||||
tail_fan_speed[FAN_COUNT];
|
||||
uint8_t axis_active[NUM_AXIS] = { 0 },
|
||||
tail_fan_speed[FAN_COUNT];
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
#if HAS_HEATER_1
|
||||
@ -1225,7 +1225,7 @@ void Planner::check_axes_activity() {
|
||||
}
|
||||
else {
|
||||
#if FAN_COUNT > 0
|
||||
for (uint8_t i = 0; i < FAN_COUNT; i++) tail_fan_speed[i] = fanSpeeds[i];
|
||||
for (uint8_t i = 0; i < FAN_COUNT; i++) tail_fan_speed[i] = fan_speed[i];
|
||||
#endif
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
@ -1774,7 +1774,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
#endif
|
||||
|
||||
#if FAN_COUNT > 0
|
||||
for (uint8_t i = 0; i < FAN_COUNT; i++) block->fan_speed[i] = fanSpeeds[i];
|
||||
for (uint8_t i = 0; i < FAN_COUNT; i++) block->fan_speed[i] = fan_speed[i];
|
||||
#endif
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
|
@ -144,7 +144,7 @@ typedef struct {
|
||||
acceleration_steps_per_s2; // acceleration steps/sec^2
|
||||
|
||||
#if FAN_COUNT > 0
|
||||
uint16_t fan_speed[FAN_COUNT];
|
||||
uint8_t fan_speed[FAN_COUNT];
|
||||
#endif
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
|
@ -273,12 +273,12 @@ float zprobe_zoffset; // Initialized by settings.load()
|
||||
fans_paused = p;
|
||||
if (p)
|
||||
for (uint8_t x = 0; x < FAN_COUNT; x++) {
|
||||
paused_fanSpeeds[x] = fanSpeeds[x];
|
||||
fanSpeeds[x] = 0;
|
||||
paused_fan_speed[x] = fan_speed[x];
|
||||
fan_speed[x] = 0;
|
||||
}
|
||||
else
|
||||
for (uint8_t x = 0; x < FAN_COUNT; x++)
|
||||
fanSpeeds[x] = paused_fanSpeeds[x];
|
||||
fan_speed[x] = paused_fan_speed[x];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
|
||||
Temperature::target_temperature[HOTENDS] = { 0 };
|
||||
|
||||
#if ENABLED(AUTO_POWER_E_FANS)
|
||||
int16_t Temperature::autofan_speed[HOTENDS] = { 0 };
|
||||
uint8_t Temperature::autofan_speed[HOTENDS] = { 0 };
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
|
@ -123,7 +123,7 @@ class Temperature {
|
||||
static uint8_t soft_pwm_amount[HOTENDS];
|
||||
|
||||
#if ENABLED(AUTO_POWER_E_FANS)
|
||||
static int16_t autofan_speed[HOTENDS];
|
||||
static uint8_t autofan_speed[HOTENDS];
|
||||
#endif
|
||||
|
||||
#if ENABLED(FAN_SOFT_PWM)
|
||||
|
Reference in New Issue
Block a user