Support fan PWM settings #73

Merged
sb10q merged 16 commits from esavkin/thermostat:69-fan_pwm into master 2023-03-22 17:15:49 +08:00
2 changed files with 5 additions and 7 deletions
Showing only changes of commit 069e178966 - Show all commits

View File

@ -18,8 +18,8 @@ const MAX_TEC_I: f64 = 3.0;
const MAX_USER_FAN_PWM: f64 = 100.0; const MAX_USER_FAN_PWM: f64 = 100.0;
const MIN_USER_FAN_PWM: f64 = 1.0; const MIN_USER_FAN_PWM: f64 = 1.0;
const MAX_FAN_PWM: f64 = 1.0; const MAX_FAN_PWM: f64 = 1.0;
// below this value motor circuit assumes there is no signal and runs full speed // below this value motor's autostart feature may fail
const MIN_FAN_PWM: f64 = 0.02; const MIN_FAN_PWM: f64 = 0.04;
const DEFAULT_K_A: f64 = 1.0; const DEFAULT_K_A: f64 = 1.0;
const DEFAULT_K_B: f64 = 0.0; const DEFAULT_K_B: f64 = 0.0;

View File

@ -226,11 +226,9 @@ impl Pins {
hclk: clocks.hclk(), hclk: clocks.hclk(),
}; };
// Though there is not enough evidence available for concrete fan model, // According to `SUNON DC Brushless Fan & Blower(255-E)` catalogue p.36-37
// it is generally advised to have higher PWM frequencies for brushless motors, // Model name: MF35101V1-1000U-G99
// so that it would produce less audible noise. let fan = Timer::new(tim8, &clocks).pwm(gpioc.pc9.into_alternate(), 25u32.khz());
// Source: https://www.controleng.com/articles/understanding-the-effect-of-pwm-when-controlling-a-brushless-dc-motor/
let fan = Timer::new(tim8, &clocks).pwm(gpioc.pc9.into_alternate(), 80u32.khz());
(pins, leds, eeprom, eth_pins, usb, fan) (pins, leds, eeprom, eth_pins, usb, fan)
} }