@@ -71,8 +71,8 @@ MQTT_Client.ino
71
71
// (ditto)
72
72
// Initially we subscribe to the key distribution topic and the continental correction topic (if available)
73
73
// If enabled, we also subscribe to the AssistNow MGA topic
74
- // If localised distribution is enabled and we have a 3D fix, we subscribe to the dict topic
75
- // When the dict is received, we subscribe to the nearest localised topic and unsubscribe from the continental topic
74
+ // If localized distribution is enabled and we have a 3D fix, we subscribe to the dict topic
75
+ // When the dict is received, we subscribe to the nearest localized topic and unsubscribe from the continental topic
76
76
// When the AssistNow MGA data arrives, we unsubscribe and subscribe to AssistNow updates
77
77
78
78
#ifdef COMPILE_MQTT_CLIENT
@@ -124,8 +124,8 @@ const char localizedPrefix[] = "pp/ip/L"; // The localized distribution topic pr
124
124
std::vector<String> mqttSubscribeTopics; // List of MQTT topics to be subscribed to
125
125
std::vector<String> mqttClientSubscribedTopics; // List of topics currently subscribed to
126
126
127
- String localisedDistributionDictTopic = " " ;
128
- String localisedDistributionTileTopic = " " ;
127
+ String localizedDistributionDictTopic = " " ;
128
+ String localizedDistributionTileTopic = " " ;
129
129
130
130
static MqttClient *mqttClient;
131
131
@@ -289,7 +289,7 @@ void mqttClientPrintStatus()
289
289
// Called when a subscribed message arrives
290
290
void mqttClientReceiveMessage (int messageSize)
291
291
{
292
- // The Level 3 localised distribution dictionary topic can be up to 25KB
292
+ // The Level 3 localized distribution dictionary topic can be up to 25KB
293
293
// The full AssistNow (MGA) topic can be ~11KB
294
294
const uint16_t mqttLimit = 26000 ;
295
295
static uint8_t *mqttData = nullptr ;
@@ -327,9 +327,9 @@ void mqttClientReceiveMessage(int messageSize)
327
327
328
328
if (mqttCount > 0 )
329
329
{
330
- // Check for localisedDistributionDictTopic
331
- if ((localisedDistributionDictTopic .length () > 0 )
332
- && (strcmp (topic, localisedDistributionDictTopic .c_str ()) == 0 ))
330
+ // Check for localizedDistributionDictTopic
331
+ if ((localizedDistributionDictTopic .length () > 0 )
332
+ && (strcmp (topic, localizedDistributionDictTopic .c_str ()) == 0 ))
333
333
{
334
334
// We should be using a JSON library to read the nodes. But JSON is
335
335
// heavy on RAM and the dict could be 25KB for Level 3.
@@ -381,9 +381,9 @@ void mqttClientReceiveMessage(int messageSize)
381
381
minDist = distScaled;
382
382
tile[12 ] = 0 ; // Convert the second quote to NULL for snprintf
383
383
char tileTopic[50 ];
384
- snprintf (tileTopic, sizeof (tileTopic), " %s" , localisedDistributionDictTopic .c_str ());
384
+ snprintf (tileTopic, sizeof (tileTopic), " %s" , localizedDistributionDictTopic .c_str ());
385
385
snprintf (&tileTopic[strlen (localizedPrefix) + 13 ], sizeof (tileTopic) - (strlen (localizedPrefix) + 13 ), " %s" , tile + 1 ); // Start after the first quote
386
- localisedDistributionTileTopic = tileTopic;
386
+ localizedDistributionTileTopic = tileTopic;
387
387
}
388
388
}
389
389
tile = strtok_r (nullptr , " ," , &preservedTile);
@@ -474,9 +474,9 @@ void mqttClientReceiveMessage(int messageSize)
474
474
((strlen (settings.regionalCorrectionTopics [settings.geographicRegion ]) > 0 )
475
475
&& (strcmp (topic, settings.regionalCorrectionTopics [settings.geographicRegion ]) == 0 ))
476
476
||
477
- // Or from the localised distribution tile topic
478
- ((localisedDistributionTileTopic .length () > 0 )
479
- && (strcmp (topic, localisedDistributionTileTopic .c_str ()) == 0 ))
477
+ // Or from the localized distribution tile topic
478
+ ((localizedDistributionTileTopic .length () > 0 )
479
+ && (strcmp (topic, localizedDistributionTileTopic .c_str ()) == 0 ))
480
480
)
481
481
{
482
482
// SPARTN
@@ -830,8 +830,8 @@ void mqttClientUpdate()
830
830
831
831
mqttSubscribeTopics.clear (); // Clear the list of MQTT topics to be subscribed to
832
832
mqttClientSubscribedTopics.clear (); // Clear the list of topics currently subscribed to
833
- localisedDistributionDictTopic = " " ;
834
- localisedDistributionTileTopic = " " ;
833
+ localizedDistributionDictTopic = " " ;
834
+ localizedDistributionTileTopic = " " ;
835
835
836
836
// Subscribe to AssistNow MGA if enabled
837
837
if (settings.useAssistNow )
@@ -936,21 +936,21 @@ void mqttClientUpdate()
936
936
if (breakOut)
937
937
break ; // Break out of this state
938
938
939
- // Check if localised distribution is enabled
940
- if ((strlen (settings.regionalCorrectionTopics [settings.geographicRegion ]) > 0 ) && (settings.useLocalisedDistribution ))
939
+ // Check if localized distribution is enabled
940
+ if ((strlen (settings.regionalCorrectionTopics [settings.geographicRegion ]) > 0 ) && (settings.useLocalizedDistribution ))
941
941
{
942
942
uint8_t fixType = gnssGetFixType ();
943
943
double latitude = gnssGetLatitude (); // degrees
944
944
double longitude = gnssGetLongitude (); // degrees
945
945
if (fixType >= 3 ) // If we have a 3D fix
946
946
{
947
947
// If both the dict and tile topics are empty, prepare to subscribe to the dict topic
948
- if ((localisedDistributionDictTopic .length () == 0 ) && (localisedDistributionTileTopic .length () == 0 ))
948
+ if ((localizedDistributionDictTopic .length () == 0 ) && (localizedDistributionTileTopic .length () == 0 ))
949
949
{
950
950
float tileDelta = 2.5 ; // 2.5 degrees (10 degrees and 5 degrees are also possible)
951
- if ((settings.localisedDistributionTileLevel == 0 ) || (settings.localisedDistributionTileLevel == 3 ))
951
+ if ((settings.localizedDistributionTileLevel == 0 ) || (settings.localizedDistributionTileLevel == 3 ))
952
952
tileDelta = 10.0 ;
953
- if ((settings.localisedDistributionTileLevel == 1 ) || (settings.localisedDistributionTileLevel == 4 ))
953
+ if ((settings.localizedDistributionTileLevel == 1 ) || (settings.localizedDistributionTileLevel == 4 ))
954
954
tileDelta = 5.0 ;
955
955
956
956
float lat = latitude; // Degrees
@@ -965,34 +965,34 @@ void mqttClientUpdate()
965
965
966
966
char dictTopic[50 ];
967
967
snprintf (dictTopic, sizeof (dictTopic), " %s%c%c%04d%c%05d/dict" ,
968
- localizedPrefix, char (0x30 + settings.localisedDistributionTileLevel ),
968
+ localizedPrefix, char (0x30 + settings.localizedDistributionTileLevel ),
969
969
(lat_i < 0 ) ? ' S' : ' N' , abs (lat_i),
970
970
(lon_i < 0 ) ? ' W' : ' E' , abs (lon_i));
971
971
972
972
973
- localisedDistributionDictTopic = dictTopic;
974
- mqttSubscribeTopics.push_back (localisedDistributionDictTopic );
973
+ localizedDistributionDictTopic = dictTopic;
974
+ mqttSubscribeTopics.push_back (localizedDistributionDictTopic );
975
975
976
976
breakOut = true ;
977
977
}
978
978
979
- // localisedDistributionTileTopic is populated by mqttClientReceiveMessage
980
- // If both the dict and tile topics are populated, prepare to subscribe to the localised tile topic
981
- // Empty localisedDistributionDictTopic afterwardds to prevent this state being repeated
982
- if ((localisedDistributionDictTopic .length () > 0 ) && (localisedDistributionTileTopic .length () > 0 ))
979
+ // localizedDistributionTileTopic is populated by mqttClientReceiveMessage
980
+ // If both the dict and tile topics are populated, prepare to subscribe to the localized tile topic
981
+ // Empty localizedDistributionDictTopic afterwardds to prevent this state being repeated
982
+ if ((localizedDistributionDictTopic .length () > 0 ) && (localizedDistributionTileTopic .length () > 0 ))
983
983
{
984
- // Subscribe to the localisedDistributionTileTopic
985
- mqttSubscribeTopics.push_back (localisedDistributionTileTopic );
986
- // Unsubscribe from the localisedDistributionDictTopic
987
- std::vector<String>::iterator pos = std::find (mqttSubscribeTopics.begin (), mqttSubscribeTopics.end (), localisedDistributionDictTopic );
984
+ // Subscribe to the localizedDistributionTileTopic
985
+ mqttSubscribeTopics.push_back (localizedDistributionTileTopic );
986
+ // Unsubscribe from the localizedDistributionDictTopic
987
+ std::vector<String>::iterator pos = std::find (mqttSubscribeTopics.begin (), mqttSubscribeTopics.end (), localizedDistributionDictTopic );
988
988
if (pos != mqttSubscribeTopics.end ())
989
989
mqttSubscribeTopics.erase (pos);
990
990
// Unsubscribe from the continental corrections
991
991
pos = std::find (mqttSubscribeTopics.begin (), mqttSubscribeTopics.end (), String (settings.regionalCorrectionTopics [settings.geographicRegion ]));
992
992
if (pos != mqttSubscribeTopics.end ())
993
993
mqttSubscribeTopics.erase (pos);
994
994
995
- localisedDistributionDictTopic = " " ; // Empty localisedDistributionDictTopic to prevent this state being repeated
995
+ localizedDistributionDictTopic = " " ; // Empty localizedDistributionDictTopic to prevent this state being repeated
996
996
breakOut = true ;
997
997
}
998
998
0 commit comments