Skip to content

Add comments to the #else and #endif #477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Firmware/RTK_Surveyor/Begin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,13 @@ void beginSD()
}
}
}
#else
#else // COMPILE_SD_MMC
else
{
log_d("SD_MMC not compiled");
break; // No SD available.
}
#endif
#endif // COMPILE_SD_MMC

if (createTestFile() == false)
{
Expand Down Expand Up @@ -490,7 +490,7 @@ void endSD(bool alreadyHaveSemaphore, bool releaseSemaphore)
#ifdef COMPILE_SD_MMC
else
SD_MMC.end();
#endif
#endif // COMPILE_SD_MMC

online.microSD = false;
systemPrintln("microSD: Offline");
Expand Down Expand Up @@ -573,9 +573,9 @@ void pinUART2Task(void *pvParameters)
// ESP32 2.0.2... Uncomment these lines to prevent the stall if/when we upgrade to ESP32 ~2.0.6.
// #if defined(REF_STN_GNSS_DEBUG)
// if (ENABLE_DEVELOPER && productVariant == REFERENCE_STATION)
// #else
// #else // REF_STN_GNSS_DEBUG
// if (USE_I2C_GNSS)
// #endif
// #endif // REF_STN_GNSS_DEBUG
{
serialGNSS.setRxBufferSize(
settings.uartReceiveBufferSize); // TODO: work out if we can reduce or skip this when using SPI GNSS
Expand Down Expand Up @@ -875,7 +875,7 @@ void beginInterrupts()
pinMode(pin_Ethernet_Interrupt, INPUT_PULLUP); // Prepare the interrupt pin
attachInterrupt(pin_Ethernet_Interrupt, ethernetISR, FALLING); // Attach the interrupt
}
#endif
#endif // COMPILE_ETHERNET
}

// Set LEDs for output and configure PWM
Expand Down
46 changes: 23 additions & 23 deletions Firmware/RTK_Surveyor/Display.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1016,9 +1016,9 @@ uint32_t setWiFiIcon_TwoRadios()
{
#ifdef COMPILE_WIFI
int wifiRSSI = WiFi.RSSI();
#else
#else // COMPILE_WIFI
int wifiRSSI = -40; // Dummy
#endif
#endif // COMPILE_WIFI
// Based on RSSI, select icon
if (wifiRSSI >= -40)
icons |= ICON_WIFI_SYMBOL_3_LEFT;
Expand Down Expand Up @@ -1046,9 +1046,9 @@ uint32_t setWiFiIcon_TwoRadios()
{
#ifdef COMPILE_WIFI
int wifiRSSI = WiFi.RSSI();
#else
#else // COMPILE_WIFI
int wifiRSSI = -40; // Dummy
#endif
#endif // COMPILE_WIFI
// Based on RSSI, select icon
if (wifiRSSI >= -40)
icons |= ICON_WIFI_SYMBOL_3_LEFT;
Expand Down Expand Up @@ -1103,9 +1103,9 @@ uint32_t setWiFiIcon_ThreeRadios()
{
#ifdef COMPILE_WIFI
int wifiRSSI = WiFi.RSSI();
#else
#else // COMPILE_WIFI
int wifiRSSI = -40; // Dummy
#endif
#endif // COMPILE_WIFI
// Based on RSSI, select icon
if (wifiRSSI >= -40)
icons |= ICON_WIFI_SYMBOL_3_RIGHT;
Expand Down Expand Up @@ -1133,9 +1133,9 @@ uint32_t setWiFiIcon_ThreeRadios()
{
#ifdef COMPILE_WIFI
int wifiRSSI = WiFi.RSSI();
#else
#else // COMPILE_WIFI
int wifiRSSI = -40; // Dummy
#endif
#endif // COMPILE_WIFI
// Based on RSSI, select icon
if (wifiRSSI >= -40)
icons |= ICON_WIFI_SYMBOL_3_RIGHT;
Expand Down Expand Up @@ -1583,9 +1583,9 @@ void paintLogging()
loggingIconDisplayed %= 4; // Wrap
#ifdef COMPILE_ETHERNET
if ((online.logging == true) && (logIncreasing || ntpLogIncreasing))
#else
#else // COMPILE_ETHERNET
if ((online.logging == true) && (logIncreasing))
#endif
#endif // COMPILE_ETHERNET
{
if (loggingType == LOGGING_STANDARD)
{
Expand Down Expand Up @@ -1656,9 +1656,9 @@ void paintLoggingNTP(bool noPulse)
loggingIconDisplayed %= 4; // Wrap
#ifdef COMPILE_ETHERNET // Some redundancy here. paintLoggingNTP should only be called if Ethernet is present
if ((online.logging == true) && (logIncreasing || ntpLogIncreasing))
#else
#else // COMPILE_ETHERNET
if ((online.logging == true) && (logIncreasing))
#endif
#endif // COMPILE_ETHERNET
{
if (loggingIconDisplayed == 0)
displayBitmap(64 - Logging_0_Width, 48 - Logging_0_Height, Logging_0_Width, Logging_0_Height, Logging_0);
Expand Down Expand Up @@ -1825,9 +1825,9 @@ void paintIPAddress()
snprintf(ipAddress, sizeof(ipAddress), " %d.%d.%d.%d ",
#ifdef COMPILE_ETHERNET
Ethernet.localIP()[0], Ethernet.localIP()[1], Ethernet.localIP()[2], Ethernet.localIP()[3]);
#else
#else // COMPILE_ETHERNET
0, 0, 0, 0);
#endif
#endif // COMPILE_ETHERNET

static uint8_t ipAddressPosition = 0;

Expand Down Expand Up @@ -2037,9 +2037,9 @@ void displayWiFiConfig()
snprintf(mySSID, sizeof(mySSID), "%s", "RTK Config");
else
snprintf(mySSID, sizeof(mySSID), "%s", WiFi.SSID().c_str());
#else
#else // COMPILE_WIFI
snprintf(mySSID, sizeof(mySSID), "%s", "!Compiled");
#endif
#endif // COMPILE_WIFI

char mySSIDFront[displayMaxCharacters + 1]; // 1 for null terminator
char mySSIDBack[displayMaxCharacters + 1]; // 1 for null terminator
Expand Down Expand Up @@ -2094,9 +2094,9 @@ void displayWiFiConfig()
else
printTextCenter(myIPBack, yPos, QW_FONT_5X7, 1, false);

#else
#else // COMPILE_AP
printTextCenter("!Compiled", yPos, QW_FONT_5X7, 1, false);
#endif
#endif // COMPILE_AP
}

// When user does a factory reset, let us know
Expand Down Expand Up @@ -3307,11 +3307,11 @@ void displayConfigViaEthernet()
oled.display();
}

#else
#else // COMPILE_ETHERNET
uint8_t fontHeight = 15;
uint8_t yPos = oled.getHeight() / 2 - fontHeight;
printTextCenter("!Compiled", yPos, QW_FONT_5X7, 1, false);
#endif
#endif // COMPILE_ETHERNET
}

const uint8_t *getMacAddress()
Expand All @@ -3321,14 +3321,14 @@ const uint8_t *getMacAddress()
#ifdef COMPILE_BT
if (bluetoothState != BT_OFF)
return btMACAddress;
#endif
#endif // COMPILE_BT
#ifdef COMPILE_WIFI
if (wifiState != WIFI_OFF)
return wifiMACAddress;
#endif
#endif // COMPILE_WIFI
#ifdef COMPILE_ETHERNET
if ((online.ethernetStatus >= ETH_STARTED_CHECK_CABLE) && (online.ethernetStatus <= ETH_CONNECTED))
return ethernetMACAddress;
#endif
#endif // COMPILE_ETHERNET
return zero;
}
26 changes: 13 additions & 13 deletions Firmware/RTK_Surveyor/ESPNOW.ino
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void espnowOnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status)
// else
// systemPrintln("Delivery Fail");
}
#endif
#endif // COMPILE_ESPNOW

