|
1 | 1 | /*
|
2 | 2 | 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 |
4 | 4 | https://www.facebook.com/francefu
|
5 | 5 |
|
6 | 6 | Motor Driver IC -> PWM1(gpio12, gpio13), PWM2(gpio14, gpio15)
|
@@ -46,6 +46,7 @@ http://192.168.4.1/?decelerate=value //vale= 0~100
|
46 | 46 | 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)
|
47 | 47 | http://192.168.4.1/?getstill //base64
|
48 | 48 | 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 |
49 | 50 | http://192.168.4.1/?sendCapturedImageToLineNotify=token
|
50 | 51 |
|
51 | 52 | STAIP:
|
@@ -126,7 +127,9 @@ void ExecuteCommand()
|
126 | 127 | Feedback="{\"data\":\""+WiFi.macAddress()+"\"}";
|
127 | 128 | }
|
128 | 129 | else if (cmd=="restart") {
|
129 |
| - ESP.restart(); |
| 130 | + setup(); |
| 131 | + Feedback="{\"data\":\""+Command+"\"}"; |
| 132 | + //ESP.restart(); |
130 | 133 | }
|
131 | 134 | else if (cmd=="resetwifi") {
|
132 | 135 | WiFi.begin(P1.c_str(), P2.c_str());
|
@@ -420,7 +423,21 @@ void ExecuteCommand()
|
420 | 423 | Feedback=Feedback="{\"data\":\"\<img id=\'getstill\' src=\'"+getstill()+"\'\>\"}";
|
421 | 424 | else
|
422 | 425 | 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 | + } |
424 | 441 | else if (cmd=="sendCapturedImageToLineNotify") {
|
425 | 442 | Feedback=sendCapturedImageToLineNotify(P1);
|
426 | 443 | Feedback="{\"data\":\""+Feedback+"\"}";
|
@@ -460,15 +477,15 @@ void setup() {
|
460 | 477 | config.pixel_format = PIXFORMAT_JPEG;
|
461 | 478 | //init with high specs to pre-allocate larger buffers
|
462 | 479 | if(psramFound()){
|
463 |
| - config.frame_size = FRAMESIZE_QVGA; |
| 480 | + config.frame_size = FRAMESIZE_UXGA; |
464 | 481 | config.jpeg_quality = 10;
|
465 | 482 | config.fb_count = 2;
|
466 | 483 | } else {
|
467 |
| - config.frame_size = FRAMESIZE_QVGA; |
| 484 | + config.frame_size = FRAMESIZE_SVGA; |
468 | 485 | config.jpeg_quality = 12;
|
469 | 486 | config.fb_count = 1;
|
470 | 487 | }
|
471 |
| - |
| 488 | + |
472 | 489 | // camera init
|
473 | 490 | esp_err_t err = esp_camera_init(&config);
|
474 | 491 | if (err != ESP_OK) {
|
|
0 commit comments