checked virtual "EEPROM" -> works
This commit is contained in:
@@ -12,6 +12,7 @@ extern "C" {
|
||||
#include "httpserver.h"
|
||||
#include "ota.h"
|
||||
#include "wifi_credentials.h"
|
||||
#include <EEPROM.h>
|
||||
|
||||
// BOARD
|
||||
#define ESP12_LED 2
|
||||
@@ -34,6 +35,11 @@ uint32_t _t=0;
|
||||
#define SP_US(_str,_a) Serial.print(_str); Serial.print(" took: "); Serial.print(_a); Serial.println("us")
|
||||
#define TIMEIF_US(_f, _l, _str) _t=micros(); _f; _t=micros()-_t; if(_t > (_l)) { SP_US(_str, _t); }
|
||||
|
||||
struct { // Struct for wifi-data, 40 Bytes each SSID and PW
|
||||
char SSID[40] = "";
|
||||
char PW[40] = "";
|
||||
} wifi_data;
|
||||
|
||||
|
||||
void timerCallback(void *pArg)
|
||||
{
|
||||
@@ -57,6 +63,14 @@ void setup() {
|
||||
Serial.println("Booting ....");
|
||||
pinMode(ESP12_LED, OUTPUT);
|
||||
|
||||
EEPROM.begin(512); // init virtual "EEPROM" with size 512 Bytes
|
||||
|
||||
//strncpy(wifi_data.SSID, "donotconnect", 40);
|
||||
//strncpy(wifi_data.PW, "unsafe lol", 40);
|
||||
|
||||
EEPROM.get(0, wifi_data);
|
||||
//EEPROM.commit();
|
||||
|
||||
Wire.begin(); // Wire must be started first
|
||||
Wire.setClock(1000000); // Supported baud rates are 100kHz, 400kHz, and 1000kHz
|
||||
stairs.setup();
|
||||
@@ -87,6 +101,8 @@ void setup() {
|
||||
|
||||
os_timer_setfn(&timer1, timerCallback, &timer_flag);
|
||||
os_timer_arm(&timer1, 20, true);
|
||||
|
||||
Serial.println("SSID: " + String(wifi_data.SSID) + " PW: " + String(wifi_data.PW));
|
||||
}
|
||||
|
||||
uint32_t c = 0;
|
||||
|
||||
Reference in New Issue
Block a user