Giter Site home page Giter Site logo

Comments (7)

cjhdev avatar cjhdev commented on July 18, 2024

Hello

Previous versions also set the band timer to 60s. It's a legacy thing. I kept it because the low power MCUs I use wake up regularly when hardware timers overflow and so it made no difference.

The interval could be increased. I would choose a maximum of INT32_MAX ticks as a way to ensure the time tracking in processBands() never overflows. I notice processBands() ignores differences larger than INT32_MAX but that can be changed.

LDL_TIMER_BAND exists because it seemed easier to use a single purpose timer rather than overload one of the others and then have to work out which part of the code was responsible for clearing it.

I think it is useful to have an event for when a ldl_mac.band counts down to zero. Perhaps LDL_MAC_ticksUntilNextEvent() should be refactored to check ldl_mac.band as well as inputs and timers.

from lora_device_lib.

cjhdev avatar cjhdev commented on July 18, 2024

I've increased LDL_TIMER_BAND interval in master to a large number that won't break time tracking

from lora_device_lib.

frbehrens avatar frbehrens commented on July 18, 2024

I've increased LDL_TIMER_BAND interval in master to a large number that won't break time tracking

Thanks!

from lora_device_lib.

frbehrens avatar frbehrens commented on July 18, 2024

Meanwhile I found a working solution for my use case, so I reopen the issue to document it. The comitted changes for LDL_TIMER_BAND interval were not sufficient.

Summary of my requirements:
I'm able to call LDL_MAC_process() regulary, with a maximum interval of several minutes, but want to deep sleep when no transmission or receive event is pending. So I want to distinguish between "important" events (retry of transmission, when channel is not available; wait for reiceive window; ..) and "unimportant" events (band events). In the latter case the LDL_MAC_ticksUntilNextEvent() wait time should not inhibit the sleep.

My solution:
I call LDL_MAC_process() in a loop only, when the mac.state is not LDL_STATE_IDLE. To compensate the missed band events after a deep sleep I ensure that LDL_MAC_process() is called before any other LDL function call.
As a result the process runs in the LDL_MAC_process() loop only after a transmit request - until the transmit was successful and the receive windows elapsed. Afterwards the device goes to deep sleep for several minutes.

from lora_device_lib.

cjhdev avatar cjhdev commented on July 18, 2024

Thanks for sharing your workaround.

I don't think there is a quick fix to avoid spurious wakeups with the current implementation, the whole thing needs to be reworked.

from lora_device_lib.

cjhdev avatar cjhdev commented on July 18, 2024

I've solved this problem in my current working branch (sx1262). I expect to merge this month.

from lora_device_lib.

frbehrens avatar frbehrens commented on July 18, 2024

I'm still running my mentioned solution with the new LDL version (450ae80). It works well. I have also implemented a check for a maximum sleep time, so even between longer retransmission attempts (channel not available, OTAA pending) I can go into deep sleep. I see only the requirements, that after deep sleep the timer is roughly adjusted and LDL_MAC_process() is called again.

I see that LDL_MAC_priority() may also help in many situations, but did not touch my existing solution.

I close the issue, because solutions exists for the described requirement.

from lora_device_lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.