Skip to content

Commit

Permalink
add device gui for yamahaAmp
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausMu committed Apr 23, 2024
1 parent caff7ee commit 15903c3
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <lvgl.h>
#include "applicationInternal/gui/guiBase.h"
#include "applicationInternal/gui/guiRegistry.h"
#include "applicationInternal/commandHandler.h"
#include "devices/AVreceiver/device_yamahaAmp/device_yamahaAmp.h"
#include "devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.h"

static void button_clicked_event_cb(lv_event_t* e) {
int user_data = (intptr_t)(e->user_data);

if (user_data == 0) {
executeCommand(YAMAHA_STANDARD);
}

}

void create_tab_content_yamahaAmp(lv_obj_t* tab) {

// Add content to the sceneSelection tab

lv_obj_set_layout(tab, LV_LAYOUT_FLEX);
lv_obj_set_flex_flow(tab, LV_FLEX_FLOW_COLUMN);
lv_obj_set_scrollbar_mode(tab, LV_SCROLLBAR_MODE_ACTIVE);

// -- create a button for "standard" ----------------------------------------
lv_obj_t* button = lv_btn_create(tab);
lv_obj_set_size(button, 80, 40);
lv_obj_set_style_radius(button, 10, LV_PART_MAIN);
lv_obj_set_style_bg_color(button, color_primary, LV_PART_MAIN);
lv_obj_add_event_cb(button, button_clicked_event_cb, LV_EVENT_CLICKED, (void *)(intptr_t) 0);

lv_obj_t* label = lv_label_create(button);
lv_label_set_text(label, "Standard");
lv_obj_center(label);

}

void notify_tab_before_delete_yamahaAmp(void) {
// remember to set all pointers to lvgl objects to NULL if they might be accessed from outside.
// They must check if object is NULL and must not use it if so

}

void register_gui_yamahaAmp(void){
register_gui(std::string(tabName_yamahaAmp), & create_tab_content_yamahaAmp, & notify_tab_before_delete_yamahaAmp);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#pragma once

const char * const tabName_yamahaAmp = "Yamaha Amp";
void register_gui_yamahaAmp(void);
4 changes: 3 additions & 1 deletion Platformio/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "guis/gui_irReceiver.h"
#include "guis/gui_settings.h"
#include "guis/gui_numpad.h"
#include "devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.h"
#include "devices/mediaPlayer/device_appleTV/gui_appleTV.h"
#include "devices/misc/device_smarthome/gui_smarthome.h"
#include "applicationInternal/keys.h"
Expand Down Expand Up @@ -110,9 +111,10 @@ int main(int argc, char *argv[]) {
register_gui_appleTV();
register_gui_numpad();
register_gui_smarthome();
register_gui_yamahaAmp();
// Only show these GUIs in the main gui list. If you don't set this explicitely, by default all registered guis are shown.
#if (USE_SCENE_SPECIFIC_GUI_LIST != 0)
main_gui_list = {tabName_sceneSelection, tabName_smarthome, tabName_settings, tabName_irReceiver};
main_gui_list = {tabName_yamahaAmp, tabName_sceneSelection, tabName_smarthome, tabName_settings, tabName_irReceiver};
#endif

// register the scenes and their key_commands_*
Expand Down

0 comments on commit 15903c3

Please sign in to comment.