Browse Source

Charge / charging test modified.

klaute 11 months ago
parent
commit
c2f1571305
4 changed files with 11 additions and 11 deletions
  1. BIN
      doc/NODEMCU_DEVKIT_V1.0.PDF
  2. 1
    1
      firmware/config.h
  3. 5
    5
      firmware/firmware.ino
  4. 5
    5
      firmware/sensors.ino

BIN
doc/NODEMCU_DEVKIT_V1.0.PDF View File


+ 1
- 1
firmware/config.h View File

@@ -43,4 +43,4 @@
43 43
 
44 44
 #define INITIAL_WEBSERVER_TIME 20
45 45
 
46
-#endif
46
+#endif

+ 5
- 5
firmware/firmware.ino View File

@@ -1,3 +1,5 @@
1
+
2
+
1 3
 // Standard ESP8266 libs
2 4
 #include <ESP8266mDNS.h>
3 5
 #include <ESP8266HTTPUpdateServer.h>
@@ -68,11 +70,6 @@ String localIP = "127.0.0.1";
68 70
 
69 71
 void setup() {
70 72
 
71
-#ifdef BOARD_NODEMCU
72
-  // on nodemcu v0.1 (aliexpress) the delay is required to prevent a endless reboot bug
73
-  delay(100);
74
-#endif
75
-
76 73
   // Erase WiFi Credentials (maybe this will work ...)
77 74
   //WiFi.disconnect(true);
78 75
   //delay(2000);
@@ -151,6 +148,9 @@ void setup() {
151 148
   WiFi.mode(WIFI_OFF);
152 149
   WiFi.forceSleepBegin();
153 150
 
151
+#ifdef DEBUG
152
+  Serial.println("deep sleep");
153
+#endif
154 154
   // the ESP.deepSleep requires microseconds as input, after the sleep the system will run into the setup routine
155 155
   ESP.deepSleep(POWERSAVING_SLEEP_S * 1000000, WAKE_RF_DEFAULT);
156 156
   delay(100);

+ 5
- 5
firmware/sensors.ino View File

@@ -63,16 +63,16 @@ float getBatteryVoltage() {
63 63
 }
64 64
 
65 65
 float isBatCharging() {
66
-  if (LOW == digitalRead(BAT_CHARGED_PIN))
67
-  {
68
-    return BAT_CHARGE_STATE_CHARGED;
69
-  } else if (LOW == digitalRead(BAT_CHARGING_PIN))
66
+  if (LOW == digitalRead(BAT_CHARGING_PIN))
70 67
   {
71 68
     return BAT_CHARGE_STATE_CHARGING;
69
+  } else if (LOW == digitalRead(BAT_CHARGED_PIN))
70
+  {
71
+    return BAT_CHARGE_STATE_CHARGED;
72 72
   }
73 73
 
74 74
   return BAT_CHARGE_STATE_NOTCHARGING;
75 75
 }
76 76
 
77 77
 #endif
78
-
78
+

Loading…
Cancel
Save