meetjestad / mjs_firmware

8 stars 4 forks source link

Improvement: Smarter GPS timeout and GPS enabling #7

Open matthijskooijman opened 6 years ago

matthijskooijman commented 6 years ago

Right now, the GPS is enabled every 24h and kept on until a fix is obtained (and then a bit more, to improve accuracy) or a timeout occurs. However, when the node is inside, it will typically not lock any sattelites during this timeout period. It might be possible to be smarter about this timeout, and detect early that the GPS signal is too weak to get a fix and bail out. On the other hand, once a fix is obtained, it is useful to keep the GPS on for a bit more to improve accuracy. This currently uses a fixed time (10 seconds I believe), but it might be possible to use a GPS-supplied accuracy value to see if any gain is to be expected.

Finally, these timing values could also be influenced by earlier GPS attempts. For example, when no GPS signal can be found for a few times, a subsequent attempt could be skipped or made shorter. At the same time, the node could keep the GPS on for more time every now and then, to see if it can get a fix anyway (but do that less often, so it does not spend more time/power in total). Similarly, if the GPS returns the same position every day, it could reduce the frequency of reading the GPS as well.