static msg_t track_status_thread(void *arg)
{
  (void)arg;
  chRegSetThreadName("track status");
  while (TRUE) {
    if (simulation_enabled()) {
      led_on(LED_GREEN);
      chThdSleepMilliseconds(500);
    } else {
      chThdSleepMilliseconds(1000);
      u8 n_ready = tracking_channels_ready();
      if (n_ready == 0) {
        led_on(LED_GREEN);
        chThdSleepMilliseconds(1000);
        led_off(LED_GREEN);
      } else {
        for (u8 i=0; i<n_ready; i++) {
          led_on(LED_GREEN);
          chThdSleepMilliseconds(250);
          led_off(LED_GREEN);
          chThdSleepMilliseconds(250);
        }
        chThdSleepMilliseconds(1000);
      }
    }
  }
  return 0;
}
예제 #2
0
/** Enables or disables the simulator when an SBP callback triggers this function
*
*/
void set_simulation_enabled_callback(u16 sender_id, u8 len, u8 msg[], void* context)
{
    (void)sender_id;
    (void)len;
    (void) context;
    if (len == 1) {
        if (sim_state.last_update_ticks == 0) {
            sim_state.last_update_ticks = chTimeNow();
        }
        sim_enabled = msg[0];
    }

    if (simulation_enabled()) {
        printf("Enabled Simulation\n");
    } else {
        printf("Disabled Simulation\n");
    }

}