From 7fdb5ef3cb517fec5c66036deed83bb6e31cb3c4 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Thu, 8 Feb 2024 16:08:11 +0100 Subject: [PATCH] PWMOut/px4io: correct automatic servo/motor configuration messages --- src/drivers/pwm_out/PWMOut.cpp | 8 ++++---- src/drivers/px4io/px4io.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/drivers/pwm_out/PWMOut.cpp b/src/drivers/pwm_out/PWMOut.cpp index 6b482a36f7..0a3cbad4ca 100644 --- a/src/drivers/pwm_out/PWMOut.cpp +++ b/src/drivers/pwm_out/PWMOut.cpp @@ -229,7 +229,7 @@ void PWMOut::update_params() if (output_function >= (int)OutputFunction::Servo1 && output_function <= (int)OutputFunction::ServoMax) { // Function got set to a servo int32_t val = 1500; - PX4_INFO("Setting channel %i disarmed to %i", (int) val, i); + PX4_INFO("Setting channel %i disarmed to %i", i + 1, (int)val); param_set(_mixing_output.disarmedParamHandle(i), &val); // If the whole timer group was not set previously, then set the pwm rate to 50 Hz @@ -250,7 +250,7 @@ void PWMOut::update_params() if (param_get(handle, &tim_config) == 0 && tim_config == 400) { tim_config = 50; - PX4_INFO("setting timer %i to %i Hz", timer, (int) tim_config); + PX4_INFO("Setting timer %i to %i Hz", timer, (int)tim_config); param_set(handle, &tim_config); } } @@ -261,10 +261,10 @@ void PWMOut::update_params() if (output_function >= (int)OutputFunction::Motor1 && output_function <= (int)OutputFunction::MotorMax) { // Function got set to a motor int32_t val = 1100; - PX4_INFO("Setting channel %i minimum to %i", (int) val, i); + PX4_INFO("Setting channel %i minimum to %i", i + 1, (int)val); param_set(_mixing_output.minParamHandle(i), &val); val = 1900; - PX4_INFO("Setting channel %i maximum to %i", (int) val, i); + PX4_INFO("Setting channel %i maximum to %i", i + 1, (int)val); param_set(_mixing_output.maxParamHandle(i), &val); } } diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 12ab205c69..bd6b5d1f31 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -705,7 +705,7 @@ void PX4IO::update_params() if (output_function >= (int)OutputFunction::Servo1 && output_function <= (int)OutputFunction::ServoMax) { // Function got set to a servo int32_t val = 1500; - PX4_INFO("Setting channel %i disarmed to %i", (int) val, i); + PX4_INFO("Setting channel %i disarmed to %i", i + 1, (int)val); param_set(_mixing_output.disarmedParamHandle(i), &val); // If the whole timer group was not set previously, then set the pwm rate to 50 Hz @@ -726,7 +726,7 @@ void PX4IO::update_params() if (param_get(handle, &tim_config) == 0 && tim_config == 400) { tim_config = 50; - PX4_INFO("setting timer %i to %i Hz", timer, (int) tim_config); + PX4_INFO("Setting timer %i to %i Hz", timer, (int)tim_config); param_set(handle, &tim_config); } } @@ -737,10 +737,10 @@ void PX4IO::update_params() if (output_function >= (int)OutputFunction::Motor1 && output_function <= (int)OutputFunction::MotorMax) { // Function got set to a motor int32_t val = 1100; - PX4_INFO("Setting channel %i minimum to %i", (int) val, i); + PX4_INFO("Setting channel %i minimum to %i", i + 1, (int)val); param_set(_mixing_output.minParamHandle(i), &val); val = 1900; - PX4_INFO("Setting channel %i maximum to %i", (int) val, i); + PX4_INFO("Setting channel %i maximum to %i", i + 1, (int)val); param_set(_mixing_output.maxParamHandle(i), &val); } }