Skip to content

Commit b31333d

Browse files
committed
Add isInitialized state check
1 parent b8e6490 commit b31333d

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/SparkFun_IM19_IMU_Arduino_Library.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,24 @@ bool IM19::isReady()
355355
return (false);
356356
}
357357

358-
// isCorrecting - Bits 20 (RTK data)/19 (Time sync)/18 (PPS received)/17 (init complete) IMU is
359-
// outputting modified lat/lon/alt
358+
// isInitialized - Bits 13 (Init shaking 1)/14 (Init shaking 2)
359+
// User has started the tilt/shake process
360+
// Return true if device is only in this state. Return false once device isCorrecting.
361+
bool IM19::isInitialized()
362+
{
363+
if (isReady() == false)
364+
return (false);
365+
366+
if(isCorrecting() == true)
367+
return (false);
368+
369+
if ((getNaviStatus() & (1 << 13)))
370+
return (true);
371+
return (false);
372+
}
373+
374+
// isCorrecting - Bits 20 (RTK data)/19 (Time sync)/18 (PPS received)/17 (init complete)
375+
// IMU is outputting modified lat/lon/alt
360376
bool IM19::isCorrecting()
361377
{
362378
if (isReady() == false)

src/SparkFun_IM19_IMU_Arduino_Library.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@ class IM19
307307
uint8_t getGnssDifferentialAge();
308308

309309
bool isRtkFixed(); //Check is GNSS is reporting as fixed. Requires "GNSS_OUTPUT=UART1,ON" during config.
310-
bool isReady(); //IMU is online and ready for a shake, but is not outputting new lat/lon/alt
310+
bool isReady(); //IMU is online and ready for a shake
311+
bool isInitialized(); //IMU has been shaken, but is not yet outputting modified lat/lon/alt
311312
bool isCorrecting(); //IMU has been shaken and is outputting modified lat/lon/alt
312313
//bool isTiltError(); //Returns true when
313314
};

0 commit comments

Comments
 (0)