Skip to content

Commit da21d67

Browse files
committed
ESP-NOW: Rename espnowState to espNowState
1 parent b63ffa7 commit da21d67

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

Firmware/RTK_Everywhere/ESPNOW.ino

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ esp_err_t espNowAddPeer(const uint8_t * peerMac)
7070
// Get the current ESP-NOW state
7171
ESPNOWState espnowGetState()
7272
{
73-
return espnowState;
73+
return espNowState;
7474
}
7575

7676
//----------------------------------------------------------------------
@@ -480,15 +480,15 @@ void updateEspnow()
480480
{
481481
if (settings.enableEspNow == true)
482482
{
483-
if (espnowState == ESPNOW_PAIRED || espnowState == ESPNOW_BROADCASTING)
483+
if (espNowState == ESPNOW_PAIRED || espNowState == ESPNOW_BROADCASTING)
484484
{
485485
// If it's been longer than a few ms since we last added a byte to the buffer
486486
// then we've reached the end of the RTCM stream. Send partial buffer.
487487
if (espnowOutgoingSpot > 0 && (millis() - espnowLastAdd) > 50)
488488
{
489-
if (espnowState == ESPNOW_PAIRED)
489+
if (espNowState == ESPNOW_PAIRED)
490490
esp_now_send(0, (uint8_t *)&espnowOutgoing, espnowOutgoingSpot); // Send partial packet to all peers
491-
else // if (espnowState == ESPNOW_BROADCASTING)
491+
else // if (espNowState == ESPNOW_BROADCASTING)
492492
{
493493
uint8_t broadcastMac[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
494494
esp_now_send(broadcastMac, (uint8_t *)&espnowOutgoing,
@@ -525,7 +525,7 @@ void espnowOnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status)
525525
// Callback when data is received
526526
void espnowOnDataReceived(const esp_now_recv_info *mac, const uint8_t *incomingData, int len)
527527
{
528-
if (espnowState == ESPNOW_PAIRING)
528+
if (espNowState == ESPNOW_PAIRING)
529529
{
530530
if (len == sizeof(ESP_NOW_PAIR_MESSAGE)) // First error check
531531
{
@@ -605,7 +605,7 @@ void espnowStart()
605605
if (response != ESP_OK)
606606
systemPrintf("espnowStart: Failed to get protocols: %s\r\n", esp_err_to_name(response));
607607

608-
if ((WIFI_IS_RUNNING() == false) && espnowState == ESPNOW_OFF)
608+
if ((WIFI_IS_RUNNING() == false) && espNowState == ESPNOW_OFF)
609609
{
610610
// Radio is off, turn it on
611611
if (protocols != (WIFI_PROTOCOL_LR))
@@ -626,7 +626,7 @@ void espnowStart()
626626
}
627627
}
628628
// If WiFi is on but ESP NOW is off, then enable LR protocol
629-
else if (WIFI_IS_RUNNING() && espnowState == ESPNOW_OFF)
629+
else if (WIFI_IS_RUNNING() && espNowState == ESPNOW_OFF)
630630
{
631631
// Enable WiFi + ESP-Now
632632
// Enable long range, PHY rate of ESP32 will be 512Kbps or 256Kbps
@@ -743,7 +743,7 @@ void espnowStart()
743743
// If WiFi is off, stop the radio entirely
744744
void espnowStop()
745745
{
746-
if (espnowState == ESPNOW_OFF)
746+
if (espNowState == ESPNOW_OFF)
747747
return;
748748

749749
// Turn off promiscuous WiFi mode
@@ -831,7 +831,7 @@ void espnowBeginPairing()
831831
// Regularly call during pairing to see if we've received a Pairing message
832832
bool espnowIsPaired()
833833
{
834-
if (espnowState == ESPNOW_MAC_RECEIVED)
834+
if (espNowState == ESPNOW_MAC_RECEIVED)
835835
{
836836
// Remove broadcast peer
837837
uint8_t broadcastMac[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
@@ -928,13 +928,13 @@ esp_err_t espnowRemovePeer(uint8_t *peerMac)
928928
// Update the state of the ESP Now state machine
929929
void espnowSetState(ESPNOWState newState)
930930
{
931-
if (espnowState == newState && settings.debugEspNow == true)
931+
if (espNowState == newState && settings.debugEspNow == true)
932932
systemPrint("*");
933-
espnowState = newState;
933+
espNowState = newState;
934934

935935
if (settings.debugEspNow == true)
936936
{
937-
systemPrint("espnowState: ");
937+
systemPrint("espNowState: ");
938938
switch (newState)
939939
{
940940
case ESPNOW_OFF:
@@ -964,7 +964,7 @@ void espnowProcessRTCM(byte incoming)
964964
// If we are paired,
965965
// Or if the radio is broadcasting
966966
// Then add bytes to the outgoing buffer
967-
if (espnowState == ESPNOW_PAIRED || espnowState == ESPNOW_BROADCASTING)
967+
if (espNowState == ESPNOW_PAIRED || espNowState == ESPNOW_BROADCASTING)
968968
{
969969
// Move this byte into ESP NOW to send buffer
970970
espnowOutgoing[espnowOutgoingSpot++] = incoming;
@@ -976,9 +976,9 @@ void espnowProcessRTCM(byte incoming)
976976
{
977977
espnowOutgoingSpot = 0; // Wrap
978978

979-
if (espnowState == ESPNOW_PAIRED)
979+
if (espNowState == ESPNOW_PAIRED)
980980
esp_now_send(0, (uint8_t *)&espnowOutgoing, sizeof(espnowOutgoing)); // Send packet to all peers
981-
else // if (espnowState == ESPNOW_BROADCASTING)
981+
else // if (espNowState == ESPNOW_BROADCASTING)
982982
{
983983
uint8_t broadcastMac[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
984984
esp_now_send(broadcastMac, (uint8_t *)&espnowOutgoing,
@@ -1041,7 +1041,7 @@ void espnowStaticPairing()
10411041
// Returns the current channel being used by WiFi
10421042
uint8_t espnowGetChannel()
10431043
{
1044-
if (espnowState == ESPNOW_OFF)
1044+
if (espNowState == ESPNOW_OFF)
10451045
return 0;
10461046

10471047
bool originalPromiscuousMode = false;

Firmware/RTK_Everywhere/settings.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ typedef enum
364364
ESPNOW_PAIRED,
365365
ESPNOW_MAX
366366
} ESPNOWState;
367-
volatile ESPNOWState espnowState = ESPNOW_OFF;
368367

369368
const uint8_t ESPNOW_MAX_PEERS = 5; // Maximum of 5 rovers
370369

0 commit comments

Comments
 (0)