Fix and adjust temperature regulation
This commit is contained in:
parent
6be8231668
commit
39d65c38e2
|
@ -49,7 +49,7 @@ use usb_device::{bus::UsbBus as UsbBusTrait, bus::UsbBusAllocator, prelude::*};
|
||||||
|
|
||||||
use usbd_serial::{SerialPort, USB_CLASS_CDC};
|
use usbd_serial::{SerialPort, USB_CLASS_CDC};
|
||||||
|
|
||||||
const HYSTERESIS: u16 = 5;
|
const HYSTERESIS: u16 = 10;
|
||||||
|
|
||||||
const PEAK_TEMPERATURE: u16 = 240;
|
const PEAK_TEMPERATURE: u16 = 240;
|
||||||
|
|
||||||
|
@ -260,8 +260,8 @@ fn main() -> ! {
|
||||||
let mut bytes: [u8; 7] = [32, 32, 32, 32, 194, 176, 67];
|
let mut bytes: [u8; 7] = [32, 32, 32, 32, 194, 176, 67];
|
||||||
let text = match thermocouple.read_temperature(&mut timer.count_down()) {
|
let text = match thermocouple.read_temperature(&mut timer.count_down()) {
|
||||||
Ok(mut temperature) => {
|
Ok(mut temperature) => {
|
||||||
current_temperature = Some(temperature);
|
|
||||||
temperature >>= 2;
|
temperature >>= 2;
|
||||||
|
current_temperature = Some(temperature);
|
||||||
|
|
||||||
for i in (0..3).rev() {
|
for i in (0..3).rev() {
|
||||||
bytes[i] = 48u8 + (temperature % 10) as u8;
|
bytes[i] = 48u8 + (temperature % 10) as u8;
|
||||||
|
@ -322,7 +322,7 @@ fn main() -> ! {
|
||||||
relay.set_high().unwrap();
|
relay.set_high().unwrap();
|
||||||
} else if temperature > PREHEAT_TEMPERATURE + HYSTERESIS * 2 {
|
} else if temperature > PREHEAT_TEMPERATURE + HYSTERESIS * 2 {
|
||||||
state = State::Reflow;
|
state = State::Reflow;
|
||||||
} else if temperature > PREHEAT_TEMPERATURE + HYSTERESIS {
|
} else if temperature > PREHEAT_TEMPERATURE {
|
||||||
relay.set_low().unwrap();
|
relay.set_low().unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue