tnt has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-e1-hardware/+/29610 )


Change subject: icE1usb fw/gpsdo: If no PPS present for >= 3s, go to hold over 
mode
......................................................................

icE1usb fw/gpsdo: If no PPS present for >= 3s, go to hold over mode

Signed-off-by: Sylvain Munaut <[email protected]>
Change-Id: Ia85a8bb0e146cb117ea6e2704c6a4dedf215c75a
---
M firmware/ice40-riscv/icE1usb/gpsdo.c
1 file changed, 11 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware 
refs/changes/10/29610/1

diff --git a/firmware/ice40-riscv/icE1usb/gpsdo.c 
b/firmware/ice40-riscv/icE1usb/gpsdo.c
index 573c0bb..2481c2e 100644
--- a/firmware/ice40-riscv/icE1usb/gpsdo.c
+++ b/firmware/ice40-riscv/icE1usb/gpsdo.c
@@ -15,6 +15,8 @@

 #include "ice1usb_proto.h"

+#include "config.h"
+

 struct {
        /* Configuration */
@@ -275,6 +277,14 @@
        uint32_t tick_now, tick_diff;
        bool valid;

+       /* If more than 3 sec elapsed since last PPS, go to hold-over */
+       if (time_elapsed(g_gpsdo.meas.tick_prev, 3 * SYS_CLK_FREQ)) {
+               g_gpsdo.state = STATE_HOLD_OVER;
+               g_gpsdo.meas.invalid = 0;
+               g_gpsdo.meas.skip = 0;
+               return;
+       }
+
        /* Get current tick and check if there was a PPS and estimate frequency 
*/
        tick_now = time_pps_read();

@@ -299,6 +309,7 @@
                /* No GPS fix, go to hold-over */
                g_gpsdo.state = STATE_HOLD_OVER;
                g_gpsdo.meas.invalid = 0;
+               g_gpsdo.meas.skip = 0;
                return;
        }


--
To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/29610
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1-hardware
Gerrit-Branch: master
Gerrit-Change-Id: Ia85a8bb0e146cb117ea6e2704c6a4dedf215c75a
Gerrit-Change-Number: 29610
Gerrit-PatchSet: 1
Gerrit-Owner: tnt <[email protected]>
Gerrit-MessageType: newchange

Reply via email to