@@ -729,161 +729,210 @@ long gpsToMjd(long GpsCycle, long GpsWeek, long GpsSeconds)
729
729
// Global L-Band Routines
730
730
// ----------------------------------------
731
731
732
- // Begin any L-Band hardware
732
+ // Update any L-Band hardware
733
733
// Check if NEO-D9S is connected. Configure if available.
734
734
// If GNSS is mosaic-X5, configure LBandBeam1
735
- void beginLBand ()
735
+ void updateLBand ()
736
736
{
737
737
738
738
#ifdef COMPILE_L_BAND
739
739
if (present.lband_neo )
740
740
{
741
- if (i2cLBand.begin (*i2c_0, 0x43 ) ==
742
- false ) // Connect to the u-blox NEO-D9S using Wire port. The D9S default I2C address is 0x43 (not 0x42)
741
+ if (!online.lband_neo && settings.enablePointPerfectCorrections )
743
742
{
744
- if (settings.debugCorrections == true )
743
+ static bool lband_neo_can_not_begin = false ;
744
+
745
+ if (lband_neo_can_not_begin)
746
+ return ;
747
+
748
+ // NEO-D9S is present but is not yet online. Try to begin the hardware
749
+ if (i2cLBand.begin (*i2c_0, 0x43 ) ==
750
+ false ) // Connect to the u-blox NEO-D9S using Wire port. The D9S default I2C address is 0x43 (not 0x42)
751
+ {
745
752
systemPrintln (" L-Band not detected" );
746
- return ;
747
- }
753
+ lband_neo_can_not_begin = true ;
754
+ return ;
755
+ }
748
756
749
- // Check the firmware version of the NEO-D9S. Based on Example21_ModuleInfo.
750
- if (i2cLBand.getModuleInfo (1100 ) == true ) // Try to get the module info
751
- {
752
- // Reconstruct the firmware version
753
- snprintf (neoFirmwareVersion, sizeof (neoFirmwareVersion), " %s %d.%02d" , i2cLBand.getFirmwareType (),
754
- i2cLBand.getFirmwareVersionHigh (), i2cLBand.getFirmwareVersionLow ());
757
+ // Check the firmware version of the NEO-D9S. Based on Example21_ModuleInfo.
758
+ if (i2cLBand.getModuleInfo (1100 ) == true ) // Try to get the module info
759
+ {
760
+ // Reconstruct the firmware version
761
+ snprintf (neoFirmwareVersion, sizeof (neoFirmwareVersion), " %s %d.%02d" , i2cLBand.getFirmwareType (),
762
+ i2cLBand.getFirmwareVersionHigh (), i2cLBand.getFirmwareVersionLow ());
755
763
756
- printNEOInfo (); // Print module firmware version
757
- }
764
+ printNEOInfo (); // Print module firmware version
765
+ }
766
+ else
767
+ {
768
+ systemPrintln (" L-Band not detected" );
769
+ lband_neo_can_not_begin = true ;
770
+ return ;
771
+ }
758
772
759
- gnss->update ();
773
+ // Update the GNSS position. Use the position to set the frequency if available
774
+ gnss->update ();
760
775
761
- uint32_t LBandFreq;
762
- uint8_t fixType = gnss->getFixType ();
763
- double latitude = gnss->getLatitude ();
764
- double longitude = gnss->getLongitude ();
765
- // If we have a fix, check which frequency to use
766
- if (fixType >= 2 && fixType <= 5 ) // 2D, 3D, 3D+DR, or Time
767
- {
768
- int r = 0 ; // Step through each geographic region
769
- for (; r < numRegionalAreas; r++)
776
+ uint32_t LBandFreq;
777
+ uint8_t fixType = gnss->getFixType ();
778
+ double latitude = gnss->getLatitude ();
779
+ double longitude = gnss->getLongitude ();
780
+
781
+ // If we have a fix, check which frequency to use
782
+ if (fixType >= 2 && fixType <= 5 ) // 2D, 3D, 3D+DR, or Time
770
783
{
771
- if ((longitude >= Regional_Information_Table[r].area .lonWest ) &&
772
- (longitude <= Regional_Information_Table[r].area .lonEast ) &&
773
- (latitude >= Regional_Information_Table[r].area .latSouth ) &&
774
- (latitude <= Regional_Information_Table[r].area .latNorth ))
784
+ int r = 0 ; // Step through each geographic region
785
+ for (; r < numRegionalAreas; r++)
786
+ {
787
+ if ((longitude >= Regional_Information_Table[r].area .lonWest ) &&
788
+ (longitude <= Regional_Information_Table[r].area .lonEast ) &&
789
+ (latitude >= Regional_Information_Table[r].area .latSouth ) &&
790
+ (latitude <= Regional_Information_Table[r].area .latNorth ))
791
+ {
792
+ LBandFreq = Regional_Information_Table[r].frequency ;
793
+ if (settings.debugCorrections == true )
794
+ systemPrintf (" Setting L-Band frequency to %s (%dHz)\r\n " , Regional_Information_Table[r].name ,
795
+ LBandFreq);
796
+ break ;
797
+ }
798
+ }
799
+ if (r == numRegionalAreas) // Geographic region not found
775
800
{
776
- LBandFreq = Regional_Information_Table[r ].frequency ;
801
+ LBandFreq = Regional_Information_Table[settings. geographicRegion ].frequency ;
777
802
if (settings.debugCorrections == true )
778
- systemPrintf (" Setting L-Band frequency to %s (%dHz)\r\n " , Regional_Information_Table[r].name ,
779
- LBandFreq);
780
- break ;
803
+ systemPrintf (" Error: Unknown L-Band geographic region. Using %s (%dHz)\r\n " ,
804
+ Regional_Information_Table[settings.geographicRegion ].name , LBandFreq);
781
805
}
782
806
}
783
- if (r == numRegionalAreas) // Geographic region not found
807
+ else
784
808
{
785
809
LBandFreq = Regional_Information_Table[settings.geographicRegion ].frequency ;
786
810
if (settings.debugCorrections == true )
787
- systemPrintf (" Error: Unknown L-Band geographic region. Using %s (%dHz)\r\n " ,
788
- Regional_Information_Table[settings.geographicRegion ].name , LBandFreq);
811
+ systemPrintf (" No fix available for L-Band geographic region determination . Using %s (%dHz)\r\n " ,
812
+ Regional_Information_Table[settings.geographicRegion ].name , LBandFreq);
789
813
}
790
- }
791
- else
792
- {
793
- LBandFreq = Regional_Information_Table[settings.geographicRegion ].frequency ;
794
- if (settings.debugCorrections == true )
795
- systemPrintf (" No fix available for L-Band geographic region determination. Using %s (%dHz)\r\n " ,
796
- Regional_Information_Table[settings.geographicRegion ].name , LBandFreq);
797
- }
798
-
799
- bool response = true ;
800
- response &= i2cLBand.newCfgValset ();
801
- response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_CENTER_FREQUENCY, LBandFreq); // Default 1539812500 Hz
802
- response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_SEARCH_WINDOW, 2200 ); // Default 2200 Hz
803
- response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_USE_SERVICE_ID, 0 ); // Default 1
804
- response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_SERVICE_ID, 21845 ); // Default 50821
805
- response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_DATA_RATE, 2400 ); // Default 2400 bps
806
- response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_USE_DESCRAMBLER, 1 ); // Default 1
807
- response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_DESCRAMBLER_INIT, 26969 ); // Default 23560
808
- response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_USE_PRESCRAMBLING, 0 ); // Default 0
809
- response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_UNIQUE_WORD, 16238547128276412563ull );
810
- response &=
811
- i2cLBand.addCfgValset (UBLOX_CFG_MSGOUT_UBX_RXM_PMP_UART1, 0 ); // Diasable UBX-RXM-PMP on UART1. Not used.
812
-
813
- response &= i2cLBand.sendCfgValset ();
814
814
815
- GNSS_ZED *zed = (GNSS_ZED *)gnss;
816
- response &= zed->lBandCommunicationEnable ();
817
-
818
- if (response == false )
819
- systemPrintln (" L-Band failed to configure" );
820
-
821
- i2cLBand.softwareResetGNSSOnly (); // Do a restart
815
+ bool response = true ;
816
+ response &= i2cLBand.newCfgValset ();
817
+ response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_CENTER_FREQUENCY, LBandFreq); // Default 1539812500 Hz
818
+ response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_SEARCH_WINDOW, 2200 ); // Default 2200 Hz
819
+ response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_USE_SERVICE_ID, 0 ); // Default 1
820
+ response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_SERVICE_ID, 21845 ); // Default 50821
821
+ response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_DATA_RATE, 2400 ); // Default 2400 bps
822
+ response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_USE_DESCRAMBLER, 1 ); // Default 1
823
+ response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_DESCRAMBLER_INIT, 26969 ); // Default 23560
824
+ response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_USE_PRESCRAMBLING, 0 ); // Default 0
825
+ response &= i2cLBand.addCfgValset (UBLOX_CFG_PMP_UNIQUE_WORD, 16238547128276412563ull );
826
+ response &=
827
+ i2cLBand.addCfgValset (UBLOX_CFG_MSGOUT_UBX_RXM_PMP_UART1, 0 ); // Disable UBX-RXM-PMP on UART1. Not used.
828
+
829
+ response &= i2cLBand.sendCfgValset ();
830
+
831
+ GNSS_ZED *zed = (GNSS_ZED *)gnss;
832
+ response &= zed->lBandCommunicationEnable ();
833
+
834
+ if (response == false )
835
+ {
836
+ systemPrintln (" L-Band failed to configure" );
837
+ lband_neo_can_not_begin = true ;
838
+ return ;
839
+ }
822
840
823
- if (settings.debugCorrections == true )
824
- systemPrintln (" L-Band online" );
841
+ i2cLBand.softwareResetGNSSOnly (); // Do a restart
825
842
826
- gnss->applyPointPerfectKeys (); // Apply keys now, if we have them. This sets online.lbandCorrections
843
+ if (settings.debugCorrections == true )
844
+ systemPrintln (" L-Band online" );
827
845
828
- online.lband_neo = true ;
846
+ online.lband_neo = true ;
847
+ }
848
+ else if (online.lband_neo && settings.enablePointPerfectCorrections )
849
+ {
850
+ // L-Band is online. Apply the keys if they have changed
851
+ // This may be redundant as PROVISIONING_KEYS_REMAINING also applies the keys
852
+ static char previousKey[33 ] = " " ;
853
+ if (strncmp (previousKey, settings.pointPerfectCurrentKey , 33 ) != 0 )
854
+ {
855
+ strncpy (previousKey, settings.pointPerfectCurrentKey , 33 );
856
+ gnss->applyPointPerfectKeys (); // Apply keys now. This sets online.lbandCorrections
857
+ if (settings.debugCorrections == true )
858
+ systemPrintln (" ZED-F9P PointPerfect keys applied" );
859
+ }
860
+ }
829
861
}
830
862
#endif // COMPILE_L_BAND
831
863
#ifdef COMPILE_MOSAICX5
832
- if (present.gnss_mosaicX5 && settings. enablePointPerfectCorrections )
864
+ if (present.gnss_mosaicX5 )
833
865
{
834
- uint32_t LBandFreq;
835
- uint8_t fixType = gnss->getFixType ();
836
- double latitude = gnss->getLatitude ();
837
- double longitude = gnss->getLongitude ();
838
- // If we have a fix, check which frequency to use
839
- if (fixType >= 1 ) // Stand-Alone PVT or better
866
+ if (!online.lband_gnss && settings.enablePointPerfectCorrections )
840
867
{
841
- int r = 0 ; // Step through each geographic region
842
- for (; r < numRegionalAreas; r++)
868
+ static bool lband_gnss_can_not_begin = false ;
869
+
870
+ if (lband_gnss_can_not_begin)
871
+ return ;
872
+
873
+ uint32_t LBandFreq;
874
+ uint8_t fixType = gnss->getFixType ();
875
+ double latitude = gnss->getLatitude ();
876
+ double longitude = gnss->getLongitude ();
877
+ // If we have a fix, check which frequency to use
878
+ if (fixType >= 1 ) // Stand-Alone PVT or better
843
879
{
844
- if ((longitude >= Regional_Information_Table[r].area .lonWest ) &&
845
- (longitude <= Regional_Information_Table[r].area .lonEast ) &&
846
- (latitude >= Regional_Information_Table[r].area .latSouth ) &&
847
- (latitude <= Regional_Information_Table[r].area .latNorth ))
880
+ int r = 0 ; // Step through each geographic region
881
+ for (; r < numRegionalAreas; r++)
848
882
{
849
- LBandFreq = Regional_Information_Table[r].frequency ;
883
+ if ((longitude >= Regional_Information_Table[r].area .lonWest ) &&
884
+ (longitude <= Regional_Information_Table[r].area .lonEast ) &&
885
+ (latitude >= Regional_Information_Table[r].area .latSouth ) &&
886
+ (latitude <= Regional_Information_Table[r].area .latNorth ))
887
+ {
888
+ LBandFreq = Regional_Information_Table[r].frequency ;
889
+ if (settings.debugCorrections == true )
890
+ systemPrintf (" Setting L-Band frequency to %s (%dHz)\r\n " , Regional_Information_Table[r].name ,
891
+ LBandFreq);
892
+ break ;
893
+ }
894
+ }
895
+ if (r == numRegionalAreas) // Geographic region not found
896
+ {
897
+ LBandFreq = Regional_Information_Table[settings.geographicRegion ].frequency ;
850
898
if (settings.debugCorrections == true )
851
- systemPrintf (" Setting L-Band frequency to %s (%dHz)\r\n " , Regional_Information_Table[r].name ,
852
- LBandFreq);
853
- break ;
899
+ systemPrintf (" Error: Unknown L-Band geographic region. Using %s (%dHz)\r\n " ,
900
+ Regional_Information_Table[settings.geographicRegion ].name , LBandFreq);
854
901
}
855
902
}
856
- if (r == numRegionalAreas) // Geographic region not found
903
+ else
857
904
{
858
905
LBandFreq = Regional_Information_Table[settings.geographicRegion ].frequency ;
859
906
if (settings.debugCorrections == true )
860
- systemPrintf (" Error: Unknown L-Band geographic region. Using %s (%dHz)\r\n " ,
861
- Regional_Information_Table[settings.geographicRegion ].name , LBandFreq);
907
+ systemPrintf (" No fix available for L-Band geographic region determination . Using %s (%dHz)\r\n " ,
908
+ Regional_Information_Table[settings.geographicRegion ].name , LBandFreq);
862
909
}
863
- }
864
- else
865
- {
866
- LBandFreq = Regional_Information_Table[settings.geographicRegion ].frequency ;
867
- if (settings.debugCorrections == true )
868
- systemPrintf (" No fix available for L-Band geographic region determination. Using %s (%dHz)\r\n " ,
869
- Regional_Information_Table[settings.geographicRegion ].name , LBandFreq);
870
- }
871
910
872
- bool result = true ;
911
+ bool result = true ;
873
912
874
- // If no SPARTN data is received, the L-Band may need a 'kick'. Turn L-Band off and back on again!
875
- GNSS_MOSAIC *mosaic = (GNSS_MOSAIC *)gnss;
913
+ GNSS_MOSAIC *mosaic = (GNSS_MOSAIC *)gnss;
876
914
877
- result &= mosaic->configureGNSSCOM (true ); // Ensure LBandBeam1 is enabled on COM1
915
+ result &= mosaic->configureGNSSCOM (true ); // Ensure LBandBeam1 is enabled on COM1
878
916
879
- result &= mosaic->configureLBand (true , LBandFreq); // Start L-Band
917
+ result &= mosaic->configureLBand (true , LBandFreq); // Start L-Band
880
918
881
- if (result == false )
882
- systemPrintln (" mosaic-X5 L-Band failed to configure" );
883
- else if (settings.debugCorrections == true )
884
- systemPrintln (" mosaic-X5 L-Band online" );
885
-
886
- online.lband_gnss = result;
919
+ if (result == false )
920
+ {
921
+ systemPrintln (" mosaic-X5 L-Band failed to configure" );
922
+ lband_gnss_can_not_begin = true ;
923
+ }
924
+ else
925
+ {
926
+ if (settings.debugCorrections == true )
927
+ systemPrintln (" mosaic-X5 L-Band online" );
928
+ online.lband_gnss = true ;
929
+ }
930
+ }
931
+ // else if (online.lband_gnss && settings.enablePointPerfectCorrections)
932
+ {
933
+ // If no SPARTN data is received, the L-Band may need a 'kick'. Turn L-Band off and back on again!
934
+ // But gnss->update will do this. No need to do it here
935
+ }
887
936
}
888
937
#endif // /COMPILE_MOSAICX5
889
938
}
@@ -1092,7 +1141,7 @@ bool pointPerfectIsEnabled()
1092
1141
}
1093
1142
1094
1143
// Process any new L-Band from I2C
1095
- void updateLBand ()
1144
+ void updateLBandCorrections ()
1096
1145
{
1097
1146
static unsigned long lbandLastReport;
1098
1147
static unsigned long lbandTimeFloatStarted; // Monitors the ZED during L-Band reception if a fix takes too long
0 commit comments