Add indexed CAN map transmit API to avoid burst messages#50
Merged
jsphuebner merged 1 commit intojsphuebner:masterfrom Apr 28, 2026
Merged
Add indexed CAN map transmit API to avoid burst messages#50jsphuebner merged 1 commit intojsphuebner:masterfrom
jsphuebner merged 1 commit intojsphuebner:masterfrom
Conversation
Owner
|
Looks legit, thanks! |
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.
Summary
Adds
CanMap::SendByIndex(uint8_t ididx)so applications can transmit one configured CAN map TX message at a time instead of always sending the full mapped TX set viaSendAll().The existing
SendAll()behavior is preserved, but its frame-packing implementation now reuses a privateSend(CANIDMAP*)helper.Motivation
Some applications schedule mapped CAN TX messages periodically, for example from a 10 ms or 100 ms task. Calling
SendAll()there sends every mapped TX message in one scheduler slice, which can create a burst of up toMAX_MESSAGESframes.With
SendByIndex(), application code can spread mapped messages across smaller scheduler slices.Example downstream usage from
src/main.cppin Zombie-Slave, not included in this libopeninv PR:This keeps the existing period setting semantics while avoiding bursts of all mapped TX frames in a single scheduler slice.
Backward compatibility
This is additive and keeps existing behavior intact.
CanMap::SendAll() remains public and keeps sending all configured TX map messages in one call. Existing applications that call SendAll() do not need changes.
Existing CAN map storage, SDO mapping, terminal mapping commands, and frame encoding behavior are unchanged. The new API only exposes indexed transmission for applications that want finer scheduling control.
SendByIndex() returns false for an out-of-range index, an unused TX map slot, or if transmission is skipped while CAN map flash saving is active. It returns true when the indexed message is sent.
Validation
Built and ran the libopeninv host tests.
Added a regression test covering:
sending only the selected mapped TX message;
preserving existing DLC behavior;
returning false for an unused slot;
returning false for MAX_MESSAGES.