Skip to content

Commit eb1deb7

Browse files
committed
Minor improvements
1 parent 5d80859 commit eb1deb7

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

examples/benchmark_img_conv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def print_summary_table(results, cam):
5656

5757
try:
5858
for fb in [1, 2]:
59-
cam.reconfigure(fb_count=fb)
59+
cam.reconfigure(fb_count=fb, frame_size=FrameSize.QQVGA)
6060
results[fb] = {}
6161
for p in dir(PixelFormat):
6262
if not p.startswith('_'):

src/modcamera.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,6 @@
3737
#error Camera only works on boards configured with spiram
3838
#endif
3939

40-
// #if !defined(CONFIG_CAMERA_CORE0) && !defined(CONFIG_CAMERA_CORE1)
41-
// #if MP_TASK_COREID == 0
42-
// #define CONFIG_CAMERA_CORE0 1
43-
// #elif MP_TASK_COREID == 1
44-
// #define CONFIG_CAMERA_CORE1 1
45-
// #endif
46-
// #endif // CONFIG_CAMERA_COREx
47-
4840
// Helper functions
4941
static int map(int value, int fromLow, int fromHigh, int toLow, int toHigh) {
5042
if (fromHigh == fromLow) {
@@ -71,7 +63,7 @@ static void set_check_xclk_freq(mp_camera_obj_t *self, int32_t xclk_freq_hz) {
7163
}
7264
}
7365

74-
static void set_check_fb_count(mp_camera_obj_t *self, int fb_count) {
66+
static void set_check_fb_count(mp_camera_obj_t *self, mp_int_t fb_count) {
7567
if (fb_count > 2) {
7668
self->camera_config.fb_count = 2;
7769
mp_warning(NULL, "Frame buffer size limited to 2");
@@ -192,7 +184,7 @@ void mp_camera_hal_deinit(mp_camera_obj_t *self) {
192184

193185
void mp_camera_hal_reconfigure(mp_camera_obj_t *self, mp_camera_framesize_t frame_size, mp_camera_pixformat_t pixel_format, mp_camera_grabmode_t grab_mode, mp_int_t fb_count) {
194186
check_init(self);
195-
ESP_LOGI(TAG, "Reconfiguring camera");
187+
ESP_LOGI(TAG, "Reconfiguring camera with frame size: %d, pixel format: %d, grab mode: %d, fb count: %d", (int)frame_size, (int)pixel_format, (int)grab_mode, (int)fb_count);
196188

197189
sensor_t *sensor = esp_camera_sensor_get();
198190
camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id);
@@ -236,6 +228,7 @@ mp_obj_t mp_camera_hal_capture(mp_camera_obj_t *self, int8_t out_format) {
236228
}
237229

238230
if (out_format >= 0 && (mp_camera_pixformat_t)out_format != self->camera_config.pixel_format) {
231+
ESP_LOGI(TAG, "Converting image to pixel format: %d", out_format);
239232
switch ((mp_camera_pixformat_t)out_format) {
240233
case PIXFORMAT_JPEG:
241234
if (frame2jpg(self->captured_buffer, self->camera_config.jpeg_quality, &out_buf, &out_len)) {
@@ -289,7 +282,7 @@ mp_obj_t mp_camera_hal_capture(mp_camera_obj_t *self, int8_t out_format) {
289282
}
290283

291284
if (self->bmp_out == false) {
292-
ESP_LOGI(TAG, "Returning imgae without conversion");
285+
ESP_LOGI(TAG, "Returning image without conversion");
293286
return mp_obj_new_memoryview('b', self->captured_buffer->len, self->captured_buffer->buf);
294287
} else {
295288
ESP_LOGI(TAG, "Returning image as bitmap");

src/modcamera_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static mp_obj_t camera_reconfigure(size_t n_args, const mp_obj_t *pos_args, mp_m
180180
args[ARG_grab_mode].u_obj != MP_ROM_NONE
181181
? args[ARG_grab_mode].u_int
182182
: mp_camera_hal_get_grab_mode(self);
183-
uint8_t fb_count =
183+
mp_int_t fb_count =
184184
args[ARG_fb_count].u_obj != MP_ROM_NONE
185185
? args[ARG_fb_count].u_int
186186
: mp_camera_hal_get_fb_count(self);

0 commit comments

Comments
 (0)