Use CTR0 for max fan

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2024-07-31 16:01:52 -06:00
committed by Jeremy Soller
parent 85cd3aa9ce
commit 88ad52491a
2 changed files with 6 additions and 6 deletions

View File

@ -124,7 +124,7 @@ static uint8_t fan_duty(const struct Fan *const fan, int16_t temp) {
} else if (temp < cur->temp) { } else if (temp < cur->temp) {
// If lower than first temp, return 0% // If lower than first temp, return 0%
if (i == 0) { if (i == 0) {
return MIN_FAN_SPEED; return 0;
} else { } else {
const struct FanPoint *prev = &fan->points[i - 1]; const struct FanPoint *prev = &fan->points[i - 1];
@ -146,7 +146,7 @@ static uint8_t fan_duty(const struct Fan *const fan, int16_t temp) {
} }
// If no point is found, return 100% // If no point is found, return 100%
return MAX_FAN_SPEED; return CTR0;
} }
static uint8_t fan_smooth(uint8_t last_duty, uint8_t duty) { static uint8_t fan_smooth(uint8_t last_duty, uint8_t duty) {
@ -219,13 +219,13 @@ static uint8_t fan_get_duty(const struct Fan *const fan, int16_t temp) {
if (power_state == POWER_STATE_S0) { if (power_state == POWER_STATE_S0) {
duty = fan_duty(fan, temp); duty = fan_duty(fan, temp);
if (fan_max) { if (fan_max) {
duty = PWM_DUTY(100); duty = CTR0;
} else { } else {
duty = fan_heatup(fan, duty); duty = fan_heatup(fan, duty);
duty = fan_cooldown(fan, duty); duty = fan_cooldown(fan, duty);
} }
} else { } else {
duty = PWM_DUTY(0); duty = 0;
} }
return duty; return duty;

View File

@ -17,9 +17,9 @@ uint8_t __code __at(SCRATCH_OFFSET) scratch_rom[] = {
// Enter or exit scratch ROM // Enter or exit scratch ROM
void scratch_trampoline(void) { void scratch_trampoline(void) {
// Set fans to 100% // Set fans to 100%
FAN1_PWM = 0xFF; FAN1_PWM = CTR0;
#ifdef FAN2_PWM #ifdef FAN2_PWM
FAN2_PWM = 0xFF; FAN2_PWM = CTR0;
#endif #endif
//TODO: Clear keyboard presses //TODO: Clear keyboard presses