-
Notifications
You must be signed in to change notification settings - Fork 5
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
Async Refactor WIP #75
Conversation
This keeps the old semantic with normal/senor mode but makes main more understandable. It's a good first step towards a refactor.
Seems like it only needs formatting. |
We can merge this to have one consistent "old" version before the complete refactor. |
If it is tested on hardware that it still works, we can do so, otherwise I don't see why we should do it. Master should be known to work. You can simply give |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to see progress, cannot wait to see more 🚀
Yes, async and Traits can be tricky, we refactor it into stand-alone functions first and when it works, we see how to put it into Traits or whether we just put the functions into their respective module. The abstractions will come ;) |
@markus2330 I have a few questions regarding config. Can we just have multiple copies of config cloating around, or should there only be one config object that is atomic? what about sync, is that done by libelectra? |
1 similar comment
@markus2330 I have a few questions regarding config. Can we just have multiple copies of config cloating around, or should there only be one config object that is atomic? what about sync, is that done by libelectra? |
Elektra's core definitely allows it but there are some plugins in Elektra that don't like concurrency. E.g. ElektraInitiative/libelektra#4466 was a problem for Opensesame but it should be fixed now. Furthermore, there might be issues if there are way too many open handles: ElektraInitiative/libelektra#3140
Yeah, some mutex protection or similar is probably the simpler and safer way to use Elektra.
Which sync do you mean? Sync on file system level is done by libelektra. |
To clarify: it is allowed (with potential limitations described above) to have separated instances of KDB, Key and KeySet per thread and use them concurrently. |
…n CommandToButtons; and mod_ir_temps.rs and clima_sensor_us.rs remove timeouts
…into refactor_main
…r check if capacity changed; reorder interval.tick()
I think the refactoring to async is done. Other changes can be done in a separate PR. I already tested Buttons, Bell, PWR, Environment, Battery, Watchdog, Audio Bell, Garage, Signal, and Sensors. Today I am going to test Weatherstation in combination with other modules. Which version of opensesame should this PR be? v0.8.0? |
Great! 🚀 Is it already ready to review? How to start reviewing this big PR, can you write some intro to the module system and how everything works together?
Please watch out that the weatherstation keeps on publishing most of the time. (If you install a broken version, please replace it with a working version again afterwards.)
Yes, at least if already everything works. Maybe even 0.9.0 to indicate we will be soon at 1.0.0? |
Yes, now it's ready for review. I hope my explanation below is helping. OpenSesameaudio.rsThis module handles audio output for playing fire alarms and bell sounds. This module can receive commands from the Module Buttons (Bell), Environment (FireAlarm), Nextcloud (FireAlarm, Bell), and Signals (FireAlarm, Bell). bat.rsChecks the battery capacity every ten minutes and outputs to Nextcloud if it falls below 50%. If it goes below 50%, the threshold for the next Nextcloud message is set to 40%. buttons.rsThis module implements the clima_sensor_us.rsThis module works independently, sending warnings to Nextcloud and publishing to opensensemap. We needed to implement config.rsNo changes were made to this module. environment.rsChanged the functions garage.rsThis module is checked at intervals of 10 milliseconds, triggering Nextcloud Chat or Buttons commands if the button is pressed. Future changes will involve removing the interval and implementing trigger-oriented events because GPIO pins from the Olimex board are used, along with interrupts. mod_ir_temp.rsThis module is triggered at given intervals and warns by sending Nextcloud messages. nextcloud.rsImplements two loops: one for sending ( ping.rsThis module sends a ping message to Nextcloud if it receives the pwr.rsNo significant changes were made to this module. sensors.rsNo major changes, only the signals.rsThis module listens to system signals and executes the same events as in the old version. ssh.rsChanged to an async function. types.rsThis module contains the error types defined so far. validator.rsNo changes were made to this module. watchdog.rsThis background task is triggered every few seconds and writes to the specified file. The main.rsIn this loop, we initialize every module if it is enabled. Additionally, the MPSC (Multiple Producer, Single Consumer) channels are initialized here. To configure each module without encountering issues related to multiple access to one config object, we read the configuration in the main. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great progress, I like many of these changes. The documentation is a bit poor, please describe what works now for all the modules. There are a few German comments. Some TODOs are not clear. TODOs shouldn't be bugs in code (for that please create issues) but only things that could be improved.
Because it isn't working, and wasn't implemented in the old version of opensesame
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(only a few answers, did not review again)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few last issues are to be created and a few TODOs should refer to these issues, then we can merge this. I could test this tomorrow if we manage to merge it till then.
I merged this branch with the main, and it is now ready. I can't merge into this repo @markus2330. |
Finally done 🚀 ❤️ |
No description provided.