I now understand your code well (except for the specific quaternion math). Your code gives me rotation info including yaw which answers my original question perfectly.
Sorry to bother you again but I have another question.
In addition to my need for yaw info to control turns I need acceleration info to control speed. Specifically I need it in forward (X-axis) direction. I might be wrong, but I don't see acceleration relative to body frame in your output. Is this something simple to calculate?
Here's my thinking so far. The Euler vector you calculate is effectively the gravity vector relative to the body, correct? Can I just subtract that from the raw acceleration vector to eliminate the gravity component leaving an actual motion vector? So the body sitting still would have zero values. Then I can just use the remaining X component as my forward acceleration.
Thanks in advance for any enlightenment.