* Thread handler */
| 413 | * Thread handler |
| 414 | */ |
| 415 | static void *handle_set_position(void *arg) |
| 416 | { |
| 417 | ROT *rot = (ROT *) arg; |
| 418 | struct ars_priv_data *priv = (struct ars_priv_data *)ROTSTATE(rot)->priv; |
| 419 | int retcode; |
| 420 | |
| 421 | while (1) |
| 422 | { |
| 423 | |
| 424 | if (!priv->set_pos_active) |
| 425 | { |
| 426 | /* TODO: replace polling period by cond var */ |
| 427 | hl_usleep(100 * 1000 - 1); |
| 428 | continue; |
| 429 | } |
| 430 | |
| 431 | retcode = ars_set_position_sync(rot, priv->target_az, priv->target_el); |
| 432 | priv->set_pos_active = 0; |
| 433 | |
| 434 | if (retcode != RIG_OK) |
| 435 | { |
| 436 | rig_debug(RIG_DEBUG_WARN, "%s: ars_set_position_sync() failed: %s\n", |
| 437 | __func__, rigerror(retcode)); |
| 438 | hl_usleep(1000 * 1000); |
| 439 | continue; |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | return NULL; |
| 444 | } |
| 445 | |
| 446 | /* |
| 447 | * ars_set_position_sync() is synchronous. |
nothing calls this directly
no test coverage detected