mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 18:28:36 -07:00
Merge branch 'dev' of https://github.com/flipperdevices/flipperzero-firmware into xfw-dev
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include <gui/icon.h>
|
||||
#include <gui/view.h>
|
||||
#include <assets_icons.h>
|
||||
#include <portmacro.h>
|
||||
#include <locale/locale.h>
|
||||
#include <xtreme.h>
|
||||
|
||||
@@ -28,7 +27,7 @@ struct DesktopViewLocked {
|
||||
DesktopViewLockedCallback callback;
|
||||
void* context;
|
||||
|
||||
TimerHandle_t timer;
|
||||
FuriTimer* timer;
|
||||
uint8_t lock_count;
|
||||
uint32_t lock_lastpress;
|
||||
};
|
||||
@@ -58,8 +57,8 @@ void desktop_view_locked_set_callback(
|
||||
locked_view->context = context;
|
||||
}
|
||||
|
||||
static void locked_view_timer_callback(TimerHandle_t timer) {
|
||||
DesktopViewLocked* locked_view = pvTimerGetTimerID(timer);
|
||||
static void locked_view_timer_callback(void* context) {
|
||||
DesktopViewLocked* locked_view = context;
|
||||
locked_view->callback(DesktopLockedEventUpdate, locked_view->context);
|
||||
}
|
||||
|
||||
@@ -155,7 +154,7 @@ static void desktop_view_locked_update_hint_icon_timeout(DesktopViewLocked* lock
|
||||
model->view_state = DesktopViewLockedStateLockedHintShown;
|
||||
}
|
||||
view_commit_model(locked_view->view, change_state);
|
||||
xTimerChangePeriod(locked_view->timer, pdMS_TO_TICKS(LOCKED_HINT_TIMEOUT_MS), portMAX_DELAY);
|
||||
furi_timer_start(locked_view->timer, LOCKED_HINT_TIMEOUT_MS);
|
||||
}
|
||||
|
||||
void desktop_view_locked_update(DesktopViewLocked* locked_view) {
|
||||
@@ -182,7 +181,7 @@ void desktop_view_locked_update(DesktopViewLocked* locked_view) {
|
||||
|
||||
if(view_state != DesktopViewLockedStateCoverClosing &&
|
||||
view_state != DesktopViewLockedStateCoverOpening) {
|
||||
xTimerStop(locked_view->timer, portMAX_DELAY);
|
||||
furi_timer_stop(locked_view->timer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +208,7 @@ static bool desktop_view_locked_input(InputEvent* event, void* context) {
|
||||
furi_assert(context);
|
||||
|
||||
bool is_changed = false;
|
||||
const uint32_t press_time = xTaskGetTickCount();
|
||||
const uint32_t press_time = furi_get_tick();
|
||||
DesktopViewLocked* locked_view = context;
|
||||
DesktopViewLockedModel* model = view_get_model(locked_view->view);
|
||||
if(model->view_state == DesktopViewLockedStateUnlockedHintShown &&
|
||||
@@ -269,7 +268,7 @@ DesktopViewLocked* desktop_view_locked_alloc() {
|
||||
DesktopViewLocked* locked_view = malloc(sizeof(DesktopViewLocked));
|
||||
locked_view->view = view_alloc();
|
||||
locked_view->timer =
|
||||
xTimerCreate(NULL, 1000 / 16, pdTRUE, locked_view, locked_view_timer_callback);
|
||||
furi_timer_alloc(locked_view_timer_callback, FuriTimerTypePeriodic, locked_view);
|
||||
|
||||
view_allocate_model(locked_view->view, ViewModelTypeLocking, sizeof(DesktopViewLockedModel));
|
||||
view_set_context(locked_view->view, locked_view);
|
||||
@@ -292,7 +291,7 @@ void desktop_view_locked_close_cover(DesktopViewLocked* locked_view) {
|
||||
model->view_state = DesktopViewLockedStateCoverClosing;
|
||||
model->cover_offset = COVER_OFFSET_START;
|
||||
view_commit_model(locked_view->view, true);
|
||||
xTimerChangePeriod(locked_view->timer, pdMS_TO_TICKS(COVER_MOVING_INTERVAL_MS), portMAX_DELAY);
|
||||
furi_timer_start(locked_view->timer, COVER_MOVING_INTERVAL_MS);
|
||||
}
|
||||
|
||||
void desktop_view_locked_lock(DesktopViewLocked* locked_view, bool pin_locked) {
|
||||
@@ -310,7 +309,7 @@ void desktop_view_locked_unlock(DesktopViewLocked* locked_view) {
|
||||
model->cover_offset = COVER_OFFSET_END;
|
||||
model->pin_locked = false;
|
||||
view_commit_model(locked_view->view, true);
|
||||
xTimerChangePeriod(locked_view->timer, pdMS_TO_TICKS(COVER_MOVING_INTERVAL_MS), portMAX_DELAY);
|
||||
furi_timer_start(locked_view->timer, COVER_MOVING_INTERVAL_MS);
|
||||
}
|
||||
|
||||
bool desktop_view_locked_is_locked_hint_visible(DesktopViewLocked* locked_view) {
|
||||
|
||||
@@ -13,7 +13,7 @@ struct DesktopMainView {
|
||||
View* view;
|
||||
DesktopMainViewCallback callback;
|
||||
void* context;
|
||||
TimerHandle_t _poweroff_timer; // Unused, kept for compatibility
|
||||
FuriTimer* _poweroff_timer; // Unused, kept for compatibility
|
||||
bool _dummy_mode; // Unused, kept for compatibility
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
#include <stdint.h>
|
||||
#include <portmacro.h>
|
||||
|
||||
#include "desktop_view_pin_input.h"
|
||||
#include <desktop/desktop_settings.h>
|
||||
@@ -21,7 +20,7 @@ struct DesktopViewPinInput {
|
||||
DesktopViewPinInputCallback timeout_callback;
|
||||
DesktopViewPinInputDoneCallback done_callback;
|
||||
void* context;
|
||||
TimerHandle_t timer;
|
||||
FuriTimer* timer;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@@ -78,7 +77,7 @@ static bool desktop_view_pin_input_input(InputEvent* event, void* context) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
furi_assert(0);
|
||||
furi_crash();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -90,7 +89,7 @@ static bool desktop_view_pin_input_input(InputEvent* event, void* context) {
|
||||
pin_input->back_callback(pin_input->context);
|
||||
}
|
||||
|
||||
xTimerStart(pin_input->timer, 0);
|
||||
furi_timer_start(pin_input->timer, NO_ACTIVITY_TIMEOUT);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -129,7 +128,7 @@ static void desktop_view_pin_input_draw_cells(Canvas* canvas, DesktopViewPinInpu
|
||||
canvas_draw_icon_ex(canvas, x + 2, y + 3, &I_Pin_arrow_up_7x9, IconRotation90);
|
||||
break;
|
||||
default:
|
||||
furi_assert(0);
|
||||
furi_crash();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -170,8 +169,8 @@ static void desktop_view_pin_input_draw(Canvas* canvas, void* context) {
|
||||
}
|
||||
}
|
||||
|
||||
void desktop_view_pin_input_timer_callback(TimerHandle_t timer) {
|
||||
DesktopViewPinInput* pin_input = pvTimerGetTimerID(timer);
|
||||
void desktop_view_pin_input_timer_callback(void* context) {
|
||||
DesktopViewPinInput* pin_input = context;
|
||||
|
||||
if(pin_input->timeout_callback) {
|
||||
pin_input->timeout_callback(pin_input->context);
|
||||
@@ -180,12 +179,12 @@ void desktop_view_pin_input_timer_callback(TimerHandle_t timer) {
|
||||
|
||||
static void desktop_view_pin_input_enter(void* context) {
|
||||
DesktopViewPinInput* pin_input = context;
|
||||
xTimerStart(pin_input->timer, portMAX_DELAY);
|
||||
furi_timer_start(pin_input->timer, NO_ACTIVITY_TIMEOUT);
|
||||
}
|
||||
|
||||
static void desktop_view_pin_input_exit(void* context) {
|
||||
DesktopViewPinInput* pin_input = context;
|
||||
xTimerStop(pin_input->timer, portMAX_DELAY);
|
||||
furi_timer_stop(pin_input->timer);
|
||||
}
|
||||
|
||||
DesktopViewPinInput* desktop_view_pin_input_alloc(void) {
|
||||
@@ -195,12 +194,8 @@ DesktopViewPinInput* desktop_view_pin_input_alloc(void) {
|
||||
view_set_context(pin_input->view, pin_input);
|
||||
view_set_draw_callback(pin_input->view, desktop_view_pin_input_draw);
|
||||
view_set_input_callback(pin_input->view, desktop_view_pin_input_input);
|
||||
pin_input->timer = xTimerCreate(
|
||||
NULL,
|
||||
pdMS_TO_TICKS(NO_ACTIVITY_TIMEOUT),
|
||||
pdFALSE,
|
||||
pin_input,
|
||||
desktop_view_pin_input_timer_callback);
|
||||
pin_input->timer =
|
||||
furi_timer_alloc(desktop_view_pin_input_timer_callback, FuriTimerTypeOnce, pin_input);
|
||||
view_set_enter_callback(pin_input->view, desktop_view_pin_input_enter);
|
||||
view_set_exit_callback(pin_input->view, desktop_view_pin_input_exit);
|
||||
|
||||
@@ -216,11 +211,7 @@ DesktopViewPinInput* desktop_view_pin_input_alloc(void) {
|
||||
void desktop_view_pin_input_free(DesktopViewPinInput* pin_input) {
|
||||
furi_assert(pin_input);
|
||||
|
||||
xTimerStop(pin_input->timer, portMAX_DELAY);
|
||||
while(xTimerIsTimerActive(pin_input->timer)) {
|
||||
furi_delay_tick(1);
|
||||
}
|
||||
xTimerDelete(pin_input->timer, portMAX_DELAY);
|
||||
furi_timer_free(pin_input->timer);
|
||||
|
||||
view_free(pin_input->view);
|
||||
free(pin_input);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <FreeRTOS.h>
|
||||
#include <portmacro.h>
|
||||
#include <projdefs.h>
|
||||
#include <input/input.h>
|
||||
#include <gui/canvas.h>
|
||||
@@ -13,7 +12,7 @@
|
||||
|
||||
struct DesktopViewPinTimeout {
|
||||
View* view;
|
||||
TimerHandle_t timer;
|
||||
FuriTimer* timer;
|
||||
DesktopViewPinTimeoutDoneCallback callback;
|
||||
void* context;
|
||||
};
|
||||
@@ -32,8 +31,8 @@ void desktop_view_pin_timeout_set_callback(
|
||||
instance->context = context;
|
||||
}
|
||||
|
||||
static void desktop_view_pin_timeout_timer_callback(TimerHandle_t timer) {
|
||||
DesktopViewPinTimeout* instance = pvTimerGetTimerID(timer);
|
||||
static void desktop_view_pin_timeout_timer_callback(void* context) {
|
||||
DesktopViewPinTimeout* instance = context;
|
||||
bool stop = false;
|
||||
|
||||
DesktopViewPinTimeoutModel* model = view_get_model(instance->view);
|
||||
@@ -45,7 +44,7 @@ static void desktop_view_pin_timeout_timer_callback(TimerHandle_t timer) {
|
||||
view_commit_model(instance->view, true);
|
||||
|
||||
if(stop) {
|
||||
xTimerStop(instance->timer, portMAX_DELAY);
|
||||
furi_timer_stop(instance->timer);
|
||||
instance->callback(instance->context);
|
||||
}
|
||||
}
|
||||
@@ -73,15 +72,15 @@ static void desktop_view_pin_timeout_draw(Canvas* canvas, void* _model) {
|
||||
|
||||
void desktop_view_pin_timeout_free(DesktopViewPinTimeout* instance) {
|
||||
view_free(instance->view);
|
||||
xTimerDelete(instance->timer, portMAX_DELAY);
|
||||
furi_timer_free(instance->timer);
|
||||
|
||||
free(instance);
|
||||
}
|
||||
|
||||
DesktopViewPinTimeout* desktop_view_pin_timeout_alloc(void) {
|
||||
DesktopViewPinTimeout* instance = malloc(sizeof(DesktopViewPinTimeout));
|
||||
instance->timer = xTimerCreate(
|
||||
NULL, pdMS_TO_TICKS(1000), pdTRUE, instance, desktop_view_pin_timeout_timer_callback);
|
||||
instance->timer =
|
||||
furi_timer_alloc(desktop_view_pin_timeout_timer_callback, FuriTimerTypePeriodic, instance);
|
||||
|
||||
instance->view = view_alloc();
|
||||
view_allocate_model(instance->view, ViewModelTypeLockFree, sizeof(DesktopViewPinTimeoutModel));
|
||||
@@ -101,7 +100,7 @@ void desktop_view_pin_timeout_start(DesktopViewPinTimeout* instance, uint32_t ti
|
||||
model->time_left = time_left;
|
||||
view_commit_model(instance->view, true);
|
||||
|
||||
xTimerStart(instance->timer, portMAX_DELAY);
|
||||
furi_timer_start(instance->timer, 1000);
|
||||
}
|
||||
|
||||
View* desktop_view_pin_timeout_get_view(DesktopViewPinTimeout* instance) {
|
||||
|
||||
Reference in New Issue
Block a user