Add typedef extra_fan_t
This commit is contained in:
parent
976403d10d
commit
3341e4f88c
|
@ -473,7 +473,7 @@ class MenuItem_bool : public MenuEditItemBase {
|
|||
#define _FAN_EDIT_ITEMS(F,L) do{ \
|
||||
editable.uint8 = thermalManager.fan_speed[F]; \
|
||||
EDIT_ITEM_FAST_N(percent, F, MSG_##L, &editable.uint8, 0, 255, on_fan_update); \
|
||||
EDIT_EXTRA_FAN_SPEED(percent, F, MSG_EXTRA_##L, &thermalManager.new_fan_speed[F], 3, 255); \
|
||||
EDIT_EXTRA_FAN_SPEED(percent, F, MSG_EXTRA_##L, &thermalManager.extra_fan_speed[F].speed, 3, 255); \
|
||||
}while(0)
|
||||
|
||||
#if FAN_COUNT > 1
|
||||
|
|
|
@ -273,19 +273,26 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
|
|||
uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 }
|
||||
|
||||
#if ENABLED(EXTRA_FAN_SPEED)
|
||||
uint8_t Temperature::old_fan_speed[FAN_COUNT], Temperature::new_fan_speed[FAN_COUNT];
|
||||
|
||||
void Temperature::set_temp_fan_speed(const uint8_t fan, const uint16_t tmp_temp) {
|
||||
switch (tmp_temp) {
|
||||
Temperature::extra_fan_t Temperature::extra_fan_speed[FAN_COUNT];
|
||||
|
||||
/**
|
||||
* Handle the M106 P<fan> T<speed> command:
|
||||
* T1 = Restore fan speed saved on the last T2
|
||||
* T2 = Save the fan speed, then set to the last T<3-255> value
|
||||
* T<3-255> = Set the "extra fan speed"
|
||||
*/
|
||||
void Temperature::set_temp_fan_speed(const uint8_t fan, const uint16_t command_or_speed) {
|
||||
switch (command_or_speed) {
|
||||
case 1:
|
||||
set_fan_speed(fan, old_fan_speed[fan]);
|
||||
set_fan_speed(fan, extra_fan_speed[fan].saved);
|
||||
break;
|
||||
case 2:
|
||||
old_fan_speed[fan] = fan_speed[fan];
|
||||
set_fan_speed(fan, new_fan_speed[fan]);
|
||||
extra_fan_speed[fan].saved = fan_speed[fan];
|
||||
set_fan_speed(fan, extra_fan_speed[fan].speed);
|
||||
break;
|
||||
default:
|
||||
new_fan_speed[fan] = _MIN(tmp_temp, 255U);
|
||||
extra_fan_speed[fan].speed = _MIN(command_or_speed, 255U);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -561,8 +561,9 @@ class Temperature {
|
|||
}
|
||||
|
||||
#if ENABLED(EXTRA_FAN_SPEED)
|
||||
static uint8_t old_fan_speed[FAN_COUNT], new_fan_speed[FAN_COUNT];
|
||||
static void set_temp_fan_speed(const uint8_t fan, const uint16_t tmp_temp);
|
||||
typedef struct { uint8_t saved, speed; } extra_fan_t;
|
||||
static extra_fan_t extra_fan_speed[FAN_COUNT];
|
||||
static void set_temp_fan_speed(const uint8_t fan, const uint16_t command_or_speed);
|
||||
#endif
|
||||
|
||||
#if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE)
|
||||
|
|
Loading…
Reference in a new issue