diff --git a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp index f5ec267c..cdfc6013 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp @@ -549,7 +549,7 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph) if ((toUpper(splitted[0]) == "RSSITHREASHOLD") && (splitted.size() > 1)) { - if (ChangeRSSIThreashold("/sdcard/wlan.ini", atoi(splitted[1].c_str()))) + if (ChangeRSSIThreashold(WLAN_CONFIG_FILE, atoi(splitted[1].c_str()))) { // reboot necessary so that the new wlan.ini is also used !!! fclose(pfile); @@ -562,7 +562,7 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph) if ((toUpper(splitted[0]) == "HOSTNAME") && (splitted.size() > 1)) { - if (ChangeHostName("/sdcard/wlan.ini", splitted[1])) + if (ChangeHostName(WLAN_CONFIG_FILE, splitted[1])) { // reboot necessary so that the new wlan.ini is also used !!! fclose(pfile); diff --git a/code/components/jomjol_helper/Helper.cpp b/code/components/jomjol_helper/Helper.cpp index fb0c0a91..4cfba728 100644 --- a/code/components/jomjol_helper/Helper.cpp +++ b/code/components/jomjol_helper/Helper.cpp @@ -335,7 +335,7 @@ bool CopyFile(string input, string output) input = FormatFileName(input); output = FormatFileName(output); - if (toUpper(input).compare("/SDCARD/WLAN.INI") == 0) + if (toUpper(input).compare(WLAN_CONFIG_FILE) == 0) { ESP_LOGD(TAG, "wlan.ini kann nicht kopiert werden!"); return false; diff --git a/code/include/defines.h b/code/include/defines.h index f31e38f3..3bdfdd33 100644 --- a/code/include/defines.h +++ b/code/include/defines.h @@ -23,8 +23,12 @@ #define CAMERA_MODEL_AI_THINKER #define BOARD_ESP32CAM_AITHINKER - //server_GPIO + server_file + //server_GPIO + server_file + SoftAP #define CONFIG_FILE "/sdcard/config/config.ini" + + //ClassFlowControll + Main + SoftAP + #define WLAN_CONFIG_FILE "/sdcard/wlan.ini" + //main #define __SD_USE_ONE_LINE_MODE__ @@ -112,7 +116,6 @@ #define WIFI_FAIL_BIT BIT1 //ClassFlowCNNGeneral - //ready for translateion #define Analog_error 3 #define AnalogToDigtalFehler 0.8 #define Digital_Uncertainty 0.2 @@ -122,6 +125,8 @@ #define Digital_Transition_Area_Forward 9.7 // Pre-run zero crossing only happens from approx. 9.7 onwards + + //#define DEBUG_DETAIL_ON @@ -251,4 +256,12 @@ #endif //USE_PWM_LEDFLASH +//softAP +#ifdef ENABLE_SOFTAP + #define EXAMPLE_ESP_WIFI_SSID "AI-on-the-Edge" + #define EXAMPLE_ESP_WIFI_PASS "" + #define EXAMPLE_ESP_WIFI_CHANNEL 11 + #define EXAMPLE_MAX_STA_CONN 1 +#endif // ENABLE_SOFTAP + #endif // ifndef defines_h diff --git a/code/main/main.cpp b/code/main/main.cpp index abfee69d..be257c2a 100644 --- a/code/main/main.cpp +++ b/code/main/main.cpp @@ -39,7 +39,9 @@ #include "../../include/defines.h" //#include "server_GPIO.h" +#ifdef ENABLE_SOFTAP #include "softAP.h" +#endif //ENABLE_SOFTAP extern const char* GIT_TAG; extern const char* GIT_REV; @@ -182,7 +184,7 @@ extern "C" void app_main(void) #endif char *ssid = NULL, *passwd = NULL, *hostname = NULL, *ip = NULL, *gateway = NULL, *netmask = NULL, *dns = NULL; int rssithreashold = 0; - LoadWlanFromFile("/sdcard/wlan.ini", ssid, passwd, hostname, ip, gateway, netmask, dns, rssithreashold); + LoadWlanFromFile(WLAN_CONFIG_FILE, ssid, passwd, hostname, ip, gateway, netmask, dns, rssithreashold); LogFile.WriteToFile(ESP_LOG_INFO, TAG, "WLAN-Settings - RSSI-Threashold: " + to_string(rssithreashold)); diff --git a/code/main/softAP.cpp b/code/main/softAP.cpp index a1f7cf13..7462f3b1 100644 --- a/code/main/softAP.cpp +++ b/code/main/softAP.cpp @@ -1,5 +1,7 @@ #ifdef ENABLE_SOFTAP //if ENABLE_SOFTAP = disabled, set CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n in sdkconfig.defaults to save 28k of flash +#include "../../include/defines.h" + #include "softAP.h" @@ -34,10 +36,6 @@ If you'd rather not, just change the below entries to strings with the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid" */ -#define EXAMPLE_ESP_WIFI_SSID "AI-on-the-Edge" -#define EXAMPLE_ESP_WIFI_PASS "" -#define EXAMPLE_ESP_WIFI_CHANNEL 11 -#define EXAMPLE_MAX_STA_CONN 1 bool isConfigINI = false; bool isWlanINI = false; @@ -102,7 +100,7 @@ void SendHTTPResponse(httpd_req_t *req) message += "Please follow the below instructions.

"; httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str())); - isWlanINI = FileExists("/sdcard/wlan.ini"); + isWlanINI = FileExists(WLAN_CONFIG_FILE); if (!isConfigINI) { @@ -267,7 +265,7 @@ esp_err_t config_ini_handler(httpd_req_t *req) } }; - FILE* configfilehandle = fopen("/sdcard/wlan.ini", "w"); + FILE* configfilehandle = fopen(WLAN_CONFIG_FILE, "w"); if (ssid.length()) ssid = "ssid = \"" + ssid + "\"\n"; @@ -474,8 +472,8 @@ httpd_handle_t start_webserverAP(void) void CheckStartAPMode() { - isConfigINI = FileExists("/sdcard/config/config.ini"); - isWlanINI = FileExists("/sdcard/wlan.ini"); + isConfigINI = FileExists(CONFIG_FILE); + isWlanINI = FileExists(WLAN_CONFIG_FILE); if (!isConfigINI or !isWlanINI) { diff --git a/code/platformio.ini b/code/platformio.ini index b148ef86..8b142214 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -32,4 +32,4 @@ debug_tool = esp-prog ; Enable and adapt for logging over USB ;upload_port = /dev/ttyUSB0 -upload_port =com3 \ No newline at end of file +;upload_port =com3