Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wisblock-Kit-2-PIO functionality #3

Open
tompatulpan opened this issue Aug 22, 2024 · 5 comments
Open

Wisblock-Kit-2-PIO functionality #3

tompatulpan opened this issue Aug 22, 2024 · 5 comments

Comments

@tompatulpan
Copy link

Hi, testing the example Wisblock-Kit-2-PIO on a RAK4631 device and having some questions on functionality.

  1. Setting the [at+sendint=60] I have steady loop sending correct until an interrupt, then I'm ending up stuck in the delay loop.
  2. Setting the [at+sendint=0] I can see it goes in using the "min_delay" but never sends anything until interrupt.

Wanted function:

  1. Sending each 60sec plus possible interrupts
  2. Using min_delay plus interrupts

Maybe I misunderstood the functionality, any feedback would be appropriated for my understanding.
Thanks!

@tompatulpan tompatulpan changed the title Wisblock-Kit-2-PIO functionallity Wisblock-Kit-2-PIO functionality Aug 22, 2024
@beegee-tokyo
Copy link
Owner

ATC+SENDINT=xx sets a timer that wakes up the device every xx seconds and calls app_handler() to do whatever you want it to do. xx = 0 stops the timer.

I am not sure where and why you have a delay() in your code. There should be no need for it.
WisBlock API is event driven. The MCU sleeps until a timer, an interrupt or a LoRa/LoRaWAN event wakes it up to do something.

@tompatulpan
Copy link
Author

Thanks for the reply!

This is the "delay"that puzzles me
/** Minimum delay between sending new locations, set to 45 seconds */ time_t min_delay = 45000;

@beegee-tokyo
Copy link
Owner

beegee-tokyo commented Aug 23, 2024

🤣
Misunderstanding on my side. I thought you are talking about a delay(xxxx); somewhere.

The accelerator can trigger a wake-up on every movement, but it is not advisable to send a packet every time the device moves.
This /** Minimum delay between sending new locations, set to 45 seconds */ time_t min_delay = 45000; makes sure that messages are not sent more often than every 45 seconds.

On a motion trigger from the acceleration sensor the code checks how long ago the last location message was sent. If it is less than 45 seconds, it ignores the motion and goes back to sleep.

see here

if ((millis() - last_pos_send) < min_delay)

@tompatulpan
Copy link
Author

Ok, cool! Now it makes sense.

Next issue/question: Iv got a interrupt working from accelerometer, but only once!? Shouldn't the clear_acc_int() be added to main to clear it after its been triggered?
If I do so(maybe in the wrong place) I'm ending up in a min_delay loop, so need your advice here.

Let me know if you prefer posting in the forum instead! Thanks!

@beegee-tokyo
Copy link
Owner

I see that in most parts of the code I have the ACC interrupts disabled (commented out). Honestly, I don't remember why.

You might have a look into LPWAN-Tracker-Solution, it is a more updated version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants