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

Issue with Configration and the DevEUI #14

Closed cyclops1982 closed 2 months ago

cyclops1982 commented 2 months ago

We have an issue with our _loraDevEUI and _loraNodeAppKey. These are stored in the ConfigurationParameters and are thus, also writen to the internal storage when we do WriteConfig(). The result is that an InitConfig() reads those values and thus overwrites the default values we set. A ResetConfig() should fix this, but that's a bit odd because we'd have to do that /via/ the lora itself.
We have tested that procedure and it /does/ work. We can reset and then restart, and we'll fall back to the default config. It's just a very weird setup.

So, how do we solve this? Realistically, config that is there to /connect/ to the Lora network should maybe not sit within the stored config. And the stored config should probably only hold values that we want to change via lora... this is however not 100% true because things like ADR are also lora config, but we don't change them. We also don't store a lot of lora stuff. Like public network, which class, etc,etc.

So, where does this leave this? For now, the easiest solution is to move _loraDevEUI and _loraNodeAppKey to be passed /into/ the InitConfig() parameter. This means we don't need to change the code, but we still have stuff hardcoded.

cyclops1982 commented 2 months ago

The alternative is that we actually make this configuration completely /via/ lora. So we'd hardcode some random bogus ID into the device, which we support on our gateway. They we /send/ the new devEUI and AppKey to the device and restart it...

This would allow us to do configuration, and it is stored on config...

cyclops1982 commented 2 months ago

This was/is resolved by allowing us to change the devEUI via the config. We also found some other ways to make sure the deveui is overwritten.

The main process how should be:

Furthermore, we also have logged more options to work via BT. That could allow us to seperate the storage of these settings, because then we can have it so that the device doesn't start lora if there's no deveui until programmed (into other memory) via BT.