mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-11 05:56:57 +03:00
macro definition #ifdef ENABLE_SOFTAP (#1698)
* macro definition #ifdef ENABLE_SOFTAP * Update platformio.ini * softap define in define.h * Update platformio.ini * #define WLAN_CONFIG_FILE "/sdcard/wlan.ini" Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
This commit is contained in:
@@ -549,7 +549,7 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
|
|
||||||
if ((toUpper(splitted[0]) == "RSSITHREASHOLD") && (splitted.size() > 1))
|
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 !!!
|
// reboot necessary so that the new wlan.ini is also used !!!
|
||||||
fclose(pfile);
|
fclose(pfile);
|
||||||
@@ -562,7 +562,7 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
|
|
||||||
if ((toUpper(splitted[0]) == "HOSTNAME") && (splitted.size() > 1))
|
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 !!!
|
// reboot necessary so that the new wlan.ini is also used !!!
|
||||||
fclose(pfile);
|
fclose(pfile);
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ bool CopyFile(string input, string output)
|
|||||||
input = FormatFileName(input);
|
input = FormatFileName(input);
|
||||||
output = FormatFileName(output);
|
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!");
|
ESP_LOGD(TAG, "wlan.ini kann nicht kopiert werden!");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -23,8 +23,12 @@
|
|||||||
#define CAMERA_MODEL_AI_THINKER
|
#define CAMERA_MODEL_AI_THINKER
|
||||||
#define BOARD_ESP32CAM_AITHINKER
|
#define BOARD_ESP32CAM_AITHINKER
|
||||||
|
|
||||||
//server_GPIO + server_file
|
//server_GPIO + server_file + SoftAP
|
||||||
#define CONFIG_FILE "/sdcard/config/config.ini"
|
#define CONFIG_FILE "/sdcard/config/config.ini"
|
||||||
|
|
||||||
|
//ClassFlowControll + Main + SoftAP
|
||||||
|
#define WLAN_CONFIG_FILE "/sdcard/wlan.ini"
|
||||||
|
|
||||||
//main
|
//main
|
||||||
#define __SD_USE_ONE_LINE_MODE__
|
#define __SD_USE_ONE_LINE_MODE__
|
||||||
|
|
||||||
@@ -112,7 +116,6 @@
|
|||||||
#define WIFI_FAIL_BIT BIT1
|
#define WIFI_FAIL_BIT BIT1
|
||||||
|
|
||||||
//ClassFlowCNNGeneral
|
//ClassFlowCNNGeneral
|
||||||
//ready for translateion
|
|
||||||
#define Analog_error 3
|
#define Analog_error 3
|
||||||
#define AnalogToDigtalFehler 0.8
|
#define AnalogToDigtalFehler 0.8
|
||||||
#define Digital_Uncertainty 0.2
|
#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 Digital_Transition_Area_Forward 9.7 // Pre-run zero crossing only happens from approx. 9.7 onwards
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#define DEBUG_DETAIL_ON
|
//#define DEBUG_DETAIL_ON
|
||||||
|
|
||||||
|
|
||||||
@@ -251,4 +256,12 @@
|
|||||||
|
|
||||||
#endif //USE_PWM_LEDFLASH
|
#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
|
#endif // ifndef defines_h
|
||||||
|
|||||||
@@ -39,7 +39,9 @@
|
|||||||
#include "../../include/defines.h"
|
#include "../../include/defines.h"
|
||||||
//#include "server_GPIO.h"
|
//#include "server_GPIO.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_SOFTAP
|
||||||
#include "softAP.h"
|
#include "softAP.h"
|
||||||
|
#endif //ENABLE_SOFTAP
|
||||||
|
|
||||||
extern const char* GIT_TAG;
|
extern const char* GIT_TAG;
|
||||||
extern const char* GIT_REV;
|
extern const char* GIT_REV;
|
||||||
@@ -182,7 +184,7 @@ extern "C" void app_main(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *ssid = NULL, *passwd = NULL, *hostname = NULL, *ip = NULL, *gateway = NULL, *netmask = NULL, *dns = NULL; int rssithreashold = 0;
|
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));
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "WLAN-Settings - RSSI-Threashold: " + to_string(rssithreashold));
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#ifdef ENABLE_SOFTAP
|
#ifdef ENABLE_SOFTAP
|
||||||
//if ENABLE_SOFTAP = disabled, set CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n in sdkconfig.defaults to save 28k of flash
|
//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"
|
#include "softAP.h"
|
||||||
|
|
||||||
@@ -34,10 +36,6 @@
|
|||||||
If you'd rather not, just change the below entries to strings with
|
If you'd rather not, just change the below entries to strings with
|
||||||
the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid"
|
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 isConfigINI = false;
|
||||||
bool isWlanINI = false;
|
bool isWlanINI = false;
|
||||||
@@ -102,7 +100,7 @@ void SendHTTPResponse(httpd_req_t *req)
|
|||||||
message += "Please follow the below instructions.<p>";
|
message += "Please follow the below instructions.<p>";
|
||||||
httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str()));
|
httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str()));
|
||||||
|
|
||||||
isWlanINI = FileExists("/sdcard/wlan.ini");
|
isWlanINI = FileExists(WLAN_CONFIG_FILE);
|
||||||
|
|
||||||
if (!isConfigINI)
|
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())
|
if (ssid.length())
|
||||||
ssid = "ssid = \"" + ssid + "\"\n";
|
ssid = "ssid = \"" + ssid + "\"\n";
|
||||||
@@ -474,8 +472,8 @@ httpd_handle_t start_webserverAP(void)
|
|||||||
|
|
||||||
void CheckStartAPMode()
|
void CheckStartAPMode()
|
||||||
{
|
{
|
||||||
isConfigINI = FileExists("/sdcard/config/config.ini");
|
isConfigINI = FileExists(CONFIG_FILE);
|
||||||
isWlanINI = FileExists("/sdcard/wlan.ini");
|
isWlanINI = FileExists(WLAN_CONFIG_FILE);
|
||||||
|
|
||||||
if (!isConfigINI or !isWlanINI)
|
if (!isConfigINI or !isWlanINI)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,4 +32,4 @@ debug_tool = esp-prog
|
|||||||
|
|
||||||
; Enable and adapt for logging over USB
|
; Enable and adapt for logging over USB
|
||||||
;upload_port = /dev/ttyUSB0
|
;upload_port = /dev/ttyUSB0
|
||||||
upload_port =com3
|
;upload_port =com3
|
||||||
|
|||||||
Reference in New Issue
Block a user