# Roanoke Mesh Pre-Configured Repeater

This is a custom build of the MeshCore repeater firmware for repeaters in the Roanoke, VA area. It comes pre-configured with default values suited to our local mesh, so a newly flashed repeater works here with minimal setup: the radio preset, the region list, forwarding limits and the report settings.

It also adds features for managing traffic and monitoring repeaters:
- **Traffic management:** hop limits by packet type and by channel, per-sender advert rate limiting, and loop detection.
- **Monitoring:** airtime, noise level, packet pool and drop statistics from the CLI.
- **Reports and alerts:** a daily stats report and alerts for low battery, high airtime and rising noise, posted to the `#repeaters` channel, and it responds to `report` requests.

This page lists every new command, its default, and how to read the output. All commands work over the serial console and from a remote admin login.

---

## Forwarding filters

### Channel hop limits

Limits how far group messages (`GRP_TXT` and `GRP_DATA`) on a given channel are forwarded. Each channel is identified by its 1-byte channel hash.

**Usage:**
- `get channel.hop.limits`
- `set channel.hop.limits <list>`

**Parameters:**
- `list`: comma-separated `hash:hops` pairs, with the hash in hex and the hop count in decimal (0-64). Up to 21 entries.

**Default:** `81:2` (`#wardriving` limited to 2 hops)

**Examples:**
```
set channel.hop.limits 11:6,d9:6,81:2
get channel.hop.limits
```

`get` prints the stored string, followed by one line per entry the repeater actually parsed:
```
> 11:6,d9:6,81:2
11 06
d9 06
81 02
```

**Notes:**
- A packet that has already travelled `hops` or more hops is not forwarded. A limit of `0` stops the repeater forwarding that channel at all.
- Parsing stops at the first malformed entry, but `set` still replies `OK`. Use `get` to check that every entry was parsed.
- If a hash is listed twice, the first entry is used.
- These limits only make a channel stricter. Group packets still have to pass `flood.max` (and `flood.max.data` for `GRP_DATA`).
- The changes apply immediately, without a reboot.

**Finding a channel's hash.** For a hashtag channel:
```
python3 -c 'import hashlib; k=hashlib.sha256(b"#wardriving").digest()[:16]; print(hashlib.sha256(k).hexdigest()[:2])'
```

Known hashes: Public `11`, `#test` `d9`, `#wardriving` `81`.

---

### Allow unknown channels

Controls whether group messages on channels that are not in `channel.hop.limits` are forwarded.

**Usage:**
- `get channels.allow.unknown`
- `set channels.allow.unknown <on|off>`

**Parameters:**
- `on` or `1`: forward unlisted channels (they are still subject to `flood.max`)
- `off` or `0`: drop every group message whose channel is not listed

**Default:** `on`

**Note:** Any other value (such as `true` or `yes`) is rejected with `Error, use on/off`, and the setting is left unchanged.

---

### Advert rate limit

Limits how many flood adverts the repeater forwards from each sender within a sliding time window.

**Usage:**
- `get advert.limit.max`
- `set advert.limit.max <count>`
- `get advert.limit.window`
- `set advert.limit.window <minutes>`

**Parameters:**
- `count`: adverts forwarded per sender per window (1-255)
- `minutes`: window length in minutes (0-65535). `0` turns the limiter off.

**Defaults:** `advert.limit.max` `3`, `advert.limit.window` `4320` (72 hours)

**Example:** allow 2 adverts per sender every 24 hours:
```
set advert.limit.max 2
set advert.limit.window 1440
```

**Notes:**
- Changes take effect on the next advert, without a reboot. Shrinking the window applies at once to adverts already recorded.
- The advert history is kept in RAM only and starts empty on every boot.
- History is a fixed ring of 4096 entries (512 on STM32). On a very busy mesh, or with a high `advert.limit.max`, older entries are overwritten while still inside the window, and the limit quietly loosens.
- To turn the limiter off, set `advert.limit.window 0`. `advert.limit.max` cannot be `0`.

---

## Monitoring commands

These commands are repeater-only. All of their state lives in RAM: it starts empty on every boot, and `clear stats` resets it.

### Airtime utilisation

Shows the share of time spent transmitting and receiving over the last 5, 15 and 60 minutes.

**Usage:**
- `get airtime`

**Example output:**
```
> tx 1.2/0.9/0.7% rx 8.4/6.1/5.5% (5/15/60m, 42m sampled)
```

