Update gp8211_output.cpp

This commit is contained in:
haudamekki 2024-10-19 21:10:47 +02:00 committed by GitHub
parent e8e8097e8c
commit e8c9529337
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,9 +8,7 @@ static const char *const TAG = "gp8211.output";
static const uint8_t OUTPUT_REGISTER = 0x02;
void GP8211Output::dump_config() {
ESP_LOGCONFIG(TAG, "GP8211 Output:");
}
void GP8211Output::dump_config() { ESP_LOGCONFIG(TAG, "GP8211 Output:"); }
void GP8211Output::write_state(float state) {
ESP_LOGD(TAG, "Original brightness state received from Light component: %.5f", state);
@ -18,7 +16,7 @@ void GP8211Output::write_state(float state) {
uint16_t value = static_cast<uint16_t>(state * 32767);
ESP_LOGD(TAG, "Calculated DAC value: %u", value);
i2c::ErrorCode err = this->parent_->write_register(OUTPUT_REGISTER, (uint8_t *)&value, 2);
i2c::ErrorCode err = this->parent_->write_register(OUTPUT_REGISTER, (uint8_t *) &value, 2);
if (err != i2c::ERROR_OK) {
ESP_LOGE(TAG, "Error writing to GP8211, code %d", err);