-
Notifications
You must be signed in to change notification settings - Fork 127
Monitor all temperature sensors #922
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
base: master
Are you sure you want to change the base?
Conversation
Sets `_temps[EVSE_MONITOR_TEMP_MONITOR]` and `_temps[EVSE_MONITOR_TEMP_MAX]` using the temperature sensor with the highest reading, rather than always using the first sensor with a valid reading.
Thanks for your contribution, however EVSE_MONITOR_TEMP_MAX was already the max temp, I am not sure EVSE_MONITOR_TEMP_MONITOR should be the same. EVSE_MONITOR_TEMP_MONITOR is the temp sensor that will most likely be monitoring the temp of the cable/connector to the EV that so that the current can be limited if it gets too hot. This is no nessecerially the hotest temp sensor, eg you don't what your charging current limited or cut off becuse the WiFi board is doing some number crunching and gets a little hot, but in most cases it won't matter as there will only be one temp sensor. Maybe you can describe your use csae. |
It appeared to be a bug:
Maybe I misunderstand what As I also have a DS3232 fitted (because I wanted a real-time clock) as well as a MCP9808, I noticed that Examining the code, I saw that This seems wrong, if the intention is that If on the other hand If this change isn't appropriate, may I suggest some comments clarifying what (Obviously the OpenEVSE board's handling of its three temperature sensors is independent of all this. It has a separate over-temperature threshold for temp3, for input connector monitoring, but will respond to an over-temperature condition on any of the sensors.) |
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.
Pull Request Overview
This PR refactors temperature sensor processing to determine the maximum temperature from all available sensors rather than stopping at the first valid reading.
- Iterates through all sensors to update both the monitor and max temperature registers.
- Removes the early loop exit (break) to consider every valid temperature reading.
{ | ||
_temps[EVSE_MONITOR_TEMP_MONITOR].set(temp); | ||
} | ||
if(temp > _temps[EVSE_MONITOR_TEMP_MAX].get()) |
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.
Consider adding a validity check for _temps[EVSE_MONITOR_TEMP_MAX] (similar to the monitor sensor) before comparing the temperature. This could help avoid unexpected behavior if the max sensor’s value is uninitialized.
if(temp > _temps[EVSE_MONITOR_TEMP_MAX].get()) | |
if(!_temps[EVSE_MONITOR_TEMP_MAX].isValid() || temp > _temps[EVSE_MONITOR_TEMP_MAX].get()) |
Copilot uses AI. Check for mistakes.
Sets
_temps[EVSE_MONITOR_TEMP_MONITOR]
and_temps[EVSE_MONITOR_TEMP_MAX]
using the temperature sensor with the highest reading, rather than always using the first sensor with a valid reading.