Skip to content

Commit 8d768e0

Browse files
committed
Update BadgeELF, enable it only on ESP32-P4 targets
1 parent f6adb6f commit 8d768e0

6 files changed

Lines changed: 17 additions & 11 deletions

File tree

main/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ if (CONFIG_BSP_TARGET_TANMATSU OR CONFIG_BSP_TARGET_KONSOOL OR CONFIG_BSP_TARGET
22
list(APPEND files "tanmatsu_coprocessor.bin")
33
endif()
44

5-
if (CONFIG_IDF_TARGET_ESP32P4)
6-
list(APPEND extra_requires esp-hosted-tanmatsu)
5+
# No, CONFIG_IDF_TARGET_ESP32P4 doesn't work. This does.
6+
idf_build_get_property(idf_target IDF_TARGET)
7+
if("${idf_target}" STREQUAL "esp32p4")
8+
list(APPEND extra_requires esp-hosted-tanmatsu badge-elf)
79
endif()
810

911
idf_component_register(
@@ -61,7 +63,6 @@ idf_component_register(
6163
fatfs
6264
nvs_flash
6365
badge-bsp
64-
badge-elf
6566
gui
6667
wpa_supplicant
6768
esp_https_ota

main/common/display.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ static pax_buf_t fb = {0};
2929
static pax_col_t palette[] = {0xffffffff, 0xff000000, 0xffff0000}; // white, black, red
3030
#endif
3131

32+
#if CONFIG_IDF_TARGET_ESP32P4
3233
// Display framebuffer returned by `asp_disp_get_fb`.
3334
extern uint8_t* asp_disp_fb;
3435
// PAX buffer returned by `asp_disp_get_pax_buf`.
3536
extern pax_buf_t* asp_disp_pax_buf;
37+
#endif
3638

3739
void display_init(void) {
3840
ESP_ERROR_CHECK(
@@ -82,8 +84,10 @@ void display_init(void) {
8284
}
8385
pax_buf_set_orientation(&fb, orientation);
8486

87+
#if CONFIG_IDF_TARGET_ESP32P4
8588
asp_disp_fb = pax_buf_get_pixels_rw(&fb);
8689
asp_disp_pax_buf = &fb;
90+
#endif
8791
}
8892

8993
pax_buf_t* display_get_buffer(void) {

main/menu/apps.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
#include "app_management.h"
88
#include "app_metadata_parser.h"
99
#include "appfs.h"
10+
#if CONFIG_IDF_TARGET_ESP32P4
1011
#include "badge_elf.h"
12+
#endif
1113
#include "bsp/input.h"
1214
#include "common/display.h"
1315
#include "filesystem_utils.h"
@@ -52,6 +54,7 @@ void execute_app(pax_buf_t* buffer, gui_theme_t* theme, pax_vec2_t position, app
5254
display_blit_buffer(buffer);
5355
printf("Starting %s (from %s)...\n", app->slug, app->path);
5456
if (!strcmp(app->interpreter, "BadgeELF")) {
57+
#if CONFIG_IDF_TARGET_ESP32P4
5558
size_t req = snprintf(NULL, 0, "%s/%s/%s", app->path, app->slug, app->main);
5659
if (req > PATH_MAX) {
5760
message_dialog(get_icon(ICON_ERROR), "Error", "Applet path is too long", "OK");
@@ -65,6 +68,9 @@ void execute_app(pax_buf_t* buffer, gui_theme_t* theme, pax_vec2_t position, app
6568
}
6669
free(path);
6770
}
71+
#else
72+
message_dialog(get_icon(ICON_ERROR), "Error", "BadgeELF applets not supported on this platform", "OK");
73+
#endif
6874
} else if (app->appfs_fd != APPFS_INVALID_FD) {
6975
appfsBootSelect(app->appfs_fd, NULL);
7076
while (wifi_stack_get_task_done() == false) {

main/menu/home.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <sys/unistd.h>
44
#include <time.h>
55
#include "apps.h"
6-
#include "badge_elf.h"
76
#include "bsp/display.h"
87
#include "bsp/input.h"
98
#include "bsp/power.h"
@@ -153,11 +152,7 @@ void menu_home(void) {
153152
if (event.args_navigation.state) {
154153
switch (event.args_navigation.key) {
155154
case BSP_INPUT_NAVIGATION_KEY_F1:
156-
if (event.args_navigation.modifiers & BSP_INPUT_MODIFIER_FUNCTION) {
157-
bsp_power_set_radio_state(BSP_POWER_RADIO_STATE_OFF);
158-
} else {
159-
badge_elf_start("/int/test.elf");
160-
}
155+
bsp_power_set_radio_state(BSP_POWER_RADIO_STATE_OFF);
161156
break;
162157
case BSP_INPUT_NAVIGATION_KEY_F2:
163158
if (event.args_navigation.modifiers & BSP_INPUT_MODIFIER_FUNCTION) {

0 commit comments

Comments
 (0)