mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-09-26 19:57:55 +00:00
Skip redundant modulation writes during owned fast RX retunes when the last acknowledged SF/BW/CR/LDRO tuple matches. Invalidate that cache after ordinary setters, failed writes, and lifecycle changes. Include the remaining scan, preamble, settling, and memory-soak experiments, their collectors, validation notes, and original capture records. Preserve capture bytes across checkouts and keep private soak credentials local. Run lab collector and compiled contract tests in CI. Update the expectation, profile mapping, and result-buffer tests for the extended lab tools, and make the private WiFi override header optional for ordinary soak diagnostics. Validation: 145 host tests passed from the staged source snapshot. Clean heltec_v4_repeater and Xiao_S3_WIO_companion_radio_usb builds passed their RAM/flash gates. All 229 staged capture files retain their original bytes; all 75 local documentation links resolve in the clean snapshot.
49 lines
1.6 KiB
C
49 lines
1.6 KiB
C
#pragma once
|
|
#include <stdarg.h>
|
|
|
|
struct BenchResult {
|
|
uint32_t sequence = 0;
|
|
char text[4096] = {}; // Pair diagnostics add per-profile dwell and hop timings.
|
|
};
|
|
BenchResult lastListenResult, lastTxResult, lastRxResult, lastRunResult;
|
|
|
|
void appendBenchResult(BenchResult& result, const char* format, ...) {
|
|
const size_t used=strlen(result.text);
|
|
va_list args;
|
|
va_start(args,format);
|
|
const int n=vsnprintf(result.text+used,sizeof(result.text)-used,format,args);
|
|
va_end(args);
|
|
if(n<0 || size_t(n)>=sizeof(result.text)-used) result.sequence=0;
|
|
}
|
|
|
|
void emitBenchResult(const BenchResult& result) {
|
|
Serial.print(result.text);
|
|
Serial.flush();
|
|
}
|
|
|
|
void recordBenchResult(BenchResult& result, uint32_t sequence, const char* format, ...) {
|
|
va_list args;
|
|
va_start(args, format);
|
|
const int n = vsnprintf(result.text, sizeof(result.text), format, args);
|
|
va_end(args);
|
|
if (n < 0 || size_t(n) >= sizeof(result.text)) {
|
|
result.sequence = 0;
|
|
Serial.println("{\"error\":\"result overflow\"}");
|
|
return;
|
|
}
|
|
result.sequence = sequence; // publish before USB: retrieval cannot repeat RF
|
|
emitBenchResult(result);
|
|
}
|
|
|
|
void replayBenchResult(const char* kind, uint32_t sequence) {
|
|
const BenchResult* result = !strcmp(kind,"sent") ? &lastTxResult
|
|
: !strcmp(kind,"received") ? &lastRxResult
|
|
: !strcmp(kind,"listening") ? &lastListenResult
|
|
: !strcmp(kind,"result") ? &lastRunResult : nullptr;
|
|
if (!result || !sequence || result->sequence != sequence) {
|
|
Serial.println("{\"error\":\"result unavailable\"}");
|
|
return;
|
|
}
|
|
emitBenchResult(*result);
|
|
}
|