This isn't necessary.  AttitudeActual.Yaw is defiend to be within [-180 to 180].  If you want to be sure above say

    int16_t heading = roundf(circular_mod_deg(attActual.Yaw));
    heading = (heading < 0) ? heading + 360 : heading;

also what is the 0.5f needed?