Where does the 16 come from? The comment indicates 512 as factor...
Also it might need to be ```int32_t inv_rate_gain = (float)(16 * AHRS_MAG_CORRECT_FREQUENCY) / (ahrs_impl.mag_zeta * ahrs_impl.mag_omega * AHRS_PROPAGATE_FREQUENCY);``` to be correct. This is not all in fixedpoint anymore now anyway