**Reading it:**
- `tx`: time this node spent transmitting. This figure is accurate.
- `rx`: time spent receiving MeshCore packets that decoded. This is a minimum for how busy the channel is: packets that failed CRC, collisions and other users of the frequency are not counted.
- `Xm sampled`: minutes of history collected since boot or the last `clear stats`. Until a window has filled, its figure is the average over the minutes available. Everything reads `0.0%` for the first minute after either.

---

### Hop-limit drops by payload type

Counts flood packets rejected by any of the hop limits, grouped by payload type. The hop limits are `flood.max`, `flood.max.unscoped`, the per-type `flood.max.*` limits and the 1/2/3-byte hash limits. There is one counter per payload type, not one per limit: a group text dropped by `flood.max` and one dropped by a per-type limit both add to `grptxt`.

**Usage:**
- `get payload.drops`

**Example output:**
```
> advert:812 grptxt:240 path:31 req:4
```

**Notes:**
- Only types with at least one drop are shown. If nothing has been dropped, it prints `> none`.
- Type names: `req resp txt ack advert grptxt grpdata anon path trace multi ctrl raw`. The unused types 0x0C-0x0E show as `0c`, `0d`, `0e`.
- There is no separate total for `flood.max` or any other single limit. To see how many packets one limit is stopping, compare the counts before and after changing that limit.

---

### Filter drops

Counts flood packets rejected by each of the other forwarding filters.

**Usage:**
- `get filter.drops`

**Example output:**
```
> region:15 chan.hops:230 chan.unknown:0 loop:7 advert.rate:96
```

| Counter | Counts packets dropped because |
|---|---|
| `region` | the transport code is unknown, or the region does not allow wildcard flood |
| `chan.hops` | a group packet reached its channel hop limit |
| `chan.unknown` | the channel is not listed and `channels.allow.unknown` is off |
| `loop` | loop detection fired |
| `advert.rate` | the sender went over the advert rate limit |

**Notes:**
- The filters run in order, and each packet is counted only by the first one that drops it. Together, `payload.drops` and `filter.drops` account for every flood packet the repeater declined to forward.
- Packets that are not forwarded because forwarding is switched off (`set repeat off`), and direct-routed packets, are not counted.

---

### Packet pool

Shows how full the repeater's packet buffer pool is, and how many packets were lost because it ran out. The repeater has 32 packet buffers, shared by packets waiting out their receive delay (`rxdelay`), packets waiting to be sent, newly received packets, and packets the repeater creates itself.

**Usage:**
- `get pool`

**Example output:**
```
> free:27/32 min.free:9 rx.drops:0 alloc.fails:0
```

| Field | Meaning |
|---|---|
| `free` | buffers free right now, out of the pool size |
| `min.free` | fewest free buffers seen since boot or the last `clear stats` |
| `rx.drops` | received packets thrown away because no buffer was free |
| `alloc.fails` | packets the repeater tried to create itself (adverts, ACKs, replies) but couldn't, because no buffer was free |

**Notes:**
- `min.free` near `0` means the repeater is close to losing packets, even if `rx.drops` is still `0`.
- Received packets dropped this way are lost before they are scored or checked, so they don't appear in `payload.drops` or `filter.drops`.
- A high `rxdelay` holds weakly received packets in the pool for longer, so on a busy mesh it pushes `min.free` lower. Comparing `get pool` over a busy period at different `rxdelay` values shows whether it matters on your mesh.
- `alloc.fails` also sets bit 0 of `errors` in `stats-core`, as before.

---

### Transmit deferrals

Shows how often the repeater had to wait before sending, because the channel was busy or because it had used up its airtime budget.

**Usage:**
- `get tx.defers`

**Example output:**
```
> busy.receiving:142 forced.sends:0 dc.exhausted:0 dc.timeleft:1800s
```

| Field | Meaning |
|---|---|
| `busy.receiving` | times a send was put off because the radio was busy receiving. The repeater retries 120-480 ms later, so one packet can add several. |
| `forced.sends` | times the channel was busy at every check for 4 seconds and the repeater sent anyway |
| `dc.exhausted` | times sending was held back because the duty-cycle (airtime) budget ran low. Counted once per hold, not once per check. |
| `dc.timeleft` | transmit time left in the duty-cycle budget right now, in seconds |

