 			case 1:	self_test();
 					break;
 
-			default:	system_mode	= SPEED_MODE;
+			default:	cycle	= false;
 						break;
 		}
 	}
 }
-
-byte bat_state(byte pin) {	
-	float	vcc			= 0.0,
-			curVoltage	= 0.0;
-
-	for (byte	i	= 0; i < 5; i++) {	// Получение точного значения опорного напряжения
-		// Read 1.1V reference against AVcc
-		// set the reference to Vcc and the measurement to the internal 1.1V reference
-		#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
-			ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
-		#elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
-			ADMUX = _BV(MUX5) | _BV(MUX0);
-		#elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
-			ADMUX = _BV(MUX3) | _BV(MUX2);
-		#else	// works on an Arduino 168 or 328
-			ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
-		#endif
-
-		delay(3); // Wait for Vref to settle
-		ADCSRA |= _BV(ADSC); // Start conversion
-		while (bit_is_set(ADCSRA,ADSC)); // measuring
-
-		uint8_t low  = ADCL; // must read ADCL first - it then locks ADCH
-		uint8_t high = ADCH; // unlocks both
-
-		vcc = vcc + (TYPVBG * 1023.0) / ((high<<8) | low);
-
-		sys_watch();
-		delay(5);
-	}
-
-	vcc	= vcc / 5;
-
-	for (byte	i	= 0; i < 5; i++) {
-		curVoltage = curVoltage + analogRead(pin);
-		sys_watch();
-		delay(10);
-	}
-
-	curVoltage = curVoltage / 5;
-
-	#ifdef DEBUG
-	Serial.print("Current voltage: ");
-	Serial.println(curVoltage);
-	#endif
-
+#endif
+
+byte bat_state(byte pin) {
 	if (pin == 0) {
-		return (byte)(((((curVoltage * vcc) / 1024.0) / (R2_P0 / (R1_P0 + R2_P0))) - 2.4) / 1.8 * 100);
+		if ((((analogRead(0) * VCC) / 1024.0) / (R2_P0 / (R1_P0 + R2_P0))) < 1.0) {
+			return 0;
+		} else {
+			return (byte)(((((analogRead(0) * VCC) / 1024.0) / (R2_P0 / (R1_P0 + R2_P0))) - 2.4) / 1.8 * 100);
+		}
 	} else {
-		return (byte)(((((curVoltage * vcc) / 1024.0) / (R2_P1 / (R1_P1 + R2_P1))) - 2.4) / 1.8 * 100);
+		if ((((analogRead(1) * VCC) / 1024.0) / (R2_P1 / (R1_P1 + R2_P1))) < 1.0) {
+			return 0;
+		} else {
+			return (byte)(((((analogRead(1) * VCC) / 1024.0) / (R2_P1 / (R1_P1 + R2_P1))) - 2.4) / 1.8 * 100);
+		}
 	}
 
 	return 0;

}

void road_mode() {	// Режим спидометра
	float	speed_old = 0.1;

	lcd.clear();
	lcd.print("km/h: ");


	analogReference(DEFAULT);	// DEFAULT INTERNAL использовать Vcc как AREF

	lcd.createChar(BATTERY_ICON, bat_icon);	// Загрузка иконки батареи
	lcd.createChar(SIGNAL_ICON, signal_icon);	// Загрузка иконки батареи

	#ifdef DEBUG
	lcd.clear();
