 }
 
 void loop() {
+	if (m_button_press) {
+		m_button_press = false;
+		m_automatic = true;
+	}
+
+	// handle debounce
+	if (!m_button_active && ((millis() - m_last_button_time) > START_BUTTON_DEBOUNCE_TIME_MS)) {
+		m_button_active = true;
+	}
+
 	while (SERIALDEV.available() > 0) {
 		m_rx_len = hdlc.decode(SERIALDEV.read());
 

Servo drivingservo;

bool m_automatic = false;

uint32_t last_time = 0;

MCDriver driver;


	analogReadResolution(10);
	pinMode(TEENSY_LED, OUTPUT);

	pinMode(START_BUTTON, INPUT_PULLUP);
	attachInterrupt(START_BUTTON, button_service, FALLING);

	telemetry.header = BC_TELEMETRY;
}

void button_service() {
	if (m_button_active) {
		m_button_press = true;
		m_button_active = false;
		m_last_button_time = millis();
	}
}

void toggle_led() {
