Commit bed717b0 authored by Tobias Reichert's avatar Tobias Reichert
Browse files

the end

parent 0769ad99
......@@ -9,11 +9,10 @@
#include "weather.h"
#include "configuration.h"
//#define WLAN_HOTSPOT
//#define WEB_SERVER
#define DEBUG
#define BUTTON_PIN D6 //TODO
#define LED_PIN D7 //TODO
#define POWER_PIN D5
#define BUTTON_PIN D6
#define LED_PIN D7
#define AP_SSID "ESP-Accesspoint"
#define AP_PASSWORD "12345678"
......@@ -32,12 +31,16 @@ void setup() {
int i;
pinMode(BUTTON_PIN, INPUT);
pinMode(POWER_PIN, OUTPUT);
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600); //TODO #ifdef debug
Serial.setTimeout(2000);
while (!Serial) { }
digitalWrite(POWER_PIN, LOW);
digitalWrite(LED_PIN, HIGH); //on
delay(500);
weather_init();
// read conf from EEPROM
......@@ -78,13 +81,13 @@ void setup() {
// check if config button pushed
if (config_mode){ //TODO || conf.used != 1) {
digitalWrite(LED_PIN, LOW); //on
digitalWrite(LED_PIN, HIGH); //on
Serial.println("Open AP for config");
// open an AP
WiFi.mode(WIFI_AP);
WiFi.softAP(AP_SSID, AP_PASSWORD);
config_mode = true;
config_mode = true; //TODO ???
// Start webserver
server.on("/", handleRootPath);
......@@ -108,6 +111,8 @@ void loop() {
void deepSleep(int sec) {
Serial.printf("Sleeping deep for %i sec", sec);
digitalWrite(POWER_PIN, HIGH);
uint32_t data = 1;
ESP.rtcUserMemoryWrite(0, &data, sizeof(uint32_t));
......
......@@ -13,7 +13,7 @@ int weather_read(Weather* weather) {
return -1;
}
weather->heatIndex = dht.computeHeatIndex(weather->temperature, weather->humidity, false);
weather->heatIndex = dht.computeHeatIndex(weather->temperature, weather->humidity, false); //TODO ???
// BMP180
weather->pressure = (bmp180.readPressure()/100);
......
......@@ -18,7 +18,7 @@
typedef struct {
float humidity;
float temperature;
float heatIndex;
float heatIndex; //TODO ???
float pressure;
int light;
int rain;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment