icE1usb fw/gpsdo: Only force HOLD_OVER when no PPS if not DISABLED
Bug introduced in da395cc9224f57300d8b05b8369f08d202f5c184
but since we never had anyway to use manual mode before,
didn't get noticed ...
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I6e2b6cf5c7c0c9deaf429be000770316ec88b9d4
diff --git a/firmware/ice40-riscv/icE1usb/gpsdo.c b/firmware/ice40-riscv/icE1usb/gpsdo.c
index 2481c2e..bb3801e 100644
--- a/firmware/ice40-riscv/icE1usb/gpsdo.c
+++ b/firmware/ice40-riscv/icE1usb/gpsdo.c
@@ -278,7 +278,8 @@
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)) {
+ if ((g_gpsdo.state != STATE_DISABLED) &&
+ 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;