Fix for 03962 board

This commit is contained in:
klaute 2019-01-06 15:21:03 +01:00
parent 845e637c59
commit 5ebbd6377c
3 changed files with 9 additions and 7 deletions

View file

@ -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";

View file

@ -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

View file

@ -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;
}