diff --git a/firmware/config.h b/firmware/config.h index beacde4..735d847 100644 --- a/firmware/config.h +++ b/firmware/config.h @@ -1,5 +1,5 @@ -//#define DEBUG 1 +#define DEBUG 1 #define BATTERY_POWERED 1 #define POWERSAVING 1 @@ -45,4 +45,5 @@ const char *INFLUXDB_DB = "weatherstation"; const char *INFLUXDB_USER = "oko"; const char *INFLUXDB_PASS = "de1873a0d2f8f21f17cf4d8db4f65c59"; -String DEVICE_NAME = "aaron"; +String DEVICE_NAME = "klaute"; + diff --git a/firmware/firmware.ino b/firmware/firmware.ino index 1a9421f..f7428a5 100644 --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -62,7 +62,7 @@ void setup() { digitalWrite(STATUS_LED_PIN, LOW); - lowBatCheck(getBatteryVoltage()); + criticalBatCheck(); // Establish WiFi connection String wifiName = "oko-weather-" + String(ESP.getChipId()); @@ -128,8 +128,10 @@ void setup() { //*************************************************************************// void criticalBatCheck() { - if (currentSensorData[SENSOR_BAT_VOLTAGE] <= BAT_EMERGENCY_DEEPSLEEP_VOLTAGE) { + float volt = getBatteryVoltage(); + if (volt <= BAT_EMERGENCY_DEEPSLEEP_VOLTAGE) { #ifdef DEBUG + Serial.println("Bat Voltage: " + String(volt) + " V"); Serial.println("Low battery, going into deep sleep."); #endif ESP.deepSleep(EMERGENCY_SLEEP_S * 1000000); // battery low, shutting down @@ -229,4 +231,4 @@ void _loop() { } -//*************************************************************************// +//*************************************************************************// diff --git a/firmware/sensors.ino b/firmware/sensors.ino index e594e04..b6885f0 100755 --- a/firmware/sensors.ino +++ b/firmware/sensors.ino @@ -50,7 +50,6 @@ float fetchWindspeed() { float getBatteryVoltage() { uint16_t raw = analogRead(A0); float volt = raw / 1023.0; - volt = volt * 4.2; - return volt; + return volt * 6.79; }