cyclops1982 / RAKTracker

Example code that get's a distance measure and sends it via lora. First implementation. Very basic.
0 stars 0 forks source link

Different update interval if motion threshold was reached. #8

Closed cyclops1982 closed 7 months ago

cyclops1982 commented 11 months ago

There are 2 thresholds on the motion sensor. Both should get a 'update interval'. This would allow us to /not/ send an update if there is no motion at all, or send more updates if there is specific motion. The expectation is that we'll have the same update interval on threshold 1, while we'd start to send more updates on threshold 2.

cyclops1982 commented 11 months ago

Lots of other devices work in this way. They basically send no data when there is no motion, or only start sending data when there is motion above a certain threshold.

cyclops1982 commented 11 months ago

The SoftwareTimer that our code uses has a reset(), stop() and setPeriod(), so we should be able to do it with these settings.

In our main() we have a section that checks if the motion is enabled or not. If it is enabled we read the registers and send them out. We can simply update the timer period in that code.

Also note, 2nd threshold should take priority over the 1st threshold. So, if both threshold 1 and 2 went off, then we should take the new update interval for threshold 2. If only threshold 1 went off, we take that. If none, then we stick to our default.