Model regulator servicing in extracted role loop fixtures

This commit is contained in:
mikecarper committed 2026-10-18 22:35:23 -07:00
1 parent a2b2a8616f
commit a08d7f07ab
3 files changed
+17

No files matched your search

+9
View File
@@ -20,6 +20,12 @@ uint32_t millis() { return 100000; }
void delay(unsigned) { ++delays; }
bool usbLoggingRecoverySafe() { return true; }
namespace mesh {
namespace power {
// Regulator persistence/recovery has separate executable tests. Keep its
// lifecycle boundary visible while this fixture exercises actual role loops.
static unsigned regulator_services=0;
void serviceRegulatorSettings() { ++regulator_services; }
}
void serviceUsbLoggingPort() { ++usb_services; }
void serviceUsbTerminalPort() { ++usb_services; }
bool isUsbLoggingEnabled() { return false; }
@@ -259,4 +265,7 @@ int main() {
the_mesh.dual_radio=false;
loop();
assert(board.profile_preparations==profile_preparations+1 && board.sleeps==profile_sleeps+1);
#if !ROLE_REPEATER
assert(mesh::power::regulator_services==board.calls);
#endif
}
+4
View File
@@ -24,6 +24,10 @@ struct Stream {
}
} console;
namespace mesh {
namespace power {
// The command-pump fixture isolates USB/CLI timing from regulator storage.
void serviceRegulatorSettings() {}
}
void serviceUsbLoggingPort() {}
void serviceUsbTerminalPort() {}
bool takeUsbTerminalSessionReset() { return false; }
+4
View File
@@ -96,6 +96,10 @@ MockSerial Serial;
pump = body((ROOT / "examples/simple_repeater/main.cpp").read_text(),
"static void __attribute__((noinline)) serviceCommandInterfaces()")
return source + r'''
namespace mesh { namespace power {
// The command-pump fixture isolates USB/CLI timing from regulator storage.
void serviceRegulatorSettings() {}
}}
struct MyMesh {
void handleUsbCommand(const char*, char* reply) { strcpy(reply, "Unknown"); }
void cancelPendingSerialOutput() {}