Snippet - Tilt compensated Compass

I just posted Tilt compensated Compass on Codeshare. Feel free to discuss and make suggestions here.


Nice! Thank you!

@ KiwiSaner - That is excellent. Thanks!

I was wondering if you could use the Atan2 from the System.Math class since it is now implemented there and should give better performance than the managed implementation.

thanx for sharing

what do you think about using a const. rho=(180 / 3.14159265) instead of calculating this
part in every measuring ? (line 194 and 437)

Good idea… I did not think of that. Then one can completely separate the tilt compensate class from the compass module. The only reason why put it in the compass module code was so I could share the Atan2 modules of the compass module. But it would be more elegant to have it as a separate class.

I like your idea. In my defence… I did not spend any time trying to optimise the original Arduino code much. I was too keen to just test first that it works.