mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-10-28 12:22:23 +00:00
Update host harnesses for current radio and sleep policy
This commit is contained in:
1 parent
05c0ed8bb2
commit
5cf42d0ca1
4 files changed
+16
-7
No files matched your search
@@ -85,6 +85,7 @@ struct RadioLibWrapper {
|
||||
bool _cw_active = false, pending = false, packet = false, busy = false, calibrating = false;
|
||||
bool _rx_ps_enabled = false, _rx_ps_armed = false, _rx_hold_continuous = false;
|
||||
bool _rx_ps_continuous_fallback = false, _nf_calib_active = false;
|
||||
bool _nf_refresh_requested = false;
|
||||
bool _rx_boosted_gain_valid = true, _cur_rx_boosted_gain = true;
|
||||
bool _noise_floor_valid = true, _noise_floor_secondary_valid = true;
|
||||
bool _wd_last_busy = false;
|
||||
@@ -162,7 +163,7 @@ struct RadioLibWrapper {
|
||||
}
|
||||
void doResetAGC() { ++resets; }
|
||||
bool isPacketPendingOrReceiving() { return hasPendingRadioInterrupt() || isReceivingPacket(); }
|
||||
bool resetAGCIfIdle();
|
||||
bool resetAGCIfIdle(bool refresh_floor = true);
|
||||
void resetAGC();
|
||||
void idle() { modem.standby(); state = STATE_IDLE; }
|
||||
uint8_t beginReconfigure();
|
||||
@@ -209,6 +210,7 @@ int main() {
|
||||
assert(w.beginReconfigure() == 2);
|
||||
w.startRecv(); assert(w.arms == 0);
|
||||
assert(w.recoverRadio(true) == false && w.deep_calls == 0);
|
||||
assert(!w.resetAGCIfIdle(false) && w.resets == 0 && w.recalibrations == 0);
|
||||
assert(!w.isBeaconChannelBusy() && !w.pending && w.state == STATE_IDLE);
|
||||
assert(w.restoreBeaconReceive() == Result::APPLIED);
|
||||
assert(!w._beacon_owned && w.state == STATE_RX && w._rx_ps_armed == rxps);
|
||||
@@ -342,7 +344,7 @@ class BeaconRadioTest(unittest.TestCase):
|
||||
"uint8_t RadioLibWrapper::beginReconfigure()",
|
||||
"bool RadioLibWrapper::restoreAfterDeepInit()",
|
||||
"bool RadioLibWrapper::recoverRadio(bool hard)",
|
||||
"bool RadioLibWrapper::resetAGCIfIdle()",
|
||||
"bool RadioLibWrapper::resetAGCIfIdle(bool refresh_floor)",
|
||||
"void RadioLibWrapper::resetAGC()",
|
||||
"void RadioLibWrapper::startRecv()",
|
||||
"bool RadioLibWrapper::startSendRaw(const uint8_t* bytes, int len)",
|
||||
|
||||
@@ -368,16 +368,21 @@ class Esp32HwcdcRecipeTests(unittest.TestCase):
|
||||
self.assertEqual(counts, expected)
|
||||
|
||||
def test_non_esp32_recipes_do_not_acquire_esp32_usb_selectors(self):
|
||||
count = 0
|
||||
checked = set()
|
||||
for name, row in self.rows.items():
|
||||
if row["esp32"]:
|
||||
continue
|
||||
with self.subTest(environment=name):
|
||||
count += 1
|
||||
checked.add(name)
|
||||
self.assertEqual(row["values"], {USB_MODE: "0", USB_CDC: "0"})
|
||||
self.assertFalse(self.sdk["hwcdc_primary_enabled"](row["env"]))
|
||||
self.assertFalse(self.sdk["native_primary_enabled"](row["env"]))
|
||||
self.assertEqual(count, 323)
|
||||
# Every current non-ESP32 recipe is checked above, including newly
|
||||
# added boards. Keep representative architecture coverage explicit
|
||||
# rather than pinning an unrelated, ever-growing environment count.
|
||||
self.assertTrue({"RAK_3x72_companion_radio_usb",
|
||||
"Xiao_nrf52_companion_radio_usb",
|
||||
"PicoW_companion_radio_usb"} <= checked)
|
||||
|
||||
def test_only_existing_partition_diagnostics_keep_their_cdc_override(self):
|
||||
# These two pre-existing diagnostic recipes intentionally select CDC1
|
||||
|
||||
@@ -289,7 +289,8 @@ class UsbLoggingWatchdogRoleTests(unittest.TestCase):
|
||||
self.assertIn('if (mesh::isUsbLoggingWatchdogArmed()) '
|
||||
'return mask(Reason::UsbRecovery);', guard)
|
||||
self.assertIn('const bool can_sleep = sleep_reason == 0;', loop)
|
||||
self.assertLess(loop.index(guard), loop.index('if (can_sleep)'))
|
||||
self.assertLess(loop.index(guard), loop.index(
|
||||
'if (can_sleep && the_mesh.canIdleDualRadio())'))
|
||||
else:
|
||||
self.assertIn('!mesh::isUsbLoggingWatchdogArmed()', loop)
|
||||
|
||||
|
||||
@@ -307,7 +307,8 @@ int main(){
|
||||
self.assertIn('if (mesh::wireless::control().pending()) '
|
||||
'return mask(Reason::Wireless);', guard)
|
||||
self.assertIn('const bool can_sleep = sleep_reason == 0;', loop)
|
||||
self.assertLess(loop.index(guard), loop.index('if (can_sleep)'))
|
||||
self.assertLess(loop.index(guard), loop.index(
|
||||
'if (can_sleep && the_mesh.canIdleDualRadio())'))
|
||||
else:
|
||||
self.assertIn('&& sleep_guard(!mesh::wireless::control().pending(), '
|
||||
'mesh::powerdiag::Reason::Wireless)', loop)
|
||||
|
||||
Reference in new issue
Block a user