26.04.2017, 17:11
I've been reading the code, trying to understand how/why everything works. Mostly I've been going over main/reader.go and smartpi/ade7878.go.
I'm wondering if there is some additional documentation on all of the inputs and outputs.
I'm considering refactoring this code to make it easier to follow. The big one is smartpi.ReadoutValues(), which returns a completely unformated slice of floats. This should really be a struct, or broken up into several smaller sub-functions.
For example, in the main for{} loop of readout.go, there is a sub-loop that updates all of the current/voltage gauges (I think), but it ignores the cumulative counters every 5 seconds.
Then every 12 iterations (1min) it updates the database storage and two persistent cumulative counters.
Then it resets the value state for everything and starts the temporary cumulative counters over again.
Does this all sound correct?
I'm also wondering what unit these values are:
EB1: 1.116625 EB2: 0.0341316 EB3: 0.033458143 EL1: 0 EL2: 0 EL3: 0
One more question, it looks like there is no way to ignore disconnected phases, my apartment only has one phase, I can turn off voltage readings, but it appears to be counting some current against the cumulative counter on phases that are disconnected.
I'm wondering if there is some additional documentation on all of the inputs and outputs.
I'm considering refactoring this code to make it easier to follow. The big one is smartpi.ReadoutValues(), which returns a completely unformated slice of floats. This should really be a struct, or broken up into several smaller sub-functions.
For example, in the main for{} loop of readout.go, there is a sub-loop that updates all of the current/voltage gauges (I think), but it ignores the cumulative counters every 5 seconds.
Then every 12 iterations (1min) it updates the database storage and two persistent cumulative counters.
Then it resets the value state for everything and starts the temporary cumulative counters over again.
Does this all sound correct?
I'm also wondering what unit these values are:
EB1: 1.116625 EB2: 0.0341316 EB3: 0.033458143 EL1: 0 EL2: 0 EL3: 0
One more question, it looks like there is no way to ignore disconnected phases, my apartment only has one phase, I can turn off voltage readings, but it appears to be counting some current against the cumulative counter on phases that are disconnected.