Use CTR0 for max fan
Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
		
				
					committed by
					
						 Jeremy Soller
						Jeremy Soller
					
				
			
			
				
	
			
			
			
						parent
						
							85cd3aa9ce
						
					
				
				
					commit
					88ad52491a
				
			| @@ -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; | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user