1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-15 01:32:19 +01:00

Introduce hex parsing & formatting helper functions (#2882)

This commit is contained in:
Oxan van Leeuwen
2021-12-12 21:15:23 +01:00
committed by GitHub
parent b2f05faee0
commit beeb0c7c5a
20 changed files with 186 additions and 109 deletions

View File

@@ -26,7 +26,7 @@ class MideaData {
bool is_valid() const { return this->data_[OFFSET_CS] == this->calc_cs_(); }
void finalize() { this->data_[OFFSET_CS] = this->calc_cs_(); }
bool check_compliment(const MideaData &rhs) const;
std::string to_string() const { return hexencode(*this); }
std::string to_string() const { return format_hex_pretty(this->data_, sizeof(this->data_)); }
// compare only 40-bits
bool operator==(const MideaData &rhs) const { return !memcmp(this->data_, rhs.data_, OFFSET_CS); }
enum MideaDataType : uint8_t {