Skip to content

Commit c0b81b9

Browse files
committed
Clean up comments on kiss noise floor changes.
1 parent 0fb5703 commit c0b81b9

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

docs/kiss_modem_protocol.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ Maximum unescaped frame size: 512 bytes.
2828

2929
## Commands
3030

31-
Command and response codes below are taken from `examples/kiss_modem/KissModem.h` and the switch in `KissModem::processFrame()`.
32-
3331
### Request Commands (Host → Modem)
3432

3533
| Command | Value | Data |
@@ -129,7 +127,7 @@ Response to `CMD_GET_NOISE_FLOOR` (0x13). Little-endian.
129127
|--------------|------|--------------------------------|
130128
| Noise floor | 2 | int16_t, dBm (signed), e.g. -120 |
131129

132-
The modem recalibrates the noise floor periodically (every 2 s) from RX samples when idle. The receiver AGC is also reset periodically (every 30 s) so RSSI and noise floor do not drift to the minimum (-120). Typical range after calibration is about -120 to -90 dBm. Values may be 0 or briefly stale until the radio has been in receive mode long enough to collect 64 samples.
130+
The modem recalibrates the noise floor every two seconds with an AGC reset every 30 seconds.
133131

134132
### Stats (RESP_STATS)
135133

examples/kiss_modem/main.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include <SPIFFS.h>
1313
#endif
1414

15-
#define NOISE_FLOOR_CALIB_INTERVAL_MS 2000 // match Dispatcher default
16-
#define AGC_RESET_INTERVAL_MS 30000 // periodic RX restart so AGC doesn't drift (repeater uses same via prefs)
15+
#define NOISE_FLOOR_CALIB_INTERVAL_MS 2000
16+
#define AGC_RESET_INTERVAL_MS 30000
1717

1818
StdRNG rng;
1919
mesh::LocalIdentity identity;
@@ -100,11 +100,9 @@ void loop() {
100100
uint8_t packet[KISS_MAX_PACKET_SIZE];
101101
uint16_t len;
102102

103-
// Match Dispatcher order: noise floor calib + loop() first, so we never sample RSSI in the same
104-
// iteration as startReceive() (AGC reset -> recvRaw below). Sampling right after startReceive()
105-
// can yield settling/cold RSSI and drive the floor toward -120.
103+
// trigger noise floor calibration
106104
if ((uint32_t)(millis() - next_noise_floor_calib_ms) >= NOISE_FLOOR_CALIB_INTERVAL_MS) {
107-
radio_driver.triggerNoiseFloorCalibrate(0); // 0 = no interference threshold (KISS has no prefs)
105+
radio_driver.triggerNoiseFloorCalibrate(0);
108106
next_noise_floor_calib_ms = millis();
109107
}
110108
radio_driver.loop();
@@ -119,7 +117,7 @@ void loop() {
119117
}
120118

121119
if ((uint32_t)(millis() - next_agc_reset_ms) >= AGC_RESET_INTERVAL_MS) {
122-
radio_driver.resetAGC(); // next recvRaw() will startReceive() and reset AGC so RSSI/noise floor don't stick at -120
120+
radio_driver.resetAGC();
123121
next_agc_reset_ms = millis();
124122
}
125123
uint8_t rx_buf[256];

0 commit comments

Comments
 (0)