#define Flg_PitchAngSign_tmout() ((bool)False) /*CAN signal PitchAngSign is timeout */ /False: no timeout/ /True: timeout/

#define Flg_PitchAng_tmout ((bool)False) /*CAN signal PitchAng is timeout */ /False: no timeout/ /True: timeout/

#define SYN__u8PitchAngleSign() ((uint8)0) /Get can signal PitchAngle sign/

#define SYN__u8PitchAng() ((uint8)0) /Get can signal PitchAngle/

#define Flg_PitchAngSign_fv() ((bool)False) /check if get the first PitchAngSign can frame signal/

#define Flg_PitchAng_fv() ((bool)False)

/check if get the first PitchAng can frame signal/

typedef struct { uint8 DIF_u8SlopeDirectionValue; //0: Horizontal vehicle icon; 1:Uphill vehicle icon; 2: Downhill vehicle icon uint8 DIF_u8SlopeAngleValue; // 0--90 uint8 DIF_u8SlopeUnit; // 0:None; 1: degree, other value: reserved }DIF_tstSlopeDpoolData;

DIF_tstSlopeDpoolData DIF_stSlopeDpoolData;

/define DPOOL struct for slope/ DIF_tstSlopeDpoolData DIF_stSlopeDpoolData = {0,0,1};

/*slope output function */ void slope_vOutput(void) { if (SYN__u8PitchAng() == 0) { DIF_stSlopeDpoolData.DIF_u8SlopeDirectionValue = 0; DIF_stSlopeDpoolData.DIF_u8SlopeAngleValue = 0; DIF_stSlopeDpoolData.DIF_u8SlopeUnit = 1; } else if (SYN__u8PitchAng() > 0 && SYN__u8PitchAng() <= 90) { if (SYN__u8PitchAngleSign() == 0) { DIF_stSlopeDpoolData.DIF_u8SlopeDirectionValue = 1; } else DIF_stSlopeDpoolData.DIF_u8SlopeDirectionValue = 2; DIF_stSlopeDpoolData.DIF_u8SlopeAngleValue = SYN__u8PitchAng(); DIF_stSlopeDpoolData.DIF_u8SlopeUnit = 1; } else if (Flg_PitchAngSign_tmout() == False && Flg_PitchAng_tmout == False && SYN__u8PitchAng() > 127) { DIF_stSlopeDpoolData.DIF_u8SlopeDirectionValue = 0; DIF_stSlopeDpoolData.DIF_u8SlopeAngleValue = 0; DIF_stSlopeDpoolData.DIF_u8SlopeUnit = 1; } else {

}
return;

} /*slope init function */ void slope_vInit(void) { if (Flg_PitchAngSign_fv() && Flg_PitchAng_fv()) { slope_vOutput(); } return; } /*slope main function */ void slope_vMain(void) { slope_vInit(); slope_vOutput(); Delay(TimeCnt()); }

CAN Signal Pitch Angle and Slope Calculation - C Code Analysis

原文地址: https://www.cveoy.top/t/topic/oQyP 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录