A tilt-compensated compass

A heading that holds as the board tilts: gravity levels Earth's dipping field, and gives its dip too. On a BMX055, or any pair. Live, with things to try.