waterloo-rocketry / cansw_processor_airbrakes

Processor board was developed for the 2023-2024 design cycle to perform state estimation and control tasks for Borealis's airbrakes system
2 stars 0 forks source link

I2c #7

Closed celery6 closed 6 months ago

celery6 commented 6 months ago

Add icm raw data to actual units conversion.

Outputs the data in floats now. Is this the desired data type?

RELEVANT SIDE NOTE: snprintf does not do %f formatting well... causes hardfault very quickly.

Joe-Joe-Joe-Joe commented 6 months ago

We love floats. This is a really good find, not something I knew about. The first thing to check is, do we have the RAM for it? Like, if we are using 10% of the available RAM, mayhaps increasing stack size is not the worst thing.

That being said, I can quickly see this becoming something dangerous, since we do a lot of float printing for logging stuff. My little bit of research tells me we should be integer dividing, casting, and sprintf-ing as ints with a decimal separating. We will have to do a bit of load testing to see if that makes the difference.

But that being said, we should also limit from where we call sprintf. If we only ever do it inside the logging thread, we can just make the logging thread stack very large. But if every thread is "allowed" to call sprintf, now they all have to have a big enough stack to support sprintf calls, concurrently.