Skip to content

Commit 2ae9b03

Browse files
committed
WiFi: Replace wifiIsRunning with WIFI_IS_RUNNING macro
1 parent 5a6450d commit 2ae9b03

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

Firmware/RTK_Everywhere/Developer.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void menuWiFi() {systemPrintln("**WiFi not compiled**");}
202202
bool wifiApIsRunning() {return false;}
203203
bool wifiConnect(bool startWiFiStation, bool startWiFiAP, unsigned long timeout) {return false;}
204204
uint32_t wifiGetStartTimeout() {return 0;}
205-
bool wifiIsRunning() {return false;}
205+
#define WIFI_IS_RUNNING()
206206
int wifiNetworkCount() {return 0;}
207207
void wifiResetThrottleTimeout() {}
208208
void wifiResetTimeout() {}

Firmware/RTK_Everywhere/Display.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ void setRadioIcons(std::vector<iconPropertyBlinking> *iconList)
654654

655655
// Count the number of radios in use
656656
uint8_t numberOfRadios = 1; // Bluetooth always indicated. TODO don't count if BT radio type is OFF.
657-
if (wifiIsRunning())
657+
if (WIFI_IS_RUNNING())
658658
numberOfRadios++;
659659
if (espnowState > ESPNOW_OFF)
660660
numberOfRadios++;
@@ -671,7 +671,7 @@ void setRadioIcons(std::vector<iconPropertyBlinking> *iconList)
671671
setBluetoothIcon_TwoRadios(iconList);
672672

673673
// Do we have WiFi or ESP
674-
if (wifiIsRunning())
674+
if (WIFI_IS_RUNNING())
675675
setWiFiIcon_TwoRadios(iconList);
676676
else if (espnowState > ESPNOW_OFF)
677677
setESPNowIcon_TwoRadios(iconList);
@@ -706,7 +706,7 @@ void setRadioIcons(std::vector<iconPropertyBlinking> *iconList)
706706
iconList->push_back(prop);
707707
}
708708

709-
if (wifiIsRunning()) // WiFi : Columns 34 - 46
709+
if (WIFI_IS_RUNNING()) // WiFi : Columns 34 - 46
710710
{
711711
#ifdef COMPILE_WIFI
712712
int wifiRSSI = WiFi.RSSI();

Firmware/RTK_Everywhere/ESPNOW.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ void espnowStart()
594594
if (response != ESP_OK)
595595
systemPrintf("espnowStart: Failed to get protocols: %s\r\n", esp_err_to_name(response));
596596

597-
if ((wifiIsRunning() == false) && espnowState == ESPNOW_OFF)
597+
if ((WIFI_IS_RUNNING() == false) && espnowState == ESPNOW_OFF)
598598
{
599599
// Radio is off, turn it on
600600
if (protocols != (WIFI_PROTOCOL_LR))
@@ -615,7 +615,7 @@ void espnowStart()
615615
}
616616
}
617617
// If WiFi is on but ESP NOW is off, then enable LR protocol
618-
else if (wifiIsRunning() && espnowState == ESPNOW_OFF)
618+
else if (WIFI_IS_RUNNING() && espnowState == ESPNOW_OFF)
619619
{
620620
// Enable WiFi + ESP-Now
621621
// Enable long range, PHY rate of ESP32 will be 512Kbps or 256Kbps
@@ -788,7 +788,7 @@ void espnowStop()
788788

789789
espnowSetState(ESPNOW_OFF);
790790

791-
if (wifiIsRunning() == false)
791+
if (WIFI_IS_RUNNING() == false)
792792
{
793793
// ESP-NOW was the only thing using the radio so turn WiFi radio off entirely
794794
WiFi.mode(WIFI_OFF);
@@ -797,7 +797,7 @@ void espnowStop()
797797
systemPrintln("WiFi Radio off entirely");
798798
}
799799
// If WiFi is on, then restart WiFi
800-
else if (wifiIsRunning())
800+
else if (WIFI_IS_RUNNING())
801801
{
802802
if (settings.debugEspNow == true)
803803
systemPrintln("ESP-Now starting WiFi");

Firmware/RTK_Everywhere/RTK_Everywhere.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ char logFileName[sizeof("SFE_Reference_Station_230101_120101.ubx_plusExtraSpace"
306306
int packetRSSI;
307307
RTK_WIFI wifi(false);
308308

309+
#define WIFI_IS_RUNNING() wifiIsRunning()
309310
#define WIFI_STOP() \
310311
{ \
311312
if (settings.debugWifiState) \

Firmware/RTK_Everywhere/menuMain.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ void menuRadio()
630630
}
631631
else if (settings.enableEspNow == true && incoming == 4)
632632
{
633-
if (wifiIsRunning() == false)
633+
if (WIFI_IS_RUNNING() == false)
634634
{
635635
if (getNewSetting("Enter the WiFi channel to use for ESP-NOW communication", 1, 14,
636636
&settings.wifiChannel) == INPUT_RESPONSE_VALID)

0 commit comments

Comments
 (0)