[sx127x][cc1101] Disable loop when packet mode is inactive (#15606)

This commit is contained in:
Jonathan Swoboda
2026-04-09 15:00:52 -04:00
committed by GitHub
parent 03db32d045
commit d062f62656
2 changed files with 15 additions and 1 deletions

View File

@@ -150,6 +150,10 @@ void CC1101Component::setup() {
if (this->gdo0_pin_ != nullptr) {
this->defer([this]() { this->gdo0_pin_->pin_mode(gpio::FLAG_INPUT); });
}
if (this->state_.PKT_FORMAT != static_cast<uint8_t>(PacketFormat::PACKET_FORMAT_FIFO)) {
this->disable_loop();
}
}
void CC1101Component::call_listeners_(const std::vector<uint8_t> &packet, float freq_offset, float rssi, uint8_t lqi) {
@@ -669,6 +673,11 @@ void CC1101Component::set_packet_mode(bool value) {
this->state_.GDO0_CFG = 0x0D;
}
if (this->initialized_) {
if (value) {
this->enable_loop();
} else {
this->disable_loop();
}
this->write_(Register::PKTCTRL0);
this->write_(Register::PKTCTRL1);
this->write_(Register::IOCFG0);

View File

@@ -383,9 +383,14 @@ void SX127x::set_mode_(uint8_t modulation, uint8_t mode) {
if (millis() - start > 20) {
ESP_LOGE(TAG, "Set mode failure");
this->mark_failed();
break;
return;
}
}
if (mode == MODE_RX && (modulation == MOD_LORA || this->packet_mode_)) {
this->enable_loop();
} else {
this->disable_loop();
}
}
void SX127x::set_mode_rx() {