Add menu item and placeholder action for hatchery

This commit is contained in:
Renze Nicolai 2022-06-03 04:39:49 +02:00
parent 0ed007e3f0
commit 2782665ad8
7 changed files with 18 additions and 5 deletions

View file

@ -37,6 +37,7 @@ idf_component_register(
${project_dir}/resources/icons/home.png ${project_dir}/resources/icons/home.png
${project_dir}/resources/icons/settings.png ${project_dir}/resources/icons/settings.png
${project_dir}/resources/icons/apps.png ${project_dir}/resources/icons/apps.png
${project_dir}/resources/icons/hatchery.png
${project_dir}/resources/animation/animation_frame_1.png ${project_dir}/resources/animation/animation_frame_1.png
${project_dir}/resources/animation/animation_frame_2.png ${project_dir}/resources/animation/animation_frame_2.png
${project_dir}/resources/animation/animation_frame_3.png ${project_dir}/resources/animation/animation_frame_3.png

View file

@ -43,7 +43,7 @@ void render_dev_help(pax_buf_t* pax_buffer) {
} }
void menu_dev(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) { void menu_dev(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) {
menu_t* menu = menu_alloc("Development tools", 32, 18); menu_t* menu = menu_alloc("Development tools", 34, 18);
menu->fgColor = 0xFF000000; menu->fgColor = 0xFF000000;
menu->bgColor = 0xFFFFFFFF; menu->bgColor = 0xFFFFFFFF;

View file

@ -30,7 +30,7 @@ typedef struct {
} menu_launcher_args_t; } menu_launcher_args_t;
void menu_launcher(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) { void menu_launcher(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) {
menu_t* menu = menu_alloc("Apps", 32, 18); menu_t* menu = menu_alloc("Apps", 34, 18);
menu->fgColor = 0xFF000000; menu->fgColor = 0xFF000000;
menu->bgColor = 0xFFFFFFFF; menu->bgColor = 0xFFFFFFFF;

View file

@ -42,7 +42,7 @@ void render_settings_help(pax_buf_t* pax_buffer) {
} }
void menu_settings(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) { void menu_settings(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) {
menu_t* menu = menu_alloc("Settings", 32, 18); menu_t* menu = menu_alloc("Settings", 34, 18);
menu->fgColor = 0xFF000000; menu->fgColor = 0xFF000000;
menu->bgColor = 0xFFFFFFFF; menu->bgColor = 0xFFFFFFFF;

View file

@ -16,6 +16,7 @@
#include "launcher.h" #include "launcher.h"
#include "settings.h" #include "settings.h"
#include "dev.h" #include "dev.h"
#include "bootscreen.h"
extern const uint8_t home_png_start[] asm("_binary_home_png_start"); extern const uint8_t home_png_start[] asm("_binary_home_png_start");
extern const uint8_t home_png_end[] asm("_binary_home_png_end"); extern const uint8_t home_png_end[] asm("_binary_home_png_end");
@ -23,6 +24,9 @@ extern const uint8_t home_png_end[] asm("_binary_home_png_end");
extern const uint8_t apps_png_start[] asm("_binary_apps_png_start"); extern const uint8_t apps_png_start[] asm("_binary_apps_png_start");
extern const uint8_t apps_png_end[] asm("_binary_apps_png_end"); extern const uint8_t apps_png_end[] asm("_binary_apps_png_end");
extern const uint8_t hatchery_png_start[] asm("_binary_hatchery_png_start");
extern const uint8_t hatchery_png_end[] asm("_binary_hatchery_png_end");
extern const uint8_t dev_png_start[] asm("_binary_dev_png_start"); extern const uint8_t dev_png_start[] asm("_binary_dev_png_start");
extern const uint8_t dev_png_end[] asm("_binary_dev_png_end"); extern const uint8_t dev_png_end[] asm("_binary_dev_png_end");
@ -32,6 +36,7 @@ extern const uint8_t settings_png_end[] asm("_binary_settings_png_end");
typedef enum action { typedef enum action {
ACTION_NONE, ACTION_NONE,
ACTION_APPS, ACTION_APPS,
ACTION_HATCHERY,
ACTION_DEV, ACTION_DEV,
ACTION_SETTINGS ACTION_SETTINGS
} menu_start_action_t; } menu_start_action_t;
@ -44,7 +49,7 @@ void render_start_help(pax_buf_t* pax_buffer) {
} }
void menu_start(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) { void menu_start(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) {
menu_t* menu = menu_alloc("Main menu", 32, 18); menu_t* menu = menu_alloc("Main menu", 34, 18);
menu->fgColor = 0xFF000000; menu->fgColor = 0xFF000000;
menu->bgColor = 0xFFFFFFFF; menu->bgColor = 0xFFFFFFFF;
@ -60,6 +65,8 @@ void menu_start(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili934
pax_decode_png_buf(&icon_home, (void*) home_png_start, home_png_end - home_png_start, PAX_BUF_32_8888ARGB, 0); pax_decode_png_buf(&icon_home, (void*) home_png_start, home_png_end - home_png_start, PAX_BUF_32_8888ARGB, 0);
pax_buf_t icon_apps; pax_buf_t icon_apps;
pax_decode_png_buf(&icon_apps, (void*) apps_png_start, apps_png_end - apps_png_start, PAX_BUF_32_8888ARGB, 0); pax_decode_png_buf(&icon_apps, (void*) apps_png_start, apps_png_end - apps_png_start, PAX_BUF_32_8888ARGB, 0);
pax_buf_t icon_hatchery;
pax_decode_png_buf(&icon_hatchery, (void*) hatchery_png_start, hatchery_png_end - hatchery_png_start, PAX_BUF_32_8888ARGB, 0);
pax_buf_t icon_dev; pax_buf_t icon_dev;
pax_decode_png_buf(&icon_dev, (void*) dev_png_start, dev_png_end - dev_png_start, PAX_BUF_32_8888ARGB, 0); pax_decode_png_buf(&icon_dev, (void*) dev_png_start, dev_png_end - dev_png_start, PAX_BUF_32_8888ARGB, 0);
pax_buf_t icon_settings; pax_buf_t icon_settings;
@ -68,6 +75,7 @@ void menu_start(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili934
menu_set_icon(menu, &icon_home); menu_set_icon(menu, &icon_home);
menu_insert_item_icon(menu, "Apps", NULL, (void*) ACTION_APPS, -1, &icon_apps); menu_insert_item_icon(menu, "Apps", NULL, (void*) ACTION_APPS, -1, &icon_apps);
menu_insert_item_icon(menu, "Hatchery", NULL, (void*) ACTION_HATCHERY, -1, &icon_hatchery);
menu_insert_item_icon(menu, "Development tools", NULL, (void*) ACTION_DEV, -1, &icon_dev); menu_insert_item_icon(menu, "Development tools", NULL, (void*) ACTION_DEV, -1, &icon_dev);
menu_insert_item_icon(menu, "Settings", NULL, (void*) ACTION_SETTINGS, -1, &icon_settings); menu_insert_item_icon(menu, "Settings", NULL, (void*) ACTION_SETTINGS, -1, &icon_settings);
@ -117,6 +125,9 @@ void menu_start(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili934
if (action != ACTION_NONE) { if (action != ACTION_NONE) {
if (action == ACTION_APPS) { if (action == ACTION_APPS) {
menu_launcher(buttonQueue, pax_buffer, ili9341); menu_launcher(buttonQueue, pax_buffer, ili9341);
} else if (action == ACTION_HATCHERY) {
// Not implemented
display_boot_screen(pax_buffer, ili9341, "Not implemented");
} else if (action == ACTION_SETTINGS) { } else if (action == ACTION_SETTINGS) {
menu_settings(buttonQueue, pax_buffer, ili9341); menu_settings(buttonQueue, pax_buffer, ili9341);
} else if (action == ACTION_DEV) { } else if (action == ACTION_DEV) {
@ -131,6 +142,7 @@ void menu_start(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili934
menu_free(menu); menu_free(menu);
pax_buf_destroy(&icon_home); pax_buf_destroy(&icon_home);
pax_buf_destroy(&icon_apps); pax_buf_destroy(&icon_apps);
pax_buf_destroy(&icon_hatchery);
pax_buf_destroy(&icon_dev); pax_buf_destroy(&icon_dev);
pax_buf_destroy(&icon_settings); pax_buf_destroy(&icon_settings);
} }

View file

@ -73,7 +73,7 @@ int wifi_auth_menu(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili
int wifi_phase2_menu(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341, esp_eap_ttls_phase2_types default_mode); int wifi_phase2_menu(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341, esp_eap_ttls_phase2_types default_mode);
void menu_wifi(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) { void menu_wifi(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) {
menu_t* menu = menu_alloc("WiFi configuration", 32, 18); menu_t* menu = menu_alloc("WiFi configuration", 34, 18);
menu_insert_item(menu, "Show current settings", NULL, (void*) ACTION_SHOW, -1); menu_insert_item(menu, "Show current settings", NULL, (void*) ACTION_SHOW, -1);
menu_insert_item(menu, "Scan for networks", NULL, (void*) ACTION_SCAN, -1); menu_insert_item(menu, "Scan for networks", NULL, (void*) ACTION_SCAN, -1);
menu_insert_item(menu, "Configure manually", NULL, (void*) ACTION_MANUAL, -1); menu_insert_item(menu, "Configure manually", NULL, (void*) ACTION_MANUAL, -1);

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B