Open fel115 opened 1 year ago
Thank you for creating this issue!
"So if we need to RestoreBaseline"
Do you mean in the case of signals?
Thank you for creating this issue!
"So if we need to RestoreBaseline"
Do you mean in the case of signals?
Yes, especially in case of signals. Here the program should terminate fast and save all data.
Why not make an explicit additional saving when the program terminates independent of these loops?
Yes, this was another idea, to use a Mutex of Environment and do the restore in the signals module.
Buttons already implements Drop, which also should be executed on shutdown. The same technique could be used for the sensors module.
I don't think that the signals module should know anything from the other modules.
Buttons already implements Drop, which also should be executed on shutdown. The same technique could be used for the sensors module.
Do you mean the Environment module? So we store the baseline in the Drop function.
I don't think that the signals module should know anything from the other modules.
So the signals shouldn't have a channel to the modules? Or do you mean the mutex shouldn't be passed to the signals module?
Do you mean the Environment module? So we store the baseline in the Drop function.
Yes, exactly :rocket:
So the signals shouldn't have a channel to the modules? Or do you mean the mutex shouldn't be passed to the signals module?
I meant that the signals should not have a reference to the Environment (or any other module), thus they should be unable to store the baseline.
Can you please update the architecture picture? Dependencies like this should be visible, as they are important.
Doesn't seem to be fixed?
The problem is, that if the Environment loop is only called every minute, so it can only receive MPSC-Channel messages every minute. So if we need to RestoreBaseline we need to wait a max of one minute to RestoreBaseline. The idea is to use two loops, one for handling the Envirionment data and one for receiving the MPSC-Messages. But RememberBasline and RestoreBaseline need to know the new data gathered by the other loop. Maybe a communication between the loops? Or Maybe using
tokio::macros::select
to execute the path which is triggered.