Skip to content
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

Tidal 3D Firmware #84

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mbooth101
Copy link

This PR contains two changes:

  • Update the micropython snapshot to one that includes modframebuf enhancements that allow fast native drawing of polygons, ellipses and arcs to the off-screen frame buffer
  • Add a module that provides fast native vector, matrix and quaternion maths functions

Together these changes allow real-time 3D rendering on the Tidal badge, as seen in the Tidal3D app from the hatchery that currently requires a custom firmware build: https://2022.badge.emfcamp.org/projects/tidal_3d

This snapshot includes the modframebuf improvements from ticket
micropython/micropython#9045
This module contains fast, native implementations of maths functions
commonly used in 3D rendering. These are about an order of magnitude
faster than the same functions written in pure python.
@Jonty
Copy link
Member

Jonty commented Sep 24, 2022

😍 Merrrrge

@mbooth101
Copy link
Author

FWIW I really wanted to use micropython's facility to use dynamic native modules to provide the 3D maths functions as part of my application (instead of baking them into the firmware) but there two problems with it:

  • You can't use floating point arithmetic in dynamic nat-mods because the linker doesn't know how to provide the software float routines. It's possible to work around this by providing your own implementation of the missing functions such as __divsf3() function, e.g. by ripping them off from the Espressif toolchain source, but what a pain in the arse and even if you do this....
  • The firmware seems to crash when I try to call a function in a dynamic nat-mod after a garbage collection has run. My guess is some reference to the native functions are erroneously cleaned up, but to be honest it's beyond my ability to debug and I wasn't able to completely eliminate allocations from my application (in an effort to avoid GC runs entirely)

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