Skip to content

Commit

Permalink
lut screen start
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuristian committed Feb 9, 2024
1 parent de7cd5f commit 7cb7bf6
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ idf_component_register(
${project_dir}/resources/battery1.png
${project_dir}/resources/battery2.png
${project_dir}/resources/map.png
${project_dir}/resources/lutdial.png
${project_dir}/resources/pointclick/dock1_e.png
${project_dir}/resources/pointclick/dock1_n.png
${project_dir}/resources/pointclick/dock1_s.png
Expand Down
55 changes: 55 additions & 0 deletions main/modules/screen_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ extern const uint8_t battery1_png_start[] asm("_binary_battery1_png_start");
extern const uint8_t battery1_png_end[] asm("_binary_battery1_png_end");
extern const uint8_t battery2_png_start[] asm("_binary_battery2_png_start");
extern const uint8_t battery2_png_end[] asm("_binary_battery2_png_end");
extern const uint8_t lutdial_png_start[] asm("_binary_lutdial_png_start");
extern const uint8_t lutdial_png_end[] asm("_binary_lutdial_png_end");

static const char* TAG = "settings";

Expand Down Expand Up @@ -482,6 +484,59 @@ screen_t screen_settings_entry(QueueHandle_t application_event_queue, QueueHandl
case SWITCH_4: ota_update_wrapped(keyboard_event_queue, false); break;
case SWITCH_5: ota_update_wrapped(keyboard_event_queue, true); break;
}
break;
default: ESP_LOGE(TAG, "Unhandled event type %u", event.type);
}
}
}
}

screen_t screen_lut_dial(QueueHandle_t application_event_queue, QueueHandle_t keyboard_event_queue) {
if (log)
ESP_LOGE(TAG, "Enter screen_home_entry");
// update the keyboard event handler settings
InitKeyboard(keyboard_event_queue);
configure_keyboard_presses(keyboard_event_queue, true, false, false, false, false);
configure_keyboard_rotate_both(keyboard_event_queue, SWITCH_5, true);
int cursor = 0;
epaper_lut_t activeLut = lut_4s;

while (1) {
pax_buf_t* gfx = bsp_get_gfx_buffer();
pax_insert_png_buf(gfx, lutdial_png_start, lutdial_png_end - lutdial_png_start, 0, 0, 0);
AddOneTextSWtoBuffer(SWITCH_1, "Exit");
DrawArrowHorizontal(SWITCH_5);

switch (cursor) {
case 0: activeLut = lut_1s; break;
case 1: activeLut = lut_4s; break;
case 2: activeLut = lut_8s; break;
case 3: activeLut = lut_full; break;
default: break;
}

event_t event = {0};
if (xQueueReceive(application_event_queue, &event, portMAX_DELAY) == pdTRUE) {
switch (event.type) {
case event_input_button: break; // Ignore raw button input
case event_input_keyboard:
switch (event.args_input_keyboard.action) {
case SWITCH_1: return screen_home; break;
case SWITCH_2: break;
case SWITCH_3: break;
case SWITCH_4: break;
case SWITCH_5: break;
case SWITCH_L5:
if (cursor)
cursor--;
break;
case SWITCH_R5:
if (cursor)
cursor++;
break;
}


break;
default: ESP_LOGE(TAG, "Unhandled event type %u", event.type);
}
Expand Down
Binary file added resources/Lutdial.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lutdial.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7cb7bf6

Please sign in to comment.