Replacing usleep with px4_usleep

This is a step towards isolating time from the system.
This commit is contained in:
Julian Oes
2018-12-22 10:32:18 +01:00
parent e485885344
commit 5b9dea5604
112 changed files with 339 additions and 305 deletions
+4 -4
View File
@@ -313,7 +313,7 @@ MS5611::init()
break;
}
usleep(MS5611_CONVERSION_INTERVAL);
px4_usleep(MS5611_CONVERSION_INTERVAL);
if (OK != collect()) {
ret = -EIO;
@@ -326,7 +326,7 @@ MS5611::init()
break;
}
usleep(MS5611_CONVERSION_INTERVAL);
px4_usleep(MS5611_CONVERSION_INTERVAL);
if (OK != collect()) {
ret = -EIO;
@@ -429,7 +429,7 @@ MS5611::read(struct file *filp, char *buffer, size_t buflen)
break;
}
usleep(MS5611_CONVERSION_INTERVAL);
px4_usleep(MS5611_CONVERSION_INTERVAL);
if (OK != collect()) {
ret = -EIO;
@@ -442,7 +442,7 @@ MS5611::read(struct file *filp, char *buffer, size_t buflen)
break;
}
usleep(MS5611_CONVERSION_INTERVAL);
px4_usleep(MS5611_CONVERSION_INTERVAL);
if (OK != collect()) {
ret = -EIO;
+2 -1
View File
@@ -40,6 +40,7 @@
/* XXX trim includes */
#include <px4_config.h>
#include <px4_defines.h>
#include <px4_time.h>
#include <sys/types.h>
#include <stdint.h>
@@ -238,7 +239,7 @@ MS5611_I2C::_read_prom()
* Wait for PROM contents to be in the device (2.8 ms) in the case we are
* called immediately after reset.
*/
usleep(3000);
px4_usleep(3000);
uint8_t last_val = 0;
bool bits_stuck = true;
+2 -1
View File
@@ -38,6 +38,7 @@
*/
/* XXX trim includes */
#include <px4_time.h>
#include <px4_config.h>
#include <sys/types.h>
@@ -248,7 +249,7 @@ MS5611_SPI::_read_prom()
* Wait for PROM contents to be in the device (2.8 ms) in the case we are
* called immediately after reset.
*/
usleep(3000);
px4_usleep(3000);
/* read and convert PROM words */
bool all_zero = true;
+4 -4
View File
@@ -269,7 +269,7 @@ void BATT_SMBUS::cycle()
} else {
while (_should_suspend) {
usleep(200000);
px4_usleep(200000);
}
// Schedule a fresh cycle call when the measurement is done.
@@ -444,7 +444,7 @@ int BATT_SMBUS::get_startup_info()
if (lifetime_data_flush() == PX4_OK) {
// Flush needs time to complete, otherwise device is busy. 100ms not enough, 200ms works.
usleep(200000);
px4_usleep(200000);
if (lifetime_read_block_one() == PX4_OK) {
if (_lifetime_max_delta_cell_voltage > BATT_CELL_VOLTAGE_THRESHOLD_FAILED) {
@@ -668,11 +668,11 @@ int BATT_SMBUS::custom_command(int argc, char *argv[])
if (PX4_OK != obj->dataflash_write(address, tx_buf, length)) {
PX4_INFO("Dataflash write failed: %d", address);
usleep(100000);
px4_usleep(100000);
return 1;
} else {
usleep(100000);
px4_usleep(100000);
return 0;
}
}
@@ -70,7 +70,7 @@ MS5525::init_ms5525()
return false;
}
usleep(3000);
px4_usleep(3000);
// Step 2 - read calibration coefficients from prom
@@ -70,7 +70,7 @@ SDP3X::init_sdp3x()
}
// wait until sensor is ready
usleep(20000);
px4_usleep(20000);
// step 2 - configure
ret = write_command(SDP3X_CONT_MEAS_AVG_MODE);
@@ -81,7 +81,7 @@ SDP3X::init_sdp3x()
return false;
}
usleep(10000);
px4_usleep(10000);
// step 3 - get scale
uint8_t val[9];
@@ -357,7 +357,7 @@ int leddar_one::init()
return PX4_OK;
}
usleep(1000);
px4_usleep(1000);
}
PX4_ERR("No readings from " NAME);
@@ -283,7 +283,7 @@ ssize_t LidarLiteI2C::read(device::file_t *filp, char *buffer, size_t buflen)
}
/* wait for it to complete */
usleep(LL40LS_CONVERSION_INTERVAL);
px4_usleep(LL40LS_CONVERSION_INTERVAL);
/* run the collection phase */
if (OK != collect()) {
@@ -353,7 +353,7 @@ int LidarLiteI2C::reset_sensor()
}
// wait for sensor reset to complete
usleep(50000);
px4_usleep(50000);
ret = write_reg(LL40LS_SIG_COUNT_VAL_REG, LL40LS_SIG_COUNT_VAL_MAX);
if (ret != OK) {
@@ -361,7 +361,7 @@ int LidarLiteI2C::reset_sensor()
}
// wait for register write to complete
usleep(1000);
px4_usleep(1000);
return OK;
}
@@ -374,7 +374,7 @@ void LidarLiteI2C::print_registers()
_pause_measurements = true;
printf("ll40ls registers\n");
// wait for a while to ensure the lidar is in a ready state
usleep(50000);
px4_usleep(50000);
for (uint8_t reg = 0; reg <= 0x67; reg++) {
uint8_t val = 0;
@@ -264,7 +264,7 @@ MB12XX::init()
}
// XXX we should find out why we need to wait 200 ms here
usleep(200000);
px4_usleep(200000);
/* check for connected rangefinders on each i2c port:
We start from i2c base address (0x70 = 112) and count downwards
@@ -440,7 +440,7 @@ MB12XX::read(device::file_t *filp, char *buffer, size_t buflen)
}
/* wait for it to complete */
usleep(_cycling_rate * 2);
px4_usleep(_cycling_rate * 2);
/* run the collection phase */
if (OK != collect()) {
+18 -18
View File
@@ -113,13 +113,13 @@ int PGA460::initialize_device_settings()
return PX4_ERROR;
}
usleep(10000);
px4_usleep(10000);
// Read to see if eeprom saved data matches desired data, otherwise overwrite eeprom.
if (read_eeprom() != PX4_OK) {
write_eeprom();
// Allow sufficient time for the device to complete writing to registers.
usleep(10000);
px4_usleep(10000);
}
// Verify the device is alive.
@@ -152,7 +152,7 @@ int PGA460::initialize_thresholds()
}
// Must wait >50us per datasheet.
usleep(100);
px4_usleep(100);
if (read_threshold_registers() == PX4_OK) {
return PX4_OK;
@@ -183,7 +183,7 @@ uint32_t PGA460::collect_results()
bytes_available -= ret;
usleep(1000);
px4_usleep(1000);
} while (bytes_available > 0);
@@ -250,7 +250,7 @@ float PGA460::get_temperature()
}
// The pga460 requires a 2ms delay per the datasheet.
usleep(5000);
px4_usleep(5000);
buf_tx[1] = TNLR;
ret = ::write(_fd, &buf_tx[0], sizeof(buf_tx) - 2);
@@ -259,7 +259,7 @@ float PGA460::get_temperature()
return PX4_ERROR;
}
usleep(10000);
px4_usleep(10000);
uint8_t buf_rx[4] = {};
int bytes_available = sizeof(buf_rx);
@@ -278,7 +278,7 @@ float PGA460::get_temperature()
bytes_available -= ret;
usleep(1000);
px4_usleep(1000);
} while (bytes_available > 0);
@@ -528,7 +528,7 @@ int PGA460::read_eeprom()
return PX4_ERROR;
}
usleep(10000);
px4_usleep(10000);
int bytes_available = sizeof(buf_rx);
int total_bytes = 0;
@@ -546,7 +546,7 @@ int PGA460::read_eeprom()
bytes_available -= ret;
usleep(1000);
px4_usleep(1000);
} while (bytes_available > 0);
@@ -580,7 +580,7 @@ uint8_t PGA460::read_register(const uint8_t reg)
return PX4_ERROR;
}
usleep(10000);
px4_usleep(10000);
uint8_t buf_rx[3] = {};
int bytes_available = sizeof(buf_rx);
@@ -599,7 +599,7 @@ uint8_t PGA460::read_register(const uint8_t reg)
bytes_available -= ret;
usleep(1000);
px4_usleep(1000);
} while (bytes_available > 0);
@@ -628,7 +628,7 @@ int PGA460::read_threshold_registers()
return PX4_ERROR;
}
usleep(10000);
px4_usleep(10000);
uint8_t buf_rx[array_size + 2] = {};
int bytes_available = sizeof(buf_rx);
@@ -647,7 +647,7 @@ int PGA460::read_threshold_registers()
bytes_available -= ret;
usleep(1000);
px4_usleep(1000);
} while (bytes_available > 0);
@@ -669,7 +669,7 @@ int PGA460::request_results()
{
uint8_t buf_tx[2] = {SYNCBYTE, UMR};
int ret = ::write(_fd, &buf_tx[0], sizeof(buf_tx));
usleep(10000);
px4_usleep(10000);
if(!ret) {
return PX4_ERROR;
@@ -707,7 +707,7 @@ void PGA460::run()
// Control rate.
uint64_t loop_time = hrt_absolute_time() - _start_loop;
uint32_t sleep_time = (loop_time > POLL_RATE_US) ? 0 : POLL_RATE_US - loop_time;
usleep(sleep_time);
px4_usleep(sleep_time);
_start_loop = hrt_absolute_time();
request_results();
@@ -856,17 +856,17 @@ int PGA460::write_eeprom()
}
// Needs time, see datasheet timing requirements.
usleep(5000);
px4_usleep(5000);
unlock_eeprom();
flash_eeprom();
usleep(5000);
px4_usleep(5000);
uint8_t result = 0;
// Give up to 100ms for ee_cntrl register to reflect a successful eeprom write.
for (int i = 0; i < 100; i++) {
result = read_register(EE_CNTRL_ADDR);
usleep(5000);
px4_usleep(5000);
if (result & 1 << 2) {
PX4_INFO("EEPROM write successful");
+1 -1
View File
@@ -420,7 +420,7 @@ SF0X::read(device::file_t *filp, char *buffer, size_t buflen)
}
/* wait for it to complete */
usleep(_conversion_interval);
px4_usleep(_conversion_interval);
/* run the collection phase */
if (OK != collect()) {
+1 -1
View File
@@ -439,7 +439,7 @@ SF1XX::read(device::file_t *filp, char *buffer, size_t buflen)
}
/* wait for it to complete */
usleep(_conversion_interval);
px4_usleep(_conversion_interval);
/* run the collection phase */
if (OK != collect()) {
+2 -2
View File
@@ -264,7 +264,7 @@ SRF02::init()
}
// XXX we should find out why we need to wait 200 ms here
usleep(200000);
px4_usleep(200000);
/* check for connected rangefinders on each i2c port:
We start from i2c base address (0x70 = 112) and count downwards
@@ -440,7 +440,7 @@ SRF02::read(device::file_t *filp, char *buffer, size_t buflen)
}
/* wait for it to complete */
usleep(_cycling_rate * 2);
px4_usleep(_cycling_rate * 2);
/* run the collection phase */
if (OK != collect()) {
@@ -517,7 +517,7 @@ TERARANGER::read(device::file_t *filp, char *buffer, size_t buflen)
}
/* wait for it to complete */
usleep(TERARANGER_CONVERSION_INTERVAL);
px4_usleep(TERARANGER_CONVERSION_INTERVAL);
/* run the collection phase */
if (OK != collect()) {
@@ -451,7 +451,7 @@ TFMINI::read(device::file_t *filp, char *buffer, size_t buflen)
_reports->flush();
/* wait for it to complete */
usleep(_conversion_interval);
px4_usleep(_conversion_interval);
/* run the collection phase */
if (OK != collect()) {
@@ -169,7 +169,7 @@ Radar::~Radar()
do {
/* wait 20ms */
usleep(20000);
px4_usleep(20000);
/* if we have given up, kill it */
if (++i > 50) {
@@ -436,7 +436,7 @@ Radar::task_main()
if (pret < 0) {
PX4_DEBUG("radar serial port poll error");
// sleep a bit before next try
usleep(100000);
px4_usleep(100000);
continue;
}
+8 -8
View File
@@ -300,7 +300,7 @@ GPS::~GPS()
unsigned int i = 0;
do {
usleep(20000); // 20 ms
px4_usleep(20000); // 20 ms
++i;
} while (_secondary_instance && i < 100);
}
@@ -400,11 +400,11 @@ int GPS::pollOrRead(uint8_t *buf, size_t buf_length, int timeout)
err = ioctl(_serial_fd, FIONREAD, (unsigned long)&bytes_available);
if (err != 0 || bytes_available < (int)character_count) {
usleep(sleeptime);
px4_usleep(sleeptime);
}
#else
usleep(sleeptime);
px4_usleep(sleeptime);
#endif
ret = ::read(_serial_fd, buf, buf_length);
@@ -419,7 +419,7 @@ int GPS::pollOrRead(uint8_t *buf, size_t buf_length, int timeout)
#else
/* For QURT, just use read for now, since this doesn't block, we need to slow it down
* just a bit. */
usleep(10000);
px4_usleep(10000);
return ::read(_serial_fd, buf, buf_length);
#endif
}
@@ -693,7 +693,7 @@ GPS::run()
publish();
usleep(200000);
px4_usleep(200000);
} else {
@@ -810,7 +810,7 @@ GPS::run()
case GPS_DRIVER_MODE_ASHTECH:
_mode = GPS_DRIVER_MODE_UBX;
usleep(500000); // tried all possible drivers. Wait a bit before next round
px4_usleep(500000); // tried all possible drivers. Wait a bit before next round
break;
default:
@@ -818,7 +818,7 @@ GPS::run()
}
} else {
usleep(500000);
px4_usleep(500000);
}
}
@@ -1139,7 +1139,7 @@ GPS *GPS::instantiate(int argc, char *argv[], Instance instance)
do {
/* wait up to 1s */
usleep(2500);
px4_usleep(2500);
} while (!_secondary_instance && ++i < 400);
+10 -9
View File
@@ -56,6 +56,7 @@
*/
#include <px4_config.h>
#include <px4_time.h>
#include <ecl/geo/geo.h>
#include <sys/types.h>
@@ -762,7 +763,7 @@ int MPU6000::reset()
}
perf_count(_reset_retries);
usleep(2000);
px4_usleep(2000);
}
// Hold off sampling for 30 ms
@@ -775,11 +776,11 @@ int MPU6000::reset()
return -EIO;
}
usleep(1000);
px4_usleep(1000);
// SAMPLE RATE
_set_sample_rate(_sample_rate);
usleep(1000);
px4_usleep(1000);
_set_dlpf_filter(MPU6000_DEFAULT_ONCHIP_FILTER_FREQ);
@@ -787,10 +788,10 @@ int MPU6000::reset()
_set_icm_acc_dlpf_filter(MPU6000_DEFAULT_ONCHIP_FILTER_FREQ);
}
usleep(1000);
px4_usleep(1000);
// Gyro scale 2000 deg/s ()
write_checked_reg(MPUREG_GYRO_CONFIG, BITS_FS_2000DPS);
usleep(1000);
px4_usleep(1000);
// correct gyro scale factors
// scale to rad/s in SI units
@@ -802,13 +803,13 @@ int MPU6000::reset()
set_accel_range(MPU6000_ACCEL_DEFAULT_RANGE_G);
usleep(1000);
px4_usleep(1000);
// INT CFG => Interrupt on Data Ready
write_checked_reg(MPUREG_INT_ENABLE, BIT_RAW_RDY_EN); // INT: Raw data ready
usleep(1000);
px4_usleep(1000);
write_checked_reg(MPUREG_INT_PIN_CFG, BIT_INT_ANYRD_2CLEAR); // INT: Clear on any read
usleep(1000);
px4_usleep(1000);
if (is_icm_device()) {
write_checked_reg(MPUREG_ICM_UNDOC1, MPUREG_ICM_UNDOC1_VALUE);
@@ -816,7 +817,7 @@ int MPU6000::reset()
// Oscillator set
// write_reg(MPUREG_PWR_MGMT_1,MPU_CLK_SEL_PLLGYROZ);
usleep(1000);
px4_usleep(1000);
return OK;
}
+4 -3
View File
@@ -42,6 +42,7 @@
#include <px4_config.h>
#include <px4_log.h>
#include <px4_time.h>
#include <lib/perf/perf_counter.h>
#include <drivers/drv_hrt.h>
#include <drivers/device/spi.h>
@@ -353,7 +354,7 @@ void
MPU9250_mag::passthrough_read(uint8_t reg, uint8_t *buf, uint8_t size)
{
set_passthrough(reg, size);
usleep(25 + 25 * size); // wait for the value to be read from slave
px4_usleep(25 + 25 * size); // wait for the value to be read from slave
read_block(AK_MPU_OR_ICM(MPUREG_EXT_SENS_DATA_00, ICMREG_20948_EXT_SLV_SENS_DATA_00), buf, size);
_parent->write_reg(AK_MPU_OR_ICM(MPUREG_I2C_SLV0_CTRL, ICMREG_20948_I2C_SLV0_CTRL), 0); // disable new reads
}
@@ -388,7 +389,7 @@ void
MPU9250_mag::passthrough_write(uint8_t reg, uint8_t val)
{
set_passthrough(reg, 1, &val);
usleep(50); // wait for the value to be written to slave
px4_usleep(50); // wait for the value to be written to slave
_parent->write_reg(AK_MPU_OR_ICM(MPUREG_I2C_SLV0_CTRL, ICMREG_20948_I2C_SLV0_CTRL), 0); // disable new writes
}
@@ -428,7 +429,7 @@ MPU9250_mag::ak8963_read_adjustments(void)
float ak8963_ASA[3];
write_reg(AK8963REG_CNTL1, AK8963_FUZE_MODE | AK8963_16BIT_ADC);
usleep(50);
px4_usleep(50);
if (_interface != nullptr) {
_interface->read(AK8963REG_ASAX, response, 3);
+2 -1
View File
@@ -42,6 +42,7 @@
*/
#include <px4_config.h>
#include <px4_time.h>
#include <lib/ecl/geo/geo.h>
#include <lib/perf/perf_counter.h>
#include <systemlib/conversions.h>
@@ -436,7 +437,7 @@ int MPU9250::reset()
*
*/
usleep(110000);
px4_usleep(110000);
// Hold off sampling until done (100 MS will be shortened)
state = px4_enter_critical_section();
+1 -1
View File
@@ -152,7 +152,7 @@ RGBLED::~RGBLED()
int counter = 0;
while (_running && ++counter < 10) {
usleep(100000);
px4_usleep(100000);
}
}
+2 -1
View File
@@ -39,6 +39,7 @@
#include <px4_config.h>
#include <px4_defines.h>
#include <px4_time.h>
#include <drivers/device/i2c.h>
@@ -591,7 +592,7 @@ HMC5883::read(struct file *filp, char *buffer, size_t buflen)
}
/* wait for it to complete */
usleep(HMC5883_CONVERSION_INTERVAL);
px4_usleep(HMC5883_CONVERSION_INTERVAL);
/* run the collection phase */
if (OK != collect()) {
+5 -4
View File
@@ -39,6 +39,7 @@
* Based on the hmc5883 driver.
*/
#include <px4_time.h>
#include "lis3mdl.h"
LIS3MDL::LIS3MDL(device::Device *interface, const char *path, enum Rotation rotation) :
@@ -146,7 +147,7 @@ LIS3MDL::calibrate(struct file *file_pointer, unsigned enable)
goto out;
}
usleep(20000);
px4_usleep(20000);
/* discard 10 samples to let the sensor settle */
for (uint8_t i = 0; i < num_samples; i++) {
@@ -211,7 +212,7 @@ LIS3MDL::calibrate(struct file *file_pointer, unsigned enable)
goto out;
}
usleep(60000);
px4_usleep(60000);
/* discard 10 samples to let the sensor settle */
for (uint8_t i = 0; i < num_samples; i++) {
@@ -285,7 +286,7 @@ out:
set_range(4);
set_default_register_values();
usleep(20000);
px4_usleep(20000);
return ret;
}
@@ -687,7 +688,7 @@ LIS3MDL::read(struct file *file_pointer, char *buffer, size_t buffer_len)
}
/* wait for it to complete */
usleep(LIS3MDL_CONVERSION_INTERVAL);
px4_usleep(LIS3MDL_CONVERSION_INTERVAL);
/* run the collection phase */
if (collect() != OK) {
+2 -1
View File
@@ -42,6 +42,7 @@
*/
#include <px4_config.h>
#include <px4_time.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>
@@ -587,7 +588,7 @@ static void pwmin_test(void)
} else {
/* no data, retry in 2 ms */
::usleep(2000);
px4_usleep(2000);
}
}
+1 -1
View File
@@ -800,7 +800,7 @@ start(int argc, char *argv[])
if (retry_nr < START_RETRY_COUNT) {
/* lets not be too verbose */
// PX4_WARN("PX4FLOW not found on I2C busses. Retrying in %d ms. Giving up in %d retries.", START_RETRY_TIMEOUT, START_RETRY_COUNT - retry_nr);
usleep(START_RETRY_TIMEOUT * 1000);
px4_usleep(START_RETRY_TIMEOUT * 1000);
retry_nr++;
} else {
+12 -12
View File
@@ -513,7 +513,7 @@ PX4IO::~PX4IO()
/* spin waiting for the task to stop */
for (unsigned i = 0; (i < 10) && (_task != -1); i++) {
/* give it another 100ms */
usleep(100000);
px4_usleep(100000);
}
/* well, kill it anyway, though this will probably crash */
@@ -606,7 +606,7 @@ PX4IO::init()
hrt_abstime start_try_time = hrt_absolute_time();
do {
usleep(2000);
px4_usleep(2000);
protocol = io_reg_get(PX4IO_PAGE_CONFIG, PX4IO_P_CONFIG_PROTOCOL_VERSION);
} while (protocol == _io_reg_get_error && (hrt_elapsed_time(&start_try_time) < 700U * 1000U));
@@ -709,7 +709,7 @@ PX4IO::init()
}
/* wait 10 ms */
usleep(10000);
px4_usleep(10000);
/* abort after 5s */
if ((hrt_absolute_time() - try_start_time) / 1000 > 3000) {
@@ -757,7 +757,7 @@ PX4IO::init()
}
/* wait 50 ms */
usleep(50000);
px4_usleep(50000);
/* abort after 5s */
if ((hrt_absolute_time() - try_start_time) / 1000 > 2000) {
@@ -2022,7 +2022,7 @@ PX4IO::print_debug()
fds[0].fd = io_fd;
fds[0].events = POLLIN;
usleep(500);
px4_usleep(500);
int pret = ::poll(fds, sizeof(fds) / sizeof(fds[0]), 0);
if (pret > 0) {
@@ -2103,7 +2103,7 @@ PX4IO::mixer_send(const char *buf, unsigned buflen, unsigned retries)
ret = io_reg_set(PX4IO_PAGE_MIXERLOAD, 0, (uint16_t *)frame, total_len / 2);
if (ret) {
usleep(333);
px4_usleep(333);
} else {
break;
@@ -2139,7 +2139,7 @@ PX4IO::mixer_send(const char *buf, unsigned buflen, unsigned retries)
ret = io_reg_set(PX4IO_PAGE_MIXERLOAD, 0, (uint16_t *)frame, (sizeof(px4io_mixdata) + 2) / 2);
if (ret) {
usleep(333);
px4_usleep(333);
} else {
break;
@@ -2665,12 +2665,12 @@ PX4IO::ioctl(file *filep, int cmd, unsigned long arg)
arg == DSMX_BIND_PULSES ||
arg == DSMX8_BIND_PULSES) {
io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_DSM, dsm_bind_power_down);
usleep(500000);
px4_usleep(500000);
io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_DSM, dsm_bind_set_rx_out);
io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_DSM, dsm_bind_power_up);
usleep(72000);
px4_usleep(72000);
io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_DSM, dsm_bind_send_pulses | (arg << 4));
usleep(50000);
px4_usleep(50000);
io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_DSM, dsm_bind_reinit_uart);
ret = OK;
@@ -3190,7 +3190,7 @@ test(void)
}
}
usleep(250);
px4_usleep(250);
/* readback servo values */
for (unsigned i = 0; i < servo_count; i++) {
@@ -3316,7 +3316,7 @@ lockdown(int argc, char *argv[])
}
}
usleep(10000);
px4_usleep(10000);
}
if (hrt_elapsed_time(&start) > timeout) {
+2 -1
View File
@@ -37,6 +37,7 @@
*/
#include <px4_config.h>
#include <px4_time.h>
#include <sys/types.h>
#include <stdlib.h>
@@ -127,7 +128,7 @@ PX4IO_Uploader::upload(const char *filenames[])
break;
} else {
usleep(10000);
px4_usleep(10000);
}
}
+5 -5
View File
@@ -220,7 +220,7 @@ int board_adc_init()
/* do calibration if supported */
#ifdef ADC_CR2_CAL
rCR2 |= ADC_CR2_CAL;
usleep(100);
px4_usleep(100);
if (rCR2 & ADC_CR2_CAL) {
return -1;
@@ -260,11 +260,11 @@ int board_adc_init()
/* power-cycle the ADC and turn it on */
rCR2 &= ~ADC_CR2_ADON;
usleep(10);
px4_usleep(10);
rCR2 |= ADC_CR2_ADON;
usleep(10);
px4_usleep(10);
rCR2 |= ADC_CR2_ADON;
usleep(10);
px4_usleep(10);
/* kick off a sample and wait for it to complete */
hrt_abstime now = hrt_absolute_time();
@@ -541,7 +541,7 @@ test(void)
}
printf("\n");
usleep(500000);
px4_usleep(500000);
}
exit(0);
+1 -1
View File
@@ -331,7 +331,7 @@ ToneAlarm::~ToneAlarm()
int counter = 0;
while (_running && ++counter < 10) {
usleep(100000);
px4_usleep(100000);
}
}
+1 -1
View File
@@ -135,7 +135,7 @@ ToneAlarm::~ToneAlarm()
int counter = 0;
while (_running && ++counter < 10) {
usleep(100000);
px4_usleep(100000);
}
}