Skip to content

Commit

Permalink
1st pass for defering settings reboot
Browse files Browse the repository at this point in the history
  • Loading branch information
spohtl committed Dec 28, 2024
1 parent 36337a0 commit 39ea684
Show file tree
Hide file tree
Showing 7 changed files with 259 additions and 89 deletions.
46 changes: 46 additions & 0 deletions generated/ui_320x240/screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,39 @@ void create_screen_main_screen() {
lv_obj_set_style_pad_column(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
{
lv_obj_t *parent_obj = obj;
{
// BasicSettingsApplyButton
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.basic_settings_apply_button = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_PCT(95), 40);
add_style_settings_button_style(obj);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff4db270), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_color(obj, lv_color_hex(0xffb24d8f), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff4a5e4a), LV_PART_MAIN | LV_STATE_DISABLED);
lv_obj_set_style_align(obj, LV_ALIGN_TOP_MID, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xfffafaf4), LV_PART_MAIN | LV_STATE_PRESSED);
lv_obj_set_style_text_color(obj, lv_color_hex(0xff294337), LV_PART_MAIN | LV_STATE_PRESSED);
lv_obj_set_style_text_color(obj, lv_color_hex(0xff101010), LV_PART_MAIN | LV_STATE_DISABLED);
lv_obj_set_style_margin_left(obj, 40, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_margin_right(obj, 40, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_add_state(obj, LV_STATE_DISABLED);
{
lv_obj_t *parent_obj = obj;
{
// BasicSettingsApplyLabel
lv_obj_t *obj = lv_label_create(parent_obj);
objects.basic_settings_apply_label = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_PCT(100), LV_SIZE_CONTENT);
lv_label_set_long_mode(obj, LV_LABEL_LONG_DOT);
lv_label_set_text(obj, _("Apply & Reboot"));
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff000000), LV_PART_MAIN | LV_STATE_DISABLED);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
// BasicSettingsUserButton
lv_obj_t *obj = lv_btn_create(parent_obj);
Expand All @@ -1267,6 +1300,7 @@ void create_screen_main_screen() {
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff4db270), LV_PART_MAIN | LV_STATE_PRESSED);
lv_obj_set_style_text_color(obj, lv_color_hex(0xff015114), LV_PART_MAIN | LV_STATE_PRESSED);
lv_obj_set_style_text_color(obj, lv_color_hex(0xff808080), LV_PART_MAIN | LV_STATE_DISABLED);
lv_obj_center(obj);
{
lv_obj_t *parent_obj = obj;
{
Expand Down Expand Up @@ -2062,6 +2096,18 @@ void create_screen_main_screen() {
lv_label_set_text(obj, _("Settings & Tools"));
lv_obj_set_style_align(obj, LV_ALIGN_LEFT_MID, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// TopBasicSettingsUnsavedLabel
lv_obj_t *obj = lv_label_create(parent_obj);
objects.top_basic_settings_unsaved_label = obj;
lv_obj_set_pos(obj, 25, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_long_mode(obj, LV_LABEL_LONG_SCROLL_CIRCULAR);
lv_obj_set_style_text_color(obj, lv_color_hex(0xffde3232), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_label_set_text(obj, _("Unsaved changes ..."));
lv_obj_set_style_align(obj, LV_ALIGN_LEFT_MID, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
}
{
// TopBasicSettingsImage
lv_obj_t *obj = lv_img_create(parent_obj);
Expand Down
151 changes: 77 additions & 74 deletions generated/ui_320x240/screens.h
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
#ifndef EEZ_LVGL_UI_SCREENS_H
#define EEZ_LVGL_UI_SCREENS_H

#include "lvgl.h"

#ifdef __cplusplus
extern "C" {
#endif


// advanced settings
extern lv_obj_t * ui_AdvancedSettingsPanel;
extern lv_obj_t * ui_SettingsTabView;
extern lv_obj_t * ui_TabPageGeneral;
extern lv_obj_t * ui_GeneralLanguageButton;
extern lv_obj_t * ui_LanguageLabel;
extern lv_obj_t * ui_GeneralTimezoneButton;
extern lv_obj_t * ui_TimezoneLabel;
extern lv_obj_t * ui_GeneralScreenButton;
extern lv_obj_t * ui_ScreenLabel;
extern lv_obj_t * ui_GeneralMapsButton;
extern lv_obj_t * ui_MapsLabel;
extern lv_obj_t * ui_GeneralAudioButton;
extern lv_obj_t * ui_AudioLabel1;
extern lv_obj_t * ui_TabPageRadio;
extern lv_obj_t * ui_RadioBluetoothButton;
extern lv_obj_t * ui_BluetoothLabel;
extern lv_obj_t * ui_RadioDeviceButton;
extern lv_obj_t * ui_DeviceLabel;
extern lv_obj_t * ui_RadioDisplayButton;
extern lv_obj_t * ui_DisplayLabel;
extern lv_obj_t * ui_RadioLoRaButton;
extern lv_obj_t * ui_LoRaLabel;
extern lv_obj_t * ui_RadioNetworkButton;
extern lv_obj_t * ui_NetworkLabel;
extern lv_obj_t * ui_RadioPositionButton;
extern lv_obj_t * ui_PositionLabel;
extern lv_obj_t * ui_RadioPowerButton;
extern lv_obj_t * ui_PowerLabel;
extern lv_obj_t * ui_TabPageModules;
extern lv_obj_t * ui_ModuleCannedMsgButton;
extern lv_obj_t * ui_CannedMsgLabel;
extern lv_obj_t * ui_ModuleSaFButton;
extern lv_obj_t * ui_StoreAndForwardLabel;
extern lv_obj_t * ui_ModuleTelemetryButton;
extern lv_obj_t * ui_TelemetryLabel;
extern lv_obj_t * ui_ModuleMQTTButton;
extern lv_obj_t * ui_MQTTLabel;
extern lv_obj_t * ui_ModuleRangeTestButton;
extern lv_obj_t * ui_RangeTestLabel;
extern lv_obj_t * ui_ModuleAudioButton;
extern lv_obj_t * ui_AudioLabel;
extern lv_obj_t * ui_ModuleSerialButton;
extern lv_obj_t * ui_SerialLabel;
extern lv_obj_t * ui_ModuleExtNotificationButton;
extern lv_obj_t * ui_ExtNotificationLabel;
extern lv_obj_t * ui_ModuleNeighborInfoButton;
extern lv_obj_t * ui_NeighborInfoLabel;
extern lv_obj_t * ui_ModuleAmbientLightingButton;
extern lv_obj_t * ui_AmbientLightingLabel;
extern lv_obj_t * ui_ModuleDetectionSensorButton;
extern lv_obj_t * ui_DetectionSensorLabel;
extern lv_obj_t * ui_ModuleRemoteHardwareButton;
extern lv_obj_t * ui_RemoteHardwareLabel;

void create_tabview_settings(void);

#ifndef EEZ_LVGL_UI_SCREENS_H
#define EEZ_LVGL_UI_SCREENS_H

#include "lvgl.h"

#ifdef __cplusplus
extern "C" {
#endif


// advanced settings
extern lv_obj_t * ui_AdvancedSettingsPanel;
extern lv_obj_t * ui_SettingsTabView;
extern lv_obj_t * ui_TabPageGeneral;
extern lv_obj_t * ui_GeneralLanguageButton;
extern lv_obj_t * ui_LanguageLabel;
extern lv_obj_t * ui_GeneralTimezoneButton;
extern lv_obj_t * ui_TimezoneLabel;
extern lv_obj_t * ui_GeneralScreenButton;
extern lv_obj_t * ui_ScreenLabel;
extern lv_obj_t * ui_GeneralMapsButton;
extern lv_obj_t * ui_MapsLabel;
extern lv_obj_t * ui_GeneralAudioButton;
extern lv_obj_t * ui_AudioLabel1;
extern lv_obj_t * ui_TabPageRadio;
extern lv_obj_t * ui_RadioBluetoothButton;
extern lv_obj_t * ui_BluetoothLabel;
extern lv_obj_t * ui_RadioDeviceButton;
extern lv_obj_t * ui_DeviceLabel;
extern lv_obj_t * ui_RadioDisplayButton;
extern lv_obj_t * ui_DisplayLabel;
extern lv_obj_t * ui_RadioLoRaButton;
extern lv_obj_t * ui_LoRaLabel;
extern lv_obj_t * ui_RadioNetworkButton;
extern lv_obj_t * ui_NetworkLabel;
extern lv_obj_t * ui_RadioPositionButton;
extern lv_obj_t * ui_PositionLabel;
extern lv_obj_t * ui_RadioPowerButton;
extern lv_obj_t * ui_PowerLabel;
extern lv_obj_t * ui_TabPageModules;
extern lv_obj_t * ui_ModuleCannedMsgButton;
extern lv_obj_t * ui_CannedMsgLabel;
extern lv_obj_t * ui_ModuleSaFButton;
extern lv_obj_t * ui_StoreAndForwardLabel;
extern lv_obj_t * ui_ModuleTelemetryButton;
extern lv_obj_t * ui_TelemetryLabel;
extern lv_obj_t * ui_ModuleMQTTButton;
extern lv_obj_t * ui_MQTTLabel;
extern lv_obj_t * ui_ModuleRangeTestButton;
extern lv_obj_t * ui_RangeTestLabel;
extern lv_obj_t * ui_ModuleAudioButton;
extern lv_obj_t * ui_AudioLabel;
extern lv_obj_t * ui_ModuleSerialButton;
extern lv_obj_t * ui_SerialLabel;
extern lv_obj_t * ui_ModuleExtNotificationButton;
extern lv_obj_t * ui_ExtNotificationLabel;
extern lv_obj_t * ui_ModuleNeighborInfoButton;
extern lv_obj_t * ui_NeighborInfoLabel;
extern lv_obj_t * ui_ModuleAmbientLightingButton;
extern lv_obj_t * ui_AmbientLightingLabel;
extern lv_obj_t * ui_ModuleDetectionSensorButton;
extern lv_obj_t * ui_DetectionSensorLabel;
extern lv_obj_t * ui_ModuleRemoteHardwareButton;
extern lv_obj_t * ui_RemoteHardwareLabel;

void create_tabview_settings(void);

typedef struct _objects_t {
lv_obj_t *boot_screen;
lv_obj_t *main_screen;
Expand Down Expand Up @@ -489,6 +489,9 @@ typedef struct _objects_t {
lv_obj_t *blank_screen_button;
lv_obj_t *screen_lock_button_matrix;
lv_obj_t *lock_screen_digits_label;
lv_obj_t *basic_settings_apply_button;
lv_obj_t *basic_settings_apply_label;
lv_obj_t *top_basic_settings_unsaved_label;
} objects_t;

extern objects_t objects;
Expand Down Expand Up @@ -518,13 +521,13 @@ void tick_screen_calibration_screen();

void create_user_widget_ok_cancel_widget(lv_obj_t *parent_obj, int startWidgetIndex);
void tick_user_widget_ok_cancel_widget(int startWidgetIndex);


void create_screens();
void tick_screen(int screen_index);


#ifdef __cplusplus
}
#endif



#ifdef __cplusplus
}
#endif

#endif /*EEZ_LVGL_UI_SCREENS_H*/
5 changes: 5 additions & 0 deletions include/TFTView_320x240.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class TFTView_320x240 : public MeshtasticView
void notifyResync(bool show) override;
void notifyReboot(bool show) override;
void notifyShutdown(void) override;
void notifyConfigReboot(bool show);
void blankScreen(bool enable) override;
void screenSaving(bool enabled) override;
bool isScreenLocked(void) override;
Expand Down Expand Up @@ -191,6 +192,8 @@ class TFTView_320x240 : public MeshtasticView
void ui_set_active(lv_obj_t *b, lv_obj_t *p, lv_obj_t *tp);
void showKeyboard(lv_obj_t *textArea);
lv_obj_t *showQrCode(lv_obj_t *parent, const char *data);
void configTransactionOpen();
void checkForConfigTransactionClose();

void enablePanel(lv_obj_t *panel);
void disablePanel(lv_obj_t *panel);
Expand Down Expand Up @@ -256,6 +259,7 @@ class TFTView_320x240 : public MeshtasticView

static void ui_event_message_ready(lv_event_t *e);

static void ui_event_apply_button(lv_event_t *e);
static void ui_event_user_button(lv_event_t *e);
static void ui_event_role_button(lv_event_t *e);
static void ui_event_region_button(lv_event_t *e);
Expand Down Expand Up @@ -350,6 +354,7 @@ class TFTView_320x240 : public MeshtasticView
std::array<lv_obj_t *, c_max_channels> ch_label; // indexable label list for settings
meshtastic_Channel *channel_scratch; // temporary scratch copy of channel db
lv_obj_t *qr; // qr code
bool configRebootRequired; // set when AdminModule will reboot if settings are applied

// extended default device profile struct with additional required data
struct meshtastic_DeviceProfile_ext : meshtastic_DeviceProfile {
Expand Down
2 changes: 2 additions & 0 deletions include/ViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class ViewController
virtual bool sendConfig(meshtastic_Config_BluetoothConfig &&bluetooth, uint32_t nodeId = 0);
virtual bool sendConfig(meshtastic_Config_SecurityConfig &&security, uint32_t nodeId = 0);
virtual bool sendConfig(meshtastic_Channel &channel, uint32_t nodeId = 0);
virtual bool openConfigTransaction(uint32_t nodeId = 0);
virtual bool closeConfigTransaction(uint32_t nodeId = 0);

// module config
virtual bool sendConfig(meshtastic_ModuleConfig_MQTTConfig &&mqtt, uint32_t nodeId = 0);
Expand Down
Loading

0 comments on commit 39ea684

Please sign in to comment.