Add JetFleet JFBMS slave hardware target - #97
Draft
Fajdiga wants to merge 6 commits into
Draft
Conversation
This was referenced May 14, 2026
Adds an optional hwconf macro that lets a board opt out of the COMM_PING_CAN broadcast scan. The default in main/hwconf/hw.h is 1 to preserve the existing behavior; a hwconf header can override it to 0 to skip the scan loop in commands.c. Useful for headless variants that share a CAN bus with a master and should never participate in VESC ping discovery.
Adds an optional hwconf macro that switches the TWAI driver into TWAI_MODE_NO_ACK at init. The default in main/hwconf/hw.h is 0, so the existing TWAI_MODE_NORMAL behavior is preserved unless a hwconf header opts in. Useful for bench / diagnostic builds that need to observe a live CAN bus without generating ACKs.
Adds HW_CAN_FILTER_CONFIG in main/hwconf/hw.h so a hwconf header can override the default TWAI acceptance filter. The default expands to false, so behavior remains TWAI_FILTER_CONFIG_ACCEPT_ALL() when no hardware provides an override. The filter is re-applied on both initial CAN bring-up and after comm_can_update_baudrate() so a hwconf override survives baud changes. f_config is made non-const so update_filter() can replace it. Also dispatches an optional weak hw_can_rx_hook() from the CAN process task after Lisp CAN processing and before the normal VESC/BMS decoder path. Hardware variants such as JFBMS_SLAVE can use this to consume custom 11-bit protocol frames without changing generic CAN decoding. Matches the existing HW_INIT_HOOK() / HW_POST_LISPIF_HOOK() pattern: a hwconf header declares its hardware-specific function and wires it through a small macro or weak-symbol implementation.
Adds a hwconf-defined HW_IS_SLAVE flag that suppresses two pieces of boot-time behavior in main.c: - BLE and WiFi initialization. A slave variant has no user-facing radios; running these only wastes RAM and adds attack surface. - main_store_backup_data() copying controller_id and can_baud_rate from the live config into the persisted backup. Headless slave builds use their own slave-specific config and should not mirror these shared VESC Express compatibility fields back into backup storage. When HW_IS_SLAVE is not defined, behavior is unchanged. The flag is expected to be set in a hwconf header alongside HW_NAME and the other HW_* macros.
Fajdiga
force-pushed
the
pr/jfbms-slave-hardware-target
branch
from
May 25, 2026 15:27
e7ef960 to
3d09ac8
Compare
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.
Draft while the dependency PR is reviewed.
Depends on:
This PR adds the JetFleet JFBMS slave hardware target and documents the private master/slave BMS CAN protocol.
Changes:
JFBMS_SLAVEhardware target.Scope note:
Hosted Lisp application scripts are intentionally not included here because those are kept in a separate repository.
Protocol summary:
Motivation:
This target supports pack expansion beyond the cells directly handled by the master BMS controller while keeping the protocol documented and reviewable.
Testing:
cleanup/upstream-readybranch..lispfiles or private local artifacts are included.