You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.0 KiB
78 lines
2.0 KiB
//
|
|
// Created by MightyPork on 2023/04/09.
|
|
//
|
|
|
|
#include <stddef.h>
|
|
#include <stdbool.h>
|
|
#include "app_gui.h"
|
|
#include "gui_event.h"
|
|
#include "screen_menu.h"
|
|
#include "app_heater.h"
|
|
#include "ufb/fb_7seg.h"
|
|
#include "FreeRTOS.h"
|
|
#include "ufb/fb_text.h"
|
|
|
|
|
|
void screen_manual(GuiEvent event)
|
|
{
|
|
bool temp_changed = false;
|
|
if (event == GUI_EVENT_SCREEN_INIT) {
|
|
app_heater_manual_override_clear();
|
|
app_heater_enable(false);
|
|
return;
|
|
}
|
|
|
|
// menu is activated by long push
|
|
if (push_time() >= pdMS_TO_TICKS(500)) {
|
|
switch_screen(screen_manual_menu, true);
|
|
return;
|
|
}
|
|
|
|
switch (event) {
|
|
case GUI_EVENT_PAINT:
|
|
fb_7seg_number(FBW/2 - ((12+2) * 3 - 2)/2, 36,
|
|
12, 20, 2, 2,
|
|
1,
|
|
s_app.set_temp, 3, 0
|
|
);
|
|
|
|
fb_text(FBW/2, 25, "Teplota °C", TEXT_CENTER, 1);
|
|
|
|
fb_text(FBW/2, 64, s_app.heater_enabled ? "ZAPNUTO" : "Vypnuto", TEXT_CENTER, 1);
|
|
|
|
SPRINTF(stmp, "%.1f", s_app.oven_temp);
|
|
fb_text(FBW/2, 80, stmp, TEXT_CENTER | FONT_DOUBLE, 1);
|
|
|
|
fb_text(2, FBH - 8 * 3, "←→Nastav", 0, 1);
|
|
fb_text(2, FBH - 8 * 2, "> Zap/Vyp", 0, 1);
|
|
fb_text(2, FBH - 8 * 1, "» Menu", 0, 1);
|
|
break;
|
|
|
|
case GUI_EVENT_KNOB_RELEASE:
|
|
input_sound_effect();
|
|
s_app.heater_enabled ^= 1;
|
|
app_heater_enable(s_app.heater_enabled);
|
|
request_paint();
|
|
break;
|
|
|
|
case GUI_EVENT_KNOB_PLUS:
|
|
if (s_app.set_temp <= MAX_TEMP - 5) {
|
|
s_app.set_temp += 5;
|
|
temp_changed = true;
|
|
}
|
|
break;
|
|
|
|
case GUI_EVENT_KNOB_MINUS:
|
|
if (s_app.set_temp >= 5) {
|
|
s_app.set_temp -= 5;
|
|
temp_changed = true;
|
|
}
|
|
break;
|
|
}
|
|
|
|
if (temp_changed) {
|
|
input_sound_effect();
|
|
app_heater_set_target((float) s_app.set_temp);
|
|
request_paint();
|
|
}
|
|
}
|
|
|