Merge pull request #41 from rzeldent/feature/cam_settings_names

Updated names settings
This commit is contained in:
rzeldent
2023-02-09 20:39:44 +01:00
committed by GitHub
6 changed files with 43 additions and 41 deletions

View File

@@ -31,7 +31,7 @@ This software provides a **configuration web server**, that can be used to:
- Select the frame rate,
- Select number of frame buffers
- Select the JPEG quality
- Configure the camera options
- Configure the camera options:
- Brightness
- Contrast
- Saturation
@@ -40,19 +40,19 @@ This software provides a **configuration web server**, that can be used to:
- Automatic White Balance gain
- Wite Balance mode
- Exposure control
- AEC2
- AE level
- AEC value
- Auto Exposure (dsp)
- Auto Exposure level
- Manual exposure value
- Gain control
- AGC gain
- Gain ceiling
- BPC
- WPC
- Raw gamma
- Manual gain control
- Auto gain ceiling
- Black pixel correction
- White pixel correction
- Gamma correction
- Lens correction
- Horizontal mirror
- Vertical flip
- DCW
- Downside enable
- Color bar
The software provides contains also a mDNS server to be easily discoverable on the local network.

View File

@@ -193,15 +193,15 @@
<div class="col-8">{{ExposureCtrl}}</div>
</div>
<div class="row">
<div class="col-4">AEC2:</div>
<div class="col-4">Auto exposure control (dsp):</div>
<div class="col-8">{{Aec2}}</div>
</div>
<div class="row">
<div class="col-4">AE level:</div>
<div class="col-4">Auto Exposure level:</div>
<div class="col-8">{{AeLevel}}</div>
</div>
<div class="row">
<div class="col-4">AEC value:</div>
<div class="col-4">Manual exposure value:</div>
<div class="col-8">{{AecValue}}</div>
</div>
<div class="row">
@@ -217,15 +217,15 @@
<div class="col-8">{{GainCeiling}}</div>
</div>
<div class="row">
<div class="col-4">BPC:</div>
<div class="col-4">Black pixel correct:</div>
<div class="col-8">{{Bpc}}</div>
</div>
<div class="row">
<div class="col-4">WPC:</div>
<div class="col-4">White pixel correct:</div>
<div class="col-8">{{Wpc}}</div>
</div>
<div class="row">
<div class="col-4">Raw gamma:</div>
<div class="col-4">Gamma correct:</div>
<div class="col-8">{{RawGma}}</div>
</div>
<div class="row">
@@ -241,7 +241,7 @@
<div class="col-8">{{VFlip}}</div>
</div>
<div class="row">
<div class="col-4">DCW:</div>
<div class="col-4">Downsize enable:</div>
<div class="col-8">{{Dcw}}</div>
</div>
<div class="row">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -12,10 +12,9 @@
#define RTSP_PORT 554
#define DEFAULT_CAMERA_CONFIG "AI THINKER"
#define DEFAULT_FRAME_DURATION 20
#define DEFAULT_FRAME_BUFFERS 2
#define DEFAULT_FRAME_SIZE "SVGA (800x600)"
#define DEFAULT_JPEG_QUALITY 12
#define DEFAULT_FRAME_DURATION 100
#define DEFAULT_FRAME_SIZE (psramFound() ? "UXGA (1600x1200)" : "VGA (640x480)")
#define DEFAULT_JPEG_QUALITY (psramFound() ? 10 : 12)
#define DEFAULT_BRIGHTNESS 0
#define DEFAULT_CONTRAST 0

View File

