not longer required
This commit is contained in:
@ -1,78 +0,0 @@
|
|||||||
// Do not remove the include below
|
|
||||||
#include "EspThermometer2.h"
|
|
||||||
#include "defines.h"
|
|
||||||
|
|
||||||
// #define ESP8266
|
|
||||||
|
|
||||||
|
|
||||||
#include <EEPROM.h>
|
|
||||||
|
|
||||||
#include "configuration.h"
|
|
||||||
#include "productionMode.h"
|
|
||||||
#include "configurationMode.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ADC_MODE(ADC_VCC);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool configMode = false;
|
|
||||||
|
|
||||||
uint32_t startTime = 0;
|
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
startTime = millis();
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.begin(115200);
|
|
||||||
Serial.println("Starting ...");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pinMode(CONFIG_SWITCH, INPUT_PULLUP);
|
|
||||||
pinMode(LED_PIN, OUTPUT);
|
|
||||||
|
|
||||||
|
|
||||||
EEPROM.begin(512);
|
|
||||||
EEPROM.get(EEPROM_ADDR, configBlock);
|
|
||||||
|
|
||||||
|
|
||||||
Serial.print("Magic: ");
|
|
||||||
Serial.println(configBlock.magic);
|
|
||||||
|
|
||||||
configMode = ((LOW == digitalRead(CONFIG_SWITCH)) || (configBlock.magic != MAGIC));
|
|
||||||
|
|
||||||
if (configMode) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.println("Configuration mode");
|
|
||||||
#endif
|
|
||||||
digitalWrite(LED_PIN, LOW);
|
|
||||||
setupConfigurationNetwork();
|
|
||||||
setupConfigurationServer();
|
|
||||||
} else {
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.println("Production mode");
|
|
||||||
Serial.println();
|
|
||||||
Serial.println();
|
|
||||||
showConfiguration();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
digitalWrite(LED_PIN, HIGH);
|
|
||||||
setupProduction();
|
|
||||||
setupConfigurationServer();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.println("Started.");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
if (configMode) {
|
|
||||||
loopConfiguration();
|
|
||||||
} else {
|
|
||||||
loopProduction();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user