AP_HAL: added id_signed for CANFrame

makes for more efficient lua processing
This commit is contained in:
Andrew Tridgell 2022-09-30 10:44:59 +10:00
parent acb18cf946
commit 24b83135e0
1 changed files with 5 additions and 0 deletions

View File

@ -67,6 +67,11 @@ struct AP_HAL::CANFrame {
return (id == rhs.id) && (dlc == rhs.dlc) && (memcmp(data, rhs.data, dlc) == 0);
}
// signed version of id, for use by scriping where uint32_t is expensive
int32_t id_signed(void) const {
return isExtended()? int32_t(id & MaskExtID) : int32_t(id & MaskStdID);
}
bool isExtended() const
{
return id & FlagEFF;