@@ -24,7 +24,6 @@ auto param_board = iotwebconf::Builder<iotwebconf::SelectTParameter<sizeof(camer
auto param_group_camera = iotwebconf::ParameterGroup("camera", "Camera settings");
auto param_frame_duration = iotwebconf::Builder<iotwebconf::UIntTParameter<unsigned long>>("fd").label("Frame duration (ms)").defaultValue(DEFAULT_FRAME_DURATION).min(10).build();
auto param_frame_size = iotwebconf::Builder<iotwebconf::SelectTParameter<sizeof(frame_sizes[0])>>("fs").label("Frame size").optionValues((const char *)&frame_sizes).optionNames((const char *)&frame_sizes).optionCount(sizeof(frame_sizes) / sizeof(frame_sizes[0])).nameLength(sizeof(frame_sizes[0])).defaultValue(DEFAULT_FRAME_SIZE).build();
auto param_frame_buffers = iotwebconf::Builder<iotwebconf::UIntTParameter<byte>>("fb").label("Frame buffers").defaultValue(DEFAULT_FRAME_BUFFERS).min(1).max(16).build();
auto param_jpg_quality = iotwebconf::Builder<iotwebconf::UIntTParameter<byte>>("q").label("JPG quality").defaultValue(DEFAULT_JPEG_QUALITY).min(1).max(100).build();
auto param_brightness = iotwebconf::Builder<iotwebconf::IntTParameter<int>>("b").label("Brightness").defaultValue(DEFAULT_BRIGHTNESS).min(-2).max(2).build();
auto param_contrast = iotwebconf::Builder<iotwebconf::IntTParameter<int>>("c").label("Contrast").defaultValue(DEFAULT_CONTRAST).min(-2).max(2).build();
@@ -34,19 +33,19 @@ auto param_whitebal = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("wb").
auto param_awb_gain = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("awbg").label("Automatic white balance gain").defaultValue(DEFAULT_WHITE_BALANCE_GAIN).build();
auto param_wb_mode = iotwebconf::Builder<iotwebconf::SelectTParameter<sizeof(camera_wb_modes[0])>>("wbm").label("White balance mode").optionValues((const char *)&camera_wb_modes).optionNames((const char *)&camera_wb_modes).optionCount(sizeof(camera_wb_modes) / sizeof(camera_wb_modes[0])).nameLength(sizeof(camera_wb_modes[0])).defaultValue(DEFAULT_WHITE_BALANCE_MODE).build();
auto param_exposure_ctrl = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("ec").label("Exposure control").defaultValue(DEFAULT_EXPOSURE_CONTROL).build();
auto param_aec2 = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("aec2").label("AEC2").defaultValue(DEFAULT_AEC2).build();
auto param_ae_level = iotwebconf::Builder<iotwebconf::IntTParameter<int>>("ael").label("AE level").defaultValue(DEFAULT_AE_LEVEL).min(-2).max(2).build();
auto param_aec_value = iotwebconf::Builder<iotwebconf::IntTParameter<int>>("aecv").label("AEC value").defaultValue(DEFAULT_AEC_VALUE).min(9).max(1200).build();
auto param_aec2 = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("aec2").label("Auto exposure (dsp)").defaultValue(DEFAULT_AEC2).build();
auto param_ae_level = iotwebconf::Builder<iotwebconf::IntTParameter<int>>("ael").label("Auto Exposure level").defaultValue(DEFAULT_AE_LEVEL).min(-2).max(2).build();
auto param_aec_value = iotwebconf::Builder<iotwebconf::IntTParameter<int>>("aecv").label("Manual exposure value").defaultValue(DEFAULT_AEC_VALUE).min(9).max(1200).build();
auto param_gain_ctrl = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("gc").label("Gain control").defaultValue(DEFAULT_GAIN_CONTROL).build();
auto param_agc_gain = iotwebconf::Builder<iotwebconf::IntTParameter<int>>("agcg").label("AGC gain").defaultValue(DEFAULT_AGC_GAIN).min(0).max(30).build();
auto param_gain_ceiling = iotwebconf::Builder<iotwebconf::SelectTParameter<sizeof(camera_gain_ceilings[0])>>("gcl").label("Gain ceilings").optionValues((const char *)&camera_gain_ceilings).optionNames((const char *)&camera_gain_ceilings).optionCount(sizeof(camera_gain_ceilings) / sizeof(camera_gain_ceilings[0])).nameLength(sizeof(camera_gain_ceilings[0])).defaultValue(DEFAULT_GAIN_CEILING).build();
auto param_bpc = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("bpc").label("BPC").defaultValue(DEFAULT_BPC).build();
auto param_wpc = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("wpc").label("WPC").defaultValue(DEFAULT_WPC).build();
auto param_raw_gma = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("rg").label("Raw gamma").defaultValue(DEFAULT_RAW_GAMMA).build();
auto param_gain_ceiling = iotwebconf::Builder<iotwebconf::SelectTParameter<sizeof(camera_gain_ceilings[0])>>("gcl").label("Auto Gain ceiling").optionValues((const char *)&camera_gain_ceilings).optionNames((const char *)&camera_gain_ceilings).optionCount(sizeof(camera_gain_ceilings) / sizeof(camera_gain_ceilings[0])).nameLength(sizeof(camera_gain_ceilings[0])).defaultValue(DEFAULT_GAIN_CEILING).build();
auto param_bpc = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("bpc").label("Black pixel correct").defaultValue(DEFAULT_BPC).build();
auto param_wpc = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("wpc").label("White pixel correct").defaultValue(DEFAULT_WPC).build();
auto param_raw_gma = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("rg").label("Gamma correct").defaultValue(DEFAULT_RAW_GAMMA).build();
auto param_lenc = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("lenc").label("Lens correction").defaultValue(DEFAULT_LENC).build();
auto param_hmirror = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("hm").label("Horizontal mirror").defaultValue(DEFAULT_HORIZONTAL_MIRROR).build();
auto param_vflip = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("vm").label("Vertical mirror").defaultValue(DEFAULT_VERTICAL_MIRROR).build();
auto param_dcw = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("dcw").label("DCW").defaultValue(DEFAULT_DCW).build();
auto param_dcw = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("dcw").label("Downsize enable").defaultValue(DEFAULT_DCW).build();
auto param_colorbar = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("cb").label("Colorbar").defaultValue(DEFAULT_COLORBAR).build();
auto param_group_peripheral = iotwebconf::ParameterGroup("io", "peripheral settings");
@@ -127,7 +126,7 @@ void handle_root()
{"FrameDuration", String(param_frame_duration.value())},
{"FrameFrequency", String(1000.0 / param_frame_duration.value(), 1)},
{"FrameBufferLocation", psramFound() ? "PSRAM" : "DRAM)"},
{"FrameBuffers", String(param_frame_buffers.value())},
{"FrameBuffers", String(psramFound() ? 2 : 1)},
{"JpegQuality", String(param_jpg_quality.value())},
{"CameraInitialized", String(camera_init_result == ESP_OK)},
{"CameraInitResultText", esp_err_to_name(camera_init_result)},
@@ -196,7 +195,7 @@ void handle_snapshot()
}
// Remove old images stored in the framebuffer
auto frame_buffers = param_frame_buffers.value();
auto frame_buffers = psramFound() ? 2 : 1;
while (frame_buffers--)
cam.run();
@@ -247,16 +246,21 @@ esp_err_t initialize_camera()
auto camera_config = lookup_camera_config(param_board.value());
log_i("Frame size: %s", param_frame_size.value());
auto frame_size = lookup_frame_size(param_frame_size.value());
log_i("Frame buffers: %d", param_frame_buffers.value());
// auto frame_buffers = atoi(frame_buffers_val);
log_i("JPEG quality: %d", param_jpg_quality.value());
log_i("Frame duration: %d ms", param_frame_duration.value());
camera_config.frame_size = frame_size;
camera_config.fb_count = param_frame_buffers.value();
camera_config.fb_location = psramFound() ? CAMERA_FB_IN_PSRAM : CAMERA_FB_IN_DRAM;
camera_config.jpeg_quality = param_jpg_quality.value();
if (psramFound())
{
camera_config.fb_count = 2;
camera_config.fb_location = CAMERA_FB_IN_PSRAM;
}
else
{
camera_config.fb_count = 1;
camera_config.fb_location = CAMERA_FB_IN_DRAM;
}
return cam.init(camera_config);
}
@@ -293,7 +297,7 @@ void start_rtsp_server()
camera_init_result = initialize_camera();
if (camera_init_result != ESP_OK)
{
log_e("Failed to initialize camera: 0x%0x. Type: %s, frame size: %s, frame buffers: %d, frame rate: %d ms, jpeg quality: %d", camera_init_result, param_board.value(), param_frame_size.value(), param_frame_buffers.value(), param_frame_duration.value(), param_jpg_quality.value());
log_e("Failed to initialize camera: 0x%0x. Type: %s, frame size: %s, frame rate: %d ms, jpeg quality: %d", camera_init_result, param_board.value(), param_frame_size.value(), param_frame_duration.value(), param_jpg_quality.value());
return;
}
@@ -357,7 +361,6 @@ void setup()
param_group_camera.addItem(&param_frame_duration);
param_group_camera.addItem(&param_frame_size);
param_group_camera.addItem(&param_frame_buffers);
param_group_camera.addItem(&param_jpg_quality);
param_group_camera.addItem(&param_brightness);
param_group_camera.addItem(&param_contrast);