Skip to content

Commit 9003230

Browse files
committed
Set input bounds when getting measurement rate
1 parent 324ccd7 commit 9003230

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

Firmware/RTK_Everywhere/menuGNSS.ino

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,30 @@ void menuGNSS()
177177

178178
if ((incoming == 1) && (!present.gnss_mosaicX5))
179179
{
180-
float rate = 0.0;
181-
if (getNewSetting("Enter GNSS measurement rate in Hz", 0.00012, 20.0, &rate) ==
180+
float rateHz = 0.0;
181+
float minRateHz = 1.0; // Measurement rate per second
182+
float maxRateHz = 1.0;
183+
184+
if (present.gnss_zedf9p)
185+
{
186+
maxRateHz = 20; // 20Hz
187+
minRateHz = 0.00012; // Limit of 127 (navRate) * 65000ms (measRate) = 137 minute limit.
188+
}
189+
else if (present.gnss_um980)
190+
{
191+
minRateHz = 0.02; // 1 / 65 = 0.015384 Hz = Found experimentally
192+
maxRateHz = 20; // 20Hz
193+
}
194+
else if (present.gnss_lg290p)
195+
{
196+
minRateHz = 1.0; // The LG290P doesn't support slower speeds than 1Hz
197+
maxRateHz = 20; // 20Hz
198+
}
199+
200+
if (getNewSetting("Enter GNSS measurement rate in Hz", minRateHz, maxRateHz, &rateHz) ==
182201
INPUT_RESPONSE_VALID) // 20Hz limit with all constellations enabled
183202
{
184-
gnss->setRate(1.0 / rate); // Convert Hz to seconds. This will set settings.measurementRateMs,
203+
gnss->setRate(1.0 / rateHz); // Convert Hz to seconds. This will set settings.measurementRateMs,
185204
// settings.navigationRate, and GSV message
186205
}
187206
}

0 commit comments

Comments
 (0)