mirror of
https://github.com/esphome/esphome.git
synced 2026-10-21 21:36:14 +00:00
[sx126x][sx127x] Stop reading a radio that fails while sends are held back
Also drop a leftover preamble_detect key from a test case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
431444dc7f
commit
8a07d4204b
@@ -49,9 +49,10 @@ class RadioLink : public RadioLinkBase, public Listener {
|
||||
this->radio_->register_listener(this);
|
||||
this->disable_loop();
|
||||
}
|
||||
// Runs only during a busy period; a busy flag that never clears keeps it running
|
||||
// Runs only during a busy period; a busy flag that never clears keeps it running. A radio that failed meanwhile
|
||||
// is not read again, as reading it may wait on the radio every time
|
||||
void loop() override {
|
||||
if (!this->radio_->is_receiving())
|
||||
if (!this->radio_->is_ready() || !this->radio_->is_receiving())
|
||||
this->radio_free_();
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +105,16 @@ TEST_F(RadioLinkTest, FailedRadioRefusesSends) {
|
||||
EXPECT_TRUE(this->radio_.sent.empty());
|
||||
}
|
||||
|
||||
TEST_F(RadioLinkTest, RadioFailingWhileBusyEndsBusyPeriod) {
|
||||
set_time(START);
|
||||
this->radio_.receiving = true;
|
||||
EXPECT_FALSE(this->send_());
|
||||
EXPECT_TRUE(this->link_.is_in_loop_state());
|
||||
this->radio_.fail();
|
||||
this->link_.loop();
|
||||
EXPECT_TRUE(this->link_.is_idle());
|
||||
}
|
||||
|
||||
TEST_F(RadioLinkTest, ReceivedPacketCarriesSignal) {
|
||||
Packet received;
|
||||
PacketMetaData meta;
|
||||
|
||||
@@ -137,7 +137,6 @@ class _FullConfig(dict):
|
||||
"packet_mode": True,
|
||||
"payload_length": 0,
|
||||
"sync_value": [],
|
||||
"preamble_detect": 0,
|
||||
},
|
||||
{},
|
||||
"sync_value",
|
||||
|
||||
Reference in New Issue
Block a user