esp32 firmware for a toaster reflow oven WIP!!!!!
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.
reflower/main/scenes/scene_test_menu.c

53 lines
1.6 KiB

#include <malloc.h>
#include <graphics/bitmaps.h>
#include <sys/param.h>
#include <string.h>
#include <stdio.h>
#include "liquid.h"
#include "graphics/drawing.h"
#include "scenes.h"
#include "scene_menu.h"
static struct SceneEvent onSelect(struct MenuScene *self) {
if (self->selected == 0) {
return SceneEvent_Close(0, NULL);
}
if (self->selected == 8) {
return SceneEvent_OpenChild(NewScene_Car(), 0);
}
if (self->selected == 9) {
return SceneEvent_OpenChild(NewScene_Demo(), 0);
}
if (self->selected == 5) {
self->items[5].tag++;
snprintf(self->items[5].label, MENUITEM_LABEL_LEN, "Count = %d", self->items[5].tag);
return SceneEvent_Repaint();
}
return SceneEvent_None();
}
struct Scene *NewScene_MenuTest() {
struct MenuItem *items = calloc(10, sizeof(struct MenuItem));
strncpy(items[0].label, "🔙Back", MENUITEM_LABEL_LEN);
strncpy(items[1].label, "▶#1", MENUITEM_LABEL_LEN);
strncpy(items[2].label, "▶#2", MENUITEM_LABEL_LEN);
strncpy(items[3].label, "▶#3", MENUITEM_LABEL_LEN);
strncpy(items[4].label, "▶#4", MENUITEM_LABEL_LEN);
strncpy(items[5].label, "Count = 0", MENUITEM_LABEL_LEN);
strncpy(items[6].label, "▶#6", MENUITEM_LABEL_LEN);
strncpy(items[7].label, "▶#7", MENUITEM_LABEL_LEN);
strncpy(items[8].label, "Car", MENUITEM_LABEL_LEN);
strncpy(items[9].label, "Demo Scene", MENUITEM_LABEL_LEN);
struct MenuScene * scene = NewScene_Menu(items, 10);
scene->onSelect = onSelect;
return (struct Scene *) scene;
}