Updated serial communication and readme.md
parent
0eefd45e11
commit
079378a22c
|
|
@ -39,13 +39,18 @@ void SerialCfg::ProcessIncommingData() {
|
||||||
|
|
||||||
while (Serial.available() > 0) {
|
while (Serial.available() > 0) {
|
||||||
char incomingChar = Serial.read();
|
char incomingChar = Serial.read();
|
||||||
|
#if (CONSOLE_VERBOSE_DEBUG == true)
|
||||||
|
Serial.print("0x");
|
||||||
|
Serial.print(incomingChar, HEX);
|
||||||
|
Serial.print(" ");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (incomingChar == '\n') {
|
if ((incomingChar == '\n') || (incomingChar == '\r')) {
|
||||||
// Ak nájdeme nový riadok, spracujeme prikaz
|
if (inputBuffer.length() > 1) {
|
||||||
ParseIncommingData(inputBuffer);
|
ParseIncommingData(inputBuffer);
|
||||||
inputBuffer = ""; // Vynulujeme buffer pre ďalší príkaz
|
}
|
||||||
|
inputBuffer = "";
|
||||||
} else {
|
} else {
|
||||||
// Inak pridáme znak do bufferu
|
|
||||||
inputBuffer += incomingChar;
|
inputBuffer += incomingChar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -57,8 +62,15 @@ void SerialCfg::ProcessIncommingData() {
|
||||||
@return none
|
@return none
|
||||||
*/
|
*/
|
||||||
void SerialCfg::ParseIncommingData(String command) {
|
void SerialCfg::ParseIncommingData(String command) {
|
||||||
/* check command */
|
|
||||||
|
|
||||||
|
String lastTwoChars = command.substring(command.length() - 2);
|
||||||
|
|
||||||
|
/* remove end of line symbol */
|
||||||
|
while (!command.isEmpty() && ((command.endsWith("\r") || command.endsWith("\n")))) {
|
||||||
|
command.remove(command.length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check command */
|
||||||
if (command.startsWith("setwifissid:") && command.endsWith(";")) {
|
if (command.startsWith("setwifissid:") && command.endsWith(";")) {
|
||||||
/* remove prefix "setwifissid:" and end of command symbol ";" */
|
/* remove prefix "setwifissid:" and end of command symbol ";" */
|
||||||
wifi_ssid = command.substring(12, command.length() -1);
|
wifi_ssid = command.substring(12, command.length() -1);
|
||||||
|
|
|
||||||
24
README.md
24
README.md
|
|
@ -25,6 +25,7 @@ What we need for functionality
|
||||||
- Power supply [here](#power_supply)
|
- Power supply [here](#power_supply)
|
||||||
- Debug logs [here](#logs)
|
- Debug logs [here](#logs)
|
||||||
- Serial console configuration [here](#serial_cfg)
|
- Serial console configuration [here](#serial_cfg)
|
||||||
|
- Potential issue [here](#issue)
|
||||||
|
|
||||||
<a name="esp32"></a>
|
<a name="esp32"></a>
|
||||||
## ESP32-CAM AI-thinker board
|
## ESP32-CAM AI-thinker board
|
||||||
|
|
@ -106,7 +107,8 @@ After the initial firmware upload to the MCU, it's necessary to disable this opt
|
||||||
|
|
||||||
To upload the firmware on the MAC or Linux platform, you must use the console. First, ensure you have installed esptool for Python. You can find it on the manufacturer's website, ESPRESSIF, [here](https://docs.espressif.com/projects/esp-at/en/latest/esp32/Get_Started/Downloading_guide.html).
|
To upload the firmware on the MAC or Linux platform, you must use the console. First, ensure you have installed esptool for Python. You can find it on the manufacturer's website, ESPRESSIF, [here](https://docs.espressif.com/projects/esp-at/en/latest/esp32/Get_Started/Downloading_guide.html).
|
||||||
|
|
||||||
And command for FLASH FW is here, where **/dev/ttya0** is your serial interface for communication with the ESP32-cam board.
|
And command for FLASH FW is here, where **/dev/ttya0** is your serial interface for communication with the ESP32-cam board. This is command for first flash FW to MCU.
|
||||||
|
|
||||||
```
|
```
|
||||||
python3 -m esptool -p /dev/ttya0 -b 460800 --before default_reset --after hard_reset --chip
|
python3 -m esptool -p /dev/ttya0 -b 460800 --before default_reset --after hard_reset --chip
|
||||||
esp32 write_flash --erase-all --flash_mode dio --flash_size 4MB --flash_freq 80m 0x1000
|
esp32 write_flash --erase-all --flash_mode dio --flash_size 4MB --flash_freq 80m 0x1000
|
||||||
|
|
@ -114,6 +116,17 @@ ESP32_PrusaConnectCam_web.ino.bootloader.bin 0x8000
|
||||||
ESP32_PrusaConnectCam_web.ino.partitions.bin 0x10000 ESP32_PrusaConnectCam_web.ino.bin
|
ESP32_PrusaConnectCam_web.ino.partitions.bin 0x10000 ESP32_PrusaConnectCam_web.ino.bin
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This command contains the parameter **--eras-all**, which erases the entire flash in the MCU. So, for just updating the firmware, it is necessary to remove the parameter **--eras-all**; otherwise, the MCU configuration will also be deleted. The basic command list can be found [here](https://docs.espressif.com/projects/esptool/en/latest/esp32s3/esptool/basic-commands.html)
|
||||||
|
|
||||||
|
Here is the command for updating the firmware in the MCU without erasing the MCU configuration
|
||||||
|
|
||||||
|
```
|
||||||
|
python3 -m esptool -p /dev/ttya0 -b 460800 --before default_reset --after hard_reset --chip
|
||||||
|
esp32 write_flash --flash_mode dio --flash_size 4MB --flash_freq 80m 0x1000
|
||||||
|
ESP32_PrusaConnectCam_web.ino.bootloader.bin 0x8000
|
||||||
|
ESP32_PrusaConnectCam_web.ino.partitions.bin 0x10000 ESP32_PrusaConnectCam_web.ino.bin
|
||||||
|
```
|
||||||
|
|
||||||
Here is the partitions table:
|
Here is the partitions table:
|
||||||
|
|
||||||
| Name | Type | SubType | Offset | Size | Flags |
|
| Name | Type | SubType | Offset | Size | Flags |
|
||||||
|
|
@ -228,8 +241,8 @@ Currently is possible set the basicaly camera configuration during serial consol
|
||||||
Commands for configuration have simple syntax
|
Commands for configuration have simple syntax
|
||||||
|
|
||||||
| command | separator | variable | termination | line terminator |
|
| command | separator | variable | termination | line terminator |
|
||||||
|--------------|-----------|-----------|-------------|-----------------|
|
|--------------|-----------|-----------|-------------|--------------------------|
|
||||||
| setwifissid | : | SSID | ; | \n |
|
| setwifissid | : | SSID | ; | \n or \r or \n\r or \r\n |
|
||||||
|
|
||||||
Currently available commands are listed in the table below:
|
Currently available commands are listed in the table below:
|
||||||
|
|
||||||
|
|
@ -253,3 +266,8 @@ Standard commands sequence for camera basic settings is
|
||||||
- wificonnect;
|
- wificonnect;
|
||||||
- setauthtoken:TOKEN;
|
- setauthtoken:TOKEN;
|
||||||
- mcureboot;
|
- mcureboot;
|
||||||
|
|
||||||
|
<a name="issue"></a>
|
||||||
|
## Potential issue
|
||||||
|
|
||||||
|
- A potential issue may arise with connecting to the service AP. If the connection fails and an authentication error occurs, it is necessary to clear the FLASH memory of the processor, and FLASH FW again. This can be done either through the Arduino IDE or using official software.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue