Skip to content

Commit 1248170

Browse files
committed
Shutdown LBand if it is no longer needed by the select PointPerfect service
1 parent 134f370 commit 1248170

File tree

1 file changed

+62
-12
lines changed

1 file changed

+62
-12
lines changed

Firmware/RTK_Everywhere/menuPP.ino

Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -512,11 +512,13 @@ void menuPointPerfectKeys()
512512
// If GNSS is mosaic-X5, configure LBandBeam1
513513
void updateLBand()
514514
{
515+
static bool lband_gnss_can_not_begin = false;
515516

516517
#ifdef COMPILE_L_BAND
517518
if (present.lband_neo)
518519
{
519-
if (!online.lband_neo && pointPerfectIsEnabled())
520+
//Start L-Band if it is enabled
521+
if (online.lband_neo == false && pointPerfectLbandEnabled() == true)
520522
{
521523
static bool lband_neo_can_not_begin = false;
522524

@@ -641,10 +643,9 @@ void updateLBand()
641643
#ifdef COMPILE_MOSAICX5
642644
if (present.gnss_mosaicX5)
643645
{
644-
if (!online.lband_gnss && pointPerfectIsEnabled())
646+
// Start L-Band if service is enabled
647+
if (online.lband_gnss == false && pointPerfectLbandEnabled())
645648
{
646-
static bool lband_gnss_can_not_begin = false;
647-
648649
if (lband_gnss_can_not_begin)
649650
return;
650651

@@ -694,7 +695,7 @@ void updateLBand()
694695

695696
result &= mosaic->configureLBand(true, LBandFreq); // Start L-Band
696697

697-
result &= mosaic->saveConfiguration(); // Save the updated configuration. Probably redundant?
698+
result &= mosaic->saveConfiguration(); // Save the updated configuration.
698699

699700
if (result == false)
700701
{
@@ -708,10 +709,32 @@ void updateLBand()
708709
online.lband_gnss = true;
709710
}
710711
}
711-
// else if (online.lband_gnss && pointPerfectIsEnabled())
712+
713+
// Stop L-Band is service is disabled
714+
else if (online.lband_gnss == true && pointPerfectLbandEnabled() == false)
712715
{
713-
// If no SPARTN data is received, the L-Band may need a 'kick'. Turn L-Band off and back on again!
714-
// But gnss->update will do this. No need to do it here
716+
Serial.println("\n\r Taking L-Band offline");
717+
718+
bool result = true;
719+
720+
GNSS_MOSAIC *mosaic = (GNSS_MOSAIC *)gnss;
721+
722+
uint32_t LBandFreq = 1556290000; // Default to US band
723+
result &= mosaic->configureLBand(false, LBandFreq); // Stop L-Band
724+
725+
result &= mosaic->saveConfiguration(); // Save the updated configuration.
726+
727+
if (result == false)
728+
{
729+
systemPrintln("mosaic-X5 L-Band failed to stop. Retrying...");
730+
}
731+
else
732+
{
733+
if (settings.debugCorrections == true)
734+
systemPrintln("mosaic-X5 L-Band successfully taken offline");
735+
online.lband_gnss = false;
736+
lband_gnss_can_not_begin = false; // reset so L-Band can restart if requested
737+
}
715738
}
716739
}
717740
#endif // /COMPILE_MOSAICX5
@@ -799,7 +822,7 @@ bool pointPerfectIsEnabled()
799822
return false;
800823
}
801824

802-
// Determine if this service type uses keys
825+
// Determine if this service type is encrypted and requires keys for decryption
803826
bool pointPerfectServiceUsesKeys()
804827
{
805828
if (settings.pointPerfectService == PP_NICKNAME_FLEX_LBAND_NA ||
@@ -808,8 +831,16 @@ bool pointPerfectServiceUsesKeys()
808831
return false;
809832
}
810833

834+
// Determine if this service type uses L-Band
835+
bool pointPerfectLbandEnabled()
836+
{
837+
if (settings.pointPerfectService == PP_NICKNAME_FLEX_LBAND_NA || settings.pointPerfectService == PP_NICKNAME_GLOBAL)
838+
return true;
839+
return false;
840+
}
841+
811842
// Determine if this service type uses NTRIP for corrections
812-
bool pointPerfectServiceUsesNtrip()
843+
bool pointPerfectNtripEnabled()
813844
{
814845
if (settings.pointPerfectService == PP_NICKNAME_FLEX_RTCM || settings.pointPerfectService == PP_NICKNAME_LIVE)
815846
return true;
@@ -852,7 +883,7 @@ bool productVariantSupportsLbandNA()
852883

853884
bool productVariantSupportsLbandGlobal()
854885
{
855-
return false; //As of June 2025, LBand Global is not yet available
886+
return false; // As of June 2025, LBand Global is not yet available
856887

857888
if (productVariant == RTK_EVK)
858889
return false;
@@ -869,6 +900,25 @@ bool productVariantSupportsLbandGlobal()
869900
return false;
870901
}
871902

903+
// Returns true if this platform requires the PointPerfect Library to run to use the corrections from PointPerfect
904+
bool productVariantNeedsPpl()
905+
{
906+
if (productVariant == RTK_EVK)
907+
return false;
908+
if (productVariant == RTK_FACET_V2)
909+
return false; // TODO - will require specific module lookup
910+
if (productVariant == RTK_FACET_MOSAIC)
911+
return true;
912+
if (productVariant == RTK_TORCH)
913+
return true;
914+
if (productVariant == RTK_POSTCARD)
915+
return true;
916+
917+
systemPrintln("Uncaught productVariantNeedsPpl()");
918+
return false;
919+
}
920+
921+
872922
// Given a service nick name, return whether this platform supports it
873923
// Helps with printing the menu
874924
bool productVariantSupportsService(uint8_t ppNickName)
@@ -895,7 +945,7 @@ bool productVariantSupportsService(uint8_t ppNickName)
895945
}
896946
else if (ppNickName == PP_NICKNAME_LIVE)
897947
{
898-
return false; //As of June 2025, PointPerfect Live is not yet available
948+
return false; // As of June 2025, PointPerfect Live is not yet available
899949

900950
// All platforms support RTCM over NTRIP
901951
return true;

0 commit comments

Comments
 (0)