mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 11:21:23 +00:00
bdk: fan: clamp duty before checking if the same
This commit is contained in:
parent
c6fdb637ca
commit
4d91d2baff
1 changed files with 5 additions and 5 deletions
|
@ -29,9 +29,14 @@ void set_fan_duty(u32 duty)
|
||||||
static bool fan_init = false;
|
static bool fan_init = false;
|
||||||
static u16 curr_duty = -1;
|
static u16 curr_duty = -1;
|
||||||
|
|
||||||
|
if (duty > 236)
|
||||||
|
duty = 236;
|
||||||
|
|
||||||
if (curr_duty == duty)
|
if (curr_duty == duty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
curr_duty = duty;
|
||||||
|
|
||||||
//! TODO: Add HOAG/AULA support.
|
//! TODO: Add HOAG/AULA support.
|
||||||
u32 hw_type = fuse_read_hw_type();
|
u32 hw_type = fuse_read_hw_type();
|
||||||
if (hw_type != FUSE_NX_HW_TYPE_ICOSA &&
|
if (hw_type != FUSE_NX_HW_TYPE_ICOSA &&
|
||||||
|
@ -53,9 +58,6 @@ void set_fan_duty(u32 duty)
|
||||||
fan_init = true;
|
fan_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duty > 236)
|
|
||||||
duty = 236;
|
|
||||||
|
|
||||||
// Inverted polarity.
|
// Inverted polarity.
|
||||||
u32 inv_duty = 236 - duty;
|
u32 inv_duty = 236 - duty;
|
||||||
|
|
||||||
|
@ -78,8 +80,6 @@ void set_fan_duty(u32 duty)
|
||||||
// Enable fan.
|
// Enable fan.
|
||||||
PINMUX_AUX(PINMUX_AUX_LCD_GPIO2) = 1; // Set source to PWM1.
|
PINMUX_AUX(PINMUX_AUX_LCD_GPIO2) = 1; // Set source to PWM1.
|
||||||
}
|
}
|
||||||
|
|
||||||
curr_duty = duty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_fan_speed(u32 *duty, u32 *rpm)
|
void get_fan_speed(u32 *duty, u32 *rpm)
|
||||||
|
|
Loading…
Reference in a new issue