Skip to content

feat: add a brightness option for direct mode - #6

Merged
benkelly merged 1 commit into
mainfrom
brightness-option
Nov 19, 2026
Merged

benkelly merged 1 commit into
mainfrom
brightness-option

Conversation

@benkelly

Copy link
Copy Markdown
Owner

Summary

Users who do not run the SidePulse service cannot dim the LEDs. In direct mode, the plugin writes every LED program at full brightness.

This change adds a brightness plugin option. The value is an integer from 0 (off) to 255 (full). In direct mode, the plugin puts a brightness N line before each LED program. The controller then scales the colors.

{
  "plugins": [{ "package": "opencode-sidepulse", "options": { "brightness": 40 } }]
}

OpenCode 2 gives the option to the plugin in ctx.options. OpenCode 1 gives it as the second argument of server(). The README shows the configuration for both versions.

The plugin ignores the option in app mode, because the SidePulse service applies its own brightness setting. The plugin also ignores a value that is not an integer from 0 to 255, and then uses full brightness.

The version changes to 0.4.0, so the merge publishes the release.

Test

Run these commands from the repository root, on the brightness-option branch:

npm test
node test/run.mjs brightness

The first command shows 68 of 68 passed. The second command shows 4 of 4 passed.

The new tests cover direct mode on OpenCode 1 and OpenCode 2, an invalid value, and app mode. The self-check in plugin.mjs now also makes sure that each program stays within the controller limits of 512 bytes and 20 lines with the extra brightness line.

Users who do not run the SidePulse service had no way to dim the LEDs.
The plugin wrote every program at full brightness.

The new `brightness` plugin option takes an integer from 0 to 255. In
direct mode, the plugin puts `brightness N` before each LED program. In
app mode, the plugin ignores the option, because the service applies its
own brightness. The plugin ignores a value outside 0 to 255.

OpenCode 2 passes the option in ctx.options. OpenCode 1 passes it as the
second argument of server().
Copilot AI balanced review requested due to automatic review settings November 19, 2026 04:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@benkelly
benkelly merged commit c74f9d8 into main Nov 19, 2026
13 checks passed
@benkelly
benkelly deleted the brightness-option branch November 19, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants