Cover RXPS arm retry state in radio diagnostics reset fixture

This commit is contained in:
mikecarper committed 2026-10-23 18:56:00 -07:00
1 parent 590d0258e5
commit e13d24020a
1 file changed
+9
+9
View File
@@ -6,6 +6,7 @@
#include <string>
#include <vector>
#include <helpers/CompanionRadioDiagnostics.h>
#include <helpers/radiolib/RXPowerSaving.h>
constexpr int RADIOLIB_NC=-1;
constexpr int RADIOLIB_ERR_NONE=0;
@@ -33,6 +34,8 @@ public:
bool _rx_ps_enabled=true;
uint32_t _rx_ps_rx_us=123456,_rx_ps_sleep_us=765432;
uint32_t n_recv=7,n_sent=9,n_recv_errors=3,n_wd_soft=11,n_wd_hard=13;
uint32_t _rx_ps_arm_failures=23;
RxPowerSavingArmRetryState _rx_ps_arm_retry;
uint32_t last_rx=1234;
unsigned rearm_calls=0;
bool hasPendingRadioInterrupt() const {return physical.pending;}
@@ -197,9 +200,15 @@ int main() {
assert(!h.command(nullptr,reply,sizeof(reply)));
assert(!h.command("clear stats",nullptr,sizeof(reply)));
assert(!h.command("clear stats",reply,0));assert(h.clears==0);
assert(h.driver._rx_ps_arm_failures==23);
for(unsigned i=0;i<RX_POWERSAVING_MAX_CONSEC_ARM_FAILURES;++i)
h.driver._rx_ps_arm_retry.recordFailure();
assert(!h.driver._rx_ps_arm_retry.canAttempt());
assert(h.command("clear stats",reply,sizeof(reply)));
assert(!strcmp(reply,"(OK - stats reset)")&&h.clears==1);
assert(h.driver.n_recv==0&&h.driver.n_sent==0&&h.driver.n_recv_errors==0);
assert(h.driver._rx_ps_arm_failures==0);
assert(h.driver._rx_ps_arm_retry.consecutiveFailures()==0&&h.driver._rx_ps_arm_retry.canAttempt());
assert(h.dispatcher.n_sent_flood==0&&h.dispatcher.n_sent_direct==0&&h.dispatcher.n_recv_flood==0&&h.dispatcher.n_recv_direct==0);
assert(h.dispatcher._err_flags==0&&h.tables._direct_dups==0&&h.tables._flood_dups==0);
assert(h.driver.n_wd_soft==11&&h.driver.n_wd_hard==13&&h.driver.last_rx==1234);