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:
Mark Charlebois 2015-06-03 11:49:28 -07:00
parent 122c52c731
commit f763c4cc0e
2 changed files with 4 additions and 4 deletions

View File

@ -439,10 +439,10 @@ BAROSIM::ioctl(device::file_t *filp, int cmd, unsigned long arg)
bool want_start = (_measure_ticks == 0);
/* convert hz to tick interval via microseconds */
unsigned ticks = USEC2TICK(1000000 / arg);
unsigned long ticks = USEC2TICK(1000000 / arg);
/* check against maximum rate */
if ((long)ticks < USEC2TICK(BAROSIM_CONVERSION_INTERVAL))
if (ticks < USEC2TICK(BAROSIM_CONVERSION_INTERVAL))
return -EINVAL;
/* update interval for next measurement */
@ -559,7 +559,7 @@ BAROSIM::cycle()
* doing pressure measurements at something close to the desired rate.
*/
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 */
work_queue(HPWORK,

View File

@ -131,7 +131,7 @@ __BEGIN_DECLS
extern long PX4_TICKS_PER_SEC;
__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 px4_statfs_buf_f_bavail_t unsigned long