forked from Blendman974/faceclaw
Simplify glanceboard-trigger angle setting; fix incorrectly-rotated accelerometer readings on G1
The glanceboard head-tilt option was more complicated than necessary, because it wanted the user to take two angle measurements, a baseline angle and a tilt angle. That was a workaround to not knowing the accelerometer's orientation/calibration, but actually, we do know those. (Except, as it turns out, on the G1, the accelerometer orientation is different than it is on the G2, and there was a bug where EvenHub apps got their accelerometer readings in the wrong orientation. So for example the EvenHub Level app didn't work correctly.)
This commit is contained in:
1 parent
37d81d0308
commit
e09f8eae96
17 files changed
+255
-281
No files matched your search
@@ -1724,9 +1724,18 @@ type SettingsMenuOptions<T> = {
|
||||
label?: string
|
||||
}
|
||||
|
||||
type EnumSettingMenuOptions<T> = SettingsMenuOptions<T> & {
|
||||
/**
|
||||
* A live line under the picker's values, such as a sensor reading to pick
|
||||
* by. open() runs as the picker opens, with a function that repaints it,
|
||||
* and returns what to run when the picker closes.
|
||||
*/
|
||||
pickerFooter?: { text: () => string; open: (repaint: () => void) => () => void }
|
||||
}
|
||||
|
||||
export function enumSettingMenuItem<TValue extends string, TId extends string = string>(
|
||||
setting: ConfigSettingEnum<TValue, TId>,
|
||||
opts?: SettingsMenuOptions<TValue>
|
||||
opts?: EnumSettingMenuOptions<TValue>
|
||||
): MenuItem {
|
||||
const label = opts?.label ?? setting.label;
|
||||
return {
|
||||
@@ -1754,7 +1763,11 @@ export function enumSettingMenuItem<TValue extends string, TId extends string =
|
||||
);
|
||||
},
|
||||
}));
|
||||
openModalMenu(ctx, label, items, Math.max(0, setting.values.indexOf(current)));
|
||||
const footer = opts?.pickerFooter;
|
||||
openModalMenu(ctx, label, items, Math.max(0, setting.values.indexOf(current)), {
|
||||
footer: footer?.text,
|
||||
onClosed: footer?.open(() => ctx.actions.requestRender()),
|
||||
});
|
||||
},
|
||||
render: ({ image, x, y, width }) => {
|
||||
drawRightValueMenuItem(image, getDefaultSmallFont(), x, y, width, label, setting.displayValue(setting.get()));
|
||||
|
||||
Reference in new issue
Block a user