Repository navigation
feat(sim): run the receiver firmware and inject RF frame loss - #173
Merged
Merged
Conversation
The RFM69 model gets its receiving side: a frame that has been sent reaches every other radio; one listening on the same network gets it in its FIFO, with PayloadReady and DIO0 (D2, INT0) raised, so the library's receive path runs unchanged. A radio not listening misses it. grid_sim -r <node>=<receiver.elf> runs the RemoteLoadReceiver firmware in its own simulated AVR, in step with the router. Its load pins (receiver_pins) drive the remote loads, its serial output is shown and its link losses counted. Nodes without firmware keep the ideal receiver. Frames can be lost: rf_drop <t0> <t1> [node] and rf_loss <percent> (fixed seed). New expectation: expect rf_links_lost <node> <min> <max>, and two scenarios, link_loss (1 s blackout) and lossy_link (20 % loss). build_receivers.sh builds the receiver once per node ID; make check-rf uses it for RX_NODES (15 by default, empty for ideal receivers). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its executable bit was not recorded (committed from Windows): make failed with Permission denied in CI. The bit is set now too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FredM67
added a commit
that referenced
this pull request
Sep 30, 2026
…nits Brings in the receiver firmware in grid_sim (#173). Both remote units now run the RemoteLoadReceiver firmware in check-rf (RX_NODES 15 16): - link_loss: unit 16 keeps its frames and its load while unit 15's are lost - lossy_link: 10 % frame loss instead of 20 %. With a 100 ms refresh, 4 frames lost in a row already reach the 500 ms timeout; at 20 %, unit 16 lost its link once in 30 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 2 of the RF mock, following #171. The remote units now run the real
RemoteLoadReceiverfirmware, and RF frames can be lost on purpose.Changes
rfm69.c): a frame that has been sent reaches every other radio.receiveDone()path therefore runs unmodified.grid_sim -r <node>=<receiver.elf>runs the receiver firmware in its own simulated AVR, in step with the router on the same clock.receiver_pins 4 3) drive the remote loads.R<node>|, and its "RF link LOST" messages are counted.rf_drop <t0> <t1> [node]loses every frame in a window.rf_loss <percent>loses frames at random, from a fixed seed, so every run loses the same frames.expect rf_links_lost <node> <min> <max>checks how often a receiver lost the link.build_receivers.sh: builds the receiver once per node ID, sinceREMOTE_NODE_IDis a constant in itsconfig_rf.h, and restores the file afterwards.make check-rfuses the receiver firmware forRX_NODES(15 by default);RX_NODES=switches back to ideal receivers. The CI step is unchanged apart from its name.Results with the receiver firmware
remote_overrideremote_steplink_loss(new): no frames to node 15 from 10 to 11 slossy_link(new): 20 % of frames lostThe ideal receivers give the same results in all four scenarios. No frame was missed because a receiver wasn't listening.
Each receiver roughly halves the simulation speed:
check-rftakes ~50 s with one receiver.Next, on #160
RX_NODESto15 16.🤖 Generated with Claude Code