Add typedef extra_fan_t
This commit is contained in:
parent
cfa6c7d45b
commit
f7aaa2e1c7
@ -473,7 +473,7 @@ class MenuItem_bool : public MenuEditItemBase {
|
|||||||
#define _FAN_EDIT_ITEMS(F,L) do{ \
|
#define _FAN_EDIT_ITEMS(F,L) do{ \
|
||||||
editable.uint8 = thermalManager.fan_speed[F]; \
|
editable.uint8 = thermalManager.fan_speed[F]; \
|
||||||
EDIT_ITEM_FAST_N(percent, F, MSG_##L, &editable.uint8, 0, 255, on_fan_update); \
|
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)
|
}while(0)
|
||||||
|
|
||||||
#if FAN_COUNT > 1
|
#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 }
|
uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 }
|
||||||
|
|
||||||
#if ENABLED(EXTRA_FAN_SPEED)
|
#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) {
|
Temperature::extra_fan_t Temperature::extra_fan_speed[FAN_COUNT];
|
||||||
switch (tmp_temp) {
|
|
||||||
|
/**
|
||||||
|
* 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:
|
case 1:
|
||||||
set_fan_speed(fan, old_fan_speed[fan]);
|
set_fan_speed(fan, extra_fan_speed[fan].saved);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
old_fan_speed[fan] = fan_speed[fan];
|
extra_fan_speed[fan].saved = fan_speed[fan];
|
||||||
set_fan_speed(fan, new_fan_speed[fan]);
|
set_fan_speed(fan, extra_fan_speed[fan].speed);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
new_fan_speed[fan] = _MIN(tmp_temp, 255U);
|
extra_fan_speed[fan].speed = _MIN(command_or_speed, 255U);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -561,8 +561,9 @@ class Temperature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(EXTRA_FAN_SPEED)
|
#if ENABLED(EXTRA_FAN_SPEED)
|
||||||
static uint8_t old_fan_speed[FAN_COUNT], new_fan_speed[FAN_COUNT];
|
typedef struct { uint8_t saved, speed; } extra_fan_t;
|
||||||
static void set_temp_fan_speed(const uint8_t fan, const uint16_t tmp_temp);
|
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
|
#endif
|
||||||
|
|
||||||
#if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE)
|
#if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE)
|
||||||
|
Loading…
Reference in New Issue
Block a user