@@ -154,6 +154,34 @@ static uint32_t mqttClientTimer;
154
154
// MQTT Client Routines
155
155
// ----------------------------------------
156
156
157
+ bool mqttClientIsNeeded ()
158
+ {
159
+ // If PointPerfectCorrections are not enabled, return false
160
+ if (!settings.enablePointPerfectCorrections )
161
+ return false ;
162
+
163
+ // For the mosaic-X5, settings.enablePointPerfectCorrections will be true if
164
+ // we are using the PPL and getting keys via ZTP. BUT the Facet mosaic-X5
165
+ // uses the L-Band (only) plan. It should not and can not subscribe to PP IP
166
+ // MQTT corrections. So, return false - even though the L-Band frequencies topic
167
+ // and key distribution topic could be beneficial.
168
+ // We could use present.gnss_mosaicX5, but let's not. See notes on EVK below.
169
+ if (productVariant == RTK_FACET_MOSAIC)
170
+ return false ;
171
+
172
+ // For the Facet v2 L-Band, the same is true. It uses the L-Band (only) plan.
173
+ // We get keys during ZTP (HTTP_Client). It should not and can not subscribe
174
+ // to PP IP MQTT corrections. So, return true only if AssistNow is enabled -
175
+ // even though the L-Band frequencies topic and key distribution topic could
176
+ // be beneficial.
177
+ // Note: EVK supports both L-Band and IP, so we cannot use present.lband_neo
178
+ if (productVariant == RTK_FACET_V2_LBAND)
179
+ if (!settings.useAssistNow )
180
+ return false ;
181
+
182
+ return true ;
183
+ }
184
+
157
185
// Determine if another connection is possible or if the limit has been reached
158
186
bool mqttClientConnectLimitReached ()
159
187
{
@@ -163,9 +191,7 @@ bool mqttClientConnectLimitReached()
163
191
// Retry the connection a few times
164
192
limitReached = (mqttClientConnectionAttempts >= MAX_MQTT_CLIENT_CONNECTION_ATTEMPTS);
165
193
166
- bool enableMqttClient = true ;
167
- if (!settings.enablePointPerfectCorrections )
168
- enableMqttClient = false ;
194
+ bool enableMqttClient = mqttClientIsNeeded ();
169
195
170
196
// Restart the MQTT client
171
197
MQTT_CLIENT_STOP (limitReached || (!enableMqttClient));
@@ -242,18 +268,7 @@ void mqttClientPrintStatus()
242
268
byte minutes;
243
269
byte seconds;
244
270
245
- bool enableMqttClient = true ;
246
- if (!settings.enablePointPerfectCorrections )
247
- enableMqttClient = false ;
248
-
249
- // For the mosaic-X5, settings.enablePointPerfectCorrections will be true if
250
- // we are using the PPL and getting keys via ZTP. BUT the Facet mosaic-X5
251
- // uses the L-Band (only) plan. It should not and can not subscribe to PP IP
252
- // MQTT corrections. So, if present.gnss_mosaicX5 is true, set enableMqttClient
253
- // to false.
254
- // TODO : review this. This feels like a bit of a hack...
255
- if (present.gnss_mosaicX5 )
256
- enableMqttClient = false ;
271
+ bool enableMqttClient = mqttClientIsNeeded ();
257
272
258
273
// Display MQTT Client status and uptime
259
274
if (enableMqttClient && (EQ_RTK_MODE (mqttClientMode)))
@@ -595,7 +610,7 @@ void mqttClientSetState(uint8_t newState)
595
610
}
596
611
systemPrintln ();
597
612
systemPrint (" MQTT Client subscribed topics: " );
598
- for (auto it = mqttSubscribedTopics .begin (); it != mqttSubscribedTopics .end (); it = std::next (it))
613
+ for (auto it = mqttClientSubscribedTopics .begin (); it != mqttClientSubscribedTopics .end (); it = std::next (it))
599
614
{
600
615
String topic = *it;
601
616
systemPrint (topic);
@@ -692,18 +707,7 @@ bool mqttClientNeedsNetwork()
692
707
// MQTT_CLIENT_RECEIVE_DATA_TIMEOUT
693
708
void mqttClientUpdate ()
694
709
{
695
- bool enableMqttClient = true ;
696
- if (!settings.enablePointPerfectCorrections )
697
- enableMqttClient = false ;
698
-
699
- // For the mosaic-X5, settings.enablePointPerfectCorrections will be true if
700
- // we are using the PPL and getting keys via ZTP. BUT the Facet mosaic-X5
701
- // uses the L-Band (only) plan. It should not and can not subscribe to PP IP
702
- // MQTT corrections. So, if present.gnss_mosaicX5 is true, set enableMqttClient
703
- // to false.
704
- // TODO : review this. This feels like a bit of a hack...
705
- if (present.gnss_mosaicX5 )
706
- enableMqttClient = false ;
710
+ bool enableMqttClient = mqttClientIsNeeded ();
707
711
708
712
// Shutdown the MQTT client when the mode or setting changes
709
713
DMW_st (mqttClientSetState, mqttClientState);
0 commit comments