 Sketch sketch = {
   0,
   LAUNCHSTATE_DISARMED,
+  LAUNCHSTATE_DISARMED,
   COUNTDOWN_MAX,
   0,
   0,

// | CONSTANTS
// +---------------------------------------------------------------------------+
#define VIN_DROPOUTS_TH 10
#define COUNTDOWN_MAX 10
#define FIRE_FOR_MILLIS 4000UL
#define ARM_COOLING_OFF_PERIOD 1000UL

// +---------------------------------------------------------------------------+
// | DATA TYPES

// +---------------------------------------------------------------------------+
// | FUNCTIONS
// +---------------------------------------------------------------------------+
void check_state(unsigned long now) {
  if (sketch.pending_state == sketch.launch_state) {
    return;
  }

  if (LAUNCHSTATE_ARMED == sketch.pending_state && now - sketch.state_timer < ARM_COOLING_OFF_PERIOD) {
    return;
  }
  sketch.last_tick = now;
  sketch.launch_state = sketch.pending_state;
  sketch.countdown = COUNTDOWN_MAX;
  sketch.state_timer = now;
  update_7segment(now);
}

void change_state(uint8_t pending_state) {
  sketch.pending_state = pending_state;
}

void update_armed_ind(unsigned long now) {
  switch (sketch.launch_state) {
    case LAUNCHSTATE_ARMED:
      digitalWrite(PIN_ARM_IND, LOW);
      break;
    default:
      digitalWrite(PIN_ARM_IND, HIGH);
      break;
  }
}

void update_fire_ind(unsigned long now) {
  switch (sketch.launch_state) {
    case LAUNCHSTATE_COUNTDOWN: {
        // blink
        if (now - sketch.ind_timer > 500) {
          digitalWrite(PIN_FIRE_IND, !digitalRead(PIN_FIRE_IND));
          sketch.ind_timer = now;
        }
      }
      break;
    case LAUNCHSTATE_POST_FIRE: {
        digitalWrite(PIN_FIRE_IND, HIGH);
      }
      break;
    case LAUNCHSTATE_FIRING: {
        if (now - sketch.ind_timer > 25) {
          digitalWrite(PIN_FIRE_IND, !digitalRead(PIN_FIRE_IND));
          sketch.ind_timer = now;
        }
      }
      break;
    default:
