mirror of
https://github.com/agessaman/MeshCore.git
synced 2026-10-15 04:30:19 +00:00
kiss_modem: default AGC reset interval to 32 s
The AGC interval is set in 4 s steps, matching MeshCore's agc.reset.interval, so the old 30 s default could not be restored by a host: setting 30 gives 28. Found on hardware. Use 32 s, the nearest multiple of 4 above it.
This commit is contained in:
@@ -227,7 +227,7 @@ All values little-endian.
|
||||
|-------------|---------|-----------------------|
|
||||
| Noise floor | 2 bytes | int16_t, dBm (signed) |
|
||||
|
||||
The modem recalibrates the noise floor every 2 seconds. AGC resets follow the configured AGC reset interval (default 30 seconds).
|
||||
The modem recalibrates the noise floor every 2 seconds. AGC resets follow the configured AGC reset interval (default 32 seconds).
|
||||
|
||||
### Capabilities (Capabilities response)
|
||||
|
||||
@@ -256,7 +256,7 @@ All values little-endian.
|
||||
|
||||
The modem periodically resets the radio's AGC while idle (no transmission in progress and host output not backed up). The interval has 4-second resolution, matching the MeshCore `agc.reset.interval` setting: requested values are rounded down to a multiple of 4, so 1-3 disable the reset. Values above 1020 return `InvalidParam`. SetAgcResetInterval replies with the AgcResetInterval response carrying the effective value, and restarts the countdown from the time of the request.
|
||||
|
||||
The default is 30 seconds. The setting is not persisted; hosts should re-send it after reconnecting or rebooting the modem.
|
||||
The default is 32 seconds (previously a fixed 30; changed so the default is a settable 4-second multiple). The setting is not persisted; hosts should re-send it after reconnecting or rebooting the modem.
|
||||
|
||||
### FEM State (SetFemState / FemState response)
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
/* FEM requests are answered strictly in arrival order; this many may wait (e.g. during a TX) */
|
||||
#define KISS_FEM_OP_QUEUE_DEPTH 4
|
||||
|
||||
#define KISS_AGC_RESET_DEFAULT_SEC 30
|
||||
#define KISS_AGC_RESET_DEFAULT_SEC 32 // a multiple of the 4 s step, so hosts can set it back
|
||||
#define KISS_AGC_RESET_MAX_SEC 1020
|
||||
#define KISS_AGC_RESET_STEP_SEC 4
|
||||
|
||||
|
||||
@@ -208,8 +208,11 @@ TEST_F(KissHwControlTest, CapabilitiesReflectBoardFem) {
|
||||
EXPECT_EQ(hw1({HW_CMD_GET_CAPABILITIES}), (std::vector<uint8_t>{0x9B, 0x07, 0x00, 0x00, 0x00}));
|
||||
}
|
||||
|
||||
TEST_F(KissHwControlTest, AgcIntervalDefaultsToThirtySeconds) {
|
||||
EXPECT_EQ(hw1({HW_CMD_GET_AGC_RESET_INTERVAL}), (std::vector<uint8_t>{0x9D, 30, 0}));
|
||||
TEST_F(KissHwControlTest, AgcIntervalDefaultsToThirtyTwoSeconds) {
|
||||
EXPECT_EQ(hw1({HW_CMD_GET_AGC_RESET_INTERVAL}), (std::vector<uint8_t>{0x9D, 32, 0}));
|
||||
// the default must be restorable, i.e. a multiple of the 4 s step
|
||||
EXPECT_EQ(hw1({HW_CMD_SET_AGC_RESET_INTERVAL, 4, 0}), (std::vector<uint8_t>{0x9D, 4, 0}));
|
||||
EXPECT_EQ(hw1({HW_CMD_SET_AGC_RESET_INTERVAL, KISS_AGC_RESET_DEFAULT_SEC, 0}), (std::vector<uint8_t>{0x9D, KISS_AGC_RESET_DEFAULT_SEC, 0}));
|
||||
}
|
||||
|
||||
TEST_F(KissHwControlTest, AgcIntervalSetReturnsEffectiveRoundedValue) {
|
||||
@@ -223,15 +226,15 @@ TEST_F(KissHwControlTest, AgcIntervalSetReturnsEffectiveRoundedValue) {
|
||||
TEST_F(KissHwControlTest, AgcIntervalRejectsOutOfRangeAndShortPayload) {
|
||||
EXPECT_EQ(hw1({HW_CMD_SET_AGC_RESET_INTERVAL, 0xFD, 0x03}), (std::vector<uint8_t>{HW_RESP_ERROR, HW_ERR_INVALID_PARAM}));
|
||||
EXPECT_EQ(hw1({HW_CMD_SET_AGC_RESET_INTERVAL, 4}), (std::vector<uint8_t>{HW_RESP_ERROR, HW_ERR_INVALID_LENGTH}));
|
||||
EXPECT_EQ(hw1({HW_CMD_GET_AGC_RESET_INTERVAL}), (std::vector<uint8_t>{0x9D, 30, 0}));
|
||||
EXPECT_EQ(hw1({HW_CMD_GET_AGC_RESET_INTERVAL}), (std::vector<uint8_t>{0x9D, 32, 0}));
|
||||
}
|
||||
|
||||
TEST_F(KissHwControlTest, AgcResetsOnDefaultSchedule) {
|
||||
advance(29999);
|
||||
advance(31999);
|
||||
EXPECT_EQ(radio.agc_resets, 0);
|
||||
advance(1);
|
||||
EXPECT_EQ(radio.agc_resets, 1);
|
||||
advance(29999);
|
||||
advance(31999);
|
||||
EXPECT_EQ(radio.agc_resets, 1);
|
||||
advance(1);
|
||||
EXPECT_EQ(radio.agc_resets, 2);
|
||||
|
||||
Reference in New Issue
Block a user