Bug fixes

This commit is contained in:
abratchik 2022-12-30 11:15:45 +04:00
parent 8f39567ff1
commit e1a876e97d
17 changed files with 72 additions and 65 deletions

40
API.md
View File

@ -115,14 +115,14 @@ the `<key>` parameter.
* Reboot the camera
* `http://<IP-ADDRESS>/control?var=reboot&val=0`
You can try these yourself in a browser address bar, from the commandline with `curl`
and co. or use them programatically from your scripting language of choice.
You can try these yourself in a browser address bar, from the command line with `curl`
and co. or use them programmatically from your scripting language of choice.
## ESP32CAM WebSocket API
This API is inteded for fast statefull communication between the server and the browser. You can think of a websocket as a state machine, which can be accessed and programmed from the client side, using JavaScript or any other language, which supports Webocket API.
This API is intended for fast stateful communication between the server and the browser. You can think of a websocket as a state machine, which can be accessed and programmed from the client side, using JavaScript or any other language, which supports Websocket API.
In order to use the WebSocket API, you need to open the Websocket first. The url of the websocket is always
`ws://<your-ip:your-port>/ws`. In Java Script, you simply need to add the followig lines to your page:
`ws://<your-ip:your-port>/ws`. In Java Script, you simply need to add the following lines to your page:
```
ws = new WebSocket(websocketURL);
@ -156,26 +156,26 @@ Once the `ws` object is created successfully, you can handle its events on the p
```
Once the websocket is open, you may also send commands and data to the server. Commands are sent with help of the `ws.send(command)` function where the `command` is to be a binary Uint8Array. The first byte of this
array reflects the command code while the rest of bytes can host addtional parameters of the command.
array reflects the command code while the rest of bytes can host additional parameters of the command.
The following commands are supported:
's' - starts the stream. Once the comamand is issued, the server will start pushing the frames to the client
according to the camera settings. The server will switch to the video mode.
'p' - similar to the previous command but there will be only one frame taken and pushed to the client. The
server will swicth to the photo mode.
'u' - similar to the previous two commands. The server will either start stream or take a still photo,
depending on the current mode of the server.
't' - terminates the stream. Only makes sense after 's' or 'u' commands.
'c' - tells the server that this websocket will be used for PWM control commands.
'w' - writes the PWM duty value to the pin. This command has additional parameters passed in the bytes of the
`command` array, as follows:
- 's' - starts the stream. Once the command is issued, the server will start pushing the frames to the client
according to the camera settings. The server will switch to the video mode.
- 'p' - similar to the previous command but there will be only one frame taken and pushed to the client. The
server will switch to the photo mode.
- 'u' - similar to the previous two commands. The server will either start stream or take a still photo,
depending on the current mode of the server.
- 't' - terminates the stream. Only makes sense after 's' or 'u' commands.
- 'c' - tells the server that this websocket will be used for PWM control commands.
- 'w' - writes the PWM duty value to the pin. This command has additional parameters passed in the bytes of the
`command` array, as follows:
byte0 - 'w' - code of the command
byte1 - pin number. If you use the ESP32CAM-DEV board, the available pins are usually limited to 4,
12, 13 and 33. The 4th pin is connected to the flash lamp so you can control the lamp brightness
by sending value to this pin via the websocket. Pin 33 is connected to the onboard LED. So, only
12 and 13 are the ones you can use, provided taht you also use the SD card for storage.
12 and 13 are the ones you can use, provided that you also use the SD card for storage.
if you use the internal LittleFS for storage, you may be able to use other pins otherwise
utilized by the SD card interface.
byte2 - send 1 for servo mode and 2 for any other PWM.
@ -205,10 +205,10 @@ GPIO pins used for PWM can be defined in the `/httpd.json`, in the `pwm` paramet
The `pwm` parameter is defined as a JSON array where each object of the array is a definition of one PWM.
Attributes of a pwm object are explained below:
`pin` - GPIO pin number
`frequency` - PWM frequency in Herz.
`resolution` - precision of the PWM (number of bits).
`default` - initial value of the PWM. if this attribute is not defined, 0 will be used for default.
- `pin` - GPIO pin number
- `frequency` - PWM frequency in Herz.
- `resolution` - precision of the PWM (number of bits).
- `default` - initial value of the PWM. if this attribute is not defined, 0 will be used for default.
if the `lamp` parameter in the httpd config is greater or equal to 0, the 1st element of the pwm array
will be used for definition of flash lamp PWM. In the example above, the lamp PWM is configured for pin 4

