-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
small changes #1306
small changes #1306
Conversation
src/devices/thermostat.cpp
Outdated
@@ -843,6 +843,8 @@ void Thermostat::process_RC35wwTimer(std::shared_ptr<const Telegram> telegram) { | |||
if (telegram->type_id != 0x38) { | |||
return; | |||
} | |||
|
|||
// TODO: should this be >= 87 to avoid out of bounds? |
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.
No, this is the right check, we make sure that all offsets 87-92 are in the telegram. (e.g. read 10 38 90 gives offsets 90-117, so 87, 88, 89 are missing, o processing)
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.
yes sorry, not sure what I was thinking
src/emsdevicevalue.cpp
Outdated
@@ -331,7 +331,7 @@ bool DeviceValue::get_custom_min(int16_t & val) { | |||
if (fahrenheit) { | |||
v = (v - (32 * (fahrenheit - 1))) / 1.8; // reset to °C | |||
} | |||
if (max > 0 && v > max) { | |||
if (max > 0 && v > (int16_t)max) { |
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.
Could be wrong to shorten max, if you want to compare identical types do
if (max > 0 && v > 0 && (uint32_t)v >max) {
Maybe it's much easier to set max as int32_t and use 31 bit range and handle the inputs for min/max also in int32_t, only shorten min to int16_t for storage.
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.
thanks, this was just so the code would compile on my MacBook - the compiler would throw an error. I'll go for option 1 or look at a compiler option to ignore these checks.
@MichaelDvP could you look at the TODO in
thermostat.cpp