Skip to content

Commit beda79e

Browse files
authored
Merge pull request #477 from LeeLeahy2/endif
Add comments to the #else and #endif
2 parents a650a52 + ba0353a commit beda79e

24 files changed

+190
-190
lines changed

Firmware/RTK_Surveyor/Begin.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,13 +445,13 @@ void beginSD()
445445
}
446446
}
447447
}
448-
#else
448+
#else // COMPILE_SD_MMC
449449
else
450450
{
451451
log_d("SD_MMC not compiled");
452452
break; // No SD available.
453453
}
454-
#endif
454+
#endif // COMPILE_SD_MMC
455455

456456
if (createTestFile() == false)
457457
{
@@ -490,7 +490,7 @@ void endSD(bool alreadyHaveSemaphore, bool releaseSemaphore)
490490
#ifdef COMPILE_SD_MMC
491491
else
492492
SD_MMC.end();
493-
#endif
493+
#endif // COMPILE_SD_MMC
494494

495495
online.microSD = false;
496496
systemPrintln("microSD: Offline");
@@ -573,9 +573,9 @@ void pinUART2Task(void *pvParameters)
573573
// ESP32 2.0.2... Uncomment these lines to prevent the stall if/when we upgrade to ESP32 ~2.0.6.
574574
// #if defined(REF_STN_GNSS_DEBUG)
575575
// if (ENABLE_DEVELOPER && productVariant == REFERENCE_STATION)
576-
// #else
576+
// #else // REF_STN_GNSS_DEBUG
577577
// if (USE_I2C_GNSS)
578-
// #endif
578+
// #endif // REF_STN_GNSS_DEBUG
579579
{
580580
serialGNSS.setRxBufferSize(
581581
settings.uartReceiveBufferSize); // TODO: work out if we can reduce or skip this when using SPI GNSS
@@ -875,7 +875,7 @@ void beginInterrupts()
875875
pinMode(pin_Ethernet_Interrupt, INPUT_PULLUP); // Prepare the interrupt pin
876876
attachInterrupt(pin_Ethernet_Interrupt, ethernetISR, FALLING); // Attach the interrupt
877877
}
878-
#endif
878+
#endif // COMPILE_ETHERNET
879879
}
880880

881881
// Set LEDs for output and configure PWM

