[dfplayer][ufire_ise][ufire_ec][qmp6988][atm90e26] Fix wrong operators and masks (#14491)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Jonathan Swoboda
2026-03-05 14:09:23 -05:00
committed by GitHub
co-authored by Claude Opus 4.6 J. Nick Koston
parent 9518d88a2a
commit e1d0c6da09
5 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -197,7 +197,7 @@ float ATM90E26Component::get_reactive_power_() {
float ATM90E26Component::get_power_factor_() {
const uint16_t val = this->read16_(ATM90E26_REGISTER_POWERF); // signed
if (val & 0x8000) {
return -(val & 0x7FF) / 1000.0f;
return -(val & 0x7FFF) / 1000.0f;
} else {
return val / 1000.0f;
}
+1
View File
@@ -260,6 +260,7 @@ void DFPlayer::loop() {
ESP_LOGV(TAG, "Playback finished (USB drive)");
this->is_playing_ = false;
this->on_finished_playback_callback_.call();
break;
case 0x3D:
ESP_LOGV(TAG, "Playback finished (SD card)");
this->is_playing_ = false;
+1 -1
View File
@@ -251,7 +251,7 @@ void QMP6988Component::set_power_mode_(uint8_t power_mode) {
void QMP6988Component::write_filter_(QMP6988IIRFilter filter) {
uint8_t data;
data = (filter & 0x03);
data = (filter & QMP6988_CONFIG_REG_FILTER_MSK);
this->write_byte(QMP6988_CONFIG_REG, data);
delay(10);
}
+1 -1
View File
@@ -8,7 +8,7 @@ static const char *const TAG = "ufire_ec";
void UFireECComponent::setup() {
uint8_t version;
if (!this->read_byte(REGISTER_VERSION, &version) && version != 0xFF) {
if (!this->read_byte(REGISTER_VERSION, &version) || version == 0xFF) {
this->mark_failed();
return;
}
+1 -1
View File
@@ -10,7 +10,7 @@ static const char *const TAG = "ufire_ise";
void UFireISEComponent::setup() {
uint8_t version;
if (!this->read_byte(REGISTER_VERSION, &version) && version != 0xFF) {
if (!this->read_byte(REGISTER_VERSION, &version) || version == 0xFF) {
this->mark_failed();
return;
}