Heater for threaded program
Dependents: LEX_Threaded_Programming_V3
Diff: Heater.cpp
- Revision:
- 33:52ab0641f2e6
- Parent:
- 31:7c6f05326c4d
- Child:
- 34:294adcc3e4b2
diff -r 34921454e932 -r 52ab0641f2e6 Heater.cpp --- a/Heater.cpp Wed Sep 04 10:18:17 2019 +0000 +++ b/Heater.cpp Thu Sep 19 16:13:30 2019 +0000 @@ -27,7 +27,7 @@ int i = 0; double drive_prev = drive->read(); //Store previous value of drive *drive = 1.0f; //Turn the driver on for the measurement - wait_us(thermal.adc_settling_time_us); //Wait for ADC to settle + wait_us(thermal.settling_time_us); //Wait for ADC to settle adc->start_conversion(15); //Incremental back off until ADC is free @@ -69,7 +69,7 @@ void Heater::update() { //Update PWM from setpoint and resistance - double duty_cycle = (double) thermal.pid_kp * (error + error_integrated/thermal.pid_integral_time); + double duty_cycle = (double) thermal.pid_kp_mho * (error + error_integrated/thermal.pid_integral_time_ms); if (duty_cycle > PWM_LIMIT) duty_cycle = PWM_LIMIT; drive->write(duty_cycle); guard->write(duty_cycle * thermal.guard_drive_ratio);