Fix xtreme settings values handling

This commit is contained in:
Willy-JL
2023-05-31 18:14:30 +01:00
parent cbcb9b3fb4
commit 014a30d8bf
9 changed files with 94 additions and 40 deletions

View File

@@ -521,7 +521,7 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
if(!flipper_format_read_uint32(ff, "Active cycles", &u32value, 1)) break; //-V779
animation->active_cycles = u32value;
if(!flipper_format_read_uint32(ff, "Frame rate", &u32value, 1)) break;
uint16_t anim_speed = XTREME_SETTINGS()->anim_speed;
uint32_t anim_speed = XTREME_SETTINGS()->anim_speed;
u32value = (u32value * anim_speed) / 100;
FURI_CONST_ASSIGN(animation->icon_animation.frame_rate, u32value < 1 ? 1 : u32value);
if(!flipper_format_read_uint32(ff, "Duration", &u32value, 1)) break;

View File

@@ -80,10 +80,10 @@ Dolphin* dolphin_alloc() {
dolphin->state = dolphin_state_alloc();
dolphin->event_queue = furi_message_queue_alloc(8, sizeof(DolphinEvent));
dolphin->pubsub = furi_pubsub_alloc();
int32_t butthurt = XTREME_SETTINGS()->butthurt_timer;
uint32_t butthurt_timer = XTREME_SETTINGS()->butthurt_timer;
dolphin->butthurt_timer = xTimerCreate(
NULL,
(butthurt > 0) ? (butthurt * 1000) : -1,
butthurt_timer ? ((int32_t)butthurt_timer * 1000) : -1,
pdTRUE,
dolphin,
dolphin_butthurt_timer_callback);

View File

@@ -473,7 +473,8 @@ static void power_check_battery_level_change(Power* power) {
}
static void power_check_charge_cap(Power* power) {
if(power->info.charge >= XTREME_SETTINGS()->charge_cap) {
uint32_t cap = XTREME_SETTINGS()->charge_cap;
if(power->info.charge >= cap && cap < 100) {
if(!power->info.is_charge_capped) { // Suppress charging if charge reaches custom cap
power->info.is_charge_capped = true;
furi_hal_power_suppress_charge_enter();