diff --git a/3rdparty/indi-gphoto/gphoto_driver.cpp b/3rdparty/indi-gphoto/gphoto_driver.cpp index a52c8418f7..e9503fdc9d 100644 --- a/3rdparty/indi-gphoto/gphoto_driver.cpp +++ b/3rdparty/indi-gphoto/gphoto_driver.cpp @@ -456,7 +456,7 @@ static void *stop_bulb(void *arg) if (gphoto->command & DSLR_CMD_BULB_CAPTURE) { gettimeofday(&curtime, nullptr); - timersub(&curtime, &gphoto->bulb_end, &diff); + timersub(&gphoto->bulb_end, &curtime, &diff); timeleft = diff.tv_sec * 1000 + diff.tv_usec / 1000; DEBUGFDEVICE(device, INDI::Logger::DBG_DEBUG, "Time left: %ld ms", timeleft); } diff --git a/libindi/drivers/telescope/lx200_OnStep.cpp b/libindi/drivers/telescope/lx200_OnStep.cpp index eddf4a2a36..1fcc74364c 100644 --- a/libindi/drivers/telescope/lx200_OnStep.cpp +++ b/libindi/drivers/telescope/lx200_OnStep.cpp @@ -426,7 +426,8 @@ bool LX200_OnStep::ISNewNumber(const char *dev, const char *name, double values[ BacklashNP.s = IPS_ALERT; IDSetNumber(&BacklashNP, "Error Backlash DEC limit."); } - usleep(100000); // time for OnStep to respond to previous cmd + const struct timespec timeout = {0, 100000000L}; + nanosleep(&timeout, NULL); // time for OnStep to respond to previous cmd snprintf(cmd, 9, ":$BR%d#", (int)bklshra); if (sendOnStepCommand(cmd)) { @@ -709,7 +710,8 @@ bool LX200_OnStep::ISNewSwitch(const char *dev, const char *name, ISState *state strcpy(cmd, ":FQ#"); } sendOnStepCommandBlind(cmd); - usleep(100000); // Pulse 0,1 s + const struct timespec timeout = {0, 100000000L}; + nanosleep(&timeout, NULL); // Pulse 0,1 s if(index != 2) { sendOnStepCommandBlind(":FQ#"); @@ -756,7 +758,8 @@ bool LX200_OnStep::ISNewSwitch(const char *dev, const char *name, ISState *state strcpy(cmd, ":fQ#"); } sendOnStepCommandBlind(cmd); - usleep(100000); // Pulse 0,1 s + const struct timespec timeout = {0, 100000000L}; + nanosleep(&timeout, NULL); // Pulse 0,1 s if(index != 2) { sendOnStepCommandBlind(":fQ#");