mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 21:38:36 -07:00
Custom lcd color
This commit is contained in:
@@ -16,5 +16,6 @@ ADD_SCENE(xtreme_app, protocols_freqs_add, ProtocolsFreqsAdd)
|
|||||||
ADD_SCENE(xtreme_app, protocols_gpio, ProtocolsGpio)
|
ADD_SCENE(xtreme_app, protocols_gpio, ProtocolsGpio)
|
||||||
ADD_SCENE(xtreme_app, misc, Misc)
|
ADD_SCENE(xtreme_app, misc, Misc)
|
||||||
ADD_SCENE(xtreme_app, misc_screen, MiscScreen)
|
ADD_SCENE(xtreme_app, misc_screen, MiscScreen)
|
||||||
|
ADD_SCENE(xtreme_app, misc_screen_color, MiscScreenColor)
|
||||||
ADD_SCENE(xtreme_app, misc_dolphin, MiscDolphin)
|
ADD_SCENE(xtreme_app, misc_dolphin, MiscDolphin)
|
||||||
ADD_SCENE(xtreme_app, misc_rename, MiscRename)
|
ADD_SCENE(xtreme_app, misc_rename, MiscRename)
|
||||||
|
|||||||
@@ -248,6 +248,9 @@ bool xtreme_app_scene_misc_screen_on_event(void* context, SceneManagerEvent even
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case VarItemListIndexLcdColor:
|
||||||
|
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMiscScreenColor);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
#include "../xtreme_app.h"
|
||||||
|
|
||||||
|
enum ByteInputResult {
|
||||||
|
ByteInputResultOk,
|
||||||
|
};
|
||||||
|
|
||||||
|
void xtreme_app_scene_misc_screen_color_byte_input_callback(void* context) {
|
||||||
|
XtremeApp* app = context;
|
||||||
|
|
||||||
|
view_dispatcher_send_custom_event(app->view_dispatcher, ByteInputResultOk);
|
||||||
|
}
|
||||||
|
|
||||||
|
void xtreme_app_scene_misc_screen_color_on_enter(void* context) {
|
||||||
|
XtremeApp* app = context;
|
||||||
|
ByteInput* byte_input = app->byte_input;
|
||||||
|
|
||||||
|
byte_input_set_header_text(byte_input, "Set LCD Color (#RRGGBB)");
|
||||||
|
|
||||||
|
app->lcd_color = rgb_backlight_get_color();
|
||||||
|
|
||||||
|
byte_input_set_result_callback(
|
||||||
|
byte_input,
|
||||||
|
xtreme_app_scene_misc_screen_color_byte_input_callback,
|
||||||
|
NULL,
|
||||||
|
app,
|
||||||
|
(void*)&app->lcd_color,
|
||||||
|
sizeof(app->lcd_color));
|
||||||
|
|
||||||
|
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewByteInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool xtreme_app_scene_misc_screen_color_on_event(void* context, SceneManagerEvent event) {
|
||||||
|
XtremeApp* app = context;
|
||||||
|
bool consumed = false;
|
||||||
|
|
||||||
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
|
consumed = true;
|
||||||
|
switch(event.event) {
|
||||||
|
case ByteInputResultOk:
|
||||||
|
rgb_backlight_set_color(app->lcd_color);
|
||||||
|
app->save_backlight = true;
|
||||||
|
scene_manager_previous_scene(app->scene_manager);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return consumed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void xtreme_app_scene_misc_screen_color_on_exit(void* context) {
|
||||||
|
XtremeApp* app = context;
|
||||||
|
byte_input_set_result_callback(app->byte_input, NULL, NULL, NULL, NULL, 0);
|
||||||
|
byte_input_set_header_text(app->byte_input, "");
|
||||||
|
}
|
||||||
@@ -193,6 +193,10 @@ XtremeApp* xtreme_app_alloc() {
|
|||||||
view_dispatcher_add_view(
|
view_dispatcher_add_view(
|
||||||
app->view_dispatcher, XtremeAppViewTextInput, text_input_get_view(app->text_input));
|
app->view_dispatcher, XtremeAppViewTextInput, text_input_get_view(app->text_input));
|
||||||
|
|
||||||
|
app->byte_input = byte_input_alloc();
|
||||||
|
view_dispatcher_add_view(
|
||||||
|
app->view_dispatcher, XtremeAppViewByteInput, byte_input_get_view(app->byte_input));
|
||||||
|
|
||||||
app->popup = popup_alloc();
|
app->popup = popup_alloc();
|
||||||
view_dispatcher_add_view(app->view_dispatcher, XtremeAppViewPopup, popup_get_view(app->popup));
|
view_dispatcher_add_view(app->view_dispatcher, XtremeAppViewPopup, popup_get_view(app->popup));
|
||||||
|
|
||||||
@@ -315,6 +319,8 @@ void xtreme_app_free(XtremeApp* app) {
|
|||||||
submenu_free(app->submenu);
|
submenu_free(app->submenu);
|
||||||
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewTextInput);
|
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewTextInput);
|
||||||
text_input_free(app->text_input);
|
text_input_free(app->text_input);
|
||||||
|
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewByteInput);
|
||||||
|
byte_input_free(app->byte_input);
|
||||||
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewPopup);
|
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewPopup);
|
||||||
popup_free(app->popup);
|
popup_free(app->popup);
|
||||||
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewDialogEx);
|
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewDialogEx);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include <gui/modules/variable_item_list.h>
|
#include <gui/modules/variable_item_list.h>
|
||||||
#include <gui/modules/submenu.h>
|
#include <gui/modules/submenu.h>
|
||||||
#include <gui/modules/text_input.h>
|
#include <gui/modules/text_input.h>
|
||||||
|
#include <gui/modules/byte_input.h>
|
||||||
#include <gui/modules/popup.h>
|
#include <gui/modules/popup.h>
|
||||||
#include <lib/toolbox/value_index.h>
|
#include <lib/toolbox/value_index.h>
|
||||||
#include <toolbox/stream/file_stream.h>
|
#include <toolbox/stream/file_stream.h>
|
||||||
@@ -42,6 +43,7 @@ typedef struct {
|
|||||||
VariableItemList* var_item_list;
|
VariableItemList* var_item_list;
|
||||||
Submenu* submenu;
|
Submenu* submenu;
|
||||||
TextInput* text_input;
|
TextInput* text_input;
|
||||||
|
ByteInput* byte_input;
|
||||||
Popup* popup;
|
Popup* popup;
|
||||||
DialogEx* dialog_ex;
|
DialogEx* dialog_ex;
|
||||||
|
|
||||||
@@ -57,6 +59,7 @@ typedef struct {
|
|||||||
uint8_t subghz_hopper_index;
|
uint8_t subghz_hopper_index;
|
||||||
char subghz_freq_buffer[XTREME_SUBGHZ_FREQ_BUFFER_SIZE];
|
char subghz_freq_buffer[XTREME_SUBGHZ_FREQ_BUFFER_SIZE];
|
||||||
bool subghz_extend;
|
bool subghz_extend;
|
||||||
|
RgbColor lcd_color;
|
||||||
char device_name[FURI_HAL_VERSION_ARRAY_NAME_LENGTH];
|
char device_name[FURI_HAL_VERSION_ARRAY_NAME_LENGTH];
|
||||||
int32_t dolphin_level;
|
int32_t dolphin_level;
|
||||||
int32_t dolphin_angry;
|
int32_t dolphin_angry;
|
||||||
@@ -79,6 +82,7 @@ typedef enum {
|
|||||||
XtremeAppViewVarItemList,
|
XtremeAppViewVarItemList,
|
||||||
XtremeAppViewSubmenu,
|
XtremeAppViewSubmenu,
|
||||||
XtremeAppViewTextInput,
|
XtremeAppViewTextInput,
|
||||||
|
XtremeAppViewByteInput,
|
||||||
XtremeAppViewPopup,
|
XtremeAppViewPopup,
|
||||||
XtremeAppViewDialogEx,
|
XtremeAppViewDialogEx,
|
||||||
} XtremeAppView;
|
} XtremeAppView;
|
||||||
|
|||||||
Reference in New Issue
Block a user