Some cleanup, halfway of EEPROM config saving for ESP8266 (required updated aJson lib)

This commit is contained in:
2019-03-23 19:11:09 +03:00
parent 2947a1e53c
commit 6fa661690b
5 changed files with 40 additions and 36 deletions

View File

@@ -129,9 +129,9 @@ class Item
//void setVal(uint8_t n, int par);
void setVal(long int par);
//void copyPar (aJsonObject *itemV);
inline int On (){Ctrl(CMD_ON);};
inline int Off(){Ctrl(CMD_OFF);};
inline int Toggle(){Ctrl(CMD_TOGGLE);};
inline int On (){return Ctrl(CMD_ON);};
inline int Off(){return Ctrl(CMD_OFF);};
inline int Toggle(){return Ctrl(CMD_TOGGLE);};
int Poll();
int SendStatus(short cmd, short n=0, int * Par=NULL, boolean deferred = false);

View File

@@ -87,17 +87,6 @@ NRFFlashStorage EEPROM;
#endif
#ifdef ARDUINO_ARCH_STM32
#include "HttpClient.h"
//#include <EthernetClient.h>
#include "UIPEthernet.h"
//#include "UIPUdp.h"
//#include <SPI.h>
//#include <Ethernet_STM.h>
#include "Dns.h"
//#include "utility/logging.h"
#include <EEPROM.h>
EthernetClient ethClient;
#endif
@@ -964,6 +953,7 @@ int mqttConfigRequest(int arg_cnt, char **args)
strncat(buf, "/req/conf", 25);
debugSerial<<buf;
mqttClient.publish(buf, "1");
return 1;
}
@@ -1277,6 +1267,10 @@ void setup_main() {
sd_card_w5100_setup();
#endif
setupMacAddress();
#if defined(ARDUINO_ARCH_ESP8266)
EEPROM.begin(ESP_EEPROM_SIZE);
#endif
loadConfigFromEEPROM();
#ifdef _modbus

View File

@@ -16,7 +16,7 @@
#if defined(ARDUINO_ARCH_ESP8266)
#include <FS.h> //this needs to be first, or it all crashes and burns...
#include <EEPROM.h>
#include <ESP_EEPROM.h>
#include <ESP8266HTTPClient.h>
#include <WiFiManager.h>
#include <DNSServer.h>
@@ -45,14 +45,14 @@
#include <NRFFlashStorage.h>
#endif
#if defined(__SAM3X8E__)
#define wdt_res() watchdogReset()
#define wdt_en()
#define wdt_dis()
#ifdef ARDUINO_ARCH_STM32
#include "HttpClient.h"
#include "UIPEthernet.h"
#include <EEPROM.h>
#endif
#if defined(ARDUINO_ARCH_STM32F1)
#define wdt_res()
#if defined(__SAM3X8E__)
#define wdt_res() watchdogReset()
#define wdt_en()
#define wdt_dis()
#endif

View File

@@ -4,6 +4,7 @@
#endif
#define TXEnablePin 13
#define ESP_EEPROM_SIZE 4096
#ifndef AVR_DMXOUT_PIN
#define AVR_DMXOUT_PIN 3