 static char msg_buf[MSG_BUF_SIZE];
 static int next_msg_buf_index;
 
-static bool speed_control_enabled;
+enum SpeedControlState
+{
+	SPEED_CONTROL_DISABLED,
+	SPEED_CONTROL_STOPPED,
+	SPEED_CONTROL_STOPPING,
+	SPEED_CONTROL_DRIVING, /* can't think of a better word for going forwards */
+	SPEED_CONTROL_REVERSING
+};
+
+static SpeedControlState speed_control_state = SPEED_CONTROL_DISABLED;
+
 static int target_speed;
 static int target_steer;
 static int current_speed;

	
	unsigned long tick_now = odometer_tick;
	
	last_odometer_tick = tick_now;
	last_odometer_update = now;
}

unsigned long last_odometer_update;
unsigned long last_odometer_tick;

static const int odometer_update_period = 100; // milliseconds

static void
update_throttle(int current_speed, int target_speed)
{
	int throttle = 0; 

	throttle += throttle_offset + 90 +
	throttle_servo.write(throttle);
}

static void
speed_control_update(unsigned long dt, unsigned long ticks)
{
	switch (speed_control_state)
	{
	case SPEED_CONTROL_DISABLED:
		return;

	case SPEED_CONTROL_STOPPED:
		return;

	case SPEED_CONTROL_STOPPING:
		return;

	case SPEED_CONTROL_DRIVING:
		return;

	case SPEED_CONTROL_REVERSING:
		return;
	}
}

static void
odometer_interrupt()
