Skip to content

Commit

Permalink
调整param和workq的命令空间
Browse files Browse the repository at this point in the history
Signed-off-by: latercomer <[email protected]>
  • Loading branch information
ComerLater committed Sep 28, 2024
1 parent 3dbc1e3 commit 3c6f67f
Show file tree
Hide file tree
Showing 137 changed files with 19,461 additions and 19,383 deletions.
2 changes: 1 addition & 1 deletion apps/airframe/airframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static airframe_info_t __airframe_table__[100];
static uint16_t __airframe_count__ = UINT16_MAX;
#endif

using namespace nextpilot::global_params;
using namespace nextpilot::param;

bool airframe_section_init() {
#if defined(_MSC_VER)
Expand Down
28 changes: 14 additions & 14 deletions apps/controller/commander/HealthAndArmingChecks/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
// #define CONSOLE_PRINT_ARMING_CHECK_EVENT // for debugging, print updated events whenever they change

#ifndef FRIEND_TEST // for gtest
#define FRIEND_TEST(a, b)
# define FRIEND_TEST(a, b)
#endif

using namespace time_literals;
using namespace nextpilot::global_params;
using namespace nextpilot::param;
using namespace nextpilot;

class HealthAndArmingChecks;
Expand Down Expand Up @@ -85,6 +85,7 @@ class HealthComponentIndex {
__attribute__((always_inline)) constexpr HealthComponentIndex(health_component_t component) :
index(log2((uint64_t)component)) {
}

const uint8_t index;
};

Expand Down Expand Up @@ -132,9 +133,9 @@ class Report {
error = {};
warning = {};
}

bool operator!=(const HealthResults &other) {
return is_present != other.is_present || error != other.error ||
warning != other.warning;
return is_present != other.is_present || error != other.error || warning != other.warning;
}
};

Expand All @@ -149,7 +150,7 @@ class Report {
NavModes can_arm; ///< whether arming is possible for each mode group (bitset)
NavModes can_run; ///< whether switching into a certain mode is possible (while armed)

bool valid; ///< whether can_arm is valid, i.e. can be used
bool valid; ///< whether can_arm is valid, i.e. can be used

void reset() {
error = {};
Expand All @@ -158,15 +159,16 @@ class Report {
can_run = (NavModes)-1;
valid = false;
}

bool operator!=(const ArmingCheckResults &other) {
return error != other.error || warning != other.warning ||
can_arm != other.can_arm || can_run != other.can_run || valid != other.valid;
return error != other.error || warning != other.warning || can_arm != other.can_arm || can_run != other.can_run || valid != other.valid;
}
};

Report(failsafe_flags_s &failsafe_flags, hrt_abstime min_reporting_interval = 2_s) :
_min_reporting_interval(min_reporting_interval), _failsafe_flags(failsafe_flags) {
}

~Report() = default;

failsafe_flags_s &failsafeFlags() {
Expand All @@ -181,16 +183,14 @@ class Report {
* Whether arming is possible for a given navigation mode
*/
bool canArm(uint8_t nav_state) const {
return _results[_current_result].arming_checks.valid &&
(uint32_t)(_results[_current_result].arming_checks.can_arm & getModeGroup(nav_state)) != 0;
return _results[_current_result].arming_checks.valid && (uint32_t)(_results[_current_result].arming_checks.can_arm & getModeGroup(nav_state)) != 0;
}

/**
* Whether a navigation mode can be run (while already armed)
*/
bool canRun(uint8_t nav_state) const {
return _results[_current_result].arming_checks.valid &&
(uint32_t)(_results[_current_result].arming_checks.can_run & getModeGroup(nav_state)) != 0;
return _results[_current_result].arming_checks.valid && (uint32_t)(_results[_current_result].arming_checks.can_run & getModeGroup(nav_state)) != 0;
}

void getHealthReport(health_report_s &report) const;
Expand Down Expand Up @@ -235,6 +235,7 @@ class Report {
const HealthResults &healthResults() const {
return _results[_current_result].health;
}

const ArmingCheckResults &armingCheckResults() const {
return _results[_current_result].arming_checks;
}
Expand Down Expand Up @@ -268,8 +269,7 @@ class Report {
}

bool operator!=(const Results &other) {
return health != other.health || arming_checks != other.arming_checks ||
num_events != other.num_events || event_id_hash != other.event_id_hash;
return health != other.health || arming_checks != other.arming_checks || num_events != other.num_events || event_id_hash != other.event_id_hash;
}
};

Expand Down Expand Up @@ -385,7 +385,7 @@ bool Report::addEvent(uint32_t event_id, const events::LogLevels &log_levels, co
class HealthAndArmingCheckBase : public ModuleParams {
public:
HealthAndArmingCheckBase() :
ModuleParams(nullptr){};
ModuleParams(nullptr) {};
~HealthAndArmingCheckBase() = default;

virtual void checkAndReport(const Context &context, Report &reporter) = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <sensor_calibration/Accelerometer.hpp>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class AccelerometerChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <uORB/topics/airspeed_validated.h>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class AirspeedChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <sensor_calibration/Barometer.hpp>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class BaroChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <uORB/topics/rtl_time_estimate.h>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class BatteryChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <uORB/topics/cpuload.h>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class CpuResourceChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <uORB/topics/distance_sensor.h>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class DistanceSensorChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <uORB/topics/esc_status.h>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class EscChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

using namespace time_literals;
using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class EstimatorChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "../Common.hpp"

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class FlightTimeChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <uORB/topics/estimator_status.h>
#include <sensor_calibration/Magnetometer.hpp>

using namespace nextpilot::global_params;
using namespace nextpilot::param;

class MagnetometerChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <uORB/Subscription.hpp>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class ModeChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <uORB/Subscription.hpp>
#include <uORB/topics/offboard_control_mode.h>

using namespace nextpilot::global_params;
using namespace nextpilot::param;
using namespace nextpilot;

class OffboardChecks : public HealthAndArmingCheckBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "../Common.hpp"

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class ParachuteChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <uORB/topics/system_power.h>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class PowerChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <uORB/topics/manual_control_setpoint.h>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class RcAndDataLinkChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <uORB/topics/input_rc.h>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class RcCalibrationChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "../Common.hpp"

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class SdCardChecks : public HealthAndArmingCheckBase {
public:
Expand All @@ -26,10 +26,10 @@ class SdCardChecks : public HealthAndArmingCheckBase {
#ifdef PX4_STORAGEDIR
bool _sdcard_detected{false};

#ifdef __PX4_NUTTX
# ifdef __PX4_NUTTX
bool _hardfault_checked_once{false};
bool _hardfault_file_present{false};
#endif
# endif
#endif

DEFINE_PARAMETERS_CUSTOM_PARENT(HealthAndArmingCheckBase,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <uORB/topics/actuator_armed.h>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class SystemChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <uORB/topics/vtol_vehicle_status.h>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class VtolChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <uORB/topics/wind.h>

using namespace nextpilot;
using namespace nextpilot::global_params;
using namespace nextpilot::param;

class WindChecks : public HealthAndArmingCheckBase {
public:
Expand Down
Loading

0 comments on commit 3c6f67f

Please sign in to comment.