mirror of https://github.com/SQ9MDD/ESP32IGate.git
Add WiFi AP Config and edit bug Update Firmware has fail.
This commit is contained in:
parent
23cb356ee6
commit
3f0a946d49
|
|
@ -12,8 +12,7 @@ extern statusType status;
|
|||
extern digiTLMType digiTLM;
|
||||
extern Configuration config;
|
||||
extern TaskHandle_t taskNetworkHandle;
|
||||
extern TaskHandle_t taskDSPHandle;
|
||||
extern TaskHandle_t taskUIHandle;
|
||||
extern TaskHandle_t taskAPRSHandle;
|
||||
extern time_t systemUptime;
|
||||
extern pkgListType pkgList[PKGLISTSIZE];
|
||||
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@ void setup()
|
|||
xTaskCreatePinnedToCore(
|
||||
taskAPRS, /* Function to implement the task */
|
||||
"taskAPRS", /* Name of the task */
|
||||
8192, /* Stack size in words */
|
||||
16384, /* Stack size in words */
|
||||
NULL, /* Task input parameter */
|
||||
1, /* Priority of the task */
|
||||
&taskAPRSHandle, /* Task handle. */
|
||||
|
|
@ -623,6 +623,7 @@ void taskAPRS(void *pvParameters)
|
|||
time_t timeStamp;
|
||||
time(&timeStamp);
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
//serviceHandle();
|
||||
|
||||
if (digitalRead(0) == LOW)
|
||||
{
|
||||
|
|
@ -836,6 +837,7 @@ void taskNetwork(void *pvParameters)
|
|||
// wdtNetworkTimer = millis();
|
||||
vTaskDelay(1 / portTICK_PERIOD_MS);
|
||||
serviceHandle();
|
||||
|
||||
if (config.wifi_mode == WIFI_AP_STA_FIX || config.wifi_mode == WIFI_STA_FIX)
|
||||
{
|
||||
if (WiFi.status() != WL_CONNECTED)
|
||||
|
|
|
|||
|
|
@ -847,6 +847,7 @@ void handle_system()
|
|||
break;
|
||||
}
|
||||
}
|
||||
saveEEPROM();
|
||||
}
|
||||
else if (server.hasArg("updateTime"))
|
||||
{
|
||||
|
|
@ -906,11 +907,71 @@ void handle_system()
|
|||
break;
|
||||
}
|
||||
}
|
||||
saveEEPROM();
|
||||
}
|
||||
else if (server.hasArg("updateWifi"))
|
||||
{
|
||||
bool wifiSTA = false;
|
||||
bool wifiAP = false;
|
||||
for (uint8_t i = 0; i < server.args(); i++)
|
||||
{
|
||||
if (server.argName(i) == "wifiAP")
|
||||
{
|
||||
if (server.arg(i) != "")
|
||||
{
|
||||
if (String(server.arg(i)) == "OK")
|
||||
{
|
||||
wifiAP = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (server.argName(i) == "wificlient")
|
||||
{
|
||||
if (server.arg(i) != "")
|
||||
{
|
||||
if (String(server.arg(i)) == "OK")
|
||||
{
|
||||
wifiSTA = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (server.argName(i) == "gpsLat")
|
||||
{
|
||||
if (server.arg(i) != "")
|
||||
{
|
||||
config.gps_lat = server.arg(i).toFloat();
|
||||
}
|
||||
}
|
||||
if (server.argName(i) == "gpsLon")
|
||||
{
|
||||
if (server.arg(i) != "")
|
||||
{
|
||||
config.gps_lon = server.arg(i).toFloat();
|
||||
}
|
||||
}
|
||||
if (server.argName(i) == "gpsAlt")
|
||||
{
|
||||
if (server.arg(i) != "")
|
||||
{
|
||||
config.gps_alt = server.arg(i).toFloat();
|
||||
}
|
||||
}
|
||||
|
||||
if (server.argName(i) == "wifi_ssidAP")
|
||||
{
|
||||
if (server.arg(i) != "")
|
||||
{
|
||||
strcpy(config.wifi_ap_ssid, server.arg(i).c_str());
|
||||
}
|
||||
}
|
||||
if (server.argName(i) == "wifi_passAP")
|
||||
{
|
||||
if (server.arg(i) != "")
|
||||
{
|
||||
strcpy(config.wifi_ap_pass, server.arg(i).c_str());
|
||||
}
|
||||
}
|
||||
if (server.argName(i) == "wifi_ssid")
|
||||
{
|
||||
if (server.arg(i) != "")
|
||||
|
|
@ -926,6 +987,23 @@ void handle_system()
|
|||
}
|
||||
}
|
||||
}
|
||||
if (wifiAP && wifiSTA)
|
||||
{
|
||||
config.wifi_mode = WIFI_AP_STA_FIX;
|
||||
}
|
||||
else if (wifiAP)
|
||||
{
|
||||
config.wifi_mode = WIFI_AP_FIX;
|
||||
}
|
||||
else if (wifiSTA)
|
||||
{
|
||||
config.wifi_mode = WIFI_STA_FIX;
|
||||
}
|
||||
else
|
||||
{
|
||||
config.wifi_mode = WIFI_OFF_FIX;
|
||||
}
|
||||
saveEEPROM();
|
||||
}
|
||||
|
||||
struct tm tmstruct;
|
||||
|
|
@ -1324,7 +1402,7 @@ void webService()
|
|||
HTTPUpload &upload = server.upload();
|
||||
if (upload.status == UPLOAD_FILE_START)
|
||||
{
|
||||
// Serial.printf("Firmware Update FILE: %s\n", upload.filename.c_str());
|
||||
Serial.printf("Firmware Update FILE: %s\n", upload.filename.c_str());
|
||||
if (!Update.begin(UPDATE_SIZE_UNKNOWN))
|
||||
{ // start with max available size
|
||||
Update.printError(Serial);
|
||||
|
|
@ -1334,9 +1412,12 @@ void webService()
|
|||
{
|
||||
// wdtDisplayTimer = millis();
|
||||
// wdtSensorTimer = millis();
|
||||
// vTaskSuspend(taskSensorHandle);
|
||||
vTaskSuspend(taskNetworkHandle);
|
||||
i2s_adc_disable(I2S_NUM_0);
|
||||
dac_i2s_disable();
|
||||
vTaskSuspend(taskAPRSHandle);
|
||||
//vTaskSuspend(taskNetworkHandle);
|
||||
config.aprs = false;
|
||||
config.tnc=false;
|
||||
#ifndef I2S_INTERNAL
|
||||
AFSK_TimerEnable(false);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue