-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement hardware-based raise-to-wake gesture with software fallback #340
base: master
Are you sure you want to change the base?
Conversation
With the BMA425 accelerometer shipped with newer PineTime units, it is possible to configure gesture detection on the hardware and send interrupts to the nRF chips when detected. The supported gestures include wrist-twist, double-tap and single-tap. This commit implements optional raise-to-wake support based on such a hardware feature. However, for compatibility with earlier units, which has a BMA421 sensor that does not support gesture detection, we also introduce a software-based detection algorithm for fallback. This algorithm is based on the InfiniTime equivalent <InfiniTimeOrg/InfiniTime#826>. Due to the way the accelerometer is mounted inside the PineTime, axes remapping is needed for the hardware to detect the gestures correctly. This was already implemented in the bma42x driver, and only needs to be exposed to the Python side via bma42x-upy, which will have a corresponding pull request for that. Note that the hardware will never remap the raw data readout -- the remapping information provided to the hardware will only be used in the hardware-based algorithms, such as step counting and gesture detection. Previously in wasp-os#275, software-based axes remapping was already introduced, however the mapping was inconsistent with what the hardware expects. The hardware expects a left-handed coordinate system flipped around the origin: when worn on the left wrist, the directions down, left, and towards the user should be positive. On the PineTime, this translates to all axes being flipped *and* the x and y axes swapped. The software mapping is now corrected to agree with what the hardware expects. This also means that apps making use of the accelerometer (for now, just the Level app) will need to be changed, but that is beyond the scope of this commit. Co-authored-by: Ashley Eastwood <aeastw.git@fastmail.co.uk> Co-authored-by: Finlay Davidson <finlay.davidson@coderclass.nl>
Note: this currently does make the image size overflow -- if anyone can give some suggestion on what to do to shrink the size, I'm all ears. My suggestion would be to just remove some of the built-in games and apps and instead make them optional. For now all my attempts at fixing the overflowing size are not successful, except building with |
What I ended up doing on my own personal builds is this: https://gitea.angry.im/PeterCxy/wasp-os/commit/40c3928ce1824fcb2ce7963cb0767cd000696196. Not sure what |
Other ways of freeing up space are moving the icons to the 4mb flash (i think there's a ticket about that but I can't find it) and #283 |
@fgaz How would the icons be initialized if they are moved to the flash? |
The software fallback should probably be updated to match the version of my algorithm that was eventually merged into InfiniTime. |
With the BMA425 accelerometer shipped with newer PineTime units, it is
possible to configure gesture detection on the hardware and send
interrupts to the nRF chips when detected. The supported gestures
include wrist-twist, double-tap and single-tap.
This commit implements optional raise-to-wake support based on such a
hardware feature. However, for compatibility with earlier units, which
has a BMA421 sensor that does not support gesture detection, we also
introduce a software-based detection algorithm for fallback. This
algorithm is based on the InfiniTime equivalent
InfiniTimeOrg/InfiniTime#826.
Due to the way the accelerometer is mounted inside the PineTime, axes
remapping is needed for the hardware to detect the gestures correctly.
This was already implemented in the bma42x driver, and only needs to be
exposed to the Python side via bma42x-upy, which will have a
corresponding pull request for that.
Note that the hardware will never remap the raw data readout -- the
remapping information provided to the hardware will only be used in the
hardware-based algorithms, such as step counting and gesture detection.
Previously in #275, software-based axes remapping was already
introduced, however the mapping was inconsistent with what the hardware
expects. The hardware expects a left-handed coordinate system flipped
around the origin: when worn on the left wrist, the directions down, left,
and towards the user should be positive. On the PineTime, this translates
to all axes being flipped and the x and y axes swapped.
The software mapping is now corrected to agree with what the hardware
expects. This also means that apps making use of the accelerometer (for
now, just the Level app) will need to be changed, but that is beyond the
scope of this commit.
Co-authored-by: Ashley Eastwood aeastw.git@fastmail.co.uk
Co-authored-by: Finlay Davidson finlay.davidson@coderclass.nl