Sync fan changes to darp5/galp3-c
This commit is contained in:
@ -8,11 +8,14 @@
|
||||
#include <ec/pwm.h>
|
||||
|
||||
// Fan speed is the lowest requested over HEATUP seconds
|
||||
#define HEATUP 5
|
||||
#define HEATUP 10
|
||||
|
||||
// Fan speed is the highest HEATUP speed over COOLDOWN seconds
|
||||
#define COOLDOWN 10
|
||||
|
||||
// Interpolate duty cycle
|
||||
#define INTERPOLATE 0
|
||||
|
||||
// Tjunction = 100C for i7-8565U (and probably the same for all WHL-U)
|
||||
#define T_JUNCTION 100
|
||||
|
||||
@ -33,10 +36,9 @@ struct FanPoint {
|
||||
// Fan curve with temperature in degrees C, duty cycle in percent
|
||||
struct FanPoint __code FAN_POINTS[] = {
|
||||
FAN_POINT(65, 40),
|
||||
FAN_POINT(70, 45),
|
||||
FAN_POINT(75, 55),
|
||||
FAN_POINT(80, 75),
|
||||
FAN_POINT(84, 100)
|
||||
FAN_POINT(70, 55),
|
||||
FAN_POINT(75, 75),
|
||||
FAN_POINT(80, 100)
|
||||
};
|
||||
|
||||
// Get duty cycle based on temperature, adapted from
|
||||
@ -55,6 +57,7 @@ uint8_t fan_duty(int16_t temp) {
|
||||
} else {
|
||||
const struct FanPoint * prev = &FAN_POINTS[i - 1];
|
||||
|
||||
#if INTERPOLATE
|
||||
// If in between current temp and previous temp, interpolate
|
||||
if (temp > prev->temp) {
|
||||
int16_t dtemp = (cur->temp - prev->temp);
|
||||
@ -64,6 +67,9 @@ uint8_t fan_duty(int16_t temp) {
|
||||
((temp - prev->temp) * dduty) / dtemp
|
||||
);
|
||||
}
|
||||
#else // INTERPOLATE
|
||||
return prev->duty;
|
||||
#endif // INTERPOLATE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,11 +8,14 @@
|
||||
#include <ec/pwm.h>
|
||||
|
||||
// Fan speed is the lowest requested over HEATUP seconds
|
||||
#define HEATUP 5
|
||||
#define HEATUP 10
|
||||
|
||||
// Fan speed is the highest HEATUP speed over COOLDOWN seconds
|
||||
#define COOLDOWN 10
|
||||
|
||||
// Interpolate duty cycle
|
||||
#define INTERPOLATE 0
|
||||
|
||||
// Tjunction = 100C for i7-8565U (and probably the same for all WHL-U)
|
||||
#define T_JUNCTION 100
|
||||
|
||||
@ -33,10 +36,9 @@ struct FanPoint {
|
||||
// Fan curve with temperature in degrees C, duty cycle in percent
|
||||
struct FanPoint __code FAN_POINTS[] = {
|
||||
FAN_POINT(65, 40),
|
||||
FAN_POINT(70, 45),
|
||||
FAN_POINT(75, 55),
|
||||
FAN_POINT(80, 75),
|
||||
FAN_POINT(84, 100)
|
||||
FAN_POINT(70, 55),
|
||||
FAN_POINT(75, 75),
|
||||
FAN_POINT(80, 100)
|
||||
};
|
||||
|
||||
// Get duty cycle based on temperature, adapted from
|
||||
@ -55,6 +57,7 @@ uint8_t fan_duty(int16_t temp) {
|
||||
} else {
|
||||
const struct FanPoint * prev = &FAN_POINTS[i - 1];
|
||||
|
||||
#if INTERPOLATE
|
||||
// If in between current temp and previous temp, interpolate
|
||||
if (temp > prev->temp) {
|
||||
int16_t dtemp = (cur->temp - prev->temp);
|
||||
@ -64,6 +67,9 @@ uint8_t fan_duty(int16_t temp) {
|
||||
((temp - prev->temp) * dduty) / dtemp
|
||||
);
|
||||
}
|
||||
#else // INTERPOLATE
|
||||
return prev->duty;
|
||||
#endif // INTERPOLATE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user