mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
linux_pwm_out fix sign-compare
This commit is contained in:
parent
dd6892443c
commit
33ee4fc453
@ -285,7 +285,7 @@ void task_main(int argc, char *argv[])
|
||||
_controls[0].control[2] = 0.f;
|
||||
int channel = rc_channels.function[rc_channels_s::RC_CHANNELS_FUNCTION_THROTTLE];
|
||||
|
||||
if (ret == 0 && channel >= 0 && channel < sizeof(rc_channels.channels) / sizeof(rc_channels.channels[0])) {
|
||||
if (ret == 0 && channel >= 0 && channel < (int)(sizeof(rc_channels.channels) / sizeof(rc_channels.channels[0]))) {
|
||||
_controls[0].control[3] = rc_channels.channels[channel];
|
||||
|
||||
} else {
|
||||
@ -347,7 +347,7 @@ void task_main(int argc, char *argv[])
|
||||
pwm_value = _pwm_min;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _outputs.noutputs; ++i) {
|
||||
for (uint32_t i = 0; i < _outputs.noutputs; ++i) {
|
||||
pwm[i] = pwm_value;
|
||||
}
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ int NavioSysfsPWMOut::send_output_pwm(const uint16_t *pwm, int num_outputs)
|
||||
int ret = 0;
|
||||
|
||||
//convert this to duty_cycle in ns
|
||||
for (unsigned i = 0; i < num_outputs; ++i) {
|
||||
for (int i = 0; i < num_outputs; ++i) {
|
||||
int n = ::snprintf(data, sizeof(data), "%u", pwm[i] * 1000);
|
||||
int write_ret = ::write(_pwm_fd[i], data, n);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user