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:
Oxan van Leeuwen
2021-09-13 18:11:27 +02:00
committed by GitHub
parent a2d2863c72
commit 40c474cd83
74 changed files with 291 additions and 364 deletions
@@ -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) {