espurna
espurna copied to clipboard
Store energy in mWs
subj
Current conversion does truncation https://github.com/xoseperez/espurna/blob/5f6df82110573f25ca0a15003ff4e22efcee9a94/code/espurna/sensor.h#L86-L88 https://en.cppreference.com/w/cpp/language/operator_arithmetic#Conversions https://en.cppreference.com/w/cpp/language/implicit_conversion#Floating.E2.80.93integral_conversions For example, sensor read 0.9W over 1 second will result in 0. Longer interval will eventually allow for the value to appear, but this may also result in loss of precision when it is truncated to the integer part.
Current Energy
pair is kWh + Ws, which could become kWh + mWs instead
https://github.com/xoseperez/espurna/blob/5f6df82110573f25ca0a15003ff4e22efcee9a94/code/espurna/sensor.h#L141-L144
This needs new type and a proper math adjustment. Plus, everything related to serialization needs to know of these different conversion rules. Right now it only understands kWh + Ws