Firmware/RTK_Surveyor/Display.ino

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,9 +1016,9 @@ uint32_t setWiFiIcon_TwoRadios()
10161016
{
10171017
#ifdef COMPILE_WIFI
10181018
int wifiRSSI = WiFi.RSSI();
1019-
#else
1019+
#else // COMPILE_WIFI
10201020
int wifiRSSI = -40; // Dummy
1021-
#endif
1021+
#endif // COMPILE_WIFI
10221022
// Based on RSSI, select icon
10231023
if (wifiRSSI >= -40)
10241024
icons |= ICON_WIFI_SYMBOL_3_LEFT;
@@ -1046,9 +1046,9 @@ uint32_t setWiFiIcon_TwoRadios()
10461046
{
10471047
#ifdef COMPILE_WIFI
10481048
int wifiRSSI = WiFi.RSSI();
1049-
#else
1049+
#else // COMPILE_WIFI
10501050
int wifiRSSI = -40; // Dummy
1051-
#endif
1051+
#endif // COMPILE_WIFI
10521052
// Based on RSSI, select icon
10531053
if (wifiRSSI >= -40)
10541054
icons |= ICON_WIFI_SYMBOL_3_LEFT;
@@ -1103,9 +1103,9 @@ uint32_t setWiFiIcon_ThreeRadios()
11031103
{
11041104
#ifdef COMPILE_WIFI
11051105
int wifiRSSI = WiFi.RSSI();
1106-
#else
1106+
#else // COMPILE_WIFI
11071107
int wifiRSSI = -40; // Dummy
1108-
#endif
1108+
#endif // COMPILE_WIFI
11091109
// Based on RSSI, select icon
11101110
if (wifiRSSI >= -40)
11111111
icons |= ICON_WIFI_SYMBOL_3_RIGHT;
@@ -1133,9 +1133,9 @@ uint32_t setWiFiIcon_ThreeRadios()
11331133
{
11341134
#ifdef COMPILE_WIFI
11351135
int wifiRSSI = WiFi.RSSI();
1136-
#else
1136+
#else // COMPILE_WIFI
11371137
int wifiRSSI = -40; // Dummy
1138-
#endif
1138+
#endif // COMPILE_WIFI
11391139
// Based on RSSI, select icon
11401140
if (wifiRSSI >= -40)
11411141
icons |= ICON_WIFI_SYMBOL_3_RIGHT;
@@ -1583,9 +1583,9 @@ void paintLogging()
15831583
loggingIconDisplayed %= 4; // Wrap
15841584
#ifdef COMPILE_ETHERNET
15851585
if ((online.logging == true) && (logIncreasing || ntpLogIncreasing))
1586-
#else
1586+
#else // COMPILE_ETHERNET
15871587
if ((online.logging == true) && (logIncreasing))
1588-
#endif
1588+
#endif // COMPILE_ETHERNET
15891589
{
15901590
if (loggingType == LOGGING_STANDARD)
15911591
{
@@ -1656,9 +1656,9 @@ void paintLoggingNTP(bool noPulse)
16561656
loggingIconDisplayed %= 4; // Wrap
16571657
#ifdef COMPILE_ETHERNET // Some redundancy here. paintLoggingNTP should only be called if Ethernet is present
16581658
if ((online.logging == true) && (logIncreasing || ntpLogIncreasing))
1659-
#else
1659+
#else // COMPILE_ETHERNET
16601660
if ((online.logging == true) && (logIncreasing))
1661-
#endif
1661+
#endif // COMPILE_ETHERNET
16621662
{
16631663
if (loggingIconDisplayed == 0)
16641664
displayBitmap(64 - Logging_0_Width, 48 - Logging_0_Height, Logging_0_Width, Logging_0_Height, Logging_0);
@@ -1825,9 +1825,9 @@ void paintIPAddress()
18251825
snprintf(ipAddress, sizeof(ipAddress), " %d.%d.%d.%d ",
18261826
#ifdef COMPILE_ETHERNET
18271827
Ethernet.localIP()[0], Ethernet.localIP()[1], Ethernet.localIP()[2], Ethernet.localIP()[3]);
1828-
#else
1828+
#else // COMPILE_ETHERNET
18291829
0, 0, 0, 0);
1830-
#endif
1830+
#endif // COMPILE_ETHERNET
18311831

18321832
static uint8_t ipAddressPosition = 0;
18331833

@@ -2037,9 +2037,9 @@ void displayWiFiConfig()
20372037
snprintf(mySSID, sizeof(mySSID), "%s", "RTK Config");
20382038
else
20392039
snprintf(mySSID, sizeof(mySSID), "%s", WiFi.SSID().c_str());
2040-
#else
2040+
#else // COMPILE_WIFI
20412041
snprintf(mySSID, sizeof(mySSID), "%s", "!Compiled");
2042-
#endif
2042+
#endif // COMPILE_WIFI
20432043

20442044
char mySSIDFront[displayMaxCharacters + 1]; // 1 for null terminator
20452045
char mySSIDBack[displayMaxCharacters + 1]; // 1 for null terminator
@@ -2094,9 +2094,9 @@ void displayWiFiConfig()
20942094
else
20952095
printTextCenter(myIPBack, yPos, QW_FONT_5X7, 1, false);
20962096

2097-
#else
2097+
#else // COMPILE_AP
20982098
printTextCenter("!Compiled", yPos, QW_FONT_5X7, 1, false);
2099-
#endif
2099+
#endif // COMPILE_AP
21002100
}
21012101

21022102
// When user does a factory reset, let us know
@@ -3307,11 +3307,11 @@ void displayConfigViaEthernet()
33073307
oled.display();
33083308
}
33093309

3310-
#else
3310+
#else // COMPILE_ETHERNET
33113311
uint8_t fontHeight = 15;
33123312
uint8_t yPos = oled.getHeight() / 2 - fontHeight;
33133313
printTextCenter("!Compiled", yPos, QW_FONT_5X7, 1, false);
3314-
#endif
3314+
#endif // COMPILE_ETHERNET
33153315
}
33163316

33173317
const uint8_t *getMacAddress()
@@ -3321,14 +3321,14 @@ const uint8_t *getMacAddress()
33213321
#ifdef COMPILE_BT
33223322
if (bluetoothState != BT_OFF)
33233323
return btMACAddress;
3324-
#endif
3324+
#endif // COMPILE_BT
33253325
#ifdef COMPILE_WIFI
33263326
if (wifiState != WIFI_OFF)
33273327
return wifiMACAddress;
3328-
#endif
3328+
#endif // COMPILE_WIFI
33293329
#ifdef COMPILE_ETHERNET
33303330
if ((online.ethernetStatus >= ETH_STARTED_CHECK_CABLE) && (online.ethernetStatus <= ETH_CONNECTED))
33313331
return ethernetMACAddress;
3332-
#endif
3332+
#endif // COMPILE_ETHERNET
33333333
return zero;
33343334
}

Firmware/RTK_Surveyor/ESPNOW.ino

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void espnowOnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status)
3232
// else
3333
// systemPrintln("Delivery Fail");
3434
}
35-
#endif
35+
#endif // COMPILE_ESPNOW
3636

