Skip to content

Commit 397c99c

Browse files
committed
WiFi: Move constants and variables
1 parent e68fb7f commit 397c99c

File tree

1 file changed

+19
-32
lines changed

1 file changed

+19
-32
lines changed

Firmware/RTK_Everywhere/WiFi.ino

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -406,13 +406,17 @@ const int wifiStartNamesEntries = sizeof(wifiStartNames) / sizeof(wifiStartNames
406406
| WIFI_STA_SELECT_REMOTE_AP \
407407
| WIFI_STA_NO_REMOTE_AP)
408408

409+
#define WIFI_MAX_TIMEOUT (15 * 60 * 1000) // Timeout in milliseconds
410+
#define WIFI_MIN_TIMEOUT (15 * 1000) // Timeout in milliseconds
411+
409412
const char * wifiSoftApSsid = "RTK Config";
410413
const char * wifiSoftApPassword = nullptr;
411414

412415
//****************************************
413416
// Globals
414417
//****************************************
415418

419+
bool restartWiFi = false; // Restart WiFi if user changes anything
416420
bool wifiRestartRequested = false; // Restart WiFi if user changes anything
417421

418422
//****************************************
@@ -422,6 +426,21 @@ bool wifiRestartRequested = false; // Restart WiFi if user changes anything
422426
// DNS server for Captive Portal
423427
static DNSServer dnsServer;
424428

429+
// Start timeout
430+
static uint32_t wifiStartTimeout;
431+
static uint32_t wifiStartLastTry; // The last time WiFi start was attempted
432+
433+
// WiFi Timer usage:
434+
// * Measure interval to display IP address
435+
static unsigned long wifiDisplayTimer;
436+
437+
// WiFi interface status
438+
static bool wifiApRunning;
439+
static bool wifiStationRunning;
440+
441+
static int wifiFailedConnectionAttempts = 0; // Count the number of connection attempts between restarts
442+
static WiFiMulti *wifiMulti;
443+
425444
//*********************************************************************
426445
// Callback for all WiFi RX Packets
427446
// Get RSSI of all incoming management packets: https://esp32.com/viewtopic.php?t=13889
@@ -2558,38 +2577,6 @@ void RTK_WIFI::verifyTables()
25582577
WL_SCAN_COMPLETED: assigned when the scan networks is completed
25592578
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
25602579

2561-
//----------------------------------------
2562-
// Globals
2563-
//----------------------------------------
2564-
2565-
int wifiFailedConnectionAttempts = 0; // Count the number of connection attempts between restarts
2566-
2567-
bool restartWiFi = false; // Restart WiFi if user changes anything
2568-
2569-
WiFiMulti *wifiMulti;
2570-
2571-
//----------------------------------------
2572-
// Constants
2573-
//----------------------------------------
2574-
2575-
#define WIFI_MAX_TIMEOUT (15 * 60 * 1000)
2576-
#define WIFI_MIN_TIMEOUT (15 * 1000)
2577-
2578-
//----------------------------------------
2579-
// Locals
2580-
//----------------------------------------
2581-
2582-
// Start timeout
2583-
static uint32_t wifiStartTimeout;
2584-
static uint32_t wifiStartLastTry; // The last time WiFi start was attempted
2585-
2586-
// WiFi Timer usage:
2587-
// * Measure interval to display IP address
2588-
static unsigned long wifiDisplayTimer;
2589-
2590-
static bool wifiStationRunning;
2591-
static bool wifiApRunning;
2592-
25932580
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
25942581
// WiFi Routines
25952582
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

0 commit comments

Comments
 (0)