Browse Source

Fix for 03962 board

klaute 1 year ago
parent
commit
5ebbd6377c
3 changed files with 9 additions and 7 deletions
  1. 3
    2
      firmware/config.h
  2. 5
    3
      firmware/firmware.ino
  3. 1
    2
      firmware/sensors.ino

+ 3
- 2
firmware/config.h View File

@@ -1,5 +1,5 @@
1 1
 
2
-//#define DEBUG 1
2
+#define DEBUG 1
3 3
 
4 4
 #define BATTERY_POWERED 1
5 5
 #define POWERSAVING 1
@@ -45,4 +45,5 @@ const char     *INFLUXDB_DB   = "weatherstation";
45 45
 const char     *INFLUXDB_USER = "oko";
46 46
 const char     *INFLUXDB_PASS = "de1873a0d2f8f21f17cf4d8db4f65c59";
47 47
 
48
-String DEVICE_NAME  = "aaron";
48
+String DEVICE_NAME  = "klaute";
49
+

+ 5
- 3
firmware/firmware.ino View File

@@ -62,7 +62,7 @@ void setup() {
62 62
 
63 63
   digitalWrite(STATUS_LED_PIN, LOW);
64 64
 
65
-  lowBatCheck(getBatteryVoltage());
65
+  criticalBatCheck();
66 66
 
67 67
   // Establish WiFi connection
68 68
   String wifiName = "oko-weather-" + String(ESP.getChipId());
@@ -128,8 +128,10 @@ void setup() {
128 128
 //*************************************************************************//
129 129
 
130 130
 void criticalBatCheck() {
131
-  if (currentSensorData[SENSOR_BAT_VOLTAGE] <= BAT_EMERGENCY_DEEPSLEEP_VOLTAGE) {
131
+  float volt = getBatteryVoltage();
132
+  if (volt <= BAT_EMERGENCY_DEEPSLEEP_VOLTAGE) {
132 133
 #ifdef DEBUG
134
+    Serial.println("Bat Voltage: " + String(volt) + " V");
133 135
     Serial.println("Low battery, going into deep sleep.");
134 136
 #endif
135 137
     ESP.deepSleep(EMERGENCY_SLEEP_S * 1000000); // battery low, shutting down
@@ -229,4 +231,4 @@ void _loop() {
229 231
 
230 232
 }
231 233
 
232
-//*************************************************************************//
234
+//*************************************************************************//

+ 1
- 2
firmware/sensors.ino View File

@@ -50,7 +50,6 @@ float fetchWindspeed() {
50 50
 float getBatteryVoltage() {
51 51
   uint16_t raw = analogRead(A0);
52 52
   float volt = raw / 1023.0;
53
-  volt = volt * 4.2;
54
-  return volt;
53
+  return volt * 6.79;
55 54
 }
56 55
 

Loading…
Cancel
Save