- Changed order cards in HTML

- Optimization lookups
This commit is contained in:
Rene Zeldenthuis
2023-02-09 00:51:37 +01:00
parent 2739ed4953
commit 276b0d4230
7 changed files with 24 additions and 31 deletions

File diff suppressed because one or more lines are too long

View File

@@ -3,10 +3,9 @@
#include <string.h>
#include <esp_camera.h>
typedef char camera_config_name_t[11];
typedef struct
{
const camera_config_name_t name;
const char name[11];
const camera_config_t config;
} camera_config_entry_t;
@@ -146,9 +145,8 @@ const camera_config_t lookup_camera_config(const char *name)
{
// Lookup table for the frame name to framesize_t
for (const auto &entry : camera_configs)
if (strncmp(entry.name, name, sizeof(camera_config_name_t)) == 0)
if (strncmp(entry.name, name, sizeof(entry.name)) == 0)
return entry.config;
return camera_config_t{};
}

View File

@@ -2,10 +2,9 @@
#include <string.h>
typedef char camera_effect_name_t[11];
typedef struct
{
const camera_effect_name_t name;
const char name[11];
const int value;
} camera_effect_entry_t;
@@ -22,7 +21,7 @@ const int lookup_camera_effect(const char *name)
{
// Lookup table for the frame name to framesize_t
for (const auto &entry : camera_effects)
if (strncmp(entry.name, name, sizeof(camera_effect_entry_t)) == 0)
if (strncmp(entry.name, name, sizeof(entry.name)) == 0)
return entry.value;
return 0;

View File

@@ -3,11 +3,9 @@
#include <string.h>
#include <sensor.h>
typedef char frame_size_name_t[18];
typedef struct frame_size_entry
{
const frame_size_name_t name;
const char name[17];
const framesize_t frame_size;
} frame_size_entry_t;
@@ -30,7 +28,7 @@ const framesize_t lookup_frame_size(const char *pin)
{
// Lookup table for the frame name to framesize_t
for (const auto &entry : frame_sizes)
if (strncmp(entry.name, pin, sizeof(frame_size_name_t)) == 0)
if (strncmp(entry.name, pin, sizeof(entry.name)) == 0)
return entry.frame_size;
return FRAMESIZE_INVALID;

View File

@@ -3,10 +3,9 @@
#include <string.h>
#include <esp_camera.h>
typedef char camera_gainceiling_name_t[5];
typedef struct
{
const camera_gainceiling_name_t name;
const char name[5];
const gainceiling_t value;
} camera_gainceiling_entry_t;
@@ -23,7 +22,7 @@ const gainceiling_t lookup_camera_gainceiling(const char *name)
{
// Lookup table for the frame name to framesize_t
for (const auto &entry : camera_gain_ceilings)
if (strncmp(entry.name, name, sizeof(camera_gainceiling_entry_t)) == 0)
if (strncmp(entry.name, name, sizeof(entry.name)) == 0)
return entry.value;
return GAINCEILING_2X;

View File

@@ -2,10 +2,9 @@
#include <string.h>
typedef char camera_wb_mode_name_t[7];
typedef struct
{
const camera_wb_mode_name_t name;
const char name[7];
const int value;
} camera_wb_mode_entry_t;
@@ -20,7 +19,7 @@ const int lookup_camera_wb_mode(const char *name)
{
// Lookup table for the frame name to framesize_t
for (const auto &entry : camera_wb_modes)
if (strncmp(entry.name, name, sizeof(camera_wb_mode_entry_t)) == 0)
if (strncmp(entry.name, name, sizeof(entry.name)) == 0)
return entry.value;
return 0;