 	// The chip remembers its last ssid and password, so generally just running the server will make it reachable,
 	// even without reconfiguring.
 	server.begin();
+}
+
+bool is_connected() {
+	return WiFi.status() == WL_CONNECTED;
 }
 
 void handle_request() {

		if (command == COMMAND_DEBUG){
			send_data(String("ssid"), ssid);
			send_data(String("password"), password);
			send_data(String("connected"), String(WiFi.status() == WL_CONNECTED));
			send_data(String("led_mode"), String(led_mode));
			send_data(String("baud rate"), String(baud_rate));
			send_data(String("ip"), format_ip(WiFi.localIP()));

	if (led_mode == LED_ACTIVITY) {
		is_on = millis() - last_activity < 500;
	} else if (led_mode == LED_CONNECTION) {
		is_on = is_connected();
	} else if (led_mode == LED_OFF) {
		is_on = false;
	} else if (led_mode == LED_ON) {
