mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
fix: only let wifiStrength broadcasts move the RSSI baseline
The emit to a newly connected client also stored the RSSI and time, which restarted the 10s hold-off and hid a real change from the clients already connected. The baseline moves into RssiBroadcast, which ignores per-client emits, with unit tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c4472ba8e8
commit
e47381b19e
5 changed files with 72 additions and 11 deletions
|
|
@ -60,6 +60,15 @@ struct rebootDelay_t {
|
|||
// otherwise only for an RSSI change of at least minDelta dBm and not more often
|
||||
// than every minMs.
|
||||
bool rssiNeedsEmit(int rssi, int lastRssi, int channel, int lastChannel, uint32_t sinceLastMs, int minDelta, uint32_t minMs);
|
||||
// What the last wifiStrength broadcast told every client. Only broadcasts
|
||||
// move it: an emit to one new client tells the others nothing.
|
||||
struct RssiBroadcast {
|
||||
int rssi = 0;
|
||||
int channel = 0;
|
||||
uint32_t at = 0; // millis() of the last broadcast.
|
||||
bool due(int rssi, int channel, uint32_t now, int minDelta, uint32_t minMs) const;
|
||||
void sent(bool broadcast, int rssi, int channel, uint32_t now);
|
||||
};
|
||||
|
||||
class Timestamp {
|
||||
char _timeBuffer[128];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue