fixes in calib

calib-gui
Ondřej Hruška 2 years ago
parent 1331460ecb
commit dc445af419
  1. 13
      Core/Src/Gui/screen_calibration.c
  2. 7
      Core/Src/Gui/screen_menu.c
  3. 3
      Core/Src/Gui/screen_menu.h
  4. 14
      Core/Src/app_temp.c
  5. 13
      Lib/ufb/Src/font_57.inc.c
  6. 225
      Lib/ufb/Src/fontedit_57.c

@ -118,21 +118,22 @@ void screen_calibration(GuiEvent event)
switch (s_calib.phase) { switch (s_calib.phase) {
case PH_HELLO: case PH_HELLO:
if (event == GUI_EVENT_PAINT) { if (event == GUI_EVENT_PAINT) {
fb_text(FBW/2, 14, "Vychlaď", TEXT_CENTER, 1); fb_text(FBW/2, 16, "Vychlaď", TEXT_CENTER, 1);
fb_text(FBW/2, 24, "troubu", TEXT_CENTER, 1); fb_text(FBW/2, 26, "troubu", TEXT_CENTER, 1);
} }
screen_menu(event, calib0_opts, calib0_cb); screen_menu_offset(event, calib0_opts, calib0_cb, 30);
break; break;
case PH_SAMPLE1: // Heater is active, waiting for mark case PH_SAMPLE1: // Heater is active, waiting for mark
case PH_SAMPLE2: case PH_SAMPLE2:
if (event == GUI_EVENT_PAINT) { if (event == GUI_EVENT_PAINT) {
fb_text(FBW/2, 14, "Zapiš teplotu", TEXT_CENTER, 1); fb_text(FBW/2, 16, "Zapiš", TEXT_CENTER, 1);
fb_text(FBW/2, 26, "teplotu", TEXT_CENTER, 1);
} }
if (s_calib.phase == PH_SAMPLE1) { if (s_calib.phase == PH_SAMPLE1) {
screen_menu(event, calib1_opts, calib1_cb); screen_menu_offset(event, calib1_opts, calib1_cb, 30);
} else { } else {
screen_menu(event, calib3_opts, calib3_cb); screen_menu_offset(event, calib3_opts, calib3_cb, 30);
} }
break; break;

@ -22,7 +22,12 @@ struct menu_state {
void * last_opts; void * last_opts;
} s_menu; } s_menu;
void screen_menu(GuiEvent event, const char **options, menu_callback_t cb) { void screen_menu(GuiEvent event, const char **options, menu_callback_t cb) {
screen_menu_offset(event, options, cb, 15);
}
void screen_menu_offset(GuiEvent event, const char **options, menu_callback_t cb, fbpos_t offset) {
if (event != GUI_EVENT_SCREEN_INIT && s_menu.last_opts != (void*) options) { if (event != GUI_EVENT_SCREEN_INIT && s_menu.last_opts != (void*) options) {
// ensure the menu is properly inited when the options list changes. // ensure the menu is properly inited when the options list changes.
screen_menu(GUI_EVENT_SCREEN_INIT, options, cb); screen_menu(GUI_EVENT_SCREEN_INIT, options, cb);
@ -71,7 +76,7 @@ void screen_menu(GuiEvent event, const char **options, menu_callback_t cb) {
// is the row currently rendered the selected row? // is the row currently rendered the selected row?
const bool is_selected = s_menu.pos == i; const bool is_selected = s_menu.pos == i;
const fbcolor_t color = !is_selected; // text color - black if selected, because it's inverted const fbcolor_t color = !is_selected; // text color - black if selected, because it's inverted
const fbpos_t y = 27 + i * 10; const fbpos_t y = 12 + offset + i * 10 ;
fb_rect(0, y, FBW, 10, !color); fb_rect(0, y, FBW, 10, !color);
fb_text(1 - (is_selected ? s_menu.text_slide : 0), y + 1, options[i], FONT_5X7, color); fb_text(1 - (is_selected ? s_menu.text_slide : 0), y + 1, options[i], FONT_5X7, color);
// ensure the text doesn't touch the edge (looks ugly) // ensure the text doesn't touch the edge (looks ugly)

@ -8,6 +8,7 @@
#define TOASTER_OVEN_BLUEPILL_SCREEN_MENU_H #define TOASTER_OVEN_BLUEPILL_SCREEN_MENU_H
#include "gui_event.h" #include "gui_event.h"
#include "ufb/framebuffer.h"
/** /**
* Choice callback for the generic menu screen. Options are indexed from zero * Choice callback for the generic menu screen. Options are indexed from zero
@ -23,5 +24,7 @@ typedef void (*menu_callback_t)(int choice);
*/ */
void screen_menu(GuiEvent event, const char **options, menu_callback_t cb); void screen_menu(GuiEvent event, const char **options, menu_callback_t cb);
/** Menu with custom offset (default is 15) */
void screen_menu_offset(GuiEvent event, const char **options, menu_callback_t cb, fbpos_t offset);
#endif //TOASTER_OVEN_BLUEPILL_SCREEN_MENU_H #endif //TOASTER_OVEN_BLUEPILL_SCREEN_MENU_H

@ -272,12 +272,12 @@ void app_temp_sample()
adc_averages[2] = (float) sums[2] / count; adc_averages[2] = (float) sums[2] / count;
adc_averages[3] = (float) sums[3] / count; adc_averages[3] = (float) sums[3] / count;
PRINTF("%f\t%f\t%f\t%f\r\n", // PRINTF("%f\t%f\t%f\t%f\r\n",
adc_averages[0], // adc_averages[0],
adc_averages[1], // adc_averages[1],
adc_averages[2], // adc_averages[2],
adc_averages[3] // adc_averages[3]
); // );
/* r_pt100, r_ref, internal_temp, v_ref_int */ /* r_pt100, r_ref, internal_temp, v_ref_int */
float refint = adc_averages[3]; float refint = adc_averages[3];
@ -313,7 +313,7 @@ void app_temp_sample()
float y = s_analog.cal_a * sum + s_analog.cal_b; float y = s_analog.cal_a * sum + s_analog.cal_b;
float actual_temp = val_to_c(y); float actual_temp = val_to_c(y);
PRINTF("Compensated x %f -> y %f, temp %f C\r\n", sum, y, actual_temp); // PRINTF("Compensated x %f -> y %f, temp %f C\r\n", sum, y, actual_temp);
s_analog.oven_temp = actual_temp; s_analog.oven_temp = actual_temp;
s_analog.oven_temp_raw = sum; s_analog.oven_temp_raw = sum;

@ -98,24 +98,13 @@ static const font5x_bitmap_t PROGMEM font57_ascii[] = {
static const struct utf_glyph5x PROGMEM font57_extra[] = { static const struct utf_glyph5x PROGMEM font57_extra[] = {
{.utf={.symbol="<EFBFBD>"}, {{0x7f, 0x41, 0x41, 0x41, 0x7f}}}, {.utf={.symbol="<EFBFBD>"}, {{0x7f, 0x41, 0x41, 0x41, 0x7f}}},
{.utf={.symbol="×"}, {{0x22, 0x14, 0x08, 0x14, 0x22}}},
{.utf={.symbol=""}, {{0x08, 0x04, 0x3e, 0x04, 0x08}}},
{.utf={.symbol=""}, {{0x08, 0x10, 0x3e, 0x10, 0x08}}},
{.utf={.symbol=""}, {{0x08, 0x1c, 0x2a, 0x08, 0x08}}}, {.utf={.symbol=""}, {{0x08, 0x1c, 0x2a, 0x08, 0x08}}},
{.utf={.symbol=""}, {{0x08, 0x08, 0x2a, 0x1c, 0x08}}}, {.utf={.symbol=""}, {{0x08, 0x08, 0x2a, 0x1c, 0x08}}},
{.utf={.symbol=""}, {{0x1c, 0x22, 0x2e, 0x2a, 0x1c}}},
{.utf={.symbol=""}, {{0x63, 0x55, 0x4d, 0x55, 0x63}}},
{.utf={.symbol=""}, {{0x1c, 0x22, 0x2a, 0x22, 0x1c}}},
{.utf={.symbol=""}, {{0x10, 0x38, 0x54, 0x10, 0x1e}}},
{.utf={.symbol="🌡"}, {{0x20, 0x7e, 0x79, 0x7e, 0x2a}}},
{.utf={.symbol="°"}, {{0x00, 0x07, 0x05, 0x07, 0x00}}}, {.utf={.symbol="°"}, {{0x00, 0x07, 0x05, 0x07, 0x00}}},
{.utf={.symbol="μ"}, {{0x7c, 0x20, 0x20, 0x10, 0x3c}}},
{.utf={.symbol=""}, {{0x04, 0x4e, 0x55, 0x44, 0x38}}},
{.utf={.symbol=""}, {{0x7f, 0x3e, 0x1c, 0x08, 0x00}}},
{.utf={.symbol=""}, {{0x00, 0x08, 0x1c, 0x3e, 0x7f}}},
{.utf={.symbol="č"}, {{0x38, 0x45, 0x46, 0x45, 0x20}}}, {.utf={.symbol="č"}, {{0x38, 0x45, 0x46, 0x45, 0x20}}},
{.utf={.symbol="š"}, {{0x48, 0x55, 0x56, 0x55, 0x20}}}, {.utf={.symbol="š"}, {{0x48, 0x55, 0x56, 0x55, 0x20}}},
{.utf={.symbol="í"}, {{0x00, 0x44, 0x7d, 0x41, 0x00}}}, {.utf={.symbol="í"}, {{0x00, 0x44, 0x7d, 0x41, 0x00}}},
{.utf={.symbol="ž"}, {{0x44, 0x65, 0x56, 0x4d, 0x44}}}, {.utf={.symbol="ž"}, {{0x44, 0x65, 0x56, 0x4d, 0x44}}},
{.utf={.symbol="ď"}, {{0x38, 0x44, 0x45, 0x48, 0x7f}}},
{.utf={.symbol="»"}, {{0x22, 0x14, 0x2a, 0x14, 0x08}}}, {.utf={.symbol="»"}, {{0x22, 0x14, 0x2a, 0x14, 0x08}}},
}; };

@ -775,30 +775,30 @@ const char *font_extras[] = {
"# #", "# #",
"# #", "# #",
"#####", "#####",
// Extra 1 // // Extra 1
" ", // " ",
"# #", // "# #",
" # # ", // " # # ",
" # ", // " # ",
" # # ", // " # # ",
"# #", // "# #",
" ", // " ",
// Extra 2 // // Extra 2
" ", // " ",
" # ", // " # ",
" ### ", // " ### ",
"# # #", // "# # #",
" # ", // " # ",
" # ", // " # ",
" ", // " ",
// Extra 3 // // Extra 3
" ", // " ",
" # ", // " # ",
" # ", // " # ",
"# # #", // "# # #",
" ### ", // " ### ",
" # ", // " # ",
" ", // " ",
// Extra 4 // Extra 4
" ", " ",
" # ", " # ",
@ -815,46 +815,46 @@ const char *font_extras[] = {
" # ", " # ",
" # ", " # ",
" ", " ",
// Extra 6 // // Extra 6
" ", // " ",
" ### ", // " ### ",
"# # #", // "# # #",
"# ###", // "# ###",
"# #", // "# #",
" ### ", // " ### ",
" ", // " ",
// Extra 7 // // Extra 7
"#####", // "#####",
"# #", // "# #",
" ### ", // " ### ",
" # ", // " # ",
" # # ", // " # # ",
"# #", // "# #",
"#####", // "#####",
// Extra 8 // // Extra 8
" ", // " ",
" ### ", // " ### ",
"# #", // "# #",
"# # #", // "# # #",
"# #", // "# #",
" ### ", // " ### ",
" ", // " ",
// Extra 9 // // Extra 9
" ", // " ",
" #", // " #",
" # #", // " # #",
" # #", // " # #",
"#####", // "#####",
" # ", // " # ",
" # ", // " # ",
// Extra 10 // // Extra 10
" # ", // " # ",
" # ##", // " # ##",
" # # ", // " # # ",
" ####", // " ####",
" ### ", // " ### ",
"#####", // "#####",
" ### ", // " ### ",
// Extra 11 // Extra 11
" ### ", " ### ",
" # # ", " # # ",
@ -863,38 +863,38 @@ const char *font_extras[] = {
" ", " ",
" ", " ",
" ", " ",
// Extra 12 // // Extra 12
" ", // " ",
" ", // " ",
"# #", // "# #",
"# #", // "# #",
"# ##", // "# ##",
"### #", // "### #",
"# ", // "# ",
// Extra 13 // // Extra 13
" # ", // " # ",
" # ", // " # ",
"#### ", // "#### ",
" # #", // " # #",
" # #", // " # #",
" #", // " #",
" ### ", // " ### ",
// Extra 14 // // Extra 14
"# ", // "# ",
"## ", // "## ",
"### ", // "### ",
"#### ", // "#### ",
"### ", // "### ",
"## ", // "## ",
"# ", // "# ",
// Extra 15 // // Extra 15
" #", // " #",
" ##", // " ##",
" ###", // " ###",
" ####", // " ####",
" ###", // " ###",
" ##", // " ##",
" #", // " #",
// 99 "č" // 99 "č"
" x x ", " x x ",
" x ", " x ",
@ -927,6 +927,14 @@ const char *font_extras[] = {
" # ", " # ",
" # ", " # ",
"#####", "#####",
// 100 "d"
" x #",
" #",
" ## #",
"# ##",
"# #",
"# #",
" ####",
// » // »
" ", " ",
"x x ", "x x ",
@ -939,25 +947,26 @@ const char *font_extras[] = {
const char *font_extras_utf[] = { const char *font_extras_utf[] = {
"<EFBFBD>", "<EFBFBD>",
"×", // "×",
"", // "↑",
"", // "↓",
"", "",
"", "",
"", // clock // "⏱", // clock
"", // "⌛",
"", // "☸",
"", // "⏎",
"🌡", // "🌡",
"°", "°",
"μ", // "μ",
"", // back // "⎌", // back
"", // "▶",
"", // "◀",
"č", "č",
"š", "š",
"í", "í",
"ž", "ž",
"ď",
"»", "»",
}; };

Loading…
Cancel
Save