68 lines
1.0 KiB
C++
68 lines
1.0 KiB
C++
|
/*
|
||
|
* productionMode.cpp
|
||
|
*
|
||
|
* Created on: Apr 05, 2019
|
||
|
* Author: wn
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
#include "../defines.h"
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdint.h>
|
||
|
#include <string.h>
|
||
|
#include <stdbool.h>
|
||
|
#include <ESP8266WiFi.h>
|
||
|
#include <ESP8266WebServer.h>
|
||
|
|
||
|
#include "../configuration.h"
|
||
|
|
||
|
void setup_wifi() {
|
||
|
delay(10);
|
||
|
WiFi.mode(WIFI_STA);
|
||
|
|
||
|
// We start by connecting to a WiFi network
|
||
|
#ifdef DEBUG
|
||
|
Serial.println();
|
||
|
Serial.print("Connecting to ");
|
||
|
Serial.println(configBlock.wifiSsid);
|
||
|
#endif
|
||
|
|
||
|
WiFi.begin(configBlock.wifiSsid, configBlock.wifiKey);
|
||
|
|
||
|
while (WiFi.status() != WL_CONNECTED) {
|
||
|
delay(50);
|
||
|
#ifdef DEBUG
|
||
|
Serial.print(".");
|
||
|
#endif
|
||
|
}
|
||
|
Serial.println("!");
|
||
|
|
||
|
#ifdef DEBUG
|
||
|
Serial.println("");
|
||
|
Serial.println("WiFi connected");
|
||
|
Serial.println("IP address: ");
|
||
|
Serial.println(WiFi.localIP());
|
||
|
#endif
|
||
|
}
|
||
|
|
||
|
void __attribute__((weak)) setupApplication() {
|
||
|
}
|
||
|
|
||
|
void __attribute__((weak)) loopApplication() {
|
||
|
}
|
||
|
|
||
|
|
||
|
void setupProduction() {
|
||
|
setup_wifi();
|
||
|
setupApplication();
|
||
|
}
|
||
|
|
||
|
|
||
|
void loopProduction() {
|
||
|
loopApplication();
|
||
|
}
|
||
|
|
||
|
|