View File

@ -105,7 +105,7 @@ $(function() {
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"><a class="line" href="class_c_l_app_cam.html#a27d4c05b87660b0e04b6a8902f0f173e"> 36</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_c_l_app_cam.html#a27d4c05b87660b0e04b6a8902f0f173e">setRotation</a>(<span class="keywordtype">int</span> val) {myRotation = val;};</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"><a class="line" href="class_c_l_app_cam.html#a65918dca872c1d5bdcb0bb556451127f"> 37</a></span> <span class="keywordtype">int</span> <a class="code hl_function" href="class_c_l_app_cam.html#a65918dca872c1d5bdcb0bb556451127f">getRotation</a>() {<span class="keywordflow">return</span> myRotation;};</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> </div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="keywordtype">int</span> <a class="code hl_function" href="class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9">snapToBufer</a>();</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="keywordtype">int</span> <a class="code hl_function" href="class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9">snapToBuffer</a>();</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"><a class="line" href="class_c_l_app_cam.html#aac54409dcd9344abbbe434b237dc505f"> 40</a></span> uint8_t * <a class="code hl_function" href="class_c_l_app_cam.html#aac54409dcd9344abbbe434b237dc505f">getBuffer</a>() {<span class="keywordflow">return</span> fb-&gt;buf;};</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"><a class="line" href="class_c_l_app_cam.html#aa0f1c434be24055bab3abb459a071abd"> 41</a></span> <span class="keywordtype">size_t</span> <a class="code hl_function" href="class_c_l_app_cam.html#aa0f1c434be24055bab3abb459a071abd">getBufferSize</a>() {<span class="keywordflow">return</span> fb-&gt;len;};</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"><a class="line" href="class_c_l_app_cam.html#a1f01a309f73eb36142ab8b449c81a381"> 42</a></span> <span class="keywordtype">bool</span> <a class="code hl_function" href="class_c_l_app_cam.html#a1f01a309f73eb36142ab8b449c81a381">isJPEGinBuffer</a>() {<span class="keywordflow">return</span> fb-&gt;format == PIXFORMAT_JPEG;};</div>
@ -163,7 +163,7 @@ $(function() {
<div class="ttc" id="aclass_c_l_app_cam_html_a6581e369883546817a1edaedf4af1734"><div class="ttname"><a href="class_c_l_app_cam.html#a6581e369883546817a1edaedf4af1734">CLAppCam::setFrameRate</a></div><div class="ttdeci">void setFrameRate(int newFrameRate)</div><div class="ttdef"><b>Definition:</b> app_cam.h:31</div></div>
<div class="ttc" id="aclass_c_l_app_cam_html_a65918dca872c1d5bdcb0bb556451127f"><div class="ttname"><a href="class_c_l_app_cam.html#a65918dca872c1d5bdcb0bb556451127f">CLAppCam::getRotation</a></div><div class="ttdeci">int getRotation()</div><div class="ttdef"><b>Definition:</b> app_cam.h:37</div></div>
<div class="ttc" id="aclass_c_l_app_cam_html_a790db89fdbe6524175ad6f447b863c26"><div class="ttname"><a href="class_c_l_app_cam.html#a790db89fdbe6524175ad6f447b863c26">CLAppCam::getFrameRate</a></div><div class="ttdeci">int getFrameRate()</div><div class="ttdef"><b>Definition:</b> app_cam.h:30</div></div>
<div class="ttc" id="aclass_c_l_app_cam_html_a89a7a39bd89130cab06fd7139fc9b6d9"><div class="ttname"><a href="class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9">CLAppCam::snapToBufer</a></div><div class="ttdeci">int snapToBufer()</div><div class="ttdef"><b>Definition:</b> app_cam.cpp:202</div></div>
<div class="ttc" id="aclass_c_l_app_cam_html_a89a7a39bd89130cab06fd7139fc9b6d9"><div class="ttname"><a href="class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9">CLAppCam::snapToBuffer</a></div><div class="ttdeci">int snapToBuffer()</div><div class="ttdef"><b>Definition:</b> app_cam.cpp:202</div></div>
<div class="ttc" id="aclass_c_l_app_cam_html_a8e19e1d337c7d7406d713a42615005aa"><div class="ttname"><a href="class_c_l_app_cam.html#a8e19e1d337c7d7406d713a42615005aa">CLAppCam::getXclk</a></div><div class="ttdeci">int getXclk()</div><div class="ttdef"><b>Definition:</b> app_cam.h:34</div></div>
<div class="ttc" id="aclass_c_l_app_cam_html_a8f1da94b3efb536a15419e5983fcac81"><div class="ttname"><a href="class_c_l_app_cam.html#a8f1da94b3efb536a15419e5983fcac81">CLAppCam::stop</a></div><div class="ttdeci">int stop()</div><div class="ttdef"><b>Definition:</b> app_cam.cpp:78</div></div>
<div class="ttc" id="aclass_c_l_app_cam_html_a97ffe4ceb1fc0ae537d4e5f96cb7691e"><div class="ttname"><a href="class_c_l_app_cam.html#a97ffe4ceb1fc0ae537d4e5f96cb7691e">CLAppCam::getErr</a></div><div class="ttdeci">String getErr()</div><div class="ttdef"><b>Definition:</b> app_cam.h:28</div></div>

View File

@ -114,7 +114,7 @@ Public Member Functions</h2></td></tr>
<tr class="separator:a27d4c05b87660b0e04b6a8902f0f173e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a65918dca872c1d5bdcb0bb556451127f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_l_app_cam.html#a65918dca872c1d5bdcb0bb556451127f">getRotation</a> ()</td></tr>
<tr class="separator:a65918dca872c1d5bdcb0bb556451127f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a89a7a39bd89130cab06fd7139fc9b6d9"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9">snapToBufer</a> ()</td></tr>
<tr class="memitem:a89a7a39bd89130cab06fd7139fc9b6d9"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9">snapToBuffer</a> ()</td></tr>
<tr class="separator:a89a7a39bd89130cab06fd7139fc9b6d9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aac54409dcd9344abbbe434b237dc505f"><td class="memItemLeft" align="right" valign="top">uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_l_app_cam.html#aac54409dcd9344abbbe434b237dc505f">getBuffer</a> ()</td></tr>
<tr class="separator:aac54409dcd9344abbbe434b237dc505f"><td class="memSeparator" colspan="2">&#160;</td></tr>
@ -535,13 +535,13 @@ Additional Inherited Members</h2></td></tr>
</div>
</div>
<a id="a89a7a39bd89130cab06fd7139fc9b6d9" name="a89a7a39bd89130cab06fd7139fc9b6d9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a89a7a39bd89130cab06fd7139fc9b6d9">&#9670;&nbsp;</a></span>snapToBufer()</h2>
<h2 class="memtitle"><span class="permalink"><a href="#a89a7a39bd89130cab06fd7139fc9b6d9">&#9670;&nbsp;</a></span>snapToBuffer()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int CLAppCam::snapToBufer </td>
<td class="memname">int CLAppCam::snapToBuffer </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>

View File

@ -259,7 +259,7 @@ $(function() {
<li>setTag()&#160;:&#160;<a class="el" href="class_c_l_app_component.html#a75a706c37e31c3083c845d304e3a519b">CLAppComponent</a></li>
<li>setup()&#160;:&#160;<a class="el" href="class_e_s_p32_p_w_m.html#a2be6068904d3bec84211221148b21310">ESP32PWM</a></li>
<li>setXclk()&#160;:&#160;<a class="el" href="class_c_l_app_cam.html#a9ccd0763eb8eeb559b46e747df25d268">CLAppCam</a></li>
<li>snapToBufer()&#160;:&#160;<a class="el" href="class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9">CLAppCam</a></li>
<li>snapToBuffer()&#160;:&#160;<a class="el" href="class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9">CLAppCam</a></li>
<li>snapToStream()&#160;:&#160;<a class="el" href="class_c_l_app_httpd.html#a4e52f72c1d20cf6420e2f17b0b521da4">CLAppHttpd</a></li>
<li>ssid&#160;:&#160;<a class="el" href="struct_station.html#ad635bfe5333139b2596ace399fe5054e">Station</a></li>
<li>start()&#160;:&#160;<a class="el" href="class_c_l_app_cam.html#af277f42041c7c0a561bd8c8b087f4b3a">CLAppCam</a>, <a class="el" href="class_c_l_app_component.html#a7e64a4c55bd1f3216c507101835392b5">CLAppComponent</a>, <a class="el" href="class_c_l_app_conn.html#a75a0c8c0ab160691ecf58e3c4ad58951">CLAppConn</a>, <a class="el" href="class_c_l_app_httpd.html#aaf8a95884768b7ac3e1c04ea041ee514">CLAppHttpd</a></li>

View File

@ -248,7 +248,7 @@ $(function() {
<li>setTag()&#160;:&#160;<a class="el" href="class_c_l_app_component.html#a75a706c37e31c3083c845d304e3a519b">CLAppComponent</a></li>
<li>setup()&#160;:&#160;<a class="el" href="class_e_s_p32_p_w_m.html#a2be6068904d3bec84211221148b21310">ESP32PWM</a></li>
<li>setXclk()&#160;:&#160;<a class="el" href="class_c_l_app_cam.html#a9ccd0763eb8eeb559b46e747df25d268">CLAppCam</a></li>
<li>snapToBufer()&#160;:&#160;<a class="el" href="class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9">CLAppCam</a></li>
<li>snapToBuffer()&#160;:&#160;<a class="el" href="class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9">CLAppCam</a></li>
<li>snapToStream()&#160;:&#160;<a class="el" href="class_c_l_app_httpd.html#a4e52f72c1d20cf6420e2f17b0b521da4">CLAppHttpd</a></li>
<li>start()&#160;:&#160;<a class="el" href="class_c_l_app_cam.html#af277f42041c7c0a561bd8c8b087f4b3a">CLAppCam</a>, <a class="el" href="class_c_l_app_component.html#a7e64a4c55bd1f3216c507101835392b5">CLAppComponent</a>, <a class="el" href="class_c_l_app_conn.html#a75a0c8c0ab160691ecf58e3c4ad58951">CLAppConn</a>, <a class="el" href="class_c_l_app_httpd.html#aaf8a95884768b7ac3e1c04ea041ee514">CLAppHttpd</a></li>
<li>startOTA()&#160;:&#160;<a class="el" href="class_c_l_app_conn.html#a8d0720ee6abfd427ed8a0d109490a286">CLAppConn</a></li>

View File

@ -30,7 +30,7 @@ var searchData=
['settag_27',['setTag',['../class_c_l_app_component.html#a75a706c37e31c3083c845d304e3a519b',1,'CLAppComponent']]],
['setup_28',['setup',['../class_e_s_p32_p_w_m.html#a2be6068904d3bec84211221148b21310',1,'ESP32PWM']]],
['setxclk_29',['setXclk',['../class_c_l_app_cam.html#a9ccd0763eb8eeb559b46e747df25d268',1,'CLAppCam']]],
['snaptobufer_30',['snapToBufer',['../class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9',1,'CLAppCam']]],
['snaptobufer_30',['snapToBuffer',['../class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9',1,'CLAppCam']]],
['snaptostream_31',['snapToStream',['../class_c_l_app_httpd.html#a4e52f72c1d20cf6420e2f17b0b521da4',1,'CLAppHttpd']]],
['ssid_32',['ssid',['../struct_station.html#ad635bfe5333139b2596ace399fe5054e',1,'Station']]],
['start_33',['start',['../class_c_l_app_httpd.html#aaf8a95884768b7ac3e1c04ea041ee514',1,'CLAppHttpd::start()'],['../class_c_l_app_conn.html#a75a0c8c0ab160691ecf58e3c4ad58951',1,'CLAppConn::start()'],['../class_c_l_app_cam.html#af277f42041c7c0a561bd8c8b087f4b3a',1,'CLAppCam::start()'],['../class_c_l_app_component.html#a7e64a4c55bd1f3216c507101835392b5',1,'CLAppComponent::start()']]],

View File

@ -30,7 +30,7 @@ var searchData=
['settag_27',['setTag',['../class_c_l_app_component.html#a75a706c37e31c3083c845d304e3a519b',1,'CLAppComponent']]],
['setup_28',['setup',['../class_e_s_p32_p_w_m.html#a2be6068904d3bec84211221148b21310',1,'ESP32PWM']]],
['setxclk_29',['setXclk',['../class_c_l_app_cam.html#a9ccd0763eb8eeb559b46e747df25d268',1,'CLAppCam']]],
['snaptobufer_30',['snapToBufer',['../class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9',1,'CLAppCam']]],
['snaptobufer_30',['snapToBuffer',['../class_c_l_app_cam.html#a89a7a39bd89130cab06fd7139fc9b6d9',1,'CLAppCam']]],
['snaptostream_31',['snapToStream',['../class_c_l_app_httpd.html#a4e52f72c1d20cf6420e2f17b0b521da4',1,'CLAppHttpd']]],
['start_32',['start',['../class_c_l_app_cam.html#af277f42041c7c0a561bd8c8b087f4b3a',1,'CLAppCam::start()'],['../class_c_l_app_component.html#a7e64a4c55bd1f3216c507101835392b5',1,'CLAppComponent::start()'],['../class_c_l_app_conn.html#a75a0c8c0ab160691ecf58e3c4ad58951',1,'CLAppConn::start()'],['../class_c_l_app_httpd.html#aaf8a95884768b7ac3e1c04ea041ee514',1,'CLAppHttpd::start()']]],
['startota_33',['startOTA',['../class_c_l_app_conn.html#a8d0720ee6abfd427ed8a0d109490a286',1,'CLAppConn']]],

View File

@ -41,7 +41,7 @@ small antennas, older designs, congested airwaves and demanding users. The major
disconnects, stutters and other communication problems are simply due to 'WiFi issues'.
The AI-THINKER camera module & esp32 combination is quite susceptible to power supply
problems affecting both WiFi conctivity and Video quality; short cabling and decent
problems affecting both WiFi connectivity and Video quality; short cabling and decent
power supplies are your friend here; also well cooled cases and, if you have the time,
decoupling capacitors on the power lines.
@ -63,7 +63,7 @@ Is pretty simple, You just need jumper wires, no soldering really required, see
* The adapters **TX** line goes to the ESP32 **RX** pin
* The **GPIO0** pin of the ESP32 must be held LOW (to ground) when the unit is
powered up to allow it to enter it's programming mode. This can be done with simple
jumper cable connected at poweron, fitting a switch for this is useful if you
jumper cable connected at power on, fitting a switch for this is useful if you
will be reprogramming a lot.
* You will to supply 5v to the ESP32 in order to power it during programming; the FTDI
board alone fails to supply this sometimes. The ESP32 CAM board is very sensitive
@ -103,13 +103,13 @@ following line in the `src/app_config.h`:
Re-build the sketch and upload it to the ESP32CAM board. Also upload the data folder using the
**ESP32 Sketch Data Upload** tool, which is invoked from the `Tools` menu of Arduino IDE.
Provided that everything goes well, you shoudl be able to boot your ESP32 CAM Web Server from LittleFS.
Provided that everything goes well, you should be able to boot your ESP32 CAM Web Server from LittleFS.
### Initial configuration
If the system has not been configured yet, it will start in Access Point mode by default. The SSID
of the access point will be `esp32cam` and the password is `123456789`. if you have the Serial monitor
connected to the ESP32CAM board, you shoudl see the following messages:
connected to the ESP32CAM board, you should see the following messages:
```
No known networks found, entering AccessPoint fallback mode
@ -117,7 +117,7 @@ Setting up Access Point (channel=1)
SSID : esp32cam
Password : 123456789
IP address: 192.168.4.1
Access Point init successfull
Access Point init successful
Starting Captive Portal
OTA is disabled
mDNS responder started
@ -133,7 +133,7 @@ Switch the Access Point Mode off. The screen will change as follows:
Specify SSID and Password for your WiFi setup. This board supports only 2.4 GHz band so you will need to ensure you wifi router has this band enabled.
Set up your preffered NTP server, Time Zone, Daylight Saving Time (DST), desired host name, HTTP port.
Set up your preferred NTP server, Time Zone, Daylight Saving Time (DST), desired host name, HTTP port.
If you plan to use Over-the-Air firmware update, please ensure to specify a complex password. Do not
leave it empty or default.
@ -153,7 +153,7 @@ The system monitoring page is accessible at `http://<YOUR_IP_ADDRESS:YOUR_PORT>/
### Configuration files
The web server stores its configuraion in JSON files. The format of the files is below. If any of these
The web server stores its configuration in JSON files. The format of the files is below. If any of these
files is missing in the root folder of the storage used, default values will be loaded.
#### Network Configuration (/conn.json)
@ -247,7 +247,7 @@ cause the module to crash and reboot rather than updating if you use it.
![IDE board config](Docs/ota-board-selection.png)
Make sure you select the `Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)` partition
cheme and turn `PSRAM` on.
scheme and turn `PSRAM` on.
The first time you program (or if OTA is failing) you need to compile and upload the
code from the IDE, and when the `Connecting...` appears in the console reboot the ESP32
@ -264,7 +264,7 @@ you should see it appearing in the `network ports` list of the IDE, and you can
wirelessly.
If you have a status LED configured it will give a double flash when it begins
attempting to conenct to WiFi, and five short flashes once it has succeeded. It will
attempting to connect to WiFi, and five short flashes once it has succeeded. It will
also flash briefly when you access the camera to change settings.

View File

@ -1,8 +1,8 @@
{ "mdns_name":"esp32cam",
"dhcp":true,
"http_port":80,
"ota_enabled":true,
"ota_password":"",
"ota_enabled":false,
"ota_password":"changeit!",
"ap_ssid":"esp32cam",
"ap_pass":"123456789",
"ap_ip": {"ip":"192.168.4.1", "netmask":"255.255.255.0"},

View File

@ -51,14 +51,6 @@ const selectOptions = [{"field": "framesize",
{"id": 13, "name": "UXGA 4:3 (1600x1200)"},
{"id": 14, "name": "FHD 16:9 (1920x1080)"},
{"id": 17, "name": "QXGA 4:3 (2048x1536)"}]},
{"field": "frame_rate",
"options": [{"id": 60, "name": "60 fps"},
{"id": 50, "name": "50 fps"},
{"id": 30, "name": "30 fps"},
{"id": 25, "name": "25 fps"},
{"id": 24, "name": "24 fps"},
{"id": 20, "name": "20 fps"},
{"id": 12, "name": "12 fps"}]},
{"field": "special_effect",
"options": [{"id": 0, "name": "No Effect"},
{"id": 1, "name": "Negative"},
@ -101,8 +93,10 @@ var cameraFormFields = [{"id": "lamp", "name": "Light", "control": "range",
"title":"Camera resolution",
"classes": "default-action",
"simple":"true"},
{"id": "frame_rate", "name": "Frame Rate", "control": "select",
{"id": "frame_rate", "name": "Frame Rate", "control": "text", "type": "number",
"title":"Frame rate&#013;Use this for a smoother stream and to reduce load on the WiFi and browser",
"min_value":"2", "max_value":"60", "default_value": "25",
"max_caption": "FPS",
"classes": "default-action",
"simple":"true"},
{"id": "quality", "name": "Quality", "control": "range",

View File

@ -62,7 +62,7 @@ void setup() {
}
else {
// Flash the LED to show we are connected
notifyConect();
notifyConnect();
}
}
@ -114,7 +114,7 @@ void loop() {
//attempt to reconnect
if(AppConn.start() == WL_CONNECTED) {
notifyConect();
notifyConnect();
}
}
@ -153,7 +153,7 @@ void handleSerial() {
}
}
void notifyConect() {
void notifyConnect() {
for (int i = 0; i < 5; i++) {
flashLED(150);
delay(50);

View File

@ -199,7 +199,7 @@ int CLAppCam::savePrefs(){
}
int CLAppCam::snapToBufer() {
int CLAppCam::snapToBuffer() {
fb = esp_camera_fb_get();
return (fb?ESP_OK:ESP_FAIL);

View File

@ -36,7 +36,7 @@ class CLAppCam : public CLAppComponent {
void setRotation(int val) {myRotation = val;};
int getRotation() {return myRotation;};
int snapToBufer();
int snapToBuffer();
uint8_t * getBuffer() {return fb->buf;};
size_t getBufferSize() {return fb->len;};
bool isJPEGinBuffer() {return fb->format == PIXFORMAT_JPEG;};

View File

@ -142,7 +142,7 @@ int CLAppConn::start() {
}
ap_status = WL_CONNECTED;
Serial.println("Access Point init successfull");
Serial.println("Access Point init successful");
// Start the DNS captive portal if requested
if (ap_dhcp) {

View File

@ -114,7 +114,7 @@ class CLAppConn : public CLAppComponent {
char ssid[64];
char password[64];
char mdnsName[20];
char mdnsName[20]="";
bool accesspoint = false;
char apName[20];
@ -144,7 +144,7 @@ class CLAppConn : public CLAppComponent {
char otaPassword[20] = "";
// NTP parameters
char ntpServer[20];
char ntpServer[20] = "";
long gmtOffset_sec;
int daylightOffset_sec;

View File

@ -175,7 +175,7 @@ int CLAppHttpd::snapToStream(bool debug) {
if(!stream_client) return ESP_FAIL;
int res = AppCam.snapToBufer();
int res = AppCam.snapToBuffer();
if(!res) {
@ -185,7 +185,7 @@ int CLAppHttpd::snapToStream(bool debug) {
Serial.print("JPG: "); Serial.print(AppCam.getBufferSize());
}
} else {
// camera failed to aquire frame
// camera failed to acquire frame
if(debug)
Serial.println("Capture Error: Non-JPEG image returned by camera module");
res = OS_FAIL;
@ -211,11 +211,16 @@ int CLAppHttpd::startStream(uint32_t id) {
xTimerStop(snap_timer, 100);
if(streammode == CAPTURE_STREAM) {
if(autoLamp){
setLamp();
delay(75); // coupled with the status led flash this gives ~150ms for lamp to settle.
}
Serial.print("Stream start, frame period = "); Serial.println(xTimerGetPeriod(snap_timer));
xTimerStart(snap_timer, 0);
streamCount=1;
}
else if(streammode == CAPTURE_STILL) {
Serial.println("Still image requested");
@ -246,6 +251,8 @@ int CLAppHttpd::startStream(uint32_t id) {
int CLAppHttpd::stopStream(uint32_t id) {
if(autoLamp) setLamp(0);
if(!snap_timer)
return OS_FAIL;
@ -377,6 +384,9 @@ void onControl(AsyncWebServerRequest *request) {
else if(variable == "lamp" && AppHttpd.getLamp() != -1) {
AppHttpd.setLamp(constrain(val,0,100));
}
else if(variable == "flashlamp" && AppHttpd.getLamp() != -1) {
AppHttpd.setFlashLamp(constrain(val,0,100));
}
else if(variable == "accesspoint") AppConn.setAccessPoint(val);
else if(variable == "ap_channel") AppConn.setAPChannel(val);
else if(variable == "ap_dhcp") AppConn.setAPDHCP(val);
@ -503,9 +513,9 @@ void dumpSystemStatusToJson(char * buf, size_t size) {
buf += sprintf(buf,"\"captiveportal\":%s,", (AppConn.isCaptivePortal()?"true":"false"));
buf += sprintf(buf,"\"ap_name\":\"%s\",", AppConn.getApName());
buf += sprintf(buf,"\"ssid\":\"%s\",", AppConn.getSSID());
buf += sprintf(buf,"\"rssi\":%i,", WiFi.RSSI());
String bssid = WiFi.BSSIDstr();
buf += sprintf(buf,"\"bssid\":\"%s\",", bssid.c_str());
buf += sprintf(buf,"\"rssi\":%i,", (!AppConn.isAccessPoint()?WiFi.RSSI():0));
buf += sprintf(buf,"\"bssid\":\"%s\",", (!AppConn.isAccessPoint()?WiFi.BSSIDstr().c_str():""));
buf += sprintf(buf,"\"dhcp\":%i,", (AppConn.isDHCPEnabled()? 1:0 ));
buf += sprintf(buf,"\"ip_address\":\"%s\",", (AppConn.isAccessPoint()?WiFi.softAPIP().toString():WiFi.localIP().toString()));
buf += sprintf(buf,"\"subnet\":\"%s\",", (!AppConn.isAccessPoint()?WiFi.subnetMask().toString():""));
@ -525,7 +535,7 @@ void dumpSystemStatusToJson(char * buf, size_t size) {
byte mac[6];
WiFi.macAddress(mac);
buf += sprintf(buf,"\"mac_address\":\"%02X:%02X:%02X:%02X:%02X:%02X\",", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
buf += sprintf(buf,"\"local_time\":\"%s\",", AppConn.getLocalTimeStr());
buf += sprintf(buf,"\"local_time\":\"%s\",", (!AppConn.isAccessPoint()?AppConn.getLocalTimeStr():""));
buf += sprintf(buf,"\"up_time\":\"%s\",", AppConn.getUpTimeStr());
buf += sprintf(buf,"\"ntp_server\":\"%s\",", AppConn.getNTPServer());
buf += sprintf(buf,"\"gmt_offset\":%li,", AppConn.getGmtOffset_sec());
@ -640,6 +650,8 @@ int CLAppHttpd::savePrefs() {
json_gen_str_start(&jstr, buf, sizeof(buf), NULL, NULL);
json_gen_start_object(&jstr);
json_gen_obj_set_string(&jstr, (char*)"my_name", myName);
json_gen_obj_set_int(&jstr, (char*)"lamp", lampVal);
json_gen_obj_set_bool(&jstr, (char*)"autolamp", autoLamp);
json_gen_obj_set_int(&jstr, (char*)"flashlamp", flashLamp);

View File

@ -98,6 +98,7 @@ class CLAppHttpd : public CLAppComponent {
void setAutoLamp(bool val) {autoLamp = val;};
bool isAutoLamp() { return autoLamp;};
int getFlashLamp() {return flashLamp;};
void setFlashLamp(int newVal) {flashLamp = newVal;};
void setLamp(int newVal = DEFAULT_FLASH);
int getLamp() {return lampVal;};
@ -141,9 +142,9 @@ class CLAppHttpd : public CLAppComponent {
// Name of the application used in web interface
// Can be re-defined in the httpd.json file
char myName[20] = CAM_NAME;
char myName[32] = CAM_NAME;
char serialBuffer[64];
char serialBuffer[64]="";
AsyncWebServer *server;
AsyncWebSocket *ws;