pimoroni / enviro

MIT License
101 stars 79 forks source link

Weather battery temperature compensation #186

Open sjefferson99 opened 11 months ago

sjefferson99 commented 11 months ago

Adds a config option for an offset when running on battery for the weather board. This extends the work done on PR #160 to add USB offset to weather board.

Get readings on the weather board will always apply a correction and selects either USB or battery value from the config file. This does assume the value is available and uses the existing config file framework to apply defaults and warn in the log if missing to prevent a crash if not actively configured.

Default value is 0 as most users will not be polling at a frequency that should cause this issue and it is not in the setup web pages.

I have tested on USB and battery with the weather board to ensure the logic works as expected.

Deploying outdoors for long term testing, I have also upgraded to the Pimoroni Enviro v1.20.3 firmware for this and my other PRs for long term stability testing, so far so good.

This addresses issue #185

MrDrem commented 1 week ago

WIth regards both this, and pull #160 (Add usb temp compensation to weather) The biggest issue that I see is when the reading that has the WiFi turned on is taken. This one creates a minor (0.5 degree C) uplift to the temperature every time. It may be lower when on battery, and lower still when outside.

sjefferson99 commented 4 days ago

@MrDrem This PR gives an option to adjust an offset specific to when running on battery. I made this as I am running permanent poll and upload on battery and this does seem to generate excess heat. I'm not sure what improvement you are looking for exactly, but perhaps it's to support an adjustment on battery only on a reading upload poll for those using the intended approach of only upload every X polls?

MrDrem commented 2 days ago

I think that what I was hoping for is that there should be 2 adjustment values - one for the 'background' additional heat that is there due to either the battery or the USB power, and a second for the WiFi upload. I guess that this makes 4 adjustments overall as the WiFi value seems to be different based on how the board is powered.