diff --git a/code/components/jomjol_configfile/configFile.h b/code/components/jomjol_configfile/configFile.h index 8d710e3f..41310077 100644 --- a/code/components/jomjol_configfile/configFile.h +++ b/code/components/jomjol_configfile/configFile.h @@ -14,6 +14,7 @@ public: bool isNewParagraph(std::string input); bool GetNextParagraph(std::string& aktparamgraph, bool &disabled, bool &eof); bool getNextLine(std::string* rt, bool &disabled, bool &eof); + bool ConfigFileExists(){return pFile;}; private: FILE* pFile; diff --git a/code/components/jomjol_time_sntp/time_sntp.cpp b/code/components/jomjol_time_sntp/time_sntp.cpp index 9be866ce..25b0b0f3 100644 --- a/code/components/jomjol_time_sntp/time_sntp.cpp +++ b/code/components/jomjol_time_sntp/time_sntp.cpp @@ -139,6 +139,11 @@ bool setupTime() { ConfigFile configFile = ConfigFile(CONFIG_FILE); + if (!configFile.ConfigFileExists()){ + LogFile.WriteToFile(ESP_LOG_INFO, TAG, "No ConfigFile defined - exit setupTime() "); + return false; + } + std::vector splitted; std::string line = ""; bool disabledLine = false; diff --git a/code/main/main.cpp b/code/main/main.cpp index 06ad8f7f..c37512a8 100644 --- a/code/main/main.cpp +++ b/code/main/main.cpp @@ -160,13 +160,6 @@ extern "C" void app_main(void) return; // No way to continue without SD-Card! } - CheckIsPlannedReboot(); - CheckOTAUpdate(); - CheckUpdate(); - #ifdef ENABLE_SOFTAP - CheckStartAPMode(); // if no wlan.ini and/or config.ini --> AP ist startet and this function does not exit anymore until reboot - #endif - setupTime(); string versionFormated = getFwVersion() + ", Date/Time: " + std::string(BUILD_TIME) + \ @@ -186,6 +179,12 @@ extern "C" void app_main(void) LogFile.WriteToFile(ESP_LOG_INFO, TAG, versionFormated); LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Reset reason: " + getResetReason()); + CheckIsPlannedReboot(); + CheckOTAUpdate(); + CheckUpdate(); + #ifdef ENABLE_SOFTAP + CheckStartAPMode(); // if no wlan.ini and/or config.ini --> AP ist startet and this function does not exit anymore until reboot + #endif char *ssid = NULL, *passwd = NULL, *hostname = NULL, *ip = NULL, *gateway = NULL, *netmask = NULL, *dns = NULL; int rssithreashold = 0; LoadWlanFromFile(WLAN_CONFIG_FILE, ssid, passwd, hostname, ip, gateway, netmask, dns, rssithreashold); diff --git a/code/main/softAP.cpp b/code/main/softAP.cpp index 5038cf1a..517ec1b8 100644 --- a/code/main/softAP.cpp +++ b/code/main/softAP.cpp @@ -107,8 +107,9 @@ void SendHTTPResponse(httpd_req_t *req) message = "

1. Upload initial configuration to sd-card

"; message += "The configuration file config.ini is missing and most propably the full configuration and html folder on the sd-card. "; message += "This is normal after the first flashing of the firmware and an empty sd-card. Please upload \"remote_setup.zip\", which contains an full inital configuration.

"; - message += ""; + message += "
"; message += "

"; + message += "The upload might take up to 60s. After a succesfull upload the page will be updated."; httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str())); message = ""; - isConfigINI = true; httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str())); return; } if (!isWlanINI) { message = "

2. WLAN access credentials

"; - message = ""; + message += "
"; message += ""; - message += ""; + message += ""; + message += "
WLAN-SSIDSSID of the WLAN
WLAN-PasswordATTENTION: the password will not be encrypted during the sending.
WLAN-PasswordATTENTION: the password will not be encrypted during the sending.

"; + message += "

ATTENTION:

Be sure about the WLAN settings. They cannot be reseted afterwards. If ssid or password is wrong, you need to take out the sd-card and manually change them in \"wlan.ini\"!

"; httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str())); // message = " Hostname"; @@ -140,9 +143,6 @@ void SendHTTPResponse(httpd_req_t *req) // message += "RSSI ThreasholdWLAN Mesh Parameter: Threashold for RSSI value to check for start switching access point in a mesh system.Possible values: -100 to 0, 0 = disabled - Value will be transfered to wlan.ini at next startup)"; // httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str())); - message = "/

