mirror of https://github.com/ArduPilot/ardupilot
SITL: add ASSERT_STORAGE_SIZE macro
saves havin gto name the dummy variable yourself
This commit is contained in:
parent
cedcd190fc
commit
bddb9aaac7
|
@ -143,8 +143,7 @@ void ADSB_Sagetech_MXS::handle_message()
|
||||||
|
|
||||||
bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::Installation& opmsg)
|
bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::Installation& opmsg)
|
||||||
{
|
{
|
||||||
assert_storage_size<Installation, 36> _assert_storage_size_Installation;
|
ASSERT_STORAGE_SIZE(Installation, 36);
|
||||||
(void)_assert_storage_size_Installation;
|
|
||||||
|
|
||||||
if (operating_mode != OperatingMode::OFF &&
|
if (operating_mode != OperatingMode::OFF &&
|
||||||
operating_mode != OperatingMode::MAINTENANCE) {
|
operating_mode != OperatingMode::MAINTENANCE) {
|
||||||
|
@ -181,8 +180,7 @@ void ADSB_Sagetech_MXS::assert_good_flight_id()
|
||||||
|
|
||||||
bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::FlightIDMessage& _msg)
|
bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::FlightIDMessage& _msg)
|
||||||
{
|
{
|
||||||
assert_storage_size<FlightIDMessage, 12> _assert_storage_size_FlightIDMessage;
|
ASSERT_STORAGE_SIZE(FlightIDMessage, 12);
|
||||||
(void)_assert_storage_size_FlightIDMessage;
|
|
||||||
|
|
||||||
// do something!
|
// do something!
|
||||||
flight_id_set_time_ms = AP_HAL::millis();
|
flight_id_set_time_ms = AP_HAL::millis();
|
||||||
|
@ -194,8 +192,7 @@ bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::FlightIDMe
|
||||||
|
|
||||||
bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::Operating& _msg)
|
bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::Operating& _msg)
|
||||||
{
|
{
|
||||||
assert_storage_size<Operating, 12> _assert_storage_size_Operating;
|
ASSERT_STORAGE_SIZE(Operating, 12);
|
||||||
(void)_assert_storage_size_Operating;
|
|
||||||
|
|
||||||
// do something!
|
// do something!
|
||||||
|
|
||||||
|
@ -222,8 +219,7 @@ double ADSB_Sagetech_MXS::lat_string_to_double(const uint8_t *str)
|
||||||
|
|
||||||
bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::GPS& _msg)
|
bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::GPS& _msg)
|
||||||
{
|
{
|
||||||
assert_storage_size<GPS, 63> _assert_storage_size_GPS;
|
ASSERT_STORAGE_SIZE(GPS, 63);
|
||||||
(void)_assert_storage_size_GPS;
|
|
||||||
|
|
||||||
// store data to transmit via ADSB
|
// store data to transmit via ADSB
|
||||||
info_from_vehicle.gps.lat = lat_string_to_double(_msg.latitude);
|
info_from_vehicle.gps.lat = lat_string_to_double(_msg.latitude);
|
||||||
|
@ -234,8 +230,7 @@ bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::GPS& _msg)
|
||||||
|
|
||||||
bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::DataRequest& _msg)
|
bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::DataRequest& _msg)
|
||||||
{
|
{
|
||||||
assert_storage_size<DataRequest, 4> _assert_storage_size_DataRequest;
|
ASSERT_STORAGE_SIZE(DataRequest, 4);
|
||||||
(void)_assert_storage_size_DataRequest;
|
|
||||||
|
|
||||||
// handle request to send data to vehicle. Note that the
|
// handle request to send data to vehicle. Note that the
|
||||||
// specification says (on page 32) that the ack is sent before the
|
// specification says (on page 32) that the ack is sent before the
|
||||||
|
@ -246,8 +241,7 @@ bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::DataReques
|
||||||
|
|
||||||
bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::TargetRequest& _msg)
|
bool ADSB_Sagetech_MXS::handle_message(const SITL::ADSB_Sagetech_MXS::TargetRequest& _msg)
|
||||||
{
|
{
|
||||||
assert_storage_size<TargetRequest, 7> _assert_storage_size_TargetRequest;
|
ASSERT_STORAGE_SIZE(TargetRequest, 7);
|
||||||
(void)_assert_storage_size_TargetRequest;
|
|
||||||
|
|
||||||
// handle request to send adsb data to vehicle as it is received
|
// handle request to send adsb data to vehicle as it is received
|
||||||
|
|
||||||
|
|
|
@ -206,8 +206,7 @@ void SITL::EFI_Hirth::send_record1()
|
||||||
|
|
||||||
write_to_autopilot((char*)&packed_record1, sizeof(packed_record1));
|
write_to_autopilot((char*)&packed_record1, sizeof(packed_record1));
|
||||||
|
|
||||||
assert_storage_size<Record1, 84> _assert_storage_size_Record1;
|
ASSERT_STORAGE_SIZE(Record1, 84);
|
||||||
(void)_assert_storage_size_Record1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SITL::EFI_Hirth::send_record2()
|
void SITL::EFI_Hirth::send_record2()
|
||||||
|
@ -224,8 +223,7 @@ void SITL::EFI_Hirth::send_record2()
|
||||||
|
|
||||||
write_to_autopilot((char*)&packed_record2, sizeof(packed_record2));
|
write_to_autopilot((char*)&packed_record2, sizeof(packed_record2));
|
||||||
|
|
||||||
assert_storage_size<Record2, 98> _assert_storage_size_Record2;
|
ASSERT_STORAGE_SIZE(Record2, 98);
|
||||||
(void)_assert_storage_size_Record2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,6 +241,5 @@ void SITL::EFI_Hirth::send_record3()
|
||||||
|
|
||||||
write_to_autopilot((char*)&packed_record3, sizeof(packed_record3));
|
write_to_autopilot((char*)&packed_record3, sizeof(packed_record3));
|
||||||
|
|
||||||
assert_storage_size<Record3, 100> _assert_storage_size_Record3;
|
ASSERT_STORAGE_SIZE(Record3, 100);
|
||||||
(void)_assert_storage_size_Record3;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
|
|
||||||
void SITL::InvensenseV3::update(const class Aircraft &aircraft)
|
void SITL::InvensenseV3::update(const class Aircraft &aircraft)
|
||||||
{
|
{
|
||||||
assert_storage_size<FIFOData, 16> _assert_fifo_size;
|
ASSERT_STORAGE_SIZE(FIFOData, 16);
|
||||||
(void)_assert_fifo_size;
|
|
||||||
|
|
||||||
const SIM *sitl = AP::sitl();
|
const SIM *sitl = AP::sitl();
|
||||||
const int16_t xAccel = sitl->state.xAccel / accel_scale();
|
const int16_t xAccel = sitl->state.xAccel / accel_scale();
|
||||||
|
|
|
@ -51,6 +51,8 @@ const AP_Param::GroupInfo RichenPower::var_info[] = {
|
||||||
|
|
||||||
RichenPower::RichenPower() : SerialDevice::SerialDevice()
|
RichenPower::RichenPower() : SerialDevice::SerialDevice()
|
||||||
{
|
{
|
||||||
|
ASSERT_STORAGE_SIZE(RichenPacket, 70);
|
||||||
|
|
||||||
AP_Param::setup_object_defaults(this, var_info);
|
AP_Param::setup_object_defaults(this, var_info);
|
||||||
|
|
||||||
u.packet.magic1 = 0xAA;
|
u.packet.magic1 = 0xAA;
|
||||||
|
|
|
@ -124,7 +124,6 @@ private:
|
||||||
uint8_t footermagic1;
|
uint8_t footermagic1;
|
||||||
uint8_t footermagic2;
|
uint8_t footermagic2;
|
||||||
};
|
};
|
||||||
assert_storage_size<RichenPacket, 70> _assert_storage_size_RichenPacket UNUSED_PRIVATE_MEMBER;
|
|
||||||
|
|
||||||
union RichenUnion {
|
union RichenUnion {
|
||||||
uint8_t parse_buffer[70];
|
uint8_t parse_buffer[70];
|
||||||
|
|
Loading…
Reference in New Issue