Conversation
Added haptic feedback settings to the app menu.
Added information about Haptics settings for devices with firmware version 2v29.14 and customization options for haptic strength.
There was a problem hiding this comment.
Pull request overview
This pull request adds haptics functionality support to the Bangle.js settings and boot system, enabling users to configure haptic feedback for devices with firmware 2v29.14+. The changes introduce UI controls to enable/disable haptics and adjust feedback strength, while ensuring persistence across reboots through boot0 updates.
Changes:
- Added haptics configuration settings with default values (enabled: true, strength: 25)
- Implemented a new "Haptics" menu in system settings with toggle and strength slider controls
- Updated bootupdate to persist haptics settings by adding Bangle.setOptions calls to boot0
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/setting/settings.min.json | Added hapticsEnabled and hapticStrength default values to the settings template |
| apps/setting/settings.js | Added hapticsEnabled and hapticStrength to resetSettings(), created hapticsMenu() function with enable/disable toggle and strength slider, integrated menu into systemMenu() when Bangle.haptic is available |
| apps/setting/metadata.json | Bumped version from 0.82 to 0.83 |
| apps/setting/ChangeLog | Documented addition of Haptics section for firmware 2v29.14+ |
| apps/boot/metadata.json | Bumped version from 0.69 to 0.70 |
| apps/boot/bootupdate.js | Added logic to generate Bangle.setOptions({hapticTime: value}) in boot0 based on hapticsEnabled and hapticStrength settings, with backwards compatibility for undefined settings |
| apps/boot/ChangeLog | Documented addition of haptic settings support for firmware 2v29.14+ |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
apps/setting/settings.js
Outdated
| settings.hapticsEnabled=v; | ||
| if(!v){ | ||
| Bangle.setOptions({hapticTime:0}) | ||
| }else{ |
There was a problem hiding this comment.
Missing space after "else". For consistency with the rest of the codebase, format as "} else {".
| }else{ | |
| } else { |
| onchange: function (v) { | ||
| settings.hapticsEnabled=v; | ||
| if(!v){ | ||
| Bangle.setOptions({hapticTime:0}) |
There was a problem hiding this comment.
Missing spaces around curly braces. For consistency with the rest of the codebase, format as "{ hapticTime: 0 }".
| popMenu(systemMenu()); | ||
| }, | ||
| /*LANG*/'Use Haptics': { | ||
| value: !!settings.hapticsEnabled, // strength 0 = disabled |
There was a problem hiding this comment.
Inconsistency in handling undefined hapticsEnabled. When upgrading from an older version without haptics settings, bootupdate.js (line 81) treats undefined as enabled (defaulting to strength 25), but this UI element treats undefined as disabled (!!undefined = false). This means after upgrade, haptics will be active but the UI will show them as disabled. Consider handling undefined explicitly to match the bootupdate.js behavior: "value: settings.hapticsEnabled !== false" or "value: settings.hapticsEnabled === undefined ? true : settings.hapticsEnabled".
| value: !!settings.hapticsEnabled, // strength 0 = disabled | |
| value: settings.hapticsEnabled !== false, // strength 0 = disabled; undefined defaults to enabled |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| // Apply any settings-specific stuff | ||
| if (s.options) boot+=`Bangle.setOptions(${E.toJS(s.options)});\n`; | ||
| if (s.brightness!==undefined && s.brightness!=1) boot+=`Bangle.setLCDBrightness(${s.brightness});\n`; | ||
| if (Bangle.haptic) { |
There was a problem hiding this comment.
There's if (s.options) boot+=Bangle.setOptions(${E.toJS(s.options)}); 2 lines above, so I don't think this is needed. Literally all you need to do is ensure that the setting you change is s.options.hapticTime and not s.hapticStrength?
And rather that having a whole new menu, can we not just have a single menu item for Haptic Strength that's got a value, or Off which maps to zero? That seems way easier, and needs less taps to change things.
There was a problem hiding this comment.
That sounds good - is there any way to force the swipe menu for numbers to be displayed? I rather like that style of displaying/changing , and it looks nice particularly for changes like these...
There was a problem hiding this comment.
You can set noList:true on the object - or it'll do it automatically if there would have been more than 20 menu items (eg you set the step small enough)
Since we now have the new
Bangle.haptic()function and option, this updates settings and boot to allow you to show and modify enabling/disabling haptics, and the strength. In bootupdate, it adds a line in boot0 to keep it persistent. More info is here