mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 05:08:35 -07:00
Add anim cycle 30s, 1m and manifest
This commit is contained in:
@@ -197,12 +197,13 @@ static void animation_manager_start_new_idle(AnimationManager* animation_manager
|
|||||||
|
|
||||||
StorageAnimation* new_animation = animation_manager_select_idle_animation(animation_manager);
|
StorageAnimation* new_animation = animation_manager_select_idle_animation(animation_manager);
|
||||||
animation_manager_replace_current_animation(animation_manager, new_animation);
|
animation_manager_replace_current_animation(animation_manager, new_animation);
|
||||||
// const BubbleAnimation* bubble_animation =
|
const BubbleAnimation* bubble_animation =
|
||||||
// animation_storage_get_bubble_animation(animation_manager->current_animation);
|
animation_storage_get_bubble_animation(animation_manager->current_animation);
|
||||||
animation_manager->state = AnimationManagerStateIdle;
|
animation_manager->state = AnimationManagerStateIdle;
|
||||||
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
|
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
|
||||||
DESKTOP_SETTINGS_LOAD(settings);
|
DESKTOP_SETTINGS_LOAD(settings);
|
||||||
furi_timer_start(animation_manager->idle_animation_timer, (settings->cycle_animations_s - 1) * 1000);
|
int32_t duration_s = settings->cycle_animation_s == -1 ? bubble_animation->duration : (settings->cycle_animation_s - 1);
|
||||||
|
furi_timer_start(animation_manager->idle_animation_timer, duration_s * 1000);
|
||||||
free(settings);
|
free(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,12 +512,13 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
|
|||||||
animation_manager->idle_animation_timer,
|
animation_manager->idle_animation_timer,
|
||||||
animation_manager->freezed_animation_time_left);
|
animation_manager->freezed_animation_time_left);
|
||||||
} else {
|
} else {
|
||||||
// const BubbleAnimation* animation = animation_storage_get_bubble_animation(
|
const BubbleAnimation* animation = animation_storage_get_bubble_animation(
|
||||||
// animation_manager->current_animation);
|
animation_manager->current_animation);
|
||||||
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
|
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
|
||||||
DESKTOP_SETTINGS_LOAD(settings);
|
DESKTOP_SETTINGS_LOAD(settings);
|
||||||
|
int32_t duration_s = settings->cycle_animation_s == -1 ? animation->duration : (settings->cycle_animation_s - 1);
|
||||||
furi_timer_start(
|
furi_timer_start(
|
||||||
animation_manager->idle_animation_timer, (settings->cycle_animations_s - 1) * 1000);
|
animation_manager->idle_animation_timer, duration_s * 1000);
|
||||||
free(settings);
|
free(settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -322,8 +322,8 @@ int32_t desktop_srv(void* p) {
|
|||||||
DESKTOP_SETTINGS_SAVE(&desktop->settings);
|
DESKTOP_SETTINGS_SAVE(&desktop->settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!desktop->settings.cycle_animations_s) {
|
if(!desktop->settings.cycle_animation_s) {
|
||||||
desktop->settings.cycle_animations_s = 3601;
|
desktop->settings.cycle_animation_s = 3601;
|
||||||
DESKTOP_SETTINGS_SAVE(&desktop->settings);
|
DESKTOP_SETTINGS_SAVE(&desktop->settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,5 +64,5 @@ typedef struct {
|
|||||||
uint8_t displayBatteryPercentage;
|
uint8_t displayBatteryPercentage;
|
||||||
bool is_sfwmode;
|
bool is_sfwmode;
|
||||||
uint8_t sfw_mode;
|
uint8_t sfw_mode;
|
||||||
uint32_t cycle_animations_s;
|
int32_t cycle_animation_s;
|
||||||
} DesktopSettings;
|
} DesktopSettings;
|
||||||
|
|||||||
@@ -39,9 +39,12 @@ const uint32_t displayBatteryPercentage_value[BATTERY_VIEW_COUNT] = {
|
|||||||
|
|
||||||
uint8_t origBattDisp_value = 0;
|
uint8_t origBattDisp_value = 0;
|
||||||
|
|
||||||
#define CYCLE_ANIMATIONS_COUNT 10
|
#define CYCLE_ANIMATION_COUNT 13
|
||||||
const char* const cycle_animations_text[CYCLE_ANIMATIONS_COUNT] = {
|
const char* const cycle_animation_text[CYCLE_ANIMATION_COUNT] = {
|
||||||
"OFF",
|
"OFF",
|
||||||
|
"Manifest",
|
||||||
|
"30 S",
|
||||||
|
"1 M",
|
||||||
"5 M",
|
"5 M",
|
||||||
"10 M",
|
"10 M",
|
||||||
"15 M",
|
"15 M",
|
||||||
@@ -53,8 +56,8 @@ const char* const cycle_animations_text[CYCLE_ANIMATIONS_COUNT] = {
|
|||||||
"24 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)
|
// 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 uint32_t cycle_animations_value[CYCLE_ANIMATIONS_COUNT] =
|
const int32_t cycle_animation_value[CYCLE_ANIMATION_COUNT] =
|
||||||
{1, 301, 601, 901, 1801, 3601, 7201, 21601, 43201, 86401};
|
{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) {
|
static void desktop_settings_scene_start_var_list_enter_callback(void* context, uint32_t index) {
|
||||||
DesktopSettingsApp* app = context;
|
DesktopSettingsApp* app = context;
|
||||||
@@ -77,12 +80,12 @@ static void desktop_settings_scene_start_battery_view_changed(VariableItem* item
|
|||||||
app->settings.displayBatteryPercentage = index;
|
app->settings.displayBatteryPercentage = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void desktop_settings_scene_start_cycle_animations_changed(VariableItem* item) {
|
static void desktop_settings_scene_start_cycle_animation_changed(VariableItem* item) {
|
||||||
DesktopSettingsApp* app = variable_item_get_context(item);
|
DesktopSettingsApp* app = variable_item_get_context(item);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
|
|
||||||
variable_item_set_current_value_text(item, cycle_animations_text[index]);
|
variable_item_set_current_value_text(item, cycle_animation_text[index]);
|
||||||
app->settings.cycle_animations_s = cycle_animations_value[index];
|
app->settings.cycle_animation_s = cycle_animation_value[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void desktop_settings_scene_start_on_enter(void* context) {
|
void desktop_settings_scene_start_on_enter(void* context) {
|
||||||
@@ -130,14 +133,14 @@ void desktop_settings_scene_start_on_enter(void* context) {
|
|||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
variable_item_list,
|
variable_item_list,
|
||||||
"Cycle Animation",
|
"Cycle Animation",
|
||||||
CYCLE_ANIMATIONS_COUNT,
|
CYCLE_ANIMATION_COUNT,
|
||||||
desktop_settings_scene_start_cycle_animations_changed,
|
desktop_settings_scene_start_cycle_animation_changed,
|
||||||
app);
|
app);
|
||||||
|
|
||||||
value_index = value_index_uint32(
|
value_index = value_index_int32(
|
||||||
app->settings.cycle_animations_s, cycle_animations_value, CYCLE_ANIMATIONS_COUNT);
|
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_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, cycle_animations_text[value_index]);
|
variable_item_set_current_value_text(item, cycle_animation_text[value_index]);
|
||||||
|
|
||||||
variable_item_list_set_enter_callback(
|
variable_item_list_set_enter_callback(
|
||||||
variable_item_list, desktop_settings_scene_start_var_list_enter_callback, app);
|
variable_item_list, desktop_settings_scene_start_var_list_enter_callback, app);
|
||||||
|
|||||||
Reference in New Issue
Block a user