Skip to content

Commit

Permalink
AP_ADSB: create an enum class for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Nov 1, 2023
1 parent d33facd commit 64c161d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions libraries/AP_ADSB/AP_ADSB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,17 +828,17 @@ bool AP_ADSB::get_vehicle_by_ICAO(const uint32_t icao, adsb_vehicle_t &vehicle)
*/
void AP_ADSB::write_log(const adsb_vehicle_t &vehicle) const
{
switch (_log) {
case logging::SPECIAL_ONLY:
switch ((Logging)_log) {
case Logging::SPECIAL_ONLY:
if (!is_special_vehicle(vehicle.info.ICAO_address)) {
return;
}
break;

case logging::ALL:
case Logging::ALL:
break;

case logging::NONE:
case Logging::NONE:
default:
return;
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/AP_ADSB/AP_ADSB.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,13 @@ class AP_ADSB {
void push_sample(const adsb_vehicle_t &vehicle);

// logging
AP_Int8 _log;
void write_log(const adsb_vehicle_t &vehicle) const;
enum logging {
enum class Logging {
NONE = 0,
SPECIAL_ONLY = 1,
ALL = 2
};
AP_Enum<Logging> _log;

// reference to backend
AP_ADSB_Backend *_backend[ADSB_MAX_INSTANCES];
Expand Down

0 comments on commit 64c161d

Please sign in to comment.