New meter config

This commit is contained in:
Gunnar Skjold
2021-11-06 19:30:58 +01:00
parent 8e9da8f255
commit 6d26102b8e
27 changed files with 156 additions and 2370 deletions

View File

@@ -4,14 +4,14 @@
#include "Arduino.h"
#define EEPROM_SIZE 1024 * 3
#define EEPROM_CHECK_SUM 87 // Used to check if config is stored. Change if structure changes
#define EEPROM_CHECK_SUM 88 // Used to check if config is stored. Change if structure changes
#define EEPROM_CONFIG_ADDRESS 0
#define EEPROM_TEMP_CONFIG_ADDRESS 2048
#define CONFIG_SYSTEM_START 8
#define CONFIG_WIFI_START 16
#define CONFIG_METER_START 224
#define CONFIG_WEB_START 648
#define CONFIG_METER_START 784
#define CONFIG_DEBUG_START 824
#define CONFIG_GPIO_START 832
#define CONFIG_DOMOTICZ_START 856
@@ -20,6 +20,7 @@
#define CONFIG_MQTT_START 1004
#define CONFIG_MQTT_START_86 224
#define CONFIG_METER_START_87 784
struct SystemConfig {
@@ -69,6 +70,17 @@ struct WebConfig {
}; // 129
struct MeterConfig {
uint32_t baud;
uint8_t parity;
bool invert;
uint8_t distributionSystem;
uint8_t mainFuse;
uint8_t productionCapacity;
uint8_t encryptionKey[16];
uint8_t authenticationKey[16];
}; // 41
struct MeterConfig87 {
uint8_t type;
uint8_t distributionSystem;
uint8_t mainFuse;
@@ -190,60 +202,6 @@ struct ConfigObject83 {
uint8_t tempAnalogSensorPin;
};
struct ConfigObject82 {
uint8_t boardType;
char wifiSsid[32];
char wifiPassword[64];
char wifiIp[15];
char wifiGw[15];
char wifiSubnet[15];
char wifiDns1[15];
char wifiDns2[15];
char wifiHostname[32];
char mqttHost[128];
uint16_t mqttPort;
char mqttClientId[32];
char mqttPublishTopic[64];
char mqttSubscribeTopic[64];
char mqttUser[64];
char mqttPassword[64];
uint8_t mqttPayloadFormat;
bool mqttSsl;
uint8_t authSecurity;
char authUser[64];
char authPassword[64];
uint8_t meterType;
uint8_t distributionSystem;
uint8_t mainFuse;
uint8_t productionCapacity;
bool substituteMissing;
bool sendUnknown;
bool debugTelnet;
bool debugSerial;
uint8_t debugLevel;
uint8_t hanPin;
uint8_t apPin;
uint8_t ledPin;
bool ledInverted;
uint8_t ledPinRed;
uint8_t ledPinGreen;
uint8_t ledPinBlue;
bool ledRgbInverted;
uint8_t tempSensorPin;
uint8_t vccPin;
uint16_t vccMultiplier;
uint8_t vccBootLimit;
uint16_t domoELIDX;
uint16_t domoVL1IDX;
uint16_t domoVL2IDX;
uint16_t domoVL3IDX;
uint16_t domoCL1IDX;
};
struct TempSensorConfig {
uint8_t address[8];
char name[16];
@@ -334,9 +292,9 @@ private:
uint8_t tempSensorCount = 0;
TempSensorConfig** tempSensors;
bool loadConfig82(int address);
bool loadConfig83(int address);
bool relocateConfig86();
bool relocateConfig87();
int readString(int pAddress, char* pString[]);
int readInt(int pAddress, int *pValue);