| ... | ... |
@@ -17,11 +17,6 @@ |
| 17 | 17 |
|
| 18 | 18 |
// My Includes |
| 19 | 19 |
#include <dummy.h> |
| 20 |
-#include <ESP8266WiFi.h> |
|
| 21 |
-//#include <ESP8266WebServer.h> |
|
| 22 |
-#include <DHT.h> |
|
| 23 |
-#include <ArduinoOTA.h> |
|
| 24 |
- |
|
| 25 | 20 |
#include "my_constants.h" |
| 26 | 21 |
#include "my_draw.h" |
| 27 | 22 |
#include "my_wifi.h" |
| ... | ... |
@@ -29,7 +24,6 @@ |
| 29 | 24 |
#include "my_ntp.h" |
| 30 | 25 |
#include "my_isr.h" |
| 31 | 26 |
|
| 32 |
- |
|
| 33 | 27 |
#ifdef USE_OTA |
| 34 | 28 |
#include "my_ota.h" |
| 35 | 29 |
#endif //USE_OTA |
| ... | ... |
@@ -40,6 +34,8 @@ |
| 40 | 34 |
|
| 41 | 35 |
#include "my_http.h" |
| 42 | 36 |
|
| 37 |
+ADC_MODE(ADC_VCC); |
|
| 38 |
+ |
|
| 43 | 39 |
|
| 44 | 40 |
void setup() {
|
| 45 | 41 |
Serial.begin(115200); |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
#ifndef _MY_CONSTANTS |
| 2 | 2 |
#define _MY_CONSTANTS |
| 3 | 3 |
|
| 4 |
-#define APPVER "1.0.3" |
|
| 4 |
+#define APPVER "1.0.4" |
|
| 5 | 5 |
#define APPNAME "DHT" |
| 6 | 6 |
const char compile_date[] = APPNAME " v" APPVER " " __DATE__ " " __TIME__; |
| 7 | 7 |
const char compile_time[] = __DATE__ " " __TIME__; |
| ... | ... |
@@ -1,6 +1,8 @@ |
| 1 | 1 |
#ifndef _MY_DHT_H |
| 2 | 2 |
#define _MY_DHT_H |
| 3 | 3 |
|
| 4 |
+#include <DHT.h> |
|
| 5 |
+ |
|
| 4 | 6 |
#ifndef ARDUINO_ESP8266_WEMOS_D1R1 |
| 5 | 7 |
#define DHTPIN 5 // D1 : Digital pin connected to the DHT sensor |
| 6 | 8 |
#else |
| ... | ... |
@@ -52,6 +52,8 @@ void handleS() {
|
| 52 | 52 |
byte mac[6]; |
| 53 | 53 |
char macStr[6]; |
| 54 | 54 |
WiFi.macAddress(mac); |
| 55 |
+ //float vccVolt = ((float)ESP.getVcc())/1024; |
|
| 56 |
+ float vccVolt = (float)ESP.getVcc(); |
|
| 55 | 57 |
sprintf(macStr,"%02x%02x%02x", mac[3], mac[4], mac[5]); |
| 56 | 58 |
String statusMsg = "{";
|
| 57 | 59 |
statusMsg += "\"app_name\": \""+String(APPNAME)+"\","; |
| ... | ... |
@@ -64,6 +66,7 @@ void handleS() {
|
| 64 | 66 |
statusMsg += "\"countMeasures\": "+String(countMeasures)+","; |
| 65 | 67 |
statusMsg += "\"period\": "+String(UPDATE_PERIOD)+","; |
| 66 | 68 |
statusMsg += "\"loop_delay\": "+String(LOOP_DELAY)+","; |
| 69 |
+ statusMsg += "\"vcc\": "+String(vccVolt)+","; |
|
| 67 | 70 |
statusMsg += "\"last_update\": \""+String(acTimeStringTZ)+"\""; |
| 68 | 71 |
statusMsg += "}"; |
| 69 | 72 |
server.send(200, "text/html", String(statusMsg) ); |
| ... | ... |
@@ -1,6 +1,8 @@ |
| 1 | 1 |
#ifndef _MY_OTA_H |
| 2 | 2 |
#define _MY_OTA_H |
| 3 | 3 |
|
| 4 |
+#include <ArduinoOTA.h> |
|
| 5 |
+ |
|
| 4 | 6 |
void ota_set() {
|
| 5 | 7 |
#ifdef USE_OTA |
| 6 | 8 |
//ArduinoOTA.setPort(8266); |
| ... | ... |
@@ -1,6 +1,8 @@ |
| 1 | 1 |
#ifndef _MY_WIFI_H |
| 2 | 2 |
#define _MY_WIFI_H |
| 3 | 3 |
|
| 4 |
+#include <ESP8266WiFi.h> |
|
| 5 |
+ |
|
| 4 | 6 |
//----------------------------------------------------------------------------------- |
| 5 | 7 |
//Wifi Constants |
| 6 | 8 |
//----------------------------------------------------------------------------------- |