Fix and adjust temperature regulation

This commit is contained in:
Luca 2023-08-03 23:50:14 +02:00
parent 6be8231668
commit 39d65c38e2
1 changed files with 3 additions and 3 deletions

View File

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