mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 22:53:34 +08:00
fix all sign-compare warnings
This commit is contained in:
committed by
Lorenz Meier
parent
cf74166801
commit
9ce83f2208
@@ -35,7 +35,6 @@ px4_add_module(
|
||||
MAIN motor_ramp
|
||||
STACK_MAIN 1200
|
||||
COMPILE_FLAGS
|
||||
-Wno-sign-compare # TODO: fix all sign-compare
|
||||
-Wno-write-strings
|
||||
SRCS
|
||||
motor_ramp.cpp
|
||||
|
||||
@@ -91,11 +91,11 @@ extern "C" __EXPORT int motor_ramp_main(int argc, char *argv[]);
|
||||
*/
|
||||
int motor_ramp_thread_main(int argc, char *argv[]);
|
||||
|
||||
bool min_pwm_valid(unsigned pwm_value);
|
||||
bool min_pwm_valid(int pwm_value);
|
||||
|
||||
bool max_pwm_valid(unsigned pwm_value);
|
||||
bool max_pwm_valid(int pwm_value);
|
||||
|
||||
int set_min_pwm(int fd, unsigned long max_channels, unsigned pwm_value);
|
||||
int set_min_pwm(int fd, unsigned long max_channels, int pwm_value);
|
||||
|
||||
int set_out(int fd, unsigned long max_channels, float output);
|
||||
|
||||
@@ -212,17 +212,17 @@ int motor_ramp_main(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool min_pwm_valid(unsigned pwm_value)
|
||||
bool min_pwm_valid(int pwm_value)
|
||||
{
|
||||
return pwm_value >= 900 && pwm_value <= 1500;
|
||||
}
|
||||
|
||||
bool max_pwm_valid(unsigned pwm_value)
|
||||
bool max_pwm_valid(int pwm_value)
|
||||
{
|
||||
return pwm_value <= 2100 && pwm_value > _min_pwm;
|
||||
}
|
||||
|
||||
int set_min_pwm(int fd, unsigned long max_channels, unsigned pwm_value)
|
||||
int set_min_pwm(int fd, unsigned long max_channels, int pwm_value)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -231,7 +231,7 @@ int set_min_pwm(int fd, unsigned long max_channels, unsigned pwm_value)
|
||||
|
||||
pwm_values.channel_count = max_channels;
|
||||
|
||||
for (int i = 0; i < max_channels; i++) {
|
||||
for (unsigned i = 0; i < max_channels; i++) {
|
||||
pwm_values.values[i] = pwm_value;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ px4_add_module(
|
||||
MAIN sd_bench
|
||||
STACK_MAIN 2500
|
||||
COMPILE_FLAGS
|
||||
-Wno-sign-compare # TODO: fix all sign-compare
|
||||
SRCS
|
||||
sd_bench.c
|
||||
DEPENDS
|
||||
|
||||
@@ -173,7 +173,7 @@ void write_test(int fd, uint8_t *block, int block_size)
|
||||
unsigned int max_write_time = 0;
|
||||
unsigned int fsync_time = 0;
|
||||
|
||||
while (hrt_elapsed_time(&start) < run_duration * 1000) {
|
||||
while ((int64_t)hrt_elapsed_time(&start) < run_duration * 1000) {
|
||||
|
||||
hrt_abstime write_start = hrt_absolute_time();
|
||||
size_t written = write(fd, block, block_size);
|
||||
|
||||
Reference in New Issue
Block a user