application: add peripheral error display
This commit is contained in:
parent
03ed02b82c
commit
bef5cf299f
|
@ -651,14 +651,38 @@ void main(void)
|
|||
if (oled_text_ok) {
|
||||
oled_text_clear();
|
||||
oled_text_line("YEAST RAISER", 0);
|
||||
oled_text_line("press button", 1);
|
||||
oled_text_line("no sourdough", 2);
|
||||
oled_text_update();
|
||||
puts("OK\n");
|
||||
} else {
|
||||
puts("KO\n");
|
||||
}
|
||||
|
||||
// show status
|
||||
const bool all_ok = heater_ok && sensor_sr04_ok && sensor_ds18b20_present && thermsitor_ok && sensor_mlx90614_ok && oled_text_ok;
|
||||
if (oled_text_ok) {
|
||||
if (all_ok) {
|
||||
oled_text_line("press button", 1);
|
||||
oled_text_line("no sourdough", 2);
|
||||
oled_text_update();
|
||||
} else {
|
||||
oled_text_line("error", 1);
|
||||
if (!heater_ok) {
|
||||
oled_text_line("heater", 2);
|
||||
} else if (!sensor_sr04_ok) {
|
||||
oled_text_line("heater MOSFET", 2);
|
||||
} else if (!sensor_ds18b20_present) {
|
||||
oled_text_line("heater thermo.", 2);
|
||||
} else if (!thermsitor_ok) {
|
||||
oled_text_line("thermistor", 2);
|
||||
} else if (!sensor_mlx90614_ok) {
|
||||
oled_text_line("IR thermo.", 2);
|
||||
} else {
|
||||
oled_text_line("unknown", 2);
|
||||
}
|
||||
oled_text_update();
|
||||
}
|
||||
}
|
||||
|
||||
puts("setup buzzer: ");
|
||||
rcc_periph_clock_enable(GPIO_RCC(BUZZER_PIN)); // enable clock for GPIO port domain
|
||||
gpio_clear(GPIO_PORT(BUZZER_PIN), GPIO_PIN(BUZZER_PIN)); // disable buzzer
|
||||
|
@ -689,7 +713,10 @@ void main(void)
|
|||
action = true; // action has been performed
|
||||
puts("button pressed\n");
|
||||
led_toggle(); // toggle LED
|
||||
if (0 == container_height) { // time to get container height
|
||||
if (!all_ok) {
|
||||
puts("can only start when all peripherals are ok\n");
|
||||
puts("restart to check again\n");
|
||||
} else if (0 == container_height) { // time to get container height
|
||||
puts("container height: ");
|
||||
sleep_ms(2000); // wait for used to remove his finger from the lid
|
||||
sensor_sr04_distance = 0; // clear measurement
|
||||
|
|
Loading…
Reference in New Issue