mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-27 08:18:28 +02:00
Run clang-tidy against ESP32 (#2147)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Co-authored-by: Otto winter <otto@otto-winter.com>
This commit is contained in:
@@ -71,8 +71,8 @@ bool XiaomiMiscale2::parse_message(const std::vector<uint8_t> &message, ParseRes
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_Stabilized = ((data[1] & (1 << 5)) != 0) ? true : false;
|
||||
bool loadRemoved = ((data[1] & (1 << 7)) != 0) ? true : false;
|
||||
bool is_stabilized = ((data[1] & (1 << 5)) != 0);
|
||||
bool load_removed = ((data[1] & (1 << 7)) != 0);
|
||||
|
||||
// weight, 2 bytes, 16-bit unsigned integer, 1 kg
|
||||
const int16_t weight = uint16_t(data[11]) | (uint16_t(data[12]) << 8);
|
||||
@@ -85,11 +85,7 @@ bool XiaomiMiscale2::parse_message(const std::vector<uint8_t> &message, ParseRes
|
||||
const int16_t impedance = uint16_t(data[9]) | (uint16_t(data[10]) << 8);
|
||||
result.impedance = impedance;
|
||||
|
||||
if (!is_Stabilized || loadRemoved || impedance == 0 || impedance >= 3000) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return is_stabilized && !load_removed && impedance != 0 && impedance < 3000;
|
||||
}
|
||||
|
||||
bool XiaomiMiscale2::report_results(const optional<ParseResult> &result, const std::string &address) {
|
||||
|
||||
Reference in New Issue
Block a user