Skip to content

Commit 803aeb6

Browse files
committed
Roll back to previous method signatures
1 parent c95dd78 commit 803aeb6

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

src/core/thread.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "util/sdcard.h"
3232
#include "util/system.h"
3333

34-
void (*sdcard_ready_cb)(void(*)()) = NULL;
34+
void (*sdcard_ready_cb)() = NULL;
3535

3636
///////////////////////////////////////////////////////////////////////////////
3737
// SD card exist
@@ -51,7 +51,7 @@ static void detect_sdcard(void) {
5151
if (g_init_done) {
5252
if (sdcard_init_scan && g_sdcard_enable) {
5353
if (sdcard_ready_cb) {
54-
sdcard_ready_cb(NULL);
54+
sdcard_ready_cb();
5555
}
5656
sdcard_init_scan = false;
5757
} else if (!g_sdcard_enable && sdcard_enable_last) {

src/ui/page_storage.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "util/sdcard.h"
1717
#include "util/system.h"
1818

19-
extern void (*sdcard_ready_cb)(void(*)());
19+
extern void (*sdcard_ready_cb)();
2020

2121
/**
2222
* Types
@@ -551,6 +551,14 @@ static void page_storage_on_click(uint8_t key, int sel) {
551551
static void page_storage_on_right_button(bool is_short) {
552552
}
553553

554+
static void page_storage_post_bootup_action(void (*complete_callback)()) {
555+
page_storage_init_auto_sd_repair();
556+
557+
if (complete_callback != NULL) {
558+
complete_callback();
559+
}
560+
}
561+
554562
/**
555563
* Main Menu page data structure, notice max is set to zero
556564
* in order to allow us to override default user input logic.
@@ -570,14 +578,13 @@ page_pack_t pp_storage = {
570578
.on_click = page_storage_on_click,
571579
.on_right_button = page_storage_on_right_button,
572580
.post_bootup_run_priority = 50,
573-
.post_bootup_run_function = page_storage_init_auto_sd_repair,
581+
.post_bootup_run_function = page_storage_post_bootup_action,
574582
};
575583

576584
/**
577585
* Worker thread for repairing SD Card.
578586
*/
579587
static void *page_storage_repair_thread(void *arg) {
580-
void (*complete_callback)() = arg;
581588
char buf[128];
582589
if (!page_storage.disable_controls) {
583590
page_storage.is_auto_sd_repair_active = true;
@@ -592,9 +599,6 @@ static void *page_storage_repair_thread(void *arg) {
592599
page_storage.is_sd_repair_complete = true;
593600
sdcard_ready_cb = page_storage_init_auto_sd_repair;
594601

595-
if (complete_callback != NULL) {
596-
complete_callback();
597-
}
598602
pthread_exit(NULL);
599603
}
600604

@@ -608,11 +612,11 @@ bool page_storage_is_sd_repair_active() {
608612
/**
609613
* Once initialized detach until completed.
610614
*/
611-
void page_storage_init_auto_sd_repair(void (*complete_callback)()) {
615+
void page_storage_init_auto_sd_repair() {
612616
page_storage.is_sd_repair_complete = false;
613617
if (!page_storage.is_auto_sd_repair_active) {
614618
pthread_t tid;
615-
if (!pthread_create(&tid, NULL, page_storage_repair_thread, complete_callback)) {
619+
if (!pthread_create(&tid, NULL, page_storage_repair_thread, NULL)) {
616620
pthread_detach(tid);
617621
}
618622
} else {

src/ui/page_storage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extern "C" {
99
extern page_pack_t pp_storage;
1010

1111
bool page_storage_is_sd_repair_active();
12-
void page_storage_init_auto_sd_repair(void(*complete_callback)());
12+
void page_storage_init_auto_sd_repair();
1313

1414
#ifdef __cplusplus
1515
}

src/ui/page_wifi.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static void page_wifi_mask_password(lv_obj_t *obj, int size) {
268268
* Note: This function will be invoked asynchronously post bootup and may
269269
* require additional APP_STATE checks to ensure integrity of execution.
270270
*/
271-
static void page_wifi_update_settings(void (*complete_callback)()) {
271+
static void page_wifi_update_settings() {
272272
g_setting.wifi.enable = btn_group_get_sel(&page_wifi.page_1.enable.button) == 0;
273273
g_setting.wifi.mode = btn_group_get_sel(&page_wifi.page_1.mode.button);
274274
g_setting.wifi.dhcp = btn_group_get_sel(&page_wifi.page_2.dhcp.button) == 0;
@@ -319,10 +319,6 @@ static void page_wifi_update_settings(void (*complete_callback)()) {
319319
system_script(WIFI_STA_ON);
320320
}
321321
}
322-
323-
if (complete_callback != NULL) {
324-
complete_callback();
325-
}
326322
}
327323

328324
/**
@@ -589,7 +585,7 @@ static void page_wifi_apply_settings_pending_cb(struct _lv_timer_t *timer) {
589585
* Callback invoked once `Apply Settings` is triggered and confirmed via the menu.
590586
*/
591587
static void page_wifi_apply_settings_timer_cb(struct _lv_timer_t *timer) {
592-
page_wifi_update_settings(NULL);
588+
page_wifi_update_settings();
593589
page_wifi_dirty_flag_reset();
594590
page_wifi_apply_settings_reset();
595591
}
@@ -1147,6 +1143,14 @@ static void page_wifi_on_right_button(bool is_short) {
11471143
}
11481144
}
11491145

1146+
void page_wifi_post_bootup_action(void (*complete_callback)()) {
1147+
page_wifi_update_settings();
1148+
1149+
if (complete_callback != NULL) {
1150+
complete_callback();
1151+
}
1152+
}
1153+
11501154
/**
11511155
* Main Menu page data structure, notice max is set to zero
11521156
* in order to allow us to override default user input logic.
@@ -1166,7 +1170,7 @@ page_pack_t pp_wifi = {
11661170
.on_click = page_wifi_on_click,
11671171
.on_right_button = page_wifi_on_right_button,
11681172
.post_bootup_run_priority = 100,
1169-
.post_bootup_run_function = page_wifi_update_settings,
1173+
.post_bootup_run_function = page_wifi_post_bootup_action,
11701174
};
11711175

11721176
/**

0 commit comments

Comments
 (0)