1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-01 00:08:15 +00:00

applay clang format

This commit is contained in:
Georgi Filipov 2024-12-24 02:56:46 +02:00
parent c3af939430
commit 6e62103acd
2 changed files with 12 additions and 11 deletions

View File

@ -125,12 +125,12 @@ void SamsungClimateIR::set_temp_(const uint8_t temp) {
/// @param[in] on true, the AC is on. false, the AC is off.
void SamsungClimateIR::set_and_send_power_state_(const bool on) {
static const uint8_t kOn[K_SAMSUNG_AC_EXTENDED_STATE_LENGTH] = {0x02, 0x92, 0x0F, 0x00, 0x00, 0x00, 0xF0,
0x01, 0xD2, 0x0F, 0x00, 0x00, 0x00, 0x00,
0x01, 0xE2, 0xFE, 0x71, 0x80, 0x11, 0xF0};
0x01, 0xD2, 0x0F, 0x00, 0x00, 0x00, 0x00,
0x01, 0xE2, 0xFE, 0x71, 0x80, 0x11, 0xF0};
static const uint8_t kOff[K_SAMSUNG_AC_EXTENDED_STATE_LENGTH] = {0x02, 0xB2, 0x0F, 0x00, 0x00, 0x00, 0xC0,
0x01, 0xD2, 0x0F, 0x00, 0x00, 0x00, 0x00,
0x01, 0x02, 0xFF, 0x71, 0x80, 0x11, 0xC0};
0x01, 0xD2, 0x0F, 0x00, 0x00, 0x00, 0x00,
0x01, 0x02, 0xFF, 0x71, 0x80, 0x11, 0xC0};
std::memcpy(protocol_.raw, on ? kOn : kOff, K_SAMSUNG_AC_EXTENDED_STATE_LENGTH);
@ -196,7 +196,7 @@ void SamsungClimateIR::checksum_(void) {
/// @param[in] init Starting value of the calculation to use. (Default is 0)
/// @return The nr. of bits found of the given type found in the array.
uint16_t SamsungClimateIR::count_bits(const uint8_t *const start, const uint16_t length, const bool ones,
const uint16_t init) {
const uint16_t init) {
uint16_t count = init;
for (uint16_t offset = 0; offset < length; offset++)

View File

@ -21,8 +21,8 @@ const uint16_t K_SAMSUNG_AC_EXTENDED_STATE_LENGTH = 21;
const uint16_t K_SAMSUNG_AC_SECTION_LENGTH = 7;
// Temperature
const uint8_t K_SAMSUNG_AC_MIN_TEMP = 16; // C Mask 0b11110000
const uint8_t K_SAMSUNG_AC_MAX_TEMP = 30; // C Mask 0b11110000
const uint8_t K_SAMSUNG_AC_MIN_TEMP = 16; // C Mask 0b11110000
const uint8_t K_SAMSUNG_AC_MAX_TEMP = 30; // C Mask 0b11110000
// Mode
const uint8_t K_SAMSUNG_AC_AUTO = 0;
@ -49,12 +49,12 @@ const uint8_t K_LOW_NIBBLE = 0;
const uint8_t K_HIGH_NIBBLE = 4;
static const uint8_t K_RESET[K_SAMSUNG_AC_EXTENDED_STATE_LENGTH] = {0x02, 0x92, 0x0F, 0x00, 0x00, 0x00, 0xF0,
0x01, 0x02, 0xAE, 0x71, 0x00, 0x15, 0xF0};
0x01, 0x02, 0xAE, 0x71, 0x00, 0x15, 0xF0};
/// Native representation of a Samsung A/C message.
union SamsungProtocol {
uint8_t raw[K_SAMSUNG_AC_EXTENDED_STATE_LENGTH]; ///< State in code form.
struct { // Standard message map
struct { // Standard message map
// Byte 0
uint8_t : 8;
// Byte 1
@ -197,8 +197,9 @@ class SamsungClimateIR : public climate_ir::ClimateIR {
void checksum_();
static uint8_t calc_section_checksum(const uint8_t *section);
static uint16_t count_bits(const uint8_t *const start, const uint16_t length, const bool ones = true,
const uint16_t init = 0);
static uint16_t count_bits(const uint64_t data, const uint8_t length, const bool ones = true, const uint16_t init = 0);
const uint16_t init = 0);
static uint16_t count_bits(const uint64_t data, const uint8_t length, const bool ones = true,
const uint16_t init = 0);
};
} // namespace climate_ir_samsung
} // namespace esphome