Default radio profile crossover to off
This commit is contained in:
1 parent
b18bd79da2
commit
44ba5b4f18
13 files changed
+70
-17
No files matched your search
+2
@@ -22,6 +22,8 @@ static void checkSafePreamble(unsigned sf, float bw, uint16_t symbols) {
|
||||
assert(Profiles::safePreamble(p, symbols) == originalSafePreamble(p, symbols));
|
||||
}
|
||||
int main() {
|
||||
Profiles fresh;
|
||||
assert(fresh.cross==mesh::RadioCrossMode::Off && !fresh.canCross());
|
||||
// Sharing the read-only validation table must preserve every supported
|
||||
// value and the strict float tolerance on both sides of its boundary.
|
||||
for (float bw : {7.8f, 10.4f, 15.6f, 20.8f, 31.25f, 41.7f,
|
||||
|
||||
+36
-1
@@ -503,6 +503,41 @@ static void spectrumOverlap() {
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
static_assert(uint8_t(mesh::RadioCrossMode::Auto)==0 && uint8_t(mesh::RadioCrossMode::On)==1
|
||||
&& uint8_t(mesh::RadioCrossMode::Off)==2, "saved crossover encoding must remain compatible");
|
||||
{
|
||||
Fixture fresh;
|
||||
assert(fresh.radio.p.cross==mesh::RadioCrossMode::Off && !fresh.radio.p.canCross());
|
||||
assert(!strcmp(fresh.cmd("get radio2.cross"),"> off") && fresh.fs.files.empty());
|
||||
for(const char* mode:{"auto","on","off"}) {
|
||||
char command[40];snprintf(command,sizeof(command),"set radio2.cross %s",mode);fresh.cmd(command);
|
||||
const auto expected=!strcmp(mode,"auto")?mesh::RadioCrossMode::Auto
|
||||
: !strcmp(mode,"on")?mesh::RadioCrossMode::On:mesh::RadioCrossMode::Off;
|
||||
assert(fresh.fs.files["/radio_profiles"][18]==uint8_t(expected));
|
||||
Radio reboot;mesh::RadioProfileCLI restored;restored.begin(&fresh.fs,&reboot,&fresh.clock);
|
||||
assert(reboot.p.cross==expected);
|
||||
restored.handle("get radio2.cross",fresh.reply);
|
||||
char reply[16];snprintf(reply,sizeof(reply),"> %s",mode);assert(!strcmp(fresh.reply,reply));
|
||||
}
|
||||
fresh.cmd("set radio2.cross on");fresh.fs.files.clear();
|
||||
fresh.cli.begin(&fresh.fs,&fresh.radio,&fresh.clock);
|
||||
assert(fresh.radio.p.cross==mesh::RadioCrossMode::Off);
|
||||
assert(!strcmp(fresh.cmd("get radio2.cross"),"> off"));
|
||||
}
|
||||
for(bool semantic:{false,true}) {
|
||||
Fixture invalid;invalid.cmd("set radio2.cross auto");
|
||||
auto& image=invalid.fs.files["/radio_profiles"];
|
||||
if(semantic) {
|
||||
image[18]=255;
|
||||
uint32_t crc=0xffffffffU;
|
||||
for(size_t i=0;i<20;++i) {crc^=image[i];for(unsigned bit=0;bit<8;++bit)crc=(crc>>1)^((crc&1)?0xedb88320U:0);}
|
||||
memcpy(image.data()+20,&crc,4);
|
||||
} else image[0]^=1;
|
||||
Radio radio;radio.p.cross=mesh::RadioCrossMode::On;
|
||||
mesh::RadioProfileCLI restored;restored.begin(&invalid.fs,&radio,&invalid.clock);
|
||||
assert(radio.p.cross==mesh::RadioCrossMode::Off);
|
||||
restored.handle("get radio2.cross",invalid.reply);assert(!strcmp(invalid.reply,"> off"));
|
||||
}
|
||||
if (argc == 2) {
|
||||
if (!strcmp(argv[1], "permanent_order")) permanentScheduleOrder();
|
||||
else if (!strcmp(argv[1], "temporary_boundary")) adjacentTemporarySchedules();
|
||||
@@ -647,7 +682,7 @@ int main(int argc, char** argv) {
|
||||
{
|
||||
Fixture f;
|
||||
assert(!strcmp(f.cmd("get radio2"),"> off"));
|
||||
assert(!strcmp(f.cmd("get radio2.cross"),"> auto"));
|
||||
assert(!strcmp(f.cmd("get radio2.cross"),"> off"));
|
||||
assert(strstr(f.cmd("set radio2 910.5,500,7,5,rxtx"),"timing self-test pending"));
|
||||
assert(!f.radio.p.enabled()); f.advance(2000); assert(f.radio.p.enabled());
|
||||
assert(strstr(f.cmd("get radio2.timing"),"self-test pending"));
|
||||
|
||||
@@ -1118,6 +1118,13 @@ assert.strictEqual(rakCommands.find(s => s.title.startsWith('RS232')).actions[0]
|
||||
assert(commands(rakCommands).includes('set gps on'));
|
||||
assert(!rakCommands.some(s => s.title === 'MQTT broker connections'));
|
||||
const indicator = picker.runtimeDirections(findControlled('SenseCapIndicator-LoRa_companion_radio_full'), {});
|
||||
const isolation = picker.runtimeDirections(Object.assign({},
|
||||
findControlled('SenseCapIndicator-LoRa_companion_radio_full'),
|
||||
{releaseFamily: 'v1.17.1.6-halo-keymind-cascade-dev-test'}), {})
|
||||
.find(section => section.title === 'Companion tempradio2: transmit on both');
|
||||
assert(isolation);
|
||||
assert.deepStrictEqual(isolation.actions.find(action => action.label === 'Default isolation').commands,
|
||||
['set radio2.cross off']);
|
||||
assert(commands(indicator).includes('set companion.transport ble'));
|
||||
assert(!indicator.some(s => s.title.startsWith('MQTT')));
|
||||
// Never apply old hardware capabilities to another release, or to an unknown
|
||||
|
||||
@@ -265,6 +265,10 @@ assert.strictEqual(
|
||||
"set tempradioat 910.1,500,8,7,+1,+2880\nget tempradioat"
|
||||
);
|
||||
assert.strictEqual(commands.primaryCancel, "get tempradioat\ndel tempradioat all");
|
||||
assert.strictEqual(commands.companionCancelBefore,
|
||||
"get tempradioat2\ndel tempradioat2 all\nset radio2.cross off");
|
||||
assert.strictEqual(commands.companionCancelDuring,
|
||||
"set tempradio2 off\nset radio2.cross off");
|
||||
assert.strictEqual(
|
||||
commands.companionNow,
|
||||
"set radio2.cross on\nset tempradio2 910.1,500,8,7,rxtx,2880"
|
||||
|
||||
Reference in new issue
Block a user