"; - message += "

ATTENTION:

Be sure about the WLAN settings. They cannot be reset afterwards. If ssid or password is wrong, you need to take out the sd-card and manually change them in \"wlan.ini\"!

"; - httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str())); message = ""; message += " + + +

+ + + + +

AI-on-the-edge-device

Webinstaller and Console

+ +


+ +

This page provides the Webinstaller and a live USB Console to your AI-on-the-edge-device.
+ For further information about AI-on-the-edge-device please go to https://github.com/jomjol/AI-on-the-edge-device.

+

Beside flashing the firmware you need a sd-card with configuration informations about the system and the wifi credentials.

+

There a two ways to make this settings:p> +

    +
  1. By hand: follow the instructions in the wiki (copy data to sd-card, setup wifi credentials by hand)
  2. +
  3. Use an integraded primitiv access point to make the first setup.
    + In this case read the instructions below carefully in advance, as you have to temporaly change wifi and need a downloaded file.
  4. +
+ +

Notes:

+ +

+
+

Installer and Console powered by ESP Web Tools

+ + +

Using internal access point for sd-card setup
+

Before starting the flash process download the necessary file. It is a zip file, that contains the initial default configuration additionally. + You can identify it by the naming. It should contain `...remote-setup...` within the file name. Store this file locally you will need it later. +

+
Flash the firmware with the WebInstaller
+
+

Instructions see above.

+
+ +
Connect to Device
+
+ + +

During the first booting, the device identifies, that the wifi credentials as well as the configuration informations are missing.

+

Therefore a simple wifi access point is initiated and a simple internal web server is startet.

+

The naming of the wifi is "AI-on-the-edge" and you can access without any password.

+ +

Access Point

+ +

You connect to the server with the fixed ip: http://192.168.4.1

+
+ +
Upload initial configuration to sd-card
+
+ + +

Access Point

+ +

Use the `select file` and `upload` button to start the upload.

+

A warning will come, if you have choosen a possible wrong file (without default configuration).

+
+ + +
Upload initial configuration to sd-card
+
+ +

Access Point

+ +

Use the `select file` and `upload` button to start the upload.
+ A warning will come, if you have choosen a possible wrong file (without default configuration).

+

Be patient - the upload takes up to about 60s without response during this time.
+ After succesfull upload the page will be reloaded for the next step.

+
+ +
Store WLAN acces information
+
+

Access Point

+ +

Here you can set your wifi credentials. Only basic settings can done here. If you need advanced features (fixed ip, ...), please use the manual setup.

+

Attention:

+ +

Finish the step by pushing `Write wlan.ini`

+
+ +
Reboot
+
+

Access Point

+ +

The final step is the reboot.

+

It will take up to 3 minutes. Afterwards you can find your device in the local network. Check you router for the IP. You can find it also in the console output.

+
+ + diff --git a/docs/setup-config.png b/docs/setup-config.png new file mode 100644 index 00000000..a583afcf Binary files /dev/null and b/docs/setup-config.png differ diff --git a/docs/setup-reboot.png b/docs/setup-reboot.png new file mode 100644 index 00000000..0e79c65f Binary files /dev/null and b/docs/setup-reboot.png differ diff --git a/docs/setup-wlan.png b/docs/setup-wlan.png new file mode 100644 index 00000000..3b543f85 Binary files /dev/null and b/docs/setup-wlan.png differ diff --git a/sd-card/demo/leer.txt b/sd-card/demo/leer.txt new file mode 100644 index 00000000..e69de29b