Add alarm code
This commit is contained in:
parent
cd65b8fd1f
commit
25d27c1e1b
@ -74,4 +74,10 @@ int main() {
|
||||
store_config = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check the temperature, and start the alarm if required
|
||||
uint16_t thermistor_voltage = thermistor_voltage_read();
|
||||
float temperature = calculate_thermistor_temp(thermistor_voltage);
|
||||
bool start_alarm = voltage_threshold_bool(temperature, 40);
|
||||
alert_voltage_threshold_exceeded(start_alarm);
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ bool voltage_threshold_bool(float thermistor_temp, uint8_t max_temp){
|
||||
//print if the maximum threshold is exceeded.
|
||||
void alert_voltage_threshold_exceeded(bool voltage_threshold_bool){
|
||||
if (voltage_threshold_bool){
|
||||
printf("Error: maximum temperature exceeded");
|
||||
//printf("Error: maximum temperature exceeded");
|
||||
PORTB.OUTSET = ALERT_PIN;
|
||||
} else{
|
||||
PORTB.OUTCLR = ALERT_PIN;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user