forked from Archive/PX4-Autopilot
POSIX: fixed type used in USEC2TICKS
The macro was using a constant defined as a long instead on an unsigned long. Made corresponsing changes to barosim. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
parent
122c52c731
commit
f763c4cc0e
|
@ -439,10 +439,10 @@ BAROSIM::ioctl(device::file_t *filp, int cmd, unsigned long arg)
|
||||||
bool want_start = (_measure_ticks == 0);
|
bool want_start = (_measure_ticks == 0);
|
||||||
|
|
||||||
/* convert hz to tick interval via microseconds */
|
/* convert hz to tick interval via microseconds */
|
||||||
unsigned ticks = USEC2TICK(1000000 / arg);
|
unsigned long ticks = USEC2TICK(1000000 / arg);
|
||||||
|
|
||||||
/* check against maximum rate */
|
/* check against maximum rate */
|
||||||
if ((long)ticks < USEC2TICK(BAROSIM_CONVERSION_INTERVAL))
|
if (ticks < USEC2TICK(BAROSIM_CONVERSION_INTERVAL))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* update interval for next measurement */
|
/* update interval for next measurement */
|
||||||
|
@ -559,7 +559,7 @@ BAROSIM::cycle()
|
||||||
* doing pressure measurements at something close to the desired rate.
|
* doing pressure measurements at something close to the desired rate.
|
||||||
*/
|
*/
|
||||||
if ((_measure_phase != 0) &&
|
if ((_measure_phase != 0) &&
|
||||||
((long)_measure_ticks > USEC2TICK(BAROSIM_CONVERSION_INTERVAL))) {
|
(_measure_ticks > USEC2TICK(BAROSIM_CONVERSION_INTERVAL))) {
|
||||||
|
|
||||||
/* schedule a fresh cycle call when we are ready to measure again */
|
/* schedule a fresh cycle call when we are ready to measure again */
|
||||||
work_queue(HPWORK,
|
work_queue(HPWORK,
|
||||||
|
|
|
@ -131,7 +131,7 @@ __BEGIN_DECLS
|
||||||
extern long PX4_TICKS_PER_SEC;
|
extern long PX4_TICKS_PER_SEC;
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
#define USEC_PER_TICK (1000000L/PX4_TICKS_PER_SEC)
|
#define USEC_PER_TICK (1000000UL/PX4_TICKS_PER_SEC)
|
||||||
#define USEC2TICK(x) (((x)+(USEC_PER_TICK/2))/USEC_PER_TICK)
|
#define USEC2TICK(x) (((x)+(USEC_PER_TICK/2))/USEC_PER_TICK)
|
||||||
|
|
||||||
#define px4_statfs_buf_f_bavail_t unsigned long
|
#define px4_statfs_buf_f_bavail_t unsigned long
|
||||||
|
|
Loading…
Reference in New Issue