mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 14:23:33 +08:00
lib/led: replace subscription missed error with perf count
This commit is contained in:
+2
-1
@@ -75,7 +75,8 @@ int LedController::update(LedControlData &control_data)
|
|||||||
|
|
||||||
if ((_led_control_sub.get_last_generation() != last_generation + 1)
|
if ((_led_control_sub.get_last_generation() != last_generation + 1)
|
||||||
&& (_led_control_sub.get_last_generation() != last_generation)) {
|
&& (_led_control_sub.get_last_generation() != last_generation)) {
|
||||||
PX4_ERR("led_control lost, generation %d -> %d", last_generation, _led_control_sub.get_last_generation());
|
perf_count(_led_control_sub_lost_perf);
|
||||||
|
PX4_DEBUG("led_control lost, generation %d -> %d", last_generation, _led_control_sub.get_last_generation());
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't apply the new state just yet to avoid interrupting an ongoing blinking state
|
// don't apply the new state just yet to avoid interrupting an ongoing blinking state
|
||||||
|
|||||||
+8
-5
@@ -43,16 +43,14 @@
|
|||||||
|
|
||||||
#include <drivers/drv_hrt.h>
|
#include <drivers/drv_hrt.h>
|
||||||
#include <drivers/drv_led.h>
|
#include <drivers/drv_led.h>
|
||||||
|
|
||||||
#include <px4_platform_common/module_params.h>
|
#include <px4_platform_common/module_params.h>
|
||||||
|
#include <lib/parameters/param.h>
|
||||||
|
#include <lib/perf/perf_counter.h>
|
||||||
#include <uORB/Subscription.hpp>
|
#include <uORB/Subscription.hpp>
|
||||||
#include <uORB/SubscriptionInterval.hpp>
|
#include <uORB/SubscriptionInterval.hpp>
|
||||||
#include <uORB/topics/led_control.h>
|
#include <uORB/topics/led_control.h>
|
||||||
#include <uORB/topics/parameter_update.h>
|
#include <uORB/topics/parameter_update.h>
|
||||||
|
|
||||||
#include <lib/parameters/param.h>
|
|
||||||
|
|
||||||
using namespace time_literals;
|
using namespace time_literals;
|
||||||
|
|
||||||
struct LedControlDataSingle {
|
struct LedControlDataSingle {
|
||||||
@@ -72,7 +70,10 @@ class LedController : public ModuleParams
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LedController() : ModuleParams(nullptr) {}
|
LedController() : ModuleParams(nullptr) {}
|
||||||
~LedController() override = default;
|
~LedController() override
|
||||||
|
{
|
||||||
|
perf_free(_led_control_sub_lost_perf);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get maxium time between two consecutive calls to update() in us.
|
* get maxium time between two consecutive calls to update() in us.
|
||||||
@@ -185,6 +186,8 @@ private:
|
|||||||
|
|
||||||
hrt_abstime _last_update_call{0};
|
hrt_abstime _last_update_call{0};
|
||||||
|
|
||||||
|
perf_counter_t _led_control_sub_lost_perf{perf_alloc(PC_COUNT, MODULE_NAME": led_control message missed")};
|
||||||
|
|
||||||
uint8_t _max_brightness{UINT8_MAX};
|
uint8_t _max_brightness{UINT8_MAX};
|
||||||
|
|
||||||
bool _force_update{true}; ///< force an orb_copy in the beginning
|
bool _force_update{true}; ///< force an orb_copy in the beginning
|
||||||
|
|||||||
Reference in New Issue
Block a user