Skip to content

Commit 49246c9

Browse files
committed
Whitespace
1 parent 2162167 commit 49246c9

File tree

2 files changed

+308
-505
lines changed

2 files changed

+308
-505
lines changed

Firmware/RTK_Everywhere/Network.ino

Lines changed: 50 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,10 @@ Network.ino
103103
// Constants
104104
//----------------------------------------
105105

106-
static const char * networkConsumerTable[] =
107-
{
108-
"HTTP_CLIENT",
109-
"NTP_SERVER",
110-
"NTRIP_CLIENT",
111-
"NTRIP_SERVER_0",
112-
"NTRIP_SERVER_1",
113-
"NTRIP_SERVER_2",
114-
"NTRIP_SERVER_3",
115-
"OTA_CLIENT",
116-
"PPL_KEY_UPDATE",
117-
"PPL_MQTT_CLIENT",
118-
"TCP_CLIENT",
119-
"TCP_SERVER",
120-
"UDP_SERVER",
121-
"WEB_CONFIG",
106+
static const char *networkConsumerTable[] = {
107+
"HTTP_CLIENT", "NTP_SERVER", "NTRIP_CLIENT", "NTRIP_SERVER_0", "NTRIP_SERVER_1",
108+
"NTRIP_SERVER_2", "NTRIP_SERVER_3", "OTA_CLIENT", "PPL_KEY_UPDATE", "PPL_MQTT_CLIENT",
109+
"TCP_CLIENT", "TCP_SERVER", "UDP_SERVER", "WEB_CONFIG",
122110
};
123111

124112
static const int networkConsumerTableEntries = sizeof(networkConsumerTable) / sizeof(networkConsumerTable[0]);
@@ -128,8 +116,8 @@ static const int networkConsumerTableEntries = sizeof(networkConsumerTable) / si
128116
//----------------------------------------
129117

130118
NETCONSUMER_MASK_t netIfConsumers[NETWORK_MAX]; // Consumers of a specific network
131-
NETCONSUMER_MASK_t networkConsumersAny; // Consumers of any network
132-
NETCONSUMER_MASK_t networkSoftApConsumer; // Consumers of soft AP
119+
NETCONSUMER_MASK_t networkConsumersAny; // Consumers of any network
120+
NETCONSUMER_MASK_t networkSoftApConsumer; // Consumers of soft AP
133121

134122
// Priority of the network when last checked by the consumer
135123
// Index by consumer ID
@@ -173,7 +161,7 @@ NetMask_t networkStarted; // Track the running networks
173161
NETWORK_POLL_SEQUENCE *networkSequence[NETWORK_OFFLINE];
174162

175163
NetMask_t networkMdnsRequests; // Non-zero when one or more interfaces request mDNS
176-
NetMask_t networkMdnsRunning; // Non-zero when mDNS is running
164+
NetMask_t networkMdnsRunning; // Non-zero when mDNS is running
177165

178166
//----------------------------------------
179167
// Menu for configuring TCP/UDP interfaces
@@ -380,8 +368,8 @@ bool networkChanged(NETCONSUMER_t consumer)
380368
networkConsumerValidate(consumer);
381369

382370
// Determine if the network interface has changed
383-
changed = (networkConsumerPriority[consumer] != NETWORK_OFFLINE)
384-
&& (networkConsumerPriority[consumer] != networkConsumerPriorityLast[consumer]);
371+
changed = (networkConsumerPriority[consumer] != NETWORK_OFFLINE) &&
372+
(networkConsumerPriority[consumer] != networkConsumerPriorityLast[consumer]);
385373

386374
// Remember the new network
387375
if (changed)
@@ -392,16 +380,13 @@ bool networkChanged(NETCONSUMER_t consumer)
392380
//----------------------------------------
393381
// Add a network consumer
394382
//----------------------------------------
395-
void networkConsumerAdd(NETCONSUMER_t consumer,
396-
NetIndex_t network,
397-
const char * fileName,
398-
uint32_t lineNumber)
383+
void networkConsumerAdd(NETCONSUMER_t consumer, NetIndex_t network, const char *fileName, uint32_t lineNumber)
399384
{
400385
NETCONSUMER_MASK_t bitMask;
401-
NETCONSUMER_MASK_t * bits;
386+
NETCONSUMER_MASK_t *bits;
402387
NETCONSUMER_MASK_t consumers;
403388
NetIndex_t index;
404-
const char * networkName;
389+
const char *networkName;
405390
NETCONSUMER_MASK_t previousBits;
406391
NetPriority_t priority;
407392

@@ -486,8 +471,7 @@ void networkConsumerAdd(NETCONSUMER_t consumer,
486471
}
487472
else
488473
{
489-
systemPrintf("Network consumer %s added more than once\r\n",
490-
networkConsumerTable[consumer]);
474+
systemPrintf("Network consumer %s added more than once\r\n", networkConsumerTable[consumer]);
491475
reportFatalError("Network consumer added more than once!");
492476
}
493477
}
@@ -598,9 +582,7 @@ void networkConsumerOffline(NETCONSUMER_t consumer)
598582
//----------------------------------------
599583
// Print the list of consumers
600584
//----------------------------------------
601-
void networkConsumerPrint(NETCONSUMER_MASK_t consumers,
602-
NETCONSUMER_MASK_t users,
603-
const char * separation)
585+
void networkConsumerPrint(NETCONSUMER_MASK_t consumers, NETCONSUMER_MASK_t users, const char *separation)
604586
{
605587
NETCONSUMER_MASK_t consumerMask;
606588

@@ -609,7 +591,7 @@ void networkConsumerPrint(NETCONSUMER_MASK_t consumers,
609591
consumerMask = 1 << consumer;
610592
if (consumers & consumerMask)
611593
{
612-
const char * active = (users & consumerMask) ? "*" : "";
594+
const char *active = (users & consumerMask) ? "*" : "";
613595
systemPrintf("%s%s%s", separation, active, networkConsumerTable[consumer]);
614596
separation = ", ";
615597
}
@@ -627,8 +609,7 @@ void networkConsumerReconnect(NetIndex_t index)
627609

628610
// Determine the consumers of the network
629611
consumers = netIfConsumers[index];
630-
if ((networkPriority < NETWORK_OFFLINE)
631-
&& (networkIndexTable[networkPriority] == index))
612+
if ((networkPriority < NETWORK_OFFLINE) && (networkIndexTable[networkPriority] == index))
632613
{
633614
consumers |= networkConsumersAny;
634615
}
@@ -645,16 +626,13 @@ void networkConsumerReconnect(NetIndex_t index)
645626
//----------------------------------------
646627
// Remove a network consumer
647628
//----------------------------------------
648-
void networkConsumerRemove(NETCONSUMER_t consumer,
649-
NetIndex_t network,
650-
const char * fileName,
651-
uint32_t lineNumber)
629+
void networkConsumerRemove(NETCONSUMER_t consumer, NetIndex_t network, const char *fileName, uint32_t lineNumber)
652630
{
653631
NETCONSUMER_MASK_t bitMask;
654-
NETCONSUMER_MASK_t * bits;
632+
NETCONSUMER_MASK_t *bits;
655633
NETCONSUMER_MASK_t consumers;
656634
NetIndex_t index;
657-
const char * networkName;
635+
const char *networkName;
658636
NETCONSUMER_MASK_t previousBits;
659637
int priority;
660638

@@ -1135,9 +1113,7 @@ void networkInterfaceEventInternetAvailable(NetIndex_t index)
11351113
//----------------------------------------
11361114
// Internet lost event
11371115
//----------------------------------------
1138-
void networkInterfaceEventInternetLost(NetIndex_t index,
1139-
const char * fileName,
1140-
uint32_t lineNumber)
1116+
void networkInterfaceEventInternetLost(NetIndex_t index, const char *fileName, uint32_t lineNumber)
11411117
{
11421118
// Validate the index
11431119
networkValidateIndex(index);
@@ -1597,8 +1573,7 @@ void networkPrintStatus(uint8_t priority)
15971573
}
15981574

15991575
// Print the network interface status
1600-
systemPrintf("%c%d: %-10s %s",
1601-
highestPriority ? '*' : ' ', priority, name, status);
1576+
systemPrintf("%c%d: %-10s %s", highestPriority ? '*' : ' ', priority, name, status);
16021577

16031578
// Display more data about the highest priority network
16041579
if (highestPriority)
@@ -1660,10 +1635,7 @@ void networkSequenceBoot(NetIndex_t index)
16601635
//----------------------------------------
16611636
// Exit the sequence by force
16621637
//----------------------------------------
1663-
void networkSequenceExit(NetIndex_t index,
1664-
bool debug,
1665-
const char * fileName,
1666-
uint32_t lineNumber)
1638+
void networkSequenceExit(NetIndex_t index, bool debug, const char *fileName, uint32_t lineNumber)
16671639
{
16681640
// Display the call
16691641
if (settings.debugNetworkLayer)
@@ -1733,10 +1705,7 @@ void networkSequenceNextEntry(NetIndex_t index, bool debug)
17331705
//----------------------------------------
17341706
// Attempt to start the start sequence
17351707
//----------------------------------------
1736-
void networkSequenceStart(NetIndex_t index,
1737-
bool debug,
1738-
const char * fileName,
1739-
uint32_t lineNumber)
1708+
void networkSequenceStart(NetIndex_t index, bool debug, const char *fileName, uint32_t lineNumber)
17401709
{
17411710
NetMask_t bitMask;
17421711
const char *description;
@@ -1820,10 +1789,7 @@ void networkSequenceStart(NetIndex_t index,
18201789
//----------------------------------------
18211790
// Start the stop sequence
18221791
//----------------------------------------
1823-
void networkSequenceStop(NetIndex_t index,
1824-
bool debug,
1825-
const char * fileName,
1826-
uint32_t lineNumber)
1792+
void networkSequenceStop(NetIndex_t index, bool debug, const char *fileName, uint32_t lineNumber)
18271793
{
18281794
NetMask_t bitMask;
18291795
const char *description;
@@ -1906,10 +1872,7 @@ void networkSequenceStop(NetIndex_t index,
19061872
//----------------------------------------
19071873
// Stop the polling sequence
19081874
//----------------------------------------
1909-
void networkSequenceStopPolling(NetIndex_t index,
1910-
bool debug,
1911-
bool forcedStop,
1912-
const char * fileName,
1875+
void networkSequenceStopPolling(NetIndex_t index, bool debug, bool forcedStop, const char *fileName,
19131876
uint32_t lineNumber)
19141877
{
19151878
NetMask_t bitMask;
@@ -1920,12 +1883,10 @@ void networkSequenceStopPolling(NetIndex_t index,
19201883

19211884
// Display the call
19221885
if (settings.debugNetworkLayer)
1923-
systemPrintf("Network: Calling networkSequenceStopPolling(%s, debug: %s, forcedStop: %s) from %s at line %d\r\n",
1924-
networkInterfaceTable[index].name,
1925-
debug ? "true" : "false",
1926-
forcedStop ? "true" : "false",
1927-
fileName,
1928-
lineNumber);
1886+
systemPrintf(
1887+
"Network: Calling networkSequenceStopPolling(%s, debug: %s, forcedStop: %s) from %s at line %d\r\n",
1888+
networkInterfaceTable[index].name, debug ? "true" : "false", forcedStop ? "true" : "false", fileName,
1889+
lineNumber);
19291890

19301891
// Stop the polling for this sequence
19311892
networkSequence[index] = nullptr;
@@ -1999,9 +1960,7 @@ void networkSequenceStopPolling(NetIndex_t index,
19991960
//----------------------------------------
20001961
// Add a soft AP consumer
20011962
//----------------------------------------
2002-
void networkSoftApConsumerAdd(NETCONSUMER_t consumer,
2003-
const char * fileName,
2004-
uint32_t lineNumber)
1963+
void networkSoftApConsumerAdd(NETCONSUMER_t consumer, const char *fileName, uint32_t lineNumber)
20051964
{
20061965
NETCONSUMER_MASK_t bitMask;
20071966
NetIndex_t index;
@@ -2012,8 +1971,7 @@ void networkSoftApConsumerAdd(NETCONSUMER_t consumer,
20121971

20131972
// Display the call
20141973
if (settings.debugNetworkLayer)
2015-
systemPrintf("Network: Calling networkSoftApConsumerAdd from %s at line %d\r\n",
2016-
fileName, lineNumber);
1974+
systemPrintf("Network: Calling networkSoftApConsumerAdd from %s at line %d\r\n", fileName, lineNumber);
20171975

20181976
// Add this consumer only once
20191977
bitMask = 1 << consumer;
@@ -2041,8 +1999,7 @@ void networkSoftApConsumerAdd(NETCONSUMER_t consumer,
20411999
}
20422000
else
20432001
{
2044-
systemPrintf("Network: Soft AP consumer %s added more than once!\r\n",
2045-
networkConsumerTable[consumer]);
2002+
systemPrintf("Network: Soft AP consumer %s added more than once!\r\n", networkConsumerTable[consumer]);
20462003
reportFatalError("Network: Soft AP consumer added more than once!");
20472004
}
20482005
}
@@ -2068,7 +2025,7 @@ void networkSoftApConsumerDisplay()
20682025
//----------------------------------------
20692026
// Print the soft AP consumers
20702027
//----------------------------------------
2071-
void networkSoftApConsumerPrint(const char * separator)
2028+
void networkSoftApConsumerPrint(const char *separator)
20722029
{
20732030
NETCONSUMER_MASK_t consumerMask;
20742031

@@ -2087,9 +2044,7 @@ void networkSoftApConsumerPrint(const char * separator)
20872044
//----------------------------------------
20882045
// Remove a soft AP consumer
20892046
//----------------------------------------
2090-
void networkSoftApConsumerRemove(NETCONSUMER_t consumer,
2091-
const char * fileName,
2092-
uint32_t lineNumber)
2047+
void networkSoftApConsumerRemove(NETCONSUMER_t consumer, const char *fileName, uint32_t lineNumber)
20932048
{
20942049
NETCONSUMER_MASK_t bitMask;
20952050
NetIndex_t index;
@@ -2100,8 +2055,7 @@ void networkSoftApConsumerRemove(NETCONSUMER_t consumer,
21002055

21012056
// Display the call
21022057
if (settings.debugNetworkLayer)
2103-
systemPrintf("Network: Calling networkSoftApConsumerRemove from %s at line %d\r\n",
2104-
fileName, lineNumber);
2058+
systemPrintf("Network: Calling networkSoftApConsumerRemove from %s at line %d\r\n", fileName, lineNumber);
21052059

21062060
// Remove the consumer only once
21072061
bitMask = 1 << consumer;
@@ -2138,10 +2092,7 @@ void networkSoftApConsumerRemove(NETCONSUMER_t consumer,
21382092
//----------------------------------------
21392093
// Start a network interface
21402094
//----------------------------------------
2141-
void networkStart(NetIndex_t index,
2142-
bool debug,
2143-
const char * fileName,
2144-
uint32_t lineNumber)
2095+
void networkStart(NetIndex_t index, bool debug, const char *fileName, uint32_t lineNumber)
21452096
{
21462097
NETCONSUMER_MASK_t consumers;
21472098

@@ -2152,8 +2103,8 @@ void networkStart(NetIndex_t index,
21522103
if (settings.debugNetworkLayer)
21532104
{
21542105
networkDisplayStatus();
2155-
systemPrintf("Network: Calling networkStart(%s) from %s at line %d\r\n",
2156-
networkInterfaceTable[index].name, fileName, lineNumber);
2106+
systemPrintf("Network: Calling networkStart(%s) from %s at line %d\r\n", networkInterfaceTable[index].name,
2107+
fileName, lineNumber);
21572108
}
21582109

21592110
// Only start networks that exist on the platform
@@ -2219,10 +2170,7 @@ void networkStartNextInterface(NetIndex_t index)
22192170
//----------------------------------------
22202171
// Stop a network interface
22212172
//----------------------------------------
2222-
void networkStop(NetIndex_t index,
2223-
bool debug,
2224-
const char * fileName,
2225-
uint32_t lineNumber)
2173+
void networkStop(NetIndex_t index, bool debug, const char *fileName, uint32_t lineNumber)
22262174
{
22272175
NetMask_t bitMask;
22282176

@@ -2232,8 +2180,8 @@ void networkStop(NetIndex_t index,
22322180
// Display the call
22332181
if (settings.debugNetworkLayer)
22342182
{
2235-
systemPrintf("Network: Calling networkStop(%s) from %s at line %d\r\n",
2236-
networkInterfaceTable[index].name, fileName, lineNumber);
2183+
systemPrintf("Network: Calling networkStop(%s) from %s at line %d\r\n", networkInterfaceTable[index].name,
2184+
fileName, lineNumber);
22372185
networkDisplayStatus();
22382186
}
22392187

@@ -2427,14 +2375,11 @@ void networkUpdate()
24272375

24282376
// Display the IP address of the highest priority network
24292377
index = networkPriorityTable[networkPriority];
2430-
if ((index < NETWORK_OFFLINE)
2431-
&& networkInterfaceHasInternet(index)
2432-
&& networkInterfaceTable[index].netif->hasIP())
2378+
if ((index < NETWORK_OFFLINE) && networkInterfaceHasInternet(index) &&
2379+
networkInterfaceTable[index].netif->hasIP())
24332380
{
24342381
ipAddress = networkInterfaceTable[index].netif->localIP();
2435-
systemPrintf("%s: %s%s\r\n",
2436-
networkInterfaceTable[index].name,
2437-
ipAddress.toString().c_str(),
2382+
systemPrintf("%s: %s%s\r\n", networkInterfaceTable[index].name, ipAddress.toString().c_str(),
24382383
networkInterfaceTable[index].netif->isDefault() ? " (default)" : "");
24392384
}
24402385
else
@@ -2468,18 +2413,16 @@ void networkUpdate()
24682413
//----------------------------------------
24692414
// Add a network user
24702415
//----------------------------------------
2471-
void networkUserAdd(NETCONSUMER_t consumer,
2472-
const char * fileName,
2473-
uint32_t lineNumber)
2416+
void networkUserAdd(NETCONSUMER_t consumer, const char *fileName, uint32_t lineNumber)
24742417
{
24752418
NetIndex_t index;
24762419
NETCONSUMER_MASK_t mask;
24772420

24782421
// Validate the consumer
24792422
networkConsumerValidate(consumer);
24802423
if (settings.debugNetworkLayer)
2481-
systemPrintf("Network: Calling networkUserAdd(%s) from %s at line %d\r\n",
2482-
networkConsumerTable[consumer], fileName, lineNumber);
2424+
systemPrintf("Network: Calling networkUserAdd(%s) from %s at line %d\r\n", networkConsumerTable[consumer],
2425+
fileName, lineNumber);
24832426

24842427
// Convert the priority into a network interface index
24852428
index = networkIndexTable[networkPriority];
@@ -2536,18 +2479,16 @@ void networkUserDisplay(NetIndex_t index)
25362479
//----------------------------------------
25372480
// Remove a network user
25382481
//----------------------------------------
2539-
void networkUserRemove(NETCONSUMER_t consumer,
2540-
const char * fileName,
2541-
uint32_t lineNumber)
2482+
void networkUserRemove(NETCONSUMER_t consumer, const char *fileName, uint32_t lineNumber)
25422483
{
25432484
NetIndex_t index;
25442485
NETCONSUMER_MASK_t mask;
25452486

25462487
// Validate the consumer
25472488
networkConsumerValidate(consumer);
25482489
if (settings.debugNetworkLayer)
2549-
systemPrintf("Network: Calling networkUserRemove(%s) from %s at line %d\r\n",
2550-
networkConsumerTable[consumer], fileName, lineNumber);
2490+
systemPrintf("Network: Calling networkUserRemove(%s) from %s at line %d\r\n", networkConsumerTable[consumer],
2491+
fileName, lineNumber);
25512492

25522493
// Convert the priority into a network interface index
25532494
index = networkConsumerIndexLast[consumer];

0 commit comments

Comments
 (0)