Skip to content

Commit

Permalink
AP_ExternalAHRS: Fixed formatting and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AN-DanielCook authored and tridge committed Apr 17, 2024
1 parent 6e911c5 commit fcd4218
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ bool AP_ExternalAHRS_AdvancedNavigation::request_data(void)
_fly_forward = in_fly_forward();
_gnss_disable = gnss_is_disabled();

// Select AdNav vehicle for current flight mode.
// Select AdNav vehicle for current flight mode.
vehicle_type_e vehicle_type = vehicle_type_3d_aircraft;
if (_fly_forward == true) {
vehicle_type = vehicle_type_fixed_wing_plane;
Expand All @@ -254,7 +254,7 @@ bool AP_ExternalAHRS_AdvancedNavigation::request_data(void)

int8_t AP_ExternalAHRS_AdvancedNavigation::get_port(void) const
{
if (!_uart) {
if (_uart == nullptr) {
return -1;
}
return _port_num;
Expand Down Expand Up @@ -531,7 +531,7 @@ bool AP_ExternalAHRS_AdvancedNavigation::sendPacketRequest()
};

AN_PACKET packet;

// load the AN_PACKETS_PERIOD Into the payload.
packet.payload.packet_periods = periods;
packet.update_checks(packet_id_packet_periods, packet.getPeriodsLength(periods));
Expand Down Expand Up @@ -603,7 +603,7 @@ bool AP_ExternalAHRS_AdvancedNavigation::set_filter_options(bool gnss_en, vehicl
options_packet.dual_antenna_disabled = false;
// set reserved packets to 0
memset(options_packet.reserved, 0, sizeof(options_packet.reserved));

return set_filter_options(options_packet);
}

Expand Down
22 changes: 11 additions & 11 deletions libraries/AP_ExternalAHRS/AP_ExternalAHRS_AdvancedNavigation.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ class AP_ExternalAHRS_AdvancedNavigation_Decoder
{
public:
uint8_t _buffer[AN_DECODE_BUFFER_SIZE];
uint16_t _buffer_length = 0;
uint64_t _packets_decoded = 0;
uint64_t _bytes_decoded = 0;
uint64_t _bytes_discarded = 0;
uint64_t _lrc_errors = 0;
uint64_t _crc_errors = 0;
size_t _bytes_received = 0;
uint16_t _buffer_length;
uint64_t _packets_decoded;
uint64_t _bytes_decoded;
uint64_t _bytes_discarded;
uint64_t _lrc_errors;
uint64_t _crc_errors;
size_t _bytes_received;

int decode_packet(uint8_t* out_buffer, size_t buf_size);

Expand Down Expand Up @@ -330,7 +330,7 @@ class AP_ExternalAHRS_AdvancedNavigation: public AP_ExternalAHRS_backend
} b;
} filter;
};

struct PACKED AN_SYSTEM_STATE {
AN_STATUS status;
uint32_t unix_time_seconds;
Expand Down Expand Up @@ -439,7 +439,7 @@ class AP_ExternalAHRS_AdvancedNavigation: public AP_ExternalAHRS_backend
void update_checks(uint8_t header_id, uint8_t payload_length)
{
length = payload_length;

// Update the packet check and header id
crc = crc16_ccitt(payload.raw_packet, payload_length, 0xFFFF);
id = header_id;
Expand All @@ -450,7 +450,7 @@ class AP_ExternalAHRS_AdvancedNavigation: public AP_ExternalAHRS_backend
}

uint8_t getPeriodsLength(AN_PACKET_PERIODS packet_periods)
{
{
// Find the utilized size of the packet and make it the payload length.
for (uint32_t idx = 0; idx < (AN_MAXIMUM_PACKET_SIZE - 2)/sizeof(AN_PERIOD); idx++)
{
Expand Down Expand Up @@ -494,7 +494,7 @@ class AP_ExternalAHRS_AdvancedNavigation: public AP_ExternalAHRS_backend
uint32_t _last_raw_gnss_pkt_ms;
uint32_t _device_id;
uint32_t _hardware_rev;

bool _gnss_disable;
bool _fly_forward;

Expand Down

0 comments on commit fcd4218

Please sign in to comment.