@@ -169,6 +169,12 @@ const int ntripServerStateNameEntries = sizeof(ntripServerStateName) / sizeof(nt
169
169
170
170
const RtkMode_t ntripServerMode = RTK_MODE_BASE_FIXED;
171
171
172
+ // ----------------------------------------
173
+ // Macros
174
+ // ----------------------------------------
175
+
176
+ #define NETWORK_CONSUMER (x ) (NETCONSUMER_NTRIP_SERVER + x)
177
+
172
178
// ----------------------------------------
173
179
// Locals
174
180
// ----------------------------------------
@@ -557,7 +563,7 @@ void ntripServerStart(int serverIndex)
557
563
systemPrintf (" NTRIP Server %d start\r\n " , serverIndex);
558
564
ntripServerStop (serverIndex, false );
559
565
if (ntripServerEnabled (serverIndex, nullptr ))
560
- networkConsumerAdd (NETCONSUMER_NTRIP_SERVER + serverIndex, NETWORK_ANY, __FILE__, __LINE__);
566
+ networkConsumerAdd (NETWORK_CONSUMER ( serverIndex) , NETWORK_ANY, __FILE__, __LINE__);
561
567
}
562
568
563
569
// ----------------------------------------
@@ -588,7 +594,7 @@ void ntripServerStop(int serverIndex, bool shutdown)
588
594
589
595
// Determine the next NTRIP server state
590
596
online.ntripServer [serverIndex] = false ;
591
- networkConsumerOffline (NETCONSUMER_NTRIP_SERVER + serverIndex);
597
+ networkConsumerOffline (NETWORK_CONSUMER ( serverIndex) );
592
598
if (shutdown)
593
599
{
594
600
if (settings.debugNtripServerState )
@@ -599,7 +605,7 @@ void ntripServerStop(int serverIndex, bool shutdown)
599
605
systemPrintf (" NTRIP Server %d caster port not configured!\r\n " , serverIndex);
600
606
if (settings.debugNtripServerState && (!settings.ntripServer_MountPoint [serverIndex][0 ]))
601
607
systemPrintf (" NTRIP Server %d mount point not configured!\r\n " , serverIndex);
602
- networkConsumerRemove (NETCONSUMER_NTRIP_SERVER + serverIndex, NETWORK_ANY, __FILE__, __LINE__);
608
+ networkConsumerRemove (NETWORK_CONSUMER ( serverIndex) , NETWORK_ANY, __FILE__, __LINE__);
603
609
ntripServerSetState (ntripServer, NTRIP_SERVER_OFF);
604
610
ntripServer->connectionAttempts = 0 ;
605
611
ntripServer->connectionAttemptTimeout = 0 ;
@@ -635,7 +641,7 @@ void ntripServerUpdate(int serverIndex)
635
641
636
642
// Shutdown the NTRIP server when the mode or setting changes
637
643
DMW_ds (ntripServerSetState, ntripServer);
638
- connected = networkConsumerIsConnected (NETCONSUMER_NTRIP_SERVER + serverIndex);
644
+ connected = networkConsumerIsConnected (NETWORK_CONSUMER ( serverIndex) );
639
645
enabled = ntripServerEnabled (serverIndex, &line);
640
646
if (!enabled && (ntripServer->state > NTRIP_SERVER_OFF))
641
647
ntripServerShutdown (serverIndex);
@@ -676,14 +682,14 @@ void ntripServerUpdate(int serverIndex)
676
682
reportHeapNow (settings.debugNtripServerState );
677
683
678
684
// Reset the timeout when the network changes
679
- if (networkChanged (NETCONSUMER_NTRIP_SERVER + serverIndex))
685
+ if (networkChanged (NETWORK_CONSUMER ( serverIndex) ))
680
686
{
681
687
ntripServer->connectionAttempts = 0 ;
682
688
ntripServer->connectionAttemptTimeout = 0 ;
683
689
}
684
690
685
691
// The network is available for the NTRIP server
686
- networkUserAdd (NETCONSUMER_NTRIP_SERVER + serverIndex, __FILE__, __LINE__);
692
+ networkUserAdd (NETWORK_CONSUMER ( serverIndex) , __FILE__, __LINE__);
687
693
ntripServerSetState (ntripServer, NTRIP_SERVER_NETWORK_CONNECTED);
688
694
}
689
695
}
0 commit comments