Skip to content

Commit c3a6795

Browse files
authored
Add files via upload
1 parent 3c1617e commit c3a6795

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

ESP32-CAM_MyBlockly_JSON/ESP32-CAM_MyBlockly_JSON.ino

+23-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
ESP32-CAM MyBlockly
3-
Author : ChungYi Fu (Kaohsiung, Taiwan) 2019-12-01 22:30
3+
Author : ChungYi Fu (Kaohsiung, Taiwan) 2019-12-02 21:00
44
https://www.facebook.com/francefu
55
66
Motor Driver IC -> PWM1(gpio12, gpio13), PWM2(gpio14, gpio15)
@@ -46,6 +46,7 @@ http://192.168.4.1/?decelerate=value //vale= 0~100
4646
http://192.168.4.1/?car=state //state= 1(Front),2(Left),3(Stop),4(Right),5(Back),6(FrontLeft),7(FrontRight),8(LeftAfter),9(RightAfter)
4747
http://192.168.4.1/?getstill //base64
4848
http://192.168.4.1/?getstill=img //<img id='getstill' src='base64'>
49+
http://192.168.4.1/?framesize=size //size= CIF,QVGA,HQVGA,QQVGA
4950
http://192.168.4.1/?sendCapturedImageToLineNotify=token
5051
5152
STAIP:
@@ -126,7 +127,9 @@ void ExecuteCommand()
126127
Feedback="{\"data\":\""+WiFi.macAddress()+"\"}";
127128
}
128129
else if (cmd=="restart") {
129-
ESP.restart();
130+
setup();
131+
Feedback="{\"data\":\""+Command+"\"}";
132+
//ESP.restart();
130133
}
131134
else if (cmd=="resetwifi") {
132135
WiFi.begin(P1.c_str(), P2.c_str());
@@ -420,7 +423,21 @@ void ExecuteCommand()
420423
Feedback=Feedback="{\"data\":\"\<img id=\'getstill\' src=\'"+getstill()+"\'\>\"}";
421424
else
422425
Feedback=Feedback="{\"data\":\""+getstill()+"\"}";
423-
}
426+
}
427+
else if (cmd=="framesize") {
428+
sensor_t * s = esp_camera_sensor_get();
429+
if (P1=="QQVGA")
430+
s->set_framesize(s, FRAMESIZE_QQVGA);
431+
else if (P1=="HQVGA")
432+
s->set_framesize(s, FRAMESIZE_HQVGA);
433+
else if (P1=="QVGA")
434+
s->set_framesize(s, FRAMESIZE_QVGA);
435+
else if (P1=="CIF")
436+
s->set_framesize(s, FRAMESIZE_CIF);
437+
else
438+
s->set_framesize(s, FRAMESIZE_QVGA);
439+
Feedback="{\"data\":\""+P1+"\"}";
440+
}
424441
else if (cmd=="sendCapturedImageToLineNotify") {
425442
Feedback=sendCapturedImageToLineNotify(P1);
426443
Feedback="{\"data\":\""+Feedback+"\"}";
@@ -460,15 +477,15 @@ void setup() {
460477
config.pixel_format = PIXFORMAT_JPEG;
461478
//init with high specs to pre-allocate larger buffers
462479
if(psramFound()){
463-
config.frame_size = FRAMESIZE_QVGA;
480+
config.frame_size = FRAMESIZE_UXGA;
464481
config.jpeg_quality = 10;
465482
config.fb_count = 2;
466483
} else {
467-
config.frame_size = FRAMESIZE_QVGA;
484+
config.frame_size = FRAMESIZE_SVGA;
468485
config.jpeg_quality = 12;
469486
config.fb_count = 1;
470487
}
471-
488+
472489
// camera init
473490
esp_err_t err = esp_camera_init(&config);
474491
if (err != ESP_OK) {

0 commit comments

Comments
 (0)