speed 460800, commands bright, satur, contr
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -3,3 +3,7 @@
|
|||||||
.vscode/c_cpp_properties.json
|
.vscode/c_cpp_properties.json
|
||||||
.vscode/launch.json
|
.vscode/launch.json
|
||||||
.vscode/ipch
|
.vscode/ipch
|
||||||
|
src/.vscode/c_cpp_properties.json
|
||||||
|
.vscode/extensions.json
|
||||||
|
.vscode/extensions.json
|
||||||
|
platformio.ini
|
||||||
|
|||||||
@@ -14,5 +14,7 @@ board = esp32cam
|
|||||||
framework = arduino
|
framework = arduino
|
||||||
monitor_port = COM[13678]
|
monitor_port = COM[13678]
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
monitor_rts = 0
|
||||||
|
monitor_dtr = 0
|
||||||
lib_deps =
|
lib_deps =
|
||||||
enviromonitor/BME280_Light@0.0.0-alpha+sha.600667f3a6
|
enviromonitor/BME280_Light@0.0.0-alpha+sha.600667f3a6
|
||||||
|
|||||||
79
src/main.cpp
79
src/main.cpp
@@ -64,11 +64,15 @@ void reboot_esp32(char *aLine)
|
|||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
void recv_ymodem(char *aLine)
|
void set_speed(char *aLine)
|
||||||
{
|
{
|
||||||
xmodem.sendFile(fb->buf, fb->len, "camera.jpg");
|
char *cmd = strtok(aLine, " \t");
|
||||||
|
char *speed = strtok(NULL," \t");
|
||||||
|
Serial.updateBaudRate(strtoul(speed,nullptr,10));
|
||||||
|
Serial.print("[OK] SETTING SPEED");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void capture_image(char *aLine)
|
void capture_image(char *aLine)
|
||||||
{
|
{
|
||||||
fb = esp_camera_fb_get();
|
fb = esp_camera_fb_get();
|
||||||
@@ -81,6 +85,13 @@ void free_image(char *aLine)
|
|||||||
Serial.println("[OK] FREE CAPTURED IMAGE");
|
Serial.println("[OK] FREE CAPTURED IMAGE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void recv_ymodem(char *aLine)
|
||||||
|
{
|
||||||
|
xmodem.sendFile(fb->buf, fb->len, "camera.jpg");
|
||||||
|
Serial.println("[OK] SEND IMAGE");
|
||||||
|
free_image(aLine);
|
||||||
|
}
|
||||||
|
|
||||||
void print_measurement(char *aLine)
|
void print_measurement(char *aLine)
|
||||||
{
|
{
|
||||||
BMESensor.refresh(); // read current sensor dat
|
BMESensor.refresh(); // read current sensor dat
|
||||||
@@ -88,9 +99,40 @@ void print_measurement(char *aLine)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_brightness(char *aLine)
|
||||||
|
{
|
||||||
|
char *cmd = strtok(aLine, " \t");
|
||||||
|
char *str = strtok(NULL," \t");
|
||||||
|
sensor_t * s = esp_camera_sensor_get();
|
||||||
|
s->set_brightness(s, strtol(str,nullptr,10)); // -2 to 2
|
||||||
|
Serial.print("[OK] SETTING BRIGHTNESS");
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_saturation(char *aLine)
|
||||||
|
{
|
||||||
|
char *cmd = strtok(aLine, " \t");
|
||||||
|
char *str = strtok(NULL," \t");
|
||||||
|
sensor_t * s = esp_camera_sensor_get();
|
||||||
|
s->set_saturation(s, strtol(str,nullptr,10)); // -2 to 2
|
||||||
|
Serial.print("[OK] SETTING SATURATION");
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_contrast(char *aLine)
|
||||||
|
{
|
||||||
|
char *cmd = strtok(aLine, " \t");
|
||||||
|
char *str = strtok(NULL," \t");
|
||||||
|
sensor_t * s = esp_camera_sensor_get();
|
||||||
|
s->set_contrast(s, strtol(str,nullptr,10)); // -2 to 2
|
||||||
|
Serial.print("[OK] SETTING CONTRAST");
|
||||||
|
}
|
||||||
|
|
||||||
const command_action_t commands[] = {
|
const command_action_t commands[] = {
|
||||||
// Name of command user types, function that implements the command.
|
// Name of command user types, function that implements the command.
|
||||||
{"reboot", reboot_esp32},
|
{"reboot", reboot_esp32},
|
||||||
|
{"bright",set_brightness},
|
||||||
|
{"satur",set_saturation},
|
||||||
|
{"contr",set_contrast},
|
||||||
|
{"speed", set_speed},
|
||||||
{"capture", capture_image},
|
{"capture", capture_image},
|
||||||
{"free", free_image},
|
{"free", free_image},
|
||||||
{"measure", print_measurement},
|
{"measure", print_measurement},
|
||||||
@@ -126,7 +168,7 @@ void execute(char *aLine) {
|
|||||||
void setup() {
|
void setup() {
|
||||||
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector
|
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(460800);
|
||||||
while (!Serial) {
|
while (!Serial) {
|
||||||
; // wait for serial port to connect. Needed for Leonardo only
|
; // wait for serial port to connect. Needed for Leonardo only
|
||||||
}
|
}
|
||||||
@@ -155,11 +197,11 @@ camera_config_t config;
|
|||||||
|
|
||||||
if(psramFound()){
|
if(psramFound()){
|
||||||
config.frame_size = FRAMESIZE_UXGA; // FRAMESIZE_ + QVGA|CIF|VGA|SVGA|XGA|SXGA|UXGA
|
config.frame_size = FRAMESIZE_UXGA; // FRAMESIZE_ + QVGA|CIF|VGA|SVGA|XGA|SXGA|UXGA
|
||||||
config.jpeg_quality = 10;
|
config.jpeg_quality = 7;
|
||||||
config.fb_count = 2;
|
config.fb_count = 2;
|
||||||
} else {
|
} else {
|
||||||
config.frame_size = FRAMESIZE_SVGA;
|
config.frame_size = FRAMESIZE_SVGA;
|
||||||
config.jpeg_quality = 12;
|
config.jpeg_quality = 10;
|
||||||
config.fb_count = 1;
|
config.fb_count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +212,31 @@ camera_config_t config;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sensor_t * s = esp_camera_sensor_get();
|
||||||
|
s->set_brightness(s, 0); // -2 to 2
|
||||||
|
s->set_contrast(s, 0); // -2 to 2
|
||||||
|
s->set_saturation(s, 0); // -2 to 2
|
||||||
|
s->set_special_effect(s, 0); // 0 to 6 (0 - No Effect, 1 - Negative, 2 - Grayscale, 3 - Red Tint, 4 - Green Tint, 5 - Blue Tint, 6 - Sepia)
|
||||||
|
s->set_whitebal(s, 1); // 0 = disable , 1 = enable
|
||||||
|
s->set_awb_gain(s, 1); // 0 = disable , 1 = enable
|
||||||
|
s->set_wb_mode(s, 0); // 0 to 4 - if awb_gain enabled (0 - Auto, 1 - Sunny, 2 - Cloudy, 3 - Office, 4 - Home)
|
||||||
|
s->set_exposure_ctrl(s, 1); // 0 = disable , 1 = enable
|
||||||
|
s->set_aec2(s, 0); // 0 = disable , 1 = enable
|
||||||
|
s->set_ae_level(s, 0); // -2 to 2
|
||||||
|
s->set_aec_value(s, 300); // 0 to 1200
|
||||||
|
s->set_gain_ctrl(s, 1); // 0 = disable , 1 = enable
|
||||||
|
s->set_agc_gain(s, 0); // 0 to 30
|
||||||
|
s->set_gainceiling(s, (gainceiling_t)0); // 0 to 6
|
||||||
|
s->set_bpc(s, 0); // 0 = disable , 1 = enable
|
||||||
|
s->set_wpc(s, 1); // 0 = disable , 1 = enable
|
||||||
|
s->set_raw_gma(s, 1); // 0 = disable , 1 = enable
|
||||||
|
s->set_lenc(s, 1); // 0 = disable , 1 = enable
|
||||||
|
s->set_hmirror(s, 0); // 0 = disable , 1 = enable
|
||||||
|
s->set_vflip(s, 0); // 0 = disable , 1 = enable
|
||||||
|
s->set_dcw(s, 1); // 0 = disable , 1 = enable
|
||||||
|
s->set_colorbar(s, 0); // 0 = disable , 1 = enable
|
||||||
|
|
||||||
|
|
||||||
// Take Picture with Camera
|
// Take Picture with Camera
|
||||||
fb = esp_camera_fb_get();
|
fb = esp_camera_fb_get();
|
||||||
if(!fb) {
|
if(!fb) {
|
||||||
@@ -182,6 +249,8 @@ camera_config_t config;
|
|||||||
|
|
||||||
BMESensor.begin();
|
BMESensor.begin();
|
||||||
|
|
||||||
|
print_commands("");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t bytesIn;
|
uint8_t bytesIn;
|
||||||
|
|||||||
Reference in New Issue
Block a user