[multiple] Fix cast/operator precedence bugs (#14560)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jonathan Swoboda
2026-03-06 09:14:12 -10:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 3db436e48e
commit 7b8ba9bf20
4 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ class DateCall {
DateEntity *parent_;
optional<int16_t> year_;
optional<uint16_t> year_;
optional<uint8_t> month_;
optional<uint8_t> day_;
};
+1 -1
View File
@@ -172,7 +172,7 @@ uint8_t ES7210::es7210_gain_reg_value_(float mic_gain) {
// reg: 12 - 34.5dB, 13 - 36dB, 14 - 37.5dB
mic_gain += 0.5;
if (mic_gain <= 33.0) {
return (uint8_t) mic_gain / 3;
return (uint8_t) (mic_gain / 3);
}
if (mic_gain < 36.0) {
return 12;
+1 -1
View File
@@ -199,7 +199,7 @@ void SGP4xComponent::measure_raw_() {
response_words = 2;
}
}
uint16_t rhticks = llround((uint16_t) ((humidity * 65535) / 100));
uint16_t rhticks = (uint16_t) llround((humidity * 65535) / 100);
uint16_t tempticks = (uint16_t) (((temperature + 45) * 65535) / 175);
// first parameter are the relative humidity ticks
data[0] = rhticks;
+3 -1
View File
@@ -327,7 +327,9 @@ uint16_t TSL2591Component::get_illuminance(TSL2591SensorChannel channel, uint32_
return (combined_illuminance >> 16);
} else if (channel == TSL2591_SENSOR_CHANNEL_VISIBLE) {
// Reads all and subtracts out the infrared
return ((combined_illuminance & 0xFFFF) - (combined_illuminance >> 16));
uint16_t full = combined_illuminance & 0xFFFF;
uint16_t ir = combined_illuminance >> 16;
return (ir > full) ? 0 : (full - ir);
}
// unknown channel!
ESP_LOGE(TAG, "get_illuminance() caller requested an unknown channel: %d", channel);