**Notes:**
- The airtime budget is set by the `af` setting (`get af` / `set af`). At the default of `1.0` the repeater may transmit up to 50% of the time, measured over a one-hour window, so the budget is at most 1800 s. `dc.exhausted` stays at `0` unless the repeater has been transmitting very heavily for a long time.
- A rising `busy.receiving` count means the channel is crowded: the repeater keeps finding someone else on air when it wants to send. Compare it with the `rx` figure in `get airtime`.
- `forced.sends` should normally be `0`. The repeater checks the channel every 120-480 ms while it waits, and a forced send means it found the channel busy at every check for 4 seconds. That takes back-to-back traffic, constant interference on the frequency, or a radio stuck in receive. Forced sends also set bit 1 of `errors` in `stats-core`, as before.

---

## Daily reports and alerts

The repeater can post a short stats report to the `#repeaters` channel once a day (off by default: turn it on with `set report.daily on`), and posts an alert if its battery runs low or its airtime usage runs high. Anyone who has joined `#repeaters` sees them as normal channel messages.

Everything is sent in one region, set with `report.region` (see [Regions](#regions)). The default is `us-va`. If the region is cleared, the repeater sends no reports or alerts and ignores `report` requests.

### Daily report

**Example:**
```
RPT-Foo: up 12d3h | 24h rx 8123 tx 5402 err 3 | air tx 2.1% rx 8.7% | nf -112dBm | 4.02V | nb 7
```

| Field | Meaning |
|---|---|
| `up` | time since boot, in days and hours |
| `24h` | hours covered by this report (since the previous report, boot, or the last `clear stats`) |
| `rx` / `tx` | packets received and sent in that time. Same counters as `recv` and `sent` in `stats-packets`. |
| `err` | packets received with errors in that time. Same counter as `recv_errors` in `stats-packets`. |
| `air tx` / `air rx` | share of that time spent transmitting / receiving |
| `nf` | noise level on the channel over the last 5 minutes, in dBm, from the repeater's own RSSI samples (see [Noise level](#noise-level)). Higher (closer to 0) means more interference. Left out for the first minute after boot. |
| volts | battery voltage. Left out on boards that don't measure the battery. |
| `nb` | other repeaters heard directly (0 hops) in the last 7 days, from their local adverts or replies to a neighbour discovery. Companions and room servers are not counted. Left out on builds without a neighbour table (`MAX_NEIGHBOURS`). |

**Schedule:**
- The first report is sent at a random time 60-90 minutes after boot, then exactly every 24 hours after that. The random start keeps repeaters that power up together from all reporting at once.
- No report or alert is sent in the first hour after boot, so a repeater stuck in a boot loop stays quiet. Responses to `report` are the exception: they work straight after boot.
- The counters are RAM-only, so the first report after a reboot covers only the time since boot.
- With `report.daily off`, no report is sent, but the counts are still reset at the same times, so responses to `report` keep covering at most the last day.
- The neighbour table is RAM-only too and starts empty at boot, so `nb` builds up over the first few hours as neighbours send their local adverts. It counts repeaters heard since boot, up to 7 days back. The table holds `MAX_NEIGHBOURS` entries (50 on most boards).
- `nb` uses the repeater's clock. If the clock is set or corrected while running, neighbours heard before the change may be miscounted until they are heard again.

### Alerts

Checked once a minute, starting one hour after boot. Each type is sent at most once every 24 hours.

| Alert | Sent when |
|---|---|
| `ALERT battery low 3.41V` | the battery reads below `report.alert.batt.mv` 3 times in a row (so a dip during a transmit doesn't trigger it). Readings of 1 V or less are ignored, as they mean the board doesn't measure its battery. |
| `ALERT rx airtime high 23.4% (5m)` | RX airtime over the last 5 minutes (the first `rx` figure of `get airtime`) is at or above `report.alert.airtime.pct`. RX only counts packets that decoded, so it is a minimum for how busy the channel is. |
| `ALERT noise up 18dB: -94dBm (normal -112dBm)` | the 5-minute noise level is at least `report.alert.noise.db` dB above the site's normal level 5 times in a row (5 minutes), so a short burst of interference doesn't trigger it. Needs an hour of noise history first. See [Noise level](#noise-level). |

A repeater that reboots before it has been up for an hour never sends an alert, including a battery alert.

### Noise level

The `nf` field and the noise alert use the repeater's own measurement of the channel, not the radio's noise floor estimate. That estimate only accepts readings within 14 dB of its current value, so after a sudden jump in noise it stops updating and keeps showing the old, quiet level.

**Usage:**
- `get nf`

**Example output:**
```
> nf -108dBm (5m) normal -112dBm (learned 360m) radio -110dBm
```

| Field | Meaning |
|---|---|
| `nf` | noise level over the last 5 minutes, the same value as `nf` in reports |
| `normal` | the site's learned normal level, which the noise alert compares against |
| `learned` | minutes of learning so far. The alert needs 60, and the count stops at 360. |
| `radio` | the radio's own noise floor estimate (as `noise_floor` in `stats-radio`), for comparison. Well below `nf` usually means it is stuck after a rise. |

It prints `> nf not measured yet` for the first minute after boot or a reset, and `> noise monitoring off (report is off)` while `report` is off.

How it is measured:
- Every 2 seconds, while the radio is listening, the repeater reads the channel's signal strength (RSSI). This is a quick status read that doesn't disturb reception.
- Each minute it keeps the median of that minute's ~30 readings. Packets are short, so they barely move the median, while steady interference raises it.
- The noise level (`nf`) is the average of the last 5 minutes.
- The site's normal level is learned from those minutes: averaged over the first 6 hours, then slowly adapting after that. It changes far too slowly to catch up with a sudden rise in the 5 minutes before the alert fires.

**Notes:**
- The alert needs an hour of history before it can fire, which matches the one-hour wait after boot.
- If interference stays for many hours, the normal level slowly moves up to it and the alert is not repeated. A further jump can still trigger it, at most once every 24 hours.
- Changing the RX gain, or applying or reverting temporary radio settings, restarts the learning, as these shift the readings. The alert then needs another hour of history.
- The noise level is only measured while `report` is on. Turning `report` off clears what was learned, so turning it back on starts again, and the alert needs another hour of history.
- Everything is RAM-only and starts again at boot.

### Responding to `report`

The repeater responds to `report` requests sent on the `#repeaters` channel. The response looks like the daily report. Named and plain requests are turned on and off separately.

| Message on `#repeaters` | Who responds |
|---|---|
| `report` | every repeater with `report.respond.unnamed` on, within `report.hops.unnamed` hops, that meets the conditions below |
| `report <name>`, eg. `report roa-cavespring-bgp0` | only the repeater with that name (set with `set name`), if `report.respond.named` is on, within `report.hops.named` hops. The whole name must match, not case-sensitive, so `report roa-cave` matches nothing. |

**Usage:**
- `get report.respond.named` / `set report.respond.named <on|off>`
- `get report.respond.unnamed` / `set report.respond.unnamed <on|off>`
- `get report.cooldown.unnamed` / `set report.cooldown.unnamed <minutes>`
- `get report.hops.unnamed` / `set report.hops.unnamed <hops>`
- `get report.hops.named` / `set report.hops.named <hops>`

**Parameters:**
- `report.respond.named` / `report.respond.unnamed`: `on` or `1` to respond to `report <name>` / plain `report`, `off` or `0` to ignore them
- `minutes`: minimum time between responses to plain `report` (15-1440, up to 24 hours)
- `report.hops.unnamed` / `report.hops.named` (0-8): for a plain `report` / a `report <name>` request, how many repeaters may have relayed the request for this repeater to respond, and how many repeaters may relay the response, so it can always get back to whoever asked. `0` means the request must be heard directly (no repeater in between), and the response is not relayed: only radios in direct range of this repeater receive it.

**Defaults:** `report.respond.named` `on`, `report.respond.unnamed` `off`, `report.cooldown.unnamed` `15`, `report.hops.unnamed` `1`, `report.hops.named` `6`

By default a repeater responds to `report <name>` but not to plain `report`: turn plain responses on with `set report.respond.unnamed on`.

The repeater only responds when all of these are true:
- `report` is `on`, and `report.respond.named` (for `report <name>`) or `report.respond.unnamed` (for plain `report`) is `on`. Daily reports and alerts can stay on with responses off.
- The message is exactly `report`, or `report` followed by this repeater's name (not case-sensitive, extra spaces ignored).
- The request was sent in this repeater's `report.region`. Requests sent un-scoped or in any other region are ignored.
- The request was relayed by no more than `report.hops.unnamed` repeaters (plain `report`) or `report.hops.named` repeaters (`report <name>`). A request heard directly is 0 hops.
- For a plain `report`: the cooldown has passed since its last response to a plain `report`. Requests during the cooldown are ignored, with no response. Named requests have no cooldown, and responding to one doesn't start it.

**Notes:**
- Responses work straight after boot, without the one-hour wait used for daily reports and alerts. The cooldown starts again from zero after a reboot.
- The stats cover the time since the last daily report. Responding does not reset them, so the next daily report is unaffected.
- A response to a plain `report` is sent after a random 1-30 second delay, so repeaters near each other don't all transmit at once. Expect responses to arrive over about half a minute.
- A response to `report <name>` is sent after 1-3 seconds, as only that repeater responds.
- Responses are relayed by up to `report.hops.unnamed` or `report.hops.named` repeaters (not `report.hops.alerts`, which is for daily reports and alerts), using the same dummy path entries as the daily report.
- Responses are sent in `report.region`, the same region as the request.
- Every repeater within `report.hops.unnamed` hops that has responses on will respond. With the default of 1, one `report` can trigger responses from every repeater with plain responses on that hears it directly or through one repeater; set it to 0 to limit responses to repeaters that hear the request directly. The cooldown limits how often each repeater can be made to respond. Named requests aren't limited, so anyone in range can make one repeater respond as often as they send `report <name>`.
- The `#repeaters` message is forwarded as normal, whether or not the repeater responds.
- With both `report.respond.named` and `report.respond.unnamed` off, or no `report.region` set, the repeater doesn't decrypt `#repeaters` messages at all.

### Settings

**Usage:**
- `get report` / `set report <on|off>`
- `get report.daily` / `set report.daily <on|off>`
- `get report.hops.alerts` / `set report.hops.alerts <hops>`
- `get report.alert.batt.mv` / `set report.alert.batt.mv <mV>`
- `get report.alert.airtime.pct` / `set report.alert.airtime.pct <percent>`
- `get report.alert.noise.db` / `set report.alert.noise.db <dB>`
- `get report.region` / `set report.region <name|<null>>`

**Parameters:**
- `report`: `on` or `1` turns reports and alerts on, `off` or `0` turns them all off, including responses to `report` requests
- `report.daily`: `off` or `0` stops the daily report only. Alerts and responses still work while `report` is on. The counts are still reset once a day at the usual time, so a response still covers at most the last day.
- `hops`: how far daily reports and alerts travel (0-8). `0` means they are not relayed: only radios in direct range of the repeater receive them. Responses to `report` use `report.hops.unnamed` / `report.hops.named` instead.
- `mV`: battery-low alert threshold in millivolts (0-10000). `0` turns the battery alert off.
- `percent`: RX airtime alert threshold (0-100). `0` turns the airtime alert off.
- `dB`: noise alert threshold, how far above the site's normal level the noise must rise (3-40). `0` turns the noise alert off. 10 dB is about ten times the normal noise power.
- `name`: region to send reports, alerts and responses in, up to 30 characters, with or without the leading `#`. `<null>` clears it, which stops all reports, alerts and responses.

**Defaults:** `report` `on`, `report.daily` `off`, `report.hops.alerts` `6`, `report.alert.batt.mv` `3400`, `report.alert.airtime.pct` `25`, `report.alert.noise.db` `10`, `report.region` `us-va`

The `report.region` default is `DEFAULT_REPORT_REGION` in `src/helpers/CommonCLI.h`, and a build can override it with a `-D DEFAULT_REPORT_REGION=...` build flag. A device that has already saved an empty `report.region` keeps it until `set report.region` is used.

### Regions

Reports, alerts and responses are only ever sent in the region (scope) set by `report.region`, on top of the hop limit. The hop limit controls how far they travel. The region controls which repeaters carry them: a repeater only forwards a region-scoped packet if that region is in its own region list with flooding allowed.

| Message | Region |
|---|---|
| Daily report, alerts | `report.region`. Not sent if it isn't set. The default region (`region default`) is not used. |
| Response to `report` | `report.region`. Only requests sent in `report.region` get a response. |

**Example:** keep reports within the `#nova` region:
```
set report.region nova
```

**Notes:**
- To carry each other's reports, the repeaters in the area need the region in their region list with flooding allowed. Repeaters without it drop the reports, counted under `filter.drops region`.
- A companion app sends channel messages in the scope the app is set to. Set the app's scope to the report region before sending `report`, or no repeater will respond.
- The region is set by a 2-byte transport code worked out from the packet contents, not the path, so it works alongside the dummy path entries.

### How the hop limit works

Flood packets carry no hop limit the sender can set: each repeater decides for itself whether to forward. To enforce the hop limit on every repeater, stock firmware included, each message is sent with its path already filled with dummy entries (3-byte hashes, all zeros), leaving only as many free slots as the limit. The path holds 21 entries, and once it is full no repeater will forward the packet.

| Message | Hop limit (free slots) |
|---|---|
| Daily report, alerts | `report.hops.alerts` (0-8, default 6) |
| Response to `report` | `report.hops.unnamed` (0-8, default 1) |
| Response to `report <name>` | `report.hops.named` (0-8, default 6) |

With a limit of 0, the path is full from the start, so no repeater relays it: only radios in direct range of the sender receive it.

Side effects:
- Each transmission carries up to 63 extra bytes of dummy path (all 21 entries, at a limit of 0).
- Clients count the dummy entries as hops, so a message shows as `21 - limit` hops plus the real ones. A daily report from a direct neighbour shows as 15 hops at the default of 6, and a response to `report` as 20 at the default of 1.
- Very old firmware that only understands 1-byte paths drops these messages.

### Channel hop limits and `#repeaters`

The `#repeaters` channel hash is `5e`. Because the dummy entries count towards a channel hop limit as well:
- Do not list `5e` in `channel.hop.limits` with a value below 21, or every report is dropped at the first repeater. Leave it out, or use `5e:21`.
- If `channels.allow.unknown` is `off`, add `5e:21` to `channel.hop.limits`, or the reports are dropped.

---

## Quick reference

| Command | Values | Default |
|---|---|---|
| `set channel.hop.limits <list>` | `hash:hops,...`, up to 21 entries, hops 0-64 | `81:2` |
| `set channels.allow.unknown <v>` | `on`/`off` (or `1`/`0`) | `on` |
| `set advert.limit.max <n>` | 1-255 | `3` |
| `set advert.limit.window <m>` | 0-65535 minutes, `0` = off | `4320` |
| `get airtime` | | |
| `get nf` | | |
| `get payload.drops` | | |
| `get filter.drops` | | |
| `get pool` | | |
| `get tx.defers` | | |
| `set report <v>` | `on`/`off` (or `1`/`0`) | `on` |
| `set report.daily <v>` | `on`/`off` (or `1`/`0`) | `off` |
| `set report.hops.alerts <n>` | 0-8, `0` = direct neighbours only | `6` |
| `set report.hops.unnamed <n>` | 0-8, `0` = heard directly only | `1` |
| `set report.hops.named <n>` | 0-8, `0` = heard directly only | `6` |
| `set report.alert.batt.mv <mV>` | 0-10000 mV, `0` = off | `3400` |
| `set report.alert.airtime.pct <pct>` | 0-100 %, `0` = off | `25` |
| `set report.alert.noise.db <dB>` | 3-40 dB, `0` = off | `10` |
| `set report.respond.named <v>` | `on`/`off` (or `1`/`0`) | `on` |
| `set report.respond.unnamed <v>` | `on`/`off` (or `1`/`0`) | `off` |
| `set report.cooldown.unnamed <m>` | 15-1440 minutes | `15` |
| `set report.region <name>` | region name, or `<null>` to clear (nothing is sent) | `us-va` |
| `clear stats` | also resets the airtime history, both drop counters, the pool stats and the transmit deferral counts, and restarts the daily report counts | |

Every `set` command has a matching `get`. Settings are saved in `prefs.json`. A repeater upgraded from a build without them starts with the defaults above.

---

## Changed defaults

These apply to new devices, or after the storage is erased. A device that already has saved settings keeps them.

| Setting | New default | Upstream default |
|---|---|---|
| Radio preset (all firmware) | USA/Canada: `910.525,62.5,7,8` (coding rate 4/8) | EU/UK narrow: `869.618,62.5,8,5` |
| `loop.detect` (repeater) | `strict` | `off` |
| `path.hash.mode` (repeater) | `2` (3-byte hashes) | `0` (1-byte) |
| `multi.acks` (repeater) | `1` | `0` |
| Region list (repeater) | the default regions below, flooding allowed | empty |

To apply them to an existing repeater:
```
set radio 910.525,62.5,7,8
set loop.detect strict
set path.hash.mode 2
set multi.acks 1
reboot
```

### Default regions

On first install, when the repeater has no saved region list, it creates this region list and saves it:
```
us
├── us-south
└── us-east
    └── us-southeast
        └── us-va
            └── us-va-sw
```

Every region in it allows flooding, and it includes `us-va`, the default `report.region`, so new repeaters carry each other's reports straight away. It doesn't set a default region.

The list is the `DEFAULT_REGION_DEF` string in `src/helpers/CommonCLI.h`, in the same format as the `region def` command, and a build can override it with `-D DEFAULT_REGION_DEF=...`. `""` turns it off. It is run exactly as if typed, then saved as with `region save`.

It only runs when the region list file (`/regions2`) doesn't exist yet: a new device, or after the storage is erased. A repeater that has already saved a region list keeps it. To apply the defaults to an existing repeater:
```
region def us us-south|us us-east us-southeast us-va us-va-sw
region save
```

---

## Code changes and fixes

For anyone reviewing the branch.

**New features**
- **Advert limits made configurable:** `AdvertLimiter::allow()` now takes the max and window as arguments. The prefs `advert_limit_max` and `advert_limit_window` are saved as `adv_lim_max` and `adv_lim_win`. The `ADVERT_LIMIT_MAX_PER_WINDOW` and `ADVERT_LIMIT_WINDOW_MINS` defines were removed, and `ADVERT_LIMIT_CACHE_SIZE` remains.
- **Airtime tracking:** the new `examples/simple_repeater/AirtimeWindow.h` keeps 60 one-minute slots of TX and RX airtime, about 500 bytes of RAM. `MyMesh::loop()` feeds it each minute of uptime from the Dispatcher's airtime counters.
- **Drop counters:** `hop_limit_drops[16]` and `filter_drops` were added in `MyMesh`, incremented in `allowPacketForward()`.
- **Hop limits by type and hash size:** `RoutingPolicy.h` keeps upstream's `isFloodHopLimitExceeded()` (`flood_max`, `flood_max_unscoped`, `flood_max_advert`) unchanged, for the stock room server and the unit tests. The repeater calls `isFloodHopLimitExceededExt()`, which calls the original for those three, then adds the per-payload-type `flood.max.*` limits and the 1/2/3-byte hash limits.
- **Pool stats:** `Dispatcher` (shared by all firmware) now counts receive-side pool drops and failed `obtainNewPacket()` calls, and tracks the low-water mark of free buffers. Before, a receive-side drop was only a debug message, and a failed allocation only set the `ERR_EVENT_FULL` bit. `resetStats()` clears all three. The repeater's pool size is now the `PACKET_POOL_SIZE` define in `MyMesh.cpp`.
- **Transmit deferrals:** `Dispatcher::checkSend()` counts each busy-channel retry, and each send forced out after 4 seconds of busy channel. Airtime-budget holds are counted once per hold, using a flag that clears when a send starts. All three reset with `resetStats()`.
- **Where the commands are handled:** `get airtime`, `get payload.drops`, `get filter.drops`, `get pool`, `get tx.defers` and `get nf` are handled in `MyMesh::handleCommand()` before CommonCLI, so they don't affect the room server or sensor.
- **Daily reports and alerts:** new prefs `report_enabled`, `report_daily_enabled` (when off, `loop()` calls `snapshotReportCounters()` at the daily report time instead of `sendDailyReport()`), `report_hops_alerts`, `report_alert_batt_mv` and `report_alert_airtime_pct`, saved as `rpt_en`, `rpt_daily_en`, `rpt_hops_alert`, `rpt_alert_mv` and `rpt_alert_pct`. Their `set`/`get` commands are in CommonCLI, so the room server and sensor accept them but ignore them. The repeater derives the channel key from the `REPORT_CHANNEL_NAME` define (default `#repeaters`) in `begin()`. `MyMesh::loop()` schedules the reports, and runs the alert checks after each per-minute airtime sample. `sendReportText()` builds the group message itself, like `BaseChatMesh::sendGroupMessage()`. It then sets the route type, transport code and padded path directly instead of calling `sendFloodScoped()`, because `sendFlood()` resets the path. `report.hops.alerts` is also capped at 8 when the report is sent (`REPORT_MAX_HOPS`, via `reportHops()`), in case a stored value is higher.
- **Noise level and alert:** new pref `report_alert_noise_db`, saved as `rpt_alert_db`. The radio's own noise floor estimate (`getNoiseFloor()`) only accepts samples within 14 dB of its current value, so it can't follow a sudden rise and gets stuck. Instead, `MyMesh::loop()` calls `sampleNoise()` every 2 s, which reads `radio_driver.getCurrentRSSI()` while `isInRecvMode()`. `updateNoiseMinute()` takes each minute's median into a 5-minute ring (`getNoiseLevel()`), and updates `noise_baseline`: a running mean for the first 360 minutes, then an exponential average with the same weight. Readings that are NaN (not a number) are skipped. Sampling only runs while `report` is on. While it is off, `resetNoiseBaseline()` is called each minute, and it is also called from `setRxBoostedGain()` and when temporary radio params are applied or reverted. `isReceiving()` is not used to skip samples during packets, as it runs a CAD scan when CAD is on. The median keeps packets out instead.
- **Responding to `report`:** new prefs `report_respond_named`, `report_respond_unnamed` and `report_cooldown_unnamed_mins`, saved as `rpt_resp_named`, `rpt_resp_unnmd` and `rpt_cool_unnmd`. The repeater now overrides `searchChannelsByHash()`, which returns the `#repeaters` channel only while responses are on, and `onGroupDataRecv()`, which checks the message and sends the response. `formatReport()` was split out of `sendDailyReport()` so both use it. As `onGroupDataRecv()` runs inside packet receive, it keeps its stack use small: it checks the message in place without copying it, and report messages are built in the existing `reply_data` scratch buffer (`beginReportText()` writes the `"<name>: "` prefix, `formatReport()` writes the text after it, and `sendReportMsg()` sends it, with an optional delay) instead of in local buffers. `sendReportText()` is a wrapper for short texts such as alerts. For `report <name>`, the name is compared in place with `_prefs.node_name` (`strncasecmp()`, whole name). Named requests skip the cooldown check, don't set `next_reply_allowed`, and use `REPORT_NAMED_REPLY_DELAY_MIN`/`MAX` (1-3 s) instead of the 1-30 s response delay. The random delays and the first report's random start go through `randomInRange()`, which falls back to the default range if a `REPORT_*` define is edited so its max isn't above its min (`RNG::nextInt()` divides by max - min). The hop limits are the prefs `report_hops_unnamed` and `report_hops_named` (saved as `rpt_hops_unnmd` and `rpt_hops_named`, capped at `REPORT_MAX_HOPS` = 8, the same limit as `report.hops.alerts`): `onGroupDataRecv()` accepts a request with a path count of at most the limit for its kind, and passes the same value to `sendReportMsg()`, which now takes the number of relays (free path slots) as an argument. The daily report and alerts pass `report.hops.alerts`. The response delay ranges are defines in `MyMesh.cpp`.
- **Report region:** new pref `report_region`, saved as `rpt_region`. `getReportScope()` returns the transport key for it: from the region list if the region is there, otherwise SHA-256 of `#name`, as `RegionMap::getTransportKeysFor()` does for hashtag regions. With no `report.region` it returns false, and `sendReportText()` then sends nothing (it checks before allocating a packet). `onGroupDataRecv()` only responds to a `TRANSPORT_FLOOD` request whose transport code matches one recalculated with the `report.region` key, so this works even if the region isn't in the repeater's own region list. `searchChannelsByHash()` also returns nothing while `report.region` is empty.
- **Default regions:** `DEFAULT_REGION_DEF` in `CommonCLI.h`. In `MyMesh::begin()`, after `region_map.load()`, if `/regions2` doesn't exist (the file `RegionMap::load()`/`save()` use), the repeater runs `"region def " DEFAULT_REGION_DEF` through `_cli.handleCommand()` (a writable copy, as the parser edits it in place), then `saveRegions()`. The existing `region def` parser is reused unchanged, and no new file is added. Repeater only: the room server is stock and doesn't run it.
- **Room server is stock:** `examples/simple_room_server/` is identical to upstream `dev`, so it needs no maintenance here. It is still built from the shared `src/` code, so it accepts the shared `set`/`get` settings from this branch, but ignores them.

**Bug fixes**
- **`channels.allow.unknown` parsing:** it used `atoi`, so `true` or `on` set it to `0` and silently stopped unknown channels being forwarded. It now accepts only `on`/`off`/`1`/`0`. `get` prints `on`/`off` and matches the full command name.
- **Default channel hop limits never set:** the default `"81:..."` string was copied with `strlen()` of the empty destination buffer, so nothing was copied. It now uses `sizeof()`.
- **Room server and sensor builds:** `parseChannelHopLimits()` and `showChannelHopLimits()` were pure virtual in `CommonCLICallbacks`, so the room server and sensor didn't compile. They now have empty default bodies.

Verified by building `Heltec_v3_repeater`, `Heltec_v3_room_server` and `Heltec_v3_sensor`. Not yet tested on hardware. The daily reports, alerts, `report` responses, report region, default regions, `isFloodHopLimitExceededExt()` and the return of the room server to stock were added after that and have not been built or tested yet.
