1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-26 11:42:09 +00:00

bdk: fan: clamp duty before checking if the same

This commit is contained in:
CTCaer 2021-10-26 10:53:22 +03:00
parent c6fdb637ca
commit 4d91d2baff

View file

@ -29,9 +29,14 @@ void set_fan_duty(u32 duty)
static bool fan_init = false;
static u16 curr_duty = -1;
if (duty > 236)
duty = 236;
if (curr_duty == duty)
return;
curr_duty = duty;
//! TODO: Add HOAG/AULA support.
u32 hw_type = fuse_read_hw_type();
if (hw_type != FUSE_NX_HW_TYPE_ICOSA &&
@ -53,9 +58,6 @@ void set_fan_duty(u32 duty)
fan_init = true;
}
if (duty > 236)
duty = 236;
// Inverted polarity.
u32 inv_duty = 236 - duty;
@ -78,8 +80,6 @@ void set_fan_duty(u32 duty)
// Enable fan.
PINMUX_AUX(PINMUX_AUX_LCD_GPIO2) = 1; // Set source to PWM1.
}
curr_duty = duty;
}
void get_fan_speed(u32 *duty, u32 *rpm)