Skip to content

feat: add cookies and gamma correction to headlights - #68

Merged
codeflight1 merged 1 commit into
mainfrom
headlight-fixes
Aug 2, 2026
Merged

feat: add cookies and gamma correction to headlights#68
codeflight1 merged 1 commit into
mainfrom
headlight-fixes

Conversation

@ConnorNeed

Copy link
Copy Markdown
Member

Makes the headlight number persistent for 1 day so refreshing doesn't turn off the headlights

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds client-side persistence and a perceptual brightness mapping to the Headlight control UI so headlight settings survive refreshes and publish adjusted PWM values to ROS topics.

Changes:

  • Persist left/right slider values in cookies with a 1-day max-age and restore them on mount.
  • Apply gamma correction when publishing slider values to /left_headlight and /right_headlight.
  • Gate publishing and UI enablement on cookiesLoaded to avoid publishing defaults before cookie restore.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +38 to +44
const perceivedBrightnessToPWM = (brightness: number) => {
const normalizedBrightness = clampBrightness(brightness) / 100;

return Math.round(
Math.pow(normalizedBrightness, BRIGHTNESS_GAMMA) * 100
);
};
Comment thread src/components/panels/HeadlightControlPanel.tsx
@codeflight1
codeflight1 merged commit 6116766 into main Aug 2, 2026
1 check passed
@codeflight1
codeflight1 deleted the headlight-fixes branch August 2, 2026 19:26
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.

3 participants