formatting

This commit is contained in:
Gábor Poczkodi 2024-10-11 17:56:12 +02:00
parent 74ca4e04bb
commit f448db79d5
3 changed files with 62 additions and 65 deletions

View file

@ -148,28 +148,23 @@ void KT0803Component::update() {
this->publish_pw_ok(); this->publish_pw_ok();
this->publish_slncid(); this->publish_slncid();
} }
/* /*
for (size_t addr = 0; addr < 0x2F; addr++) { for (size_t addr = 0; addr < 0x2F; addr++) {
uint8_t c; uint8_t c;
if (i2c::ERROR_OK == this->read_register(addr, &c, 1, false)) { if (i2c::ERROR_OK == this->read_register(addr, &c, 1, false)) {
ESP_LOGV(TAG, "update register[%02X]: %02X", addr, c); ESP_LOGV(TAG, "update register[%02X]: %02X", addr, c);
} }
} }
*/ */
} }
void KT0803Component::loop() { void KT0803Component::loop() {}
}
// config // config
void KT0803Component::set_chip_id(ChipId value) { void KT0803Component::set_chip_id(ChipId value) { this->chip_id_ = value; }
this->chip_id_ = value;
}
ChipId KT0803Component::get_chip_id() { ChipId KT0803Component::get_chip_id() { return this->chip_id_; }
return this->chip_id_;
}
std::string KT0803Component::get_chip_string() const { std::string KT0803Component::get_chip_string() const {
switch (this->chip_id_) { switch (this->chip_id_) {
@ -198,7 +193,9 @@ void KT0803Component::set_frequency(float value) {
this->state_.CHSEL0 = (uint8_t) ((ch >> 0) & 0x01); this->state_.CHSEL0 = (uint8_t) ((ch >> 0) & 0x01);
this->write_reg_(0x00); this->write_reg_(0x00);
this->write_reg_(0x01); this->write_reg_(0x01);
if (this->chip_id_ != ChipId::KT0803) {
this->write_reg_(0x02); this->write_reg_(0x02);
}
this->publish_frequency(); this->publish_frequency();
} }