Brightness control fixes (#1)

* refactor light value controls method

* fix brightness debug output

* partial fixes for brightness control

* try to fix white brightness

* fix payload debug logging

* fix debug output logging

* fix light_off message

* fix brightness
This commit is contained in:
Dennis George 2025-02-10 09:04:00 -06:00 committed by GitHub
commit d20f78ddfe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 106 additions and 57 deletions

View file

@ -1,3 +1,5 @@
#include <vector>
#include <cstdio>
#include "esphome/core/log.h"
#include "utils.h"
@ -109,5 +111,16 @@ namespace esphome
ctx.f_0x4 = var0;
}
}
std::vector<char> vector_to_hex_string(std::vector<uint8_t> &data)
{
std::vector<char> hex_str(data.size() * 2 + 1); // Allocate the vector with the required size
for (size_t i = 0; i < data.size(); i++)
{
sprintf(hex_str.data() + (i * 2), "%02X", data[i]);
}
hex_str[data.size() * 2] = '\0'; // Ensure null termination
return hex_str;
}
} // namespace fastcon
} // namespace esphome