Skip to content

Commit

Permalink
Whitespace changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nseidle committed May 23, 2024
1 parent f977f36 commit da2942f
Show file tree
Hide file tree
Showing 26 changed files with 1,250 additions and 1,254 deletions.
3 changes: 2 additions & 1 deletion Firmware/RTK_Everywhere/Begin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,8 @@ void beginGnssUart()

if (task.gnssUartPinnedTaskRunning == false)
{
task.gnssUartPinnedTaskRunning = true; // The xTaskCreate runs and completes nearly immediately. Mark start here and check for completion.
task.gnssUartPinnedTaskRunning = true; // The xTaskCreate runs and completes nearly immediately. Mark start
// here and check for completion.

xTaskCreatePinnedToCore(
pinGnssUartTask,
Expand Down
2 changes: 1 addition & 1 deletion Firmware/RTK_Everywhere/Buttons.ino
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void powerDown(bool displayInfo)

while (1)
{
//We should never get here but good to know if we do
// We should never get here but good to know if we do
systemPrintln("Device powered down");
delay(250);
}
Expand Down
24 changes: 15 additions & 9 deletions Firmware/RTK_Everywhere/Display.ino
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void displayUpdate()
oled->erase();

std::vector<iconPropertyBlinking> iconPropertyList; // List of icons to be displayed
iconPropertyList.clear(); // Redundant?
iconPropertyList.clear(); // Redundant?

switch (systemState)
{
Expand Down Expand Up @@ -959,8 +959,9 @@ void setESPNowIcon_TwoRadios(std::vector<iconPropertyBlinking> *iconList)
prop.icon = ESPNowSymbol2Left64x48;
else if (espnowRSSI >= -80)
prop.icon = ESPNowSymbol1Left64x48;
else //if (espnowRSSI > -255)
prop.icon = ESPNowSymbol0Left64x48; // Always show the synbol because we've got incoming or outgoing data
else // if (espnowRSSI > -255)
prop.icon =
ESPNowSymbol0Left64x48; // Always show the synbol because we've got incoming or outgoing data
iconList->push_back(prop);

// Share the spot. Determine if we need to indicate Up, or Down
Expand Down Expand Up @@ -1314,7 +1315,7 @@ void paintClock(std::vector<iconPropertyBlinking> *iconList, bool blinking)
{
// Animate icon to show system running. The 2* makes the blink correct
static uint8_t clockIconDisplayed = (2 * CLOCK_ICON_STATES) - 1;
clockIconDisplayed++; // Goto next icon
clockIconDisplayed++; // Goto next icon
clockIconDisplayed %= (2 * CLOCK_ICON_STATES); // Wrap

iconPropertyBlinking prop;
Expand Down Expand Up @@ -2274,10 +2275,12 @@ void paintProfile(uint8_t profileUnit)

if (profileNumber >= 0)
{
settings.updateGNSSSettings = true; // When this profile is loaded next, force system to update GNSS settings.
settings.updateGNSSSettings =
true; // When this profile is loaded next, force system to update GNSS settings.
recordSystemSettings(); // Before switching, we need to record the current settings to LittleFS and SD

recordProfileNumber((uint8_t)profileNumber); // Update internal settings with user's choice, mark unit for config update
recordProfileNumber(
(uint8_t)profileNumber); // Update internal settings with user's choice, mark unit for config update

log_d("Going to profile number %d from unit %d, name '%s'", profileNumber, profileUnit, profileName);

Expand Down Expand Up @@ -2472,15 +2475,17 @@ void paintDisplaySetup()

for (auto it = setupButtons.begin(); it != setupButtons.end(); it = std::next(it))
{
if (thisIsButton >= setupSelectedButton) // Should we display this button based on the global setupSelectedButton?
if (thisIsButton >=
setupSelectedButton) // Should we display this button based on the global setupSelectedButton?
{
if (printedButtons < maxButtons) // Do we have room to display it?
{
if (it->newState == STATE_PROFILE)
{
int nameWidth = ((present.display_type == DISPLAY_128x64) ? 17 : 9);
char miniProfileName[nameWidth] = {0};
snprintf(miniProfileName, sizeof(miniProfileName), "%d_%s", it->newProfile, it->name); // Prefix with index #
snprintf(miniProfileName, sizeof(miniProfileName), "%d_%s", it->newProfile,
it->name); // Prefix with index #
printTextCenter(miniProfileName, 12 * printedButtons, QW_FONT_8X16, 1, printedButtons == 0);
}
else
Expand Down Expand Up @@ -2550,7 +2555,8 @@ void printTextCenter(const char *text, uint8_t yPos, QwiicFont &fontType, uint8_
}

// Given text, and location, print text to the screen
void printTextAt(const char *text, uint8_t xPos, uint8_t yPos, QwiicFont &fontType, uint8_t kerning) // text, x, y, font type, kearning, inverted
void printTextAt(const char *text, uint8_t xPos, uint8_t yPos, QwiicFont &fontType,
uint8_t kerning) // text, x, y, font type, kearning, inverted
{
oled->setFont(fontType);
oled->setDrawMode(grROPXOR);
Expand Down
12 changes: 6 additions & 6 deletions Firmware/RTK_Everywhere/Form.ino
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ void createMessageList(String &returnText)
{
if (messageSupported(messageNumber) == true)
returnText += "ubxMessageRate_" + String(ubxMessages[messageNumber].msgTextName) + "," +
String(settings.ubxMessageRates[messageNumber]) + ",";
String(settings.ubxMessageRates[messageNumber]) + ",";
}
}

Expand All @@ -844,12 +844,12 @@ void createMessageList(String &returnText)
for (int messageNumber = 0; messageNumber < MAX_UM980_NMEA_MSG; messageNumber++)
{
returnText += "um980MessageRatesNMEA_" + String(umMessagesNMEA[messageNumber].msgTextName) + "," +
String(settings.um980MessageRatesNMEA[messageNumber]) + ",";
String(settings.um980MessageRatesNMEA[messageNumber]) + ",";
}
for (int messageNumber = 0; messageNumber < MAX_UM980_RTCM_MSG; messageNumber++)
{
returnText += "um980MessageRatesRTCMRover_" + String(umMessagesRTCM[messageNumber].msgTextName) + "," +
String(settings.um980MessageRatesRTCMRover[messageNumber]) + ",";
String(settings.um980MessageRatesRTCMRover[messageNumber]) + ",";
}
}

Expand All @@ -870,8 +870,8 @@ void createMessageListBase(String &returnText)
for (int messageNumber = 0; messageNumber < MAX_UBX_MSG_RTCM; messageNumber++)
{
if (messageSupported(firstRTCMRecord + messageNumber) == true)
returnText += "MessageRateBase_" + String(ubxMessages[messageNumber + firstRTCMRecord].msgTextName) + "," +
String(settings.ubxMessageRatesBase[messageNumber]) + ","; // UBX_RTCM_1074Base,4,
returnText += "MessageRateBase_" + String(ubxMessages[messageNumber + firstRTCMRecord].msgTextName) +
"," + String(settings.ubxMessageRatesBase[messageNumber]) + ","; // UBX_RTCM_1074Base,4,
}
}

Expand All @@ -880,7 +880,7 @@ void createMessageListBase(String &returnText)
for (int messageNumber = 0; messageNumber < MAX_UM980_RTCM_MSG; messageNumber++)
{
returnText += "MessageRatesRTCMBase_" + String(umMessagesRTCM[messageNumber].msgTextName) + "," +
String(settings.um980MessageRatesRTCMBase[messageNumber]) + ",";
String(settings.um980MessageRatesRTCMBase[messageNumber]) + ",";
}
}

Expand Down
22 changes: 11 additions & 11 deletions Firmware/RTK_Everywhere/MP2762A_Charger.ino
Original file line number Diff line number Diff line change
Expand Up @@ -149,21 +149,21 @@ void mp2762setFastChargeVoltageMv(uint16_t mVoltLevel)
mp2762writeRegister(MP2762A_PRECHARGE_THRESHOLD_OPTION, status);
}

//Given a bit field, and a startingBitValue
//Example: Battery voltage is bit 12.5mV per bit
// Given a bit field, and a startingBitValue
// Example: Battery voltage is bit 12.5mV per bit
float convertBitsToDoubler(uint16_t bitField, float startingBitValue)
{
float totalMv = 0;
for (int x = 0 ; x < 16 ; x++)
{
if (bitField & 0x0001)
totalMv += startingBitValue;
float totalMv = 0;
for (int x = 0; x < 16; x++)
{
if (bitField & 0x0001)
totalMv += startingBitValue;

bitField >>= 1;
bitField >>= 1;

startingBitValue *= 2;
}
return (totalMv);
startingBitValue *= 2;
}
return (totalMv);
}

// Reads from a given location
Expand Down
19 changes: 10 additions & 9 deletions Firmware/RTK_Everywhere/Network.ino
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ void networkDisplayIpAddress(uint8_t networkType)
{
strcpy(ipAddress, networkGetIpAddress(networkType).toString().c_str());
if (network->type == NETWORK_TYPE_WIFI)
systemPrintf("%s '%s' IP address: %s, RSSI: %d\r\n", networkName[network->type], wifiGetSsid(), ipAddress, wifiGetRssi());
systemPrintf("%s '%s' IP address: %s, RSSI: %d\r\n", networkName[network->type], wifiGetSsid(),
ipAddress, wifiGetRssi());
else
systemPrintf("%s IP address: %s\r\n", networkName[network->type], ipAddress);

Expand Down Expand Up @@ -810,7 +811,7 @@ void networkStart(uint8_t networkType)
//----------------------------------------
// Translate the network state into a string
//----------------------------------------
const char * networkStateToString(uint8_t state)
const char *networkStateToString(uint8_t state)
{
if (state >= networkStateEntries)
return "Unknown";
Expand Down Expand Up @@ -1025,7 +1026,7 @@ uint8_t networkTranslateNetworkType(uint8_t networkType, bool translateActive)
//----------------------------------------
// Translate type into a string
//----------------------------------------
const char * networkTypeToString(uint8_t type)
const char *networkTypeToString(uint8_t type)
{
if (type >= networkNameEntries)
return "Unknown";
Expand All @@ -1037,11 +1038,11 @@ const char * networkTypeToString(uint8_t type)
//----------------------------------------
void networkTypeUpdate(uint8_t networkType)
{
if(inWiFiConfigMode())
if (inWiFiConfigMode())
{
//Avoid the full network layer while in Browser Config Mode
// Avoid the full network layer while in Browser Config Mode
wifiUpdate();
return;
return;
}

char errorMsg[64];
Expand Down Expand Up @@ -1111,8 +1112,8 @@ void networkTypeUpdate(uint8_t networkType)
// Display the network type change
network->type = type;
if (settings.debugNetworkLayer && (network->type != network->requestedNetwork))
systemPrintf("networkTypeUpdate, network->type: %s --> %s\r\n", networkTypeToString(network->requestedNetwork),
networkName[network->type]);
systemPrintf("networkTypeUpdate, network->type: %s --> %s\r\n",
networkTypeToString(network->requestedNetwork), networkName[network->type]);
if (settings.debugNetworkLayer)
systemPrintf("networkTypeUpdate, network->requestedNetwork: %s --> %s\r\n",
networkName[network->requestedNetwork], networkTypeToString(network->type));
Expand Down Expand Up @@ -1364,7 +1365,7 @@ bool networkUserOpen(uint8_t user, uint8_t networkType)
//----------------------------------------
// Translate user into a string
//----------------------------------------
const char * networkUserToString(uint8_t userNumber)
const char *networkUserToString(uint8_t userNumber)
{
if (userNumber >= networkUserEntries)
return "Unknown";
Expand Down
46 changes: 17 additions & 29 deletions Firmware/RTK_Everywhere/NetworkUDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ extern uint8_t networkGetType(uint8_t user);
class NetworkUDP : public UDP
{
protected:

UDP * _udp; // Ethernet or WiFi udp
UDP *_udp; // Ethernet or WiFi udp
bool _friendClass;
uint8_t _networkType;

public:

//------------------------------
// Create the network client
//------------------------------
NetworkUDP(UDP * udp, uint8_t networkType)
NetworkUDP(UDP *udp, uint8_t networkType)
{
_friendClass = true;
_networkType = networkType;
Expand All @@ -34,9 +32,9 @@ class NetworkUDP : public UDP
#endif // COMPILE_ETHERNET
#if defined(COMPILE_WIFI)
_udp = new WiFiUDP;
#else // COMPILE_WIFI
_udp = nullptr;
#endif // COMPILE_WIFI
#else // COMPILE_WIFI
_udp = nullptr;
#endif // COMPILE_WIFI
};

//------------------------------
Expand All @@ -53,7 +51,6 @@ class NetworkUDP : public UDP
}
};


//------------------------------
// Determine if the network client was allocated
//------------------------------
Expand Down Expand Up @@ -110,7 +107,7 @@ class NetworkUDP : public UDP
// Read available data
//------------------------------

int read(unsigned char* buf, size_t length)
int read(unsigned char *buf, size_t length)
{
if (_udp)
return _udp->read(buf, length);
Expand All @@ -121,7 +118,7 @@ class NetworkUDP : public UDP
// Read available data
//------------------------------

int read(char* buf, size_t length)
int read(char *buf, size_t length)
{
if (_udp)
return _udp->read(buf, length);
Expand Down Expand Up @@ -186,7 +183,7 @@ class NetworkUDP : public UDP
// Begin a UDP packet
//------------------------------

int beginPacket(const char* host, uint16_t port)
int beginPacket(const char *host, uint16_t port)
{
if (_udp)
return _udp->beginPacket(host, port);
Expand Down Expand Up @@ -228,7 +225,7 @@ class NetworkUDP : public UDP
#if defined(COMPILE_WIFI)
if (_networkType == NETWORK_TYPE_WIFI)
return ((WiFiUDP *)_udp)->remoteIP();
#endif // COMPILE_WIFI
#endif // COMPILE_WIFI
return IPAddress((uint32_t)0);
}

Expand All @@ -245,12 +242,11 @@ class NetworkUDP : public UDP
#if defined(COMPILE_WIFI)
if (_networkType == NETWORK_TYPE_WIFI)
return ((WiFiUDP *)_udp)->remotePort();
#endif // COMPILE_WIFI
#endif // COMPILE_WIFI
return 0;
}

protected:

//------------------------------
// Declare the friend classes
//------------------------------
Expand All @@ -259,18 +255,14 @@ class NetworkUDP : public UDP
friend class NetworkWiFiUdp;
};

#ifdef COMPILE_ETHERNET
#ifdef COMPILE_ETHERNET
class NetworkEthernetUdp : public NetworkUDP
{
private:

EthernetUDP _udp;

public:

NetworkEthernetUdp(EthernetUDP& udp) :
_udp{udp},
NetworkUDP(&_udp, NETWORK_TYPE_ETHERNET)
NetworkEthernetUdp(EthernetUDP &udp) : _udp{udp}, NetworkUDP(&_udp, NETWORK_TYPE_ETHERNET)
{
}

Expand All @@ -279,20 +271,16 @@ class NetworkEthernetUdp : public NetworkUDP
this->~NetworkUDP();
}
};
#endif // COMPILE_ETHERNET
#endif // COMPILE_ETHERNET

#ifdef COMPILE_WIFI
#ifdef COMPILE_WIFI
class NetworkWiFiUdp : public NetworkUDP
{
private:

WiFiUDP _udp;

public:

NetworkWiFiUdp(WiFiUDP& udp) :
_udp{udp},
NetworkUDP(&_udp, NETWORK_TYPE_WIFI)
NetworkWiFiUdp(WiFiUDP &udp) : _udp{udp}, NetworkUDP(&_udp, NETWORK_TYPE_WIFI)
{
}

Expand All @@ -301,6 +289,6 @@ class NetworkWiFiUdp : public NetworkUDP
this->~NetworkUDP();
}
};
#endif // COMPILE_WIFI
#endif // COMPILE_WIFI

#endif // __NETWORK_CLIENT_H__
#endif // __NETWORK_CLIENT_H__
Loading

0 comments on commit da2942f

Please sign in to comment.