From 3747d0bc80f8ffcf5d4b66ffa9c0eecc22cfcc5b Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Wed, 21 Apr 2021 11:38:59 -0700 Subject: [PATCH] px4io:Fix types --- src/drivers/px4io/px4io.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 1044624372..fc93423183 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2012-2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2012-2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1129,7 +1129,7 @@ PX4IO::task_main() } /* S.BUS output */ - int sbus_mode; + long sbus_mode; parm_handle = param_find("PWM_SBUS_MODE"); if (parm_handle != PARAM_INVALID) { @@ -1231,7 +1231,7 @@ void PX4IO::update_params() if (param_get(param_find(str), &pwm_min) == PX4_OK) { if (pwm_min >= 0) { - pwm.values[i] = math::constrain(pwm_min, PWM_LOWEST_MIN, PWM_HIGHEST_MIN); + pwm.values[i] = math::constrain(pwm_min, static_cast(PWM_LOWEST_MIN), static_cast(PWM_HIGHEST_MIN)); if (pwm_min != pwm.values[i]) { int32_t pwm_min_new = pwm.values[i]; @@ -1260,7 +1260,7 @@ void PX4IO::update_params() if (param_get(param_find(str), &pwm_max) == PX4_OK) { if (pwm_max >= 0) { - pwm.values[i] = math::constrain(pwm_max, PWM_LOWEST_MAX, PWM_HIGHEST_MAX); + pwm.values[i] = math::constrain(pwm_max, static_cast(PWM_LOWEST_MAX), static_cast(PWM_HIGHEST_MAX)); if (pwm_max != pwm.values[i]) { int32_t pwm_max_new = pwm.values[i]; @@ -1289,7 +1289,7 @@ void PX4IO::update_params() if (param_get(param_find(str), &pwm_fail) == PX4_OK) { if (pwm_fail >= 0) { - pwm.values[i] = math::constrain(pwm_fail, 0, PWM_HIGHEST_MAX); + pwm.values[i] = math::constrain(pwm_fail, static_cast(0), static_cast(PWM_HIGHEST_MAX)); if (pwm_fail != pwm.values[i]) { int32_t pwm_fail_new = pwm.values[i]; @@ -1315,7 +1315,7 @@ void PX4IO::update_params() if (param_get(param_find(str), &pwm_dis) == PX4_OK) { if (pwm_dis >= 0) { - pwm.values[i] = math::constrain(pwm_dis, 0, PWM_HIGHEST_MAX); + pwm.values[i] = math::constrain(pwm_dis, static_cast(0), static_cast(PWM_HIGHEST_MAX)); if (pwm_dis != pwm.values[i]) { int32_t pwm_dis_new = pwm.values[i]; @@ -1511,7 +1511,7 @@ PX4IO::handle_motor_test() io_reg_get(PX4IO_PAGE_CONTROL_MAX_PWM, 0, pwm_max.values, _max_actuators) == 0) { uint16_t value = math::constrain(pwm_min.values[idx] + - (uint16_t)((pwm_max.values[idx] - pwm_min.values[idx]) * test_motor.value), + static_cast(((pwm_max.values[idx] - pwm_min.values[idx]) * test_motor.value)), pwm_min.values[idx], pwm_max.values[idx]); io_reg_set(PX4IO_PAGE_DIRECT_PWM, idx, value); }