Giter Club home page Giter Club logo

Comments (7)

Eric286 avatar Eric286 commented on September 23, 2024

Hello @chromoxdor!

Could you give me more information about what error happens in the while loop, or if it is just that the while loop in your gatherDataAndSend function keeps the device "awake"?

Have a nice day!

from beelan-lorawan.

chromoxdor avatar chromoxdor commented on September 23, 2024

Hey @Eric286,

it is hard to describe since i am no expert in this.
The loop basically wreaks havoc in the code....
e.g. i have another while loop for a sensor before. The fist time it runs fine the second time after the "lora.update();" loop and the device went to sleep and woke up again to run the "gatherDataAndSend()" function, the "sensor" looop runs forever ignoring its statement (also a timer).
Sometimes the mcu reboots.
And apart from that no data is send.

Is rRunning "lora.update();" in a loop together with "lora.readAck();" even the right way to do since it seems to mess with the rest of the code?

(The whole code can be found here: https://github.com/chromoxdor/LoRa-and-LoRaWAN/blob/main/lora_2v1/lora_2v1.ino)

Have a nice day!

You too... but here it is more of an evening :)

from beelan-lorawan.

Eric286 avatar Eric286 commented on September 23, 2024

Hello @chromoxdor!

Since the loop continuously checks for an acknowledgment, the code execution stalls at this point, preventing other code sections (like the sensor loop) from running.

Is lora.update() and lora.readAck() Necessary in a Loop?

Yes, these functions are crucial for checking for incoming data and acknowledgments. However, using them within an infinite loop is problematic.

Implement serial communication to print debug messages during code execution to identify potential problems.

Please try to call lora.update() within the loop to check for available data.

Best Regards!

from beelan-lorawan.

chromoxdor avatar chromoxdor commented on September 23, 2024

Thanks for your help. I adjusted my code and as soon as i come in reach of a gateway iยดll report back.
Have a nice day!

from beelan-lorawan.

Eric286 avatar Eric286 commented on September 23, 2024

Hello @chromoxdor

How are you doing with your code?
Could you use a gateway?
Is there anything else I can help you with?

Best Regards!

from beelan-lorawan.

chromoxdor avatar chromoxdor commented on September 23, 2024

Hi eric,

How are you doing with your code?

Everything works fine now. After a lot of trial and error i realized, that there was a memory issues leading to unexpected behavior.
The main steps i did that lead to success where:

  1. reducing the MAX_UPLINK_PAYLOAD_SIZE in the config.h to 50
  2. disabling serial communication completely

I also stripped the library a bit to just send data without waiting for an acknowledgement or any received data which saved space but more importantly time where the mcu can sleep.

Could you use a gateway?

I bought one. :) I did myself and the community a favor...

Thanks and regards,
chromoxdor

from beelan-lorawan.

Eric286 avatar Eric286 commented on September 23, 2024

Hello @chromoxdor

I'm glad to know that everything worked.

If you encounter any further difficulties or wish to share any feedback, please feel free to reach out to us again. We are here to assist you.

Have a nice day!

from beelan-lorawan.

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.