mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 12:42:30 +04:00
Desktop: seaprate callbacks for dolphin and storage subscriptions (#3836)
* Desktop: seaprate callbacks for dolphin and storage subscriptions * dolphin: renamed local variable to prevent unintended overrides Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
@@ -104,7 +104,7 @@ void animation_manager_set_dummy_mode_state(AnimationManager* animation_manager,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void animation_manager_check_blocking_callback(const void* message, void* context) {
|
static void animation_manager_storage_callback(const void* message, void* context) {
|
||||||
const StorageEvent* storage_event = message;
|
const StorageEvent* storage_event = message;
|
||||||
|
|
||||||
switch(storage_event->type) {
|
switch(storage_event->type) {
|
||||||
@@ -123,6 +123,22 @@ static void animation_manager_check_blocking_callback(const void* message, void*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void animation_manager_dolphin_callback(const void* message, void* context) {
|
||||||
|
const DolphinPubsubEvent* dolphin_event = message;
|
||||||
|
|
||||||
|
switch(*dolphin_event) {
|
||||||
|
case DolphinPubsubEventUpdate:
|
||||||
|
furi_assert(context);
|
||||||
|
AnimationManager* animation_manager = context;
|
||||||
|
if(animation_manager->check_blocking_callback) {
|
||||||
|
animation_manager->check_blocking_callback(animation_manager->context);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void animation_manager_timer_callback(void* context) {
|
static void animation_manager_timer_callback(void* context) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
AnimationManager* animation_manager = context;
|
AnimationManager* animation_manager = context;
|
||||||
@@ -300,12 +316,12 @@ AnimationManager* animation_manager_alloc(void) {
|
|||||||
|
|
||||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
animation_manager->pubsub_subscription_storage = furi_pubsub_subscribe(
|
animation_manager->pubsub_subscription_storage = furi_pubsub_subscribe(
|
||||||
storage_get_pubsub(storage), animation_manager_check_blocking_callback, animation_manager);
|
storage_get_pubsub(storage), animation_manager_storage_callback, animation_manager);
|
||||||
furi_record_close(RECORD_STORAGE);
|
furi_record_close(RECORD_STORAGE);
|
||||||
|
|
||||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||||
animation_manager->pubsub_subscription_dolphin = furi_pubsub_subscribe(
|
animation_manager->pubsub_subscription_dolphin = furi_pubsub_subscribe(
|
||||||
dolphin_get_pubsub(dolphin), animation_manager_check_blocking_callback, animation_manager);
|
dolphin_get_pubsub(dolphin), animation_manager_dolphin_callback, animation_manager);
|
||||||
furi_record_close(RECORD_DOLPHIN);
|
furi_record_close(RECORD_DOLPHIN);
|
||||||
|
|
||||||
animation_manager->blocking_shown_sd_ok = true;
|
animation_manager->blocking_shown_sd_ok = true;
|
||||||
|
|||||||
@@ -204,8 +204,8 @@ static bool dolphin_process_event(FuriEventLoopObject* object, void* context) {
|
|||||||
if(event.type == DolphinEventTypeDeed) {
|
if(event.type == DolphinEventTypeDeed) {
|
||||||
dolphin_state_on_deed(dolphin->state, event.deed);
|
dolphin_state_on_deed(dolphin->state, event.deed);
|
||||||
|
|
||||||
DolphinPubsubEvent event = DolphinPubsubEventUpdate;
|
DolphinPubsubEvent pubsub_event = DolphinPubsubEventUpdate;
|
||||||
furi_pubsub_publish(dolphin->pubsub, &event);
|
furi_pubsub_publish(dolphin->pubsub, &pubsub_event);
|
||||||
furi_event_loop_timer_start(dolphin->butthurt_timer, BUTTHURT_INCREASE_PERIOD_TICKS);
|
furi_event_loop_timer_start(dolphin->butthurt_timer, BUTTHURT_INCREASE_PERIOD_TICKS);
|
||||||
furi_event_loop_timer_start(dolphin->flush_timer, FLUSH_TIMEOUT_TICKS);
|
furi_event_loop_timer_start(dolphin->flush_timer, FLUSH_TIMEOUT_TICKS);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user