mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 12:36:52 +03:00
Merge pull request #1220 from jomjol/various-improvements
Various improvements
This commit is contained in:
@@ -18,16 +18,14 @@ platformio run --environment esp32cam
|
||||
|
||||
### Upload
|
||||
```
|
||||
pio run --target upload
|
||||
pio run --target upload --upload-port /dev/ttyUSB0
|
||||
```
|
||||
|
||||
If it doesnt find the device:
|
||||
1. make sure it is in bootloader mode
|
||||
1. set the UART device correctly: In `platformio.ini`, set `upload_port` correctly, eg. `upload_port = /dev/ttyUSB0`
|
||||
Alternatively you also can set the UART device in `platformio.ini`, eg. `upload_port = /dev/ttyUSB0`
|
||||
|
||||
### Monitor UART Log
|
||||
```
|
||||
pio device monitor
|
||||
pio device monitor -p /dev/ttyUSB0
|
||||
```
|
||||
|
||||
## Build and Flash with Visual Code IDE
|
||||
|
||||
@@ -723,3 +723,35 @@ string RundeOutput(double _in, int _anzNachkomma)
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
|
||||
string getMac(void) {
|
||||
uint8_t macInt[6];
|
||||
char macFormated[6*2 + 5 + 1]; // AA:BB:CC:DD:EE:FF
|
||||
|
||||
esp_read_mac(macInt, ESP_MAC_WIFI_STA);
|
||||
sprintf(macFormated, "%02X:%02X:%02X:%02X:%02X:%02X", macInt[0], macInt[1], macInt[2], macInt[3], macInt[4], macInt[5]);
|
||||
|
||||
return macFormated;
|
||||
}
|
||||
|
||||
string getResetReason(void) {
|
||||
std::string reasonText;
|
||||
|
||||
switch(esp_reset_reason()) {
|
||||
case ESP_RST_POWERON: reasonText = "Power-on event"; break; //!< Reset due to power-on event
|
||||
case ESP_RST_EXT: reasonText = "External pin"; break; //!< Reset by external pin (not applicable for ESP32)
|
||||
case ESP_RST_SW: reasonText = "Via esp_restart"; break; //!< Software reset via esp_restart
|
||||
case ESP_RST_PANIC: reasonText = "Exception/panic"; break; //!< Software reset due to exception/panic
|
||||
case ESP_RST_INT_WDT: reasonText = "Interrupt watchdog"; break; //!< Reset (software or hardware) due to interrupt watchdog
|
||||
case ESP_RST_TASK_WDT: reasonText = "Task watchdog"; break; //!< Reset due to task watchdog
|
||||
case ESP_RST_WDT: reasonText = "Other watchdogs"; break; //!< Reset due to other watchdogs
|
||||
case ESP_RST_DEEPSLEEP: reasonText = "Exiting deep sleep mode"; break; //!< Reset after exiting deep sleep mode
|
||||
case ESP_RST_BROWNOUT: reasonText = "Brownout"; break; //!< Brownout reset (software or hardware)
|
||||
case ESP_RST_SDIO: reasonText = "SDIO"; break; //!< Reset over SDIO
|
||||
|
||||
case ESP_RST_UNKNOWN: //!< Reset reason can not be determined
|
||||
default:
|
||||
reasonText = "Unknown";
|
||||
}
|
||||
return reasonText;
|
||||
}
|
||||
|
||||
@@ -59,3 +59,6 @@ string getSDCardManufacturer();
|
||||
string getSDCardName();
|
||||
string getSDCardCapacity();
|
||||
string getSDCardSectorSize();
|
||||
|
||||
string getMac(void);
|
||||
string getResetReason(void);
|
||||
@@ -147,9 +147,12 @@ extern "C" void app_main(void)
|
||||
string versionFormated = "Branch: '" + std::string(GIT_BRANCH) + "', Tag: '" + std::string(GIT_TAG) + \
|
||||
"', Revision: " + std::string(GIT_REV) +", Date/Time: " + std::string(BUILD_TIME);
|
||||
|
||||
ESP_LOGI(TAGMAIN, "\n\n\n\n\n"); // Add mark on log to see when it restarted
|
||||
ESP_LOGD(TAGMAIN, "=============================================================================================");
|
||||
ESP_LOGD(TAGMAIN, "%s", versionFormated.c_str());
|
||||
ESP_LOGD(TAGMAIN, "=============================================================================================");
|
||||
ESP_LOGD(TAGMAIN, "Reset reason: %s", getResetReason().c_str());
|
||||
|
||||
|
||||
PowerResetCamera();
|
||||
esp_err_t cam = Camera.InitCam();
|
||||
@@ -210,10 +213,12 @@ extern "C" void app_main(void)
|
||||
vTaskDelay( xDelay );
|
||||
setup_time();
|
||||
setBootTime();
|
||||
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, "=============================================================================================");
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, "=================================== Main Started ============================================");
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, "=============================================================================================");
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, versionFormated);
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, "Reset reason: " + getResetReason());
|
||||
LogFile.SwitchOnOff(false);
|
||||
|
||||
std::string zw = gettimestring("%Y%m%d-%H%M%S");
|
||||
|
||||
Reference in New Issue
Block a user