feat(mixer): add buzzer to unified PWM/PINIO/LED output selection#2654
Open
sensei-hacker wants to merge 10 commits into
Open
feat(mixer): add buzzer to unified PWM/PINIO/LED output selection#2654sensei-hacker wants to merge 10 commits into
sensei-hacker wants to merge 10 commits into
Conversation
- Add TIMER_OUTPUT_MODE_BEEPER = 5 to OutputMappingCollection, matching OUTPUT_MODE_BEEPER in firmware mixer.h - In getOutputTableDirect(), compare entry.type against TIM_USE_* bit-index constants (already defined in the file) instead of magic numbers; use TIM_USE_BEEPER for the new buzzer assignment type - Add BEEPER option to the per-timer output mode selector in mixer tab
…is set Add OUTPUT_TYPE_BEEPER and a pre-pass in getTimerMap() so that timers explicitly overridden to TIMER_OUTPUT_MODE_BEEPER are assigned before the flag-based motor/servo/LED passes run. Add the corresponding display case in getOutputTable(). Without this, a BEEPER-overridden LED pad would fall through to the TIM_USE_LED flag check and incorrectly show "Led".
Each timer's mode dropdown now appears in the first pad cell of that timer's column group, co-located with the output labels it controls. The separate "Output Groups (Timers)" box is removed.
…ight Timer mode dropdowns move to a dedicated row above the pad labels, with each cell spanning the number of pads in that timer group. This eliminates the unequal cell heights caused by embedding the dropdown only in the first pad of each group.
getOutputCount(), getFirstOutputOffset(), and the getTimerMap() non-dedicated pass now recognise TIM_USE_BEEPER so that targets whose buzzer pin is a timer-capable pad (e.g. BROTHERHOBBYH743) display it as a reassignable column alongside motors/servos/LEDs. GPIO-only buzzer pins are not in timerHardware[] and are unaffected.
… dropdowns Compile-time LED and buzzer pads now show /LED and /Buzzer suffixes in the Output Mapping table. Their timer dropdowns pre-select LED or BEEPER instead of AUTO. The function row fills in Led/Buzzer via JS fallback for pads the firmware does not report in direct assignments.
Use ?? instead of || when reading timer override so undefined timers correctly fall back to AUTO (0 is a valid override value). Tighten the direct-assignment gap-fill to skip jsMap entries that are also '-'. Rename private isTimerDefault helper for clarity.
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Use for-of loops and Array.at(-1) as suggested by static analysis.
Split renderOutputTable() into buildTimerGroups() and buildTimerSelectHtml() helpers. Replace repeated ternary-per-option pattern with a [value, label] array and map(). Also address SonarQube minor suggestions: for-of loops and Array.at(-1).
…shorten PINIO option Move timer number from each pad label into the timer-row dropdown cell so it appears once per group rather than repeating on every pad. Add padding-right to visually separate adjacent timer groups. Shorten 'PINIO / DUTY CYCLE' to 'PINIO / PWM' to reduce select box width.
|
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 buzzer (PWM beeper) pads to the Output Mapping table in the Mixer tab, making them visible alongside motor, servo, LED, and PINIO outputs and allowing them to be reassigned at runtime.
Works on 1024 width screens, looks better on 1280 or higher.
Changes
js/outputMapping.jsTIMER_OUTPUT_MODE_BEEPER = 5constantgetOutputCount()andgetFirstOutputOffset()now include pads withTIM_USE_BEEPERgetTimerMap()assignsOUTPUT_TYPE_BEEPERfor beeper-flagged pads in AUTO modegetOutputTableDirect()maps firmware-reported beeper assignments to"Buzzer"isBeeperPin(outputIndex)— detects beeper pads for label displayisTimerDefaultLed(timerId)/isTimerDefaultBeeper(timerId)— detect compile-time default timer assignments for dropdown pre-selectiontabs/mixer.htmltabs/mixer.jsrenderOutputTable(): LED pads labeledS13/LED, buzzer pads labeledS14/BuzzergetTimerOverride() ?? AUTOto correctly handle timers with no stored overriderenderOutputMapping(): fills LED/buzzer function cells from the JS-computed map when the firmware direct-assignment response (which only reports motors, servos, and explicitly-overridden buzzers) leaves them as"-"Testing
Tested on BrotherHobby H743 hardware (INAV 9.1.0,
DEF_TIM(TIM2, CH1, PA15, TIM_USE_BEEPER, 0, 0)):Boards with GPIO-only buzzers (e.g. SDMODELH7V1, PC13 not in
timerHardware[]) show no extra column — correct behavior.Code Review
Two rounds of review with inav-code-review agent. All critical and important findings addressed, including the
?? AUTOfallback fix and gap-fill guard.