mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 23:53:34 +08:00
lib/led: move drivers/lights/rgbled LED_RGB_MAXBRT -> SYS_RGB_MAXBRT
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include <lib/drivers/device/Device.hpp>
|
||||
#include <drivers/drv_sensor.h>
|
||||
#include <lib/parameters/param.h>
|
||||
#include <lib/mathlib/mathlib.h>
|
||||
|
||||
bool param_modify_on_import(bson_node_t node)
|
||||
{
|
||||
@@ -91,6 +92,18 @@ bool param_modify_on_import(bson_node_t node)
|
||||
}
|
||||
}
|
||||
|
||||
// 2021-08-27: translate LED_RGB_MAXBRT (0-15) to SYS_RGB_MAXBRT(0.f-1.f)
|
||||
if (node->type == BSON_INT32) {
|
||||
if (strcmp("LED_RGB_MAXBRT", node->name) == 0) {
|
||||
// convert integer (0-15) to float percentage
|
||||
node->d = math::constrain(static_cast<double>(node->i) / 15., 0., 1.);
|
||||
node->type = BSON_DOUBLE;
|
||||
strcpy(node->name, "SYS_RGB_MAXBRT");
|
||||
PX4_INFO("param migrating LED_RGB_MAXBRT (removed) -> SYS_RGB_MAXBRT: value=%.3f", node->d);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 2020-06-29 (v1.11 beta): translate CAL_ACCx_EN/CAL_GYROx_EN/CAL_MAGx_EN -> CAL_ACCx_PRIO/CAL_GYROx_PRIO/CAL_MAGx_PRIO
|
||||
if (node->type == BSON_INT32) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user