Skip to content

Commit 346ceba

Browse files
committed
Revert "camera: use VGA camera resolution for esp32s3"
QVGA appears to give faster and more accurate results when scanning than VGA for Jade Plus. Includes some minor cleanup since the surrounding code has changed slightly. This reverts commit 52df986.
1 parent 882311d commit 346ceba

28 files changed

+14
-132
lines changed

main/camera.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ void camera_set_debug_image(const uint8_t* data, const size_t len)
3737
// as we don't want the unit to shut down because of apparent inactivity.
3838
#define CAMERA_MIN_TIMEOUT_SECS 300
3939

40-
// Size of the image as provided by the camera - note this should be consistent
41-
// with CAMERA_IMAGE_WIDTH and CAMERA_IMAGE_HEIGHT ! TODO: fetch from Kconfig?
42-
#ifdef CONFIG_IDF_TARGET_ESP32S3
43-
#define CAMERA_IMAGE_RESOLUTION FRAMESIZE_VGA
44-
#else
40+
// Size of the image as provided by the camera
4541
#define CAMERA_IMAGE_RESOLUTION FRAMESIZE_QVGA
42+
#if (CAMERA_IMAGE_WIDTH != 320) || (CAMERA_IMAGE_HEIGHT != 240)
43+
#error CAMERA_IMAGE_WIDTH/HEIGHT inconsistent with CAMERA_IMAGE_RESOLUTION!
4644
#endif
4745

4846
#define CAM_MIN(a, b) (a < b ? a : b)
@@ -543,12 +541,7 @@ void jade_camera_process_images(camera_process_fn_t fn, void* ctx, const bool sh
543541
const UBaseType_t mem_caps = MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL;
544542
#endif
545543

546-
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(CONFIG_RETURN_CAMERA_IMAGES)
547-
const uint32_t stack_size = 18 * 1024;
548-
#else
549544
const uint32_t stack_size = 16 * 1024;
550-
#endif
551-
552545
TaskHandle_t camera_task;
553546
const BaseType_t retval = xTaskCreatePinnedToCoreWithCaps(&jade_camera_task, "jade_camera", stack_size,
554547
&camera_config, JADE_TASK_PRIO_CAMERA, &camera_task, JADE_CORE_SECONDARY, mem_caps);

main/camera.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@
88
#include <stddef.h>
99
#include <stdint.h>
1010

11-
// Size of the image as provided by the camera - note this should be consistent
12-
// with CAMERA_IMAGE_RESOLUTION ! TODO: fetch from Kconfig?
13-
#ifdef CONFIG_IDF_TARGET_ESP32S3
14-
#define CAMERA_IMAGE_WIDTH 640
15-
#define CAMERA_IMAGE_HEIGHT 480
16-
#else
11+
// Size of the image as provided by the camera
12+
// TODO: fetch from Kconfig?
1713
#define CAMERA_IMAGE_WIDTH 320
1814
#define CAMERA_IMAGE_HEIGHT 240
19-
#endif
2015

2116
// How much image (central area) is displayed on screen
2217
uint16_t camera_displayed_image_width(void);

main/process.h

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,15 @@
2121
#define MAX_INPUT_MSG_SIZE (1024 * 401)
2222
#endif
2323

24+
#ifndef CONFIG_RETURN_CAMERA_IMAGES
2425
// This should be the size of the largest valid output message.
2526
// Used by ble and serial when sending messages. (pinserver handshake)
26-
// NOTE: if CONFIG_RETURN_CAMERA_IMAGES is defined we allocate a larger
27-
// buffer as image sizes are much larger than standard messges.
28-
#define MAX_STANDARD_OUTPUT_MSG_SIZE (1024 * 3)
29-
#ifdef CONFIG_RETURN_CAMERA_IMAGES
30-
#ifdef CONFIG_IDF_TARGET_ESP32S3
31-
#define MAX_OUTPUT_MSG_SIZE (MAX_STANDARD_OUTPUT_MSG_SIZE * 100)
32-
#else
33-
#define MAX_OUTPUT_MSG_SIZE (MAX_STANDARD_OUTPUT_MSG_SIZE * 30)
34-
#endif // CONFIG_IDF_TARGET_ESP32S3
27+
#define MAX_OUTPUT_MSG_SIZE (1024 * 3)
3528
#else
36-
#define MAX_OUTPUT_MSG_SIZE MAX_STANDARD_OUTPUT_MSG_SIZE
37-
#endif // CONFIG_RETURN_CAMERA_IMAGES
29+
// When CONFIG_RETURN_CAMERA_IMAGES is defined we allocate a larger
30+
// buffer as image sizes are much larger than standard messges.
31+
#define MAX_OUTPUT_MSG_SIZE ((1024 * 3) * 30)
32+
#endif
3833

3934
// Cbor encoding function prototype
4035
typedef void (*cbor_encoder_fn_t)(const void*, CborEncoder*);

test_data/qr_vga_bcur_psbt.dat

-183 KB
Binary file not shown.

test_data/qr_vga_bcur_psbt.json

Lines changed: 0 additions & 8 deletions
This file was deleted.
-171 KB
Binary file not shown.

test_data/qr_vga_compactseedqr_vec1.json

Lines changed: 0 additions & 8 deletions
This file was deleted.
-145 KB
Binary file not shown.

test_data/qr_vga_compactseedqr_vec7.json

Lines changed: 0 additions & 8 deletions
This file was deleted.
-154 KB
Binary file not shown.

0 commit comments

Comments
 (0)