mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-10 06:54:19 +00:00
Merge remote-tracking branch 'OFW/dev' into dev
This commit is contained in:
commit
8a58fc1ca7
6 changed files with 49 additions and 21 deletions
|
@ -18,6 +18,33 @@ static const TextBoxViewTestContent text_box_view_test_content_arr[] = {
|
|||
.focus = TextBoxFocusStart,
|
||||
.text = "Hello, let's test text box. Press Right and Left to switch content",
|
||||
},
|
||||
{
|
||||
.font = TextBoxFontText,
|
||||
.focus = TextBoxFocusEnd,
|
||||
.text = "First test to add dynamically lines with EndFocus set\nLine 0",
|
||||
},
|
||||
{
|
||||
.font = TextBoxFontText,
|
||||
.focus = TextBoxFocusEnd,
|
||||
.text = "First test to add dynamically lines with EndFocus set\nLine 0\nLine 1",
|
||||
},
|
||||
{
|
||||
.font = TextBoxFontText,
|
||||
.focus = TextBoxFocusEnd,
|
||||
.text = "First test to add dynamically lines with EndFocus set\nLine 0\nLine 1\nLine 2",
|
||||
},
|
||||
{
|
||||
.font = TextBoxFontText,
|
||||
.focus = TextBoxFocusEnd,
|
||||
.text =
|
||||
"First test to add dynamically lines with EndFocus set\nLine 0\nLine 1\nLine 2\nLine 3",
|
||||
},
|
||||
{
|
||||
.font = TextBoxFontText,
|
||||
.focus = TextBoxFocusEnd,
|
||||
.text =
|
||||
"First test to add dynamically lines with EndFocus set\nLine 0\nLine 1\nLine 2\nLine 3\nLine 4",
|
||||
},
|
||||
{
|
||||
.font = TextBoxFontText,
|
||||
.focus = TextBoxFocusStart,
|
||||
|
@ -57,7 +84,8 @@ typedef struct {
|
|||
} TextBoxViewTest;
|
||||
|
||||
static void text_box_update_view(TextBoxViewTest* instance) {
|
||||
text_box_reset(instance->text_box);
|
||||
// Intentional incorrect way to reset text box to verify that state resets if text changes
|
||||
text_box_set_text(instance->text_box, "");
|
||||
|
||||
const TextBoxViewTestContent* content =
|
||||
&text_box_view_test_content_arr[instance->current_content_i];
|
||||
|
|
|
@ -21,14 +21,14 @@ static void archive_tick_event_callback(void* context) {
|
|||
ArchiveApp* archive_alloc(void) {
|
||||
ArchiveApp* archive = malloc(sizeof(ArchiveApp));
|
||||
|
||||
archive->gui = furi_record_open(RECORD_GUI);
|
||||
archive->loader = furi_record_open(RECORD_LOADER);
|
||||
archive->fav_move_str = furi_string_alloc();
|
||||
archive->dst_path = furi_string_alloc();
|
||||
|
||||
archive->scene_manager = scene_manager_alloc(&archive_scene_handlers, archive);
|
||||
archive->view_dispatcher = view_dispatcher_alloc();
|
||||
|
||||
archive->gui = furi_record_open(RECORD_GUI);
|
||||
|
||||
ViewDispatcher* view_dispatcher = archive->view_dispatcher;
|
||||
view_dispatcher_enable_queue(view_dispatcher);
|
||||
view_dispatcher_set_event_callback_context(view_dispatcher, archive);
|
||||
|
@ -88,6 +88,8 @@ void archive_free(ArchiveApp* archive) {
|
|||
furi_record_close(RECORD_DIALOGS);
|
||||
archive->dialogs = NULL;
|
||||
|
||||
furi_record_close(RECORD_LOADER);
|
||||
archive->loader = NULL;
|
||||
furi_record_close(RECORD_GUI);
|
||||
archive->gui = NULL;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ typedef enum {
|
|||
|
||||
struct ArchiveApp {
|
||||
Gui* gui;
|
||||
Loader* loader;
|
||||
ViewDispatcher* view_dispatcher;
|
||||
ViewStack* view_stack;
|
||||
SceneManager* scene_manager;
|
||||
|
|
|
@ -88,10 +88,8 @@ void archive_scene_browser_on_enter(void* context) {
|
|||
archive_update_focus(browser, archive->text_store);
|
||||
view_dispatcher_switch_to_view(archive->view_dispatcher, ArchiveViewBrowser);
|
||||
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
archive->loader_stop_subscription =
|
||||
furi_pubsub_subscribe(loader_get_pubsub(loader), archive_loader_callback, archive);
|
||||
furi_record_close(RECORD_LOADER);
|
||||
archive->loader_stop_subscription = furi_pubsub_subscribe(
|
||||
loader_get_pubsub(archive->loader), archive_loader_callback, archive);
|
||||
|
||||
uint32_t state = scene_manager_get_scene_state(archive->scene_manager, ArchiveAppSceneBrowser);
|
||||
|
||||
|
@ -302,10 +300,11 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
|
|||
if(!archive_is_home(browser)) {
|
||||
archive_leave_dir(browser);
|
||||
} else {
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
furi_pubsub_unsubscribe(
|
||||
loader_get_pubsub(loader), archive->loader_stop_subscription);
|
||||
furi_record_close(RECORD_LOADER);
|
||||
if(archive->loader_stop_subscription) {
|
||||
furi_pubsub_unsubscribe(
|
||||
loader_get_pubsub(archive->loader), archive->loader_stop_subscription);
|
||||
archive->loader_stop_subscription = NULL;
|
||||
}
|
||||
|
||||
view_dispatcher_stop(archive->view_dispatcher);
|
||||
}
|
||||
|
@ -321,8 +320,9 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
|
|||
|
||||
void archive_scene_browser_on_exit(void* context) {
|
||||
ArchiveApp* archive = (ArchiveApp*)context;
|
||||
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
furi_pubsub_unsubscribe(loader_get_pubsub(loader), archive->loader_stop_subscription);
|
||||
furi_record_close(RECORD_LOADER);
|
||||
if(archive->loader_stop_subscription) {
|
||||
furi_pubsub_unsubscribe(
|
||||
loader_get_pubsub(archive->loader), archive->loader_stop_subscription);
|
||||
archive->loader_stop_subscription = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,14 +227,13 @@ static void text_box_prepare_model(Canvas* canvas, TextBoxModel* model) {
|
|||
text_box_seek_next_line(canvas, model);
|
||||
lines_num++;
|
||||
} while(!text_box_end_of_text_reached(model));
|
||||
model->text_offset = 0;
|
||||
lines_num++;
|
||||
|
||||
if(model->focus == TextBoxFocusEnd) {
|
||||
if(lines_num > model->lines_on_screen) {
|
||||
model->text_offset = window_offset[(lines_num - 1) % model->lines_on_screen];
|
||||
}
|
||||
} else {
|
||||
model->text_offset = 0;
|
||||
}
|
||||
|
||||
if(lines_num > model->lines_on_screen) {
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#ifdef FLASH_OP_DEBUG
|
||||
#undef FURI_LOG_T
|
||||
#define FURI_LOG_T(...)
|
||||
#else
|
||||
#endif
|
||||
|
||||
#define FURI_HAL_CRITICAL_MSG "Critical flash operation fail"
|
||||
|
@ -154,9 +153,8 @@ static void furi_hal_flash_begin_with_core2(bool erase_flag) {
|
|||
/* Erase activity notification */
|
||||
if(erase_flag) SHCI_C2_FLASH_EraseActivity(ERASE_ACTIVITY_ON);
|
||||
|
||||
/* 64mHz 5us core2 flag protection */
|
||||
for(volatile uint32_t i = 0; i < 35; i++)
|
||||
;
|
||||
/* 5us core2 flag protection */
|
||||
furi_delay_us(5);
|
||||
|
||||
FuriHalCortexTimer timer = furi_hal_cortex_timer_get(FURI_HAL_FLASH_C2_LOCK_TIMEOUT_MS * 1000);
|
||||
while(true) {
|
||||
|
|
Loading…
Reference in a new issue