Comments removed

This commit is contained in:
Adrian Schupp 2024-10-17 21:36:14 +02:00
parent a87ce5fb85
commit 8097f85632
3 changed files with 5 additions and 9 deletions

View file

@ -28,7 +28,7 @@ CONFIG_SCHEMA = (
}
)
.extend(cv.COMPONENT_SCHEMA)
.extend(i2c.i2c_device_schema(0x58)) # GP8211 I2C-Adresse
.extend(i2c.i2c_device_schema(0x58))
)
async def to_code(config):

View file

@ -6,11 +6,10 @@ namespace gp8211 {
static const char *const TAG = "gp8211";
static const uint8_t RANGE_REGISTER = 0x01; // Register für die Spannungsrange
static const uint8_t RANGE_REGISTER = 0x01;
void GP8211::setup() {
// Wähle den Spannungsmodus basierend auf der YAML-Konfiguration
uint8_t voltage_setting = (this->voltage_ == GP8211_VOLTAGE_10V) ? 0x77 : 0x55; // 0x77 für 0-10V, 0x55 für 0-5V
uint8_t voltage_setting = (this->voltage_ == GP8211_VOLTAGE_10V) ? 0x77 : 0x55;
this->write_register(RANGE_REGISTER, &voltage_setting, 1);
}

View file

@ -13,14 +13,11 @@ void GP8211Output::dump_config() {
}
void GP8211Output::write_state(float state) {
// Ausgabe des ursprünglichen Helligkeitswerts von der Light-Komponente
ESP_LOGD(TAG, "Original brightness state received from Light component: %.5f", state);
// Konvertiere den state (0.0 bis 1.0) in einen 15-Bit DAC-Wert (0 bis 32767)
uint16_t value = static_cast<uint16_t>(state * 32767);
ESP_LOGD(TAG, "Calculated DAC value: %u", value); // Ausgabe des berechneten Wertes zur Überprüfung
ESP_LOGD(TAG, "Calculated DAC value: %u", value);
// Sende den Wert an den DAC (2 Bytes)
i2c::ErrorCode err = this->parent_->write_register(OUTPUT_REGISTER, (uint8_t *)&value, 2);
if (err != i2c::ERROR_OK) {