From 88ad52491a40e56c97ca0a595b36cb3f1629198c Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Wed, 31 Jul 2024 16:01:52 -0600 Subject: [PATCH] Use CTR0 for max fan Signed-off-by: Tim Crawford --- src/board/system76/common/fan.c | 8 ++++---- src/board/system76/common/scratch.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/board/system76/common/fan.c b/src/board/system76/common/fan.c index 0233206..eaed933 100644 --- a/src/board/system76/common/fan.c +++ b/src/board/system76/common/fan.c @@ -124,7 +124,7 @@ static uint8_t fan_duty(const struct Fan *const fan, int16_t temp) { } else if (temp < cur->temp) { // If lower than first temp, return 0% if (i == 0) { - return MIN_FAN_SPEED; + return 0; } else { 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% - return MAX_FAN_SPEED; + return CTR0; } 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) { duty = fan_duty(fan, temp); if (fan_max) { - duty = PWM_DUTY(100); + duty = CTR0; } else { duty = fan_heatup(fan, duty); duty = fan_cooldown(fan, duty); } } else { - duty = PWM_DUTY(0); + duty = 0; } return duty; diff --git a/src/board/system76/common/scratch.c b/src/board/system76/common/scratch.c index 6ea515f..9096090 100644 --- a/src/board/system76/common/scratch.c +++ b/src/board/system76/common/scratch.c @@ -17,9 +17,9 @@ uint8_t __code __at(SCRATCH_OFFSET) scratch_rom[] = { // Enter or exit scratch ROM void scratch_trampoline(void) { // Set fans to 100% - FAN1_PWM = 0xFF; + FAN1_PWM = CTR0; #ifdef FAN2_PWM - FAN2_PWM = 0xFF; + FAN2_PWM = CTR0; #endif //TODO: Clear keyboard presses