Skip to content

Commit 246add6

Browse files
Bug fixes - Build fails on ESP32, ESP32S3 without BSP leads to image capture failure
1 parent a9c6287 commit 246add6

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

examples/person_detection/main/idf_component.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ dependencies:
22
espressif/esp-tflite-micro:
33
version: "*"
44
override_path: "../../../"
5+
espressif/esp32-camera: ~2.0.5
56
espressif/esp32_s2_kaluga_kit:
67
rules:
78
- if: "$TFLITE_USE_BSP_KALUGA == 1"

examples/person_detection/main/image_provider.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ limitations under the License.
1717
#include "freertos/FreeRTOS.h"
1818
#include "freertos/task.h"
1919

20+
#if (CONFIG_TFLITE_USE_BSP)
21+
#include "bsp/esp-bsp.h"
22+
#endif
23+
2024
#include "esp_heap_caps.h"
2125
#include "esp_log.h"
22-
#include "bsp/esp-bsp.h"
2326

2427
#include "app_camera_esp.h"
2528
#include "esp_camera.h"
@@ -125,6 +128,8 @@ TfLiteStatus GetImage(int image_width, int image_height, int channels, int8_t* i
125128
for (int i = 0; i < image_width * image_height; i++) {
126129
image_data[i] = ((uint8_t *) fb->buf)[i] ^ 0x80;
127130
}
131+
132+
esp_camera_fb_return(fb);
128133
#endif // DISPLAY_SUPPORT
129134
/* here the esp camera can give you grayscale image directly */
130135
return kTfLiteOk;

examples/person_detection/main/main_functions.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,10 @@ void setup() {
112112
return;
113113
}
114114

115+
#if DISPLAY_SUPPORT
115116
create_gui();
116-
#endif
117+
#endif // DISPLAY_SUPPORT
118+
#endif // CLI_ONLY_INFERENCE
117119
}
118120

119121
#ifndef CLI_ONLY_INFERENCE
@@ -143,7 +145,7 @@ void loop() {
143145
RespondToDetection(person_score_f, no_person_score_f);
144146
vTaskDelay(1); // to avoid watchdog trigger
145147
}
146-
#endif
148+
#endif // CLI_ONLY_INFERENCE
147149

148150
#if defined(COLLECT_CPU_STATS)
149151
long long total_time = 0;

0 commit comments

Comments
 (0)