mirror of
https://github.com/Colorado-Mesh/meshcore-bot-firmware.git
synced 2026-08-11 16:20:29 +00:00
forge: add patch 9 — widen hop-step + drop "ack " from test response
- BOT_HOP_STEP_MILLIS_DEFAULT 1500 -> 2500 - BOT_HOP_BIAS_MAX_MILLIS 8000 -> 12000 - BOT_RESPONSE_PENDING_TTL_MILLIS 45000 -> 60000 - BOT_PREFS_VERSION 3 -> 4 (forces re-default of hop_step_ms on existing bots that saved the old 1500 value) - writeAckResponse + executeTest: drop the literal "ack " prefix so test responses now start with "@[sender] ..." Field test showed two bots with token-matching `[1865]` responses both firing because the far bot scheduled its reply before the near bot's reply could propagate back through the mesh. New hop step gives ~5-8 s of margin at the 4-hop boundary.
This commit is contained in:
@@ -539,7 +539,7 @@ static void test_ack_response_format() {
|
||||
char out[BOT_MAX_RESPONSE_LEN + 1];
|
||||
size_t written = 0;
|
||||
assert(FirmwareBot::writeAckResponse(message, command, out, sizeof(out), &written) == BOT_WRITE_OK);
|
||||
assert(strcmp(out, "ack @[alice] #bot | 0h SNR 0.00 | recv 21:25:45 | hello") == 0);
|
||||
assert(strcmp(out, "@[alice] #bot | 0h SNR 0.00 | recv 21:25:45 | hello") == 0);
|
||||
assert(written == strlen(out));
|
||||
|
||||
message.channel_kind = BOT_CHANNEL_DM;
|
||||
@@ -547,7 +547,7 @@ static void test_ack_response_format() {
|
||||
message.channel_name[0] = 0;
|
||||
assert(FirmwareBot::parseCommand("!t", 2, &command));
|
||||
assert(FirmwareBot::writeAckResponse(message, command, out, sizeof(out), &written) == BOT_WRITE_OK);
|
||||
assert(strcmp(out, "ack @[unknown] direct | 0h SNR 0.00 | recv 21:25:45") == 0);
|
||||
assert(strcmp(out, "@[unknown] direct | 0h SNR 0.00 | recv 21:25:45") == 0);
|
||||
|
||||
uint8_t path[] = { 0x12, 0x34, 0xab, 0xcd };
|
||||
message.channel_kind = BOT_CHANNEL_BOT;
|
||||
@@ -558,12 +558,12 @@ static void test_ack_response_format() {
|
||||
message.path_hash_count = 2;
|
||||
message.packet_snr_quarters = -5;
|
||||
assert(FirmwareBot::writeAckResponse(message, command, out, sizeof(out), &written) == BOT_WRITE_OK);
|
||||
assert(strcmp(out, "ack @[bob] #bot | 2h@2B SNR -1.25 | recv 21:25:45") == 0);
|
||||
assert(strcmp(out, "@[bob] #bot | 2h@2B SNR -1.25 | recv 21:25:45") == 0);
|
||||
assert(strstr(out, "Bot test OK") == NULL);
|
||||
|
||||
char small[16];
|
||||
assert(FirmwareBot::writeAckResponse(message, command, small, sizeof(small), &written) == BOT_WRITE_TRUNCATED);
|
||||
assert(strncmp(small, "ack @[bob]", 10) == 0);
|
||||
assert(strncmp(small, "@[bob]", 6) == 0);
|
||||
}
|
||||
|
||||
static BotMessage make_message(const char* channel, const char* text) {
|
||||
@@ -628,7 +628,7 @@ static void test_command_outputs() {
|
||||
|
||||
result = run_command("!test", out, sizeof(out));
|
||||
assert(result.code == BOT_COMMAND_RESULT_OK);
|
||||
assert_starts_with(out, "ack @[");
|
||||
assert_starts_with(out, "@[");
|
||||
assert_contains(out, "recv ");
|
||||
assert(strstr(out, "Bot test OK") == NULL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user