3737
// Callback when data is received
3838
void espnowOnDataReceived(const uint8_t *mac, const uint8_t *incomingData, int len)
@@ -73,7 +73,7 @@ void espnowOnDataReceived(const uint8_t *mac, const uint8_t *incomingData, int l
7373
espnowIncomingRTCM = true;
7474
lastEspnowRssiUpdate = millis();
7575
}
76-
#endif
76+
#endif // COMPILE_ESPNOW
7777
}
7878

7979
// Callback for all RX Packets
@@ -88,7 +88,7 @@ void promiscuous_rx_cb(void *buf, wifi_promiscuous_pkt_type_t type)
8888
const wifi_promiscuous_pkt_t *ppkt = (wifi_promiscuous_pkt_t *)buf;
8989
packetRSSI = ppkt->rx_ctrl.rssi;
9090
}
91-
#endif
91+
#endif // COMPILE_ESPNOW
9292

9393
// If WiFi is already enabled, simply add the LR protocol
9494
// If the radio is off entirely, start the radio, turn on only the LR protocol
@@ -188,7 +188,7 @@ void espnowStart()
188188
}
189189

190190
systemPrintln("ESP-Now Started");
191-
#endif
191+
#endif // COMPILE_ESPNOW
192192
}
193193

194194
// If WiFi is already enabled, simply remove the LR protocol
@@ -247,7 +247,7 @@ void espnowStop()
247247
wifiStart(); // Force WiFi to restart
248248
}
249249

250-
#endif
250+
#endif // COMPILE_ESPNOW
251251
}
252252

253253
// Start ESP-Now if needed, put ESP-Now into broadcast state
@@ -300,7 +300,7 @@ bool espnowIsPaired()
300300
espnowSetState(ESPNOW_PAIRED);
301301
return (true);
302302
}
303-
#endif
303+
#endif // COMPILE_ESPNOW
304304
return (false);
305305
}
306306

@@ -321,9 +321,9 @@ esp_err_t espnowSendPairMessage(uint8_t *sendToMac)
321321
pairMessage.crc += wifiMACAddress[x];
322322

323323
return (esp_now_send(sendToMac, (uint8_t *)&pairMessage, sizeof(pairMessage))); // Send packet to given MAC
324-
#else
324+
#else // COMPILE_ESPNOW
325325
return (ESP_OK);
326-
#endif
326+
#endif // COMPILE_ESPNOW
327327
}
328328

329329
// Add a given MAC address to the peer list
@@ -349,9 +349,9 @@ esp_err_t espnowAddPeer(uint8_t *peerMac, bool encrypt)
349349
log_d("Failed to add peer: 0x%02X%02X%02X%02X%02X%02X", peerMac[0], peerMac[1], peerMac[2], peerMac[3],
350350
peerMac[4], peerMac[5]);
351351
return (result);
352-
#else
352+
#else // COMPILE_ESPNOW
353353
return (ESP_OK);
354-
#endif
354+
#endif // COMPILE_ESPNOW
355355
}
356356

357357
// Remove a given MAC address from the peer list
@@ -363,9 +363,9 @@ esp_err_t espnowRemovePeer(uint8_t *peerMac)
363363
log_d("Failed to remove peer: %s", esp_err_to_name(response));
364364

365365
return (response);
366-
#else
366+
#else // COMPILE_ESPNOW
367367
return (ESP_OK);
368-
#endif
368+
#endif // COMPILE_ESPNOW
369369
}
370370

371371
// Update the state of the ESP Now state machine
@@ -428,7 +428,7 @@ void espnowProcessRTCM(byte incoming)
428428
espnowOutgoingRTCM = true;
429429
}
430430
}
431-
#endif
431+
#endif // COMPILE_ESPNOW
432432
}
433433

434434
// A blocking function that is used to pair two devices

0 commit comments

Comments
 (0)