// Callback when data is received
void espnowOnDataReceived(const uint8_t *mac, const uint8_t *incomingData, int len)
Expand Down Expand Up @@ -73,7 +73,7 @@ void espnowOnDataReceived(const uint8_t *mac, const uint8_t *incomingData, int l
espnowIncomingRTCM = true;
lastEspnowRssiUpdate = millis();
}
#endif
#endif // COMPILE_ESPNOW
}

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

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

systemPrintln("ESP-Now Started");
#endif
#endif // COMPILE_ESPNOW
}

// If WiFi is already enabled, simply remove the LR protocol
Expand Down Expand Up @@ -247,7 +247,7 @@ void espnowStop()
wifiStart(); // Force WiFi to restart
}

#endif
#endif // COMPILE_ESPNOW
}

// Start ESP-Now if needed, put ESP-Now into broadcast state
Expand Down Expand Up @@ -300,7 +300,7 @@ bool espnowIsPaired()
espnowSetState(ESPNOW_PAIRED);
return (true);
}
#endif
#endif // COMPILE_ESPNOW
return (false);
}

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

return (esp_now_send(sendToMac, (uint8_t *)&pairMessage, sizeof(pairMessage))); // Send packet to given MAC
#else
#else // COMPILE_ESPNOW
return (ESP_OK);
#endif
#endif // COMPILE_ESPNOW
}

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

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

return (response);
#else
#else // COMPILE_ESPNOW
return (ESP_OK);
#endif
#endif // COMPILE_ESPNOW
}

// Update the state of the ESP Now state machine
Expand Down Expand Up @@ -428,7 +428,7 @@ void espnowProcessRTCM(byte incoming)
espnowOutgoingRTCM = true;
}
}
#endif
#endif // COMPILE_ESPNOW
}

// A blocking function that is used to pair two devices
Expand Down
Loading