Skip to content

Commit

Permalink
some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
cnadler86 committed Nov 4, 2024
1 parent a908b5a commit 9f99243
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 6 additions & 3 deletions examples/CameraSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@

print(f'Connected! IP: {station.ifconfig()[0]}. Open this IP in your browser')

with open("CameraSettings.html", 'r') as file:
html = file.read()

try:
with open("CameraSettings.html", 'r') as file:
html = file.read()
except Exception as e:
print("Error reading CameraSettings.html file. You might forgot to copy it from the examples folder.")
raise e
async def stream_camera(writer):
try:
cam.init()
Expand Down
10 changes: 7 additions & 3 deletions src/modcamera.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ void mp_camera_hal_construct(
self->camera_config.xclk_freq_hz = xclk_freq_hz;
}

if (fb_count > 2) {
self->camera_config.fb_count = 2;
mp_warning(NULL, "Frame buffer size limited to 2");
if (fb_count > 3) {
self->camera_config.fb_count = 3;
mp_warning(NULL, "Frame buffer size limited to 3");
} else if (fb_count < 1) {
self->camera_config.fb_count = 1;
mp_warning(NULL, "Frame buffer size must be >0. Setting it to 1");
Expand All @@ -162,6 +162,10 @@ void mp_camera_hal_init(mp_camera_obj_t *self) {
if (self->initialized) {
return;
}
if (self->camera_config.fb_count > 1 && self->camera_config.pixel_format != PIXFORMAT_JPEG) {
mp_warning(NULL, "It is recomended to use a frame buffer size of 1 for non-JPEG pixel format");
}

ESP_LOGI(TAG, "Initializing camera");
// Correct the quality before it is passed to esp32 driver and then "undo" the correction in the camera_config
int8_t api_jpeg_quality = self->camera_config.jpeg_quality;
Expand Down

0 comments on commit 9f99243

Please sign in to comment.