Add basic Xtreme app, move animcycle option to app

This commit is contained in:
Willy-JL
2023-01-17 07:35:35 +00:00
parent cd557ec078
commit 067f7bd3f5
15 changed files with 293 additions and 57 deletions
@@ -39,26 +39,6 @@ const uint32_t displayBatteryPercentage_value[BATTERY_VIEW_COUNT] = {
uint8_t origBattDisp_value = 0;
#define CYCLE_ANIMATION_COUNT 13
const char* const cycle_animation_text[CYCLE_ANIMATION_COUNT] = {
"OFF",
"Manifest",
"30 S",
"1 M",
"5 M",
"10 M",
"15 M",
"30 M",
"1 H",
"2 H",
"6 H",
"12 H",
"24 H",
};
// Values are offset by 1 so that 0 is not a valid value and desktop.c can detect this to set a default value (3601 / 1 H)
const int32_t cycle_animation_value[CYCLE_ANIMATION_COUNT] =
{1, -1, 31, 61, 301, 601, 901, 1801, 3601, 7201, 21601, 43201, 86401};
static void desktop_settings_scene_start_var_list_enter_callback(void* context, uint32_t index) {
DesktopSettingsApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
@@ -80,14 +60,6 @@ static void desktop_settings_scene_start_battery_view_changed(VariableItem* item
app->settings.displayBatteryPercentage = index;
}
static void desktop_settings_scene_start_cycle_animation_changed(VariableItem* item) {
DesktopSettingsApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, cycle_animation_text[index]);
app->settings.cycle_animation_s = cycle_animation_value[index];
}
void desktop_settings_scene_start_on_enter(void* context) {
DesktopSettingsApp* app = context;
VariableItemList* variable_item_list = app->variable_item_list;
@@ -130,18 +102,6 @@ void desktop_settings_scene_start_on_enter(void* context) {
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, battery_view_count_text[value_index]);
item = variable_item_list_add(
variable_item_list,
"Cycle Animation",
CYCLE_ANIMATION_COUNT,
desktop_settings_scene_start_cycle_animation_changed,
app);
value_index = value_index_int32(
app->settings.cycle_animation_s, cycle_animation_value, CYCLE_ANIMATION_COUNT);
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, cycle_animation_text[value_index]);
variable_item_list_set_enter_callback(
variable_item_list, desktop_settings_scene_start_var_list_enter_callback, app);
view_dispatcher_switch_to_view(app->view_dispatcher, DesktopSettingsAppViewVarItemList);