Adjust config
* Allow wifi passwords length of 64 chars * Added max channel power
This commit is contained in:
parent
70b9f9fdba
commit
10974ade3e
@ -3,10 +3,10 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#define CONFIG_FILENAME "/config.bin"
|
#define CONFIG_FILENAME "/config.bin"
|
||||||
#define CONFIG_VERSION 0x00011000 // 0.1.10 // make sure to clean all after change
|
#define CONFIG_VERSION 0x00011100 // 0.1.17 // make sure to clean all after change
|
||||||
|
|
||||||
#define WIFI_MAX_SSID_STRLEN 31
|
#define WIFI_MAX_SSID_STRLEN 31
|
||||||
#define WIFI_MAX_PASSWORD_STRLEN 31
|
#define WIFI_MAX_PASSWORD_STRLEN 64
|
||||||
#define WIFI_MAX_HOSTNAME_STRLEN 31
|
#define WIFI_MAX_HOSTNAME_STRLEN 31
|
||||||
|
|
||||||
#define NTP_MAX_SERVER_STRLEN 31
|
#define NTP_MAX_SERVER_STRLEN 31
|
||||||
@ -21,10 +21,12 @@
|
|||||||
|
|
||||||
#define INV_MAX_NAME_STRLEN 31
|
#define INV_MAX_NAME_STRLEN 31
|
||||||
#define INV_MAX_COUNT 10
|
#define INV_MAX_COUNT 10
|
||||||
|
#define INV_MAX_CHAN_COUNT 4
|
||||||
|
|
||||||
struct INVERTER_CONFIG_T {
|
struct INVERTER_CONFIG_T {
|
||||||
uint64_t Serial;
|
uint64_t Serial;
|
||||||
char Name[INV_MAX_NAME_STRLEN + 1];
|
char Name[INV_MAX_NAME_STRLEN + 1];
|
||||||
|
uint16_t MaxChannelPower[INV_MAX_CHAN_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CONFIG_T {
|
struct CONFIG_T {
|
||||||
@ -55,14 +57,13 @@ struct CONFIG_T {
|
|||||||
char Mqtt_LwtTopic[MQTT_MAX_TOPIC_STRLEN + 1];
|
char Mqtt_LwtTopic[MQTT_MAX_TOPIC_STRLEN + 1];
|
||||||
char Mqtt_LwtValue_Online[MQTT_MAX_LWTVALUE_STRLEN + 1];
|
char Mqtt_LwtValue_Online[MQTT_MAX_LWTVALUE_STRLEN + 1];
|
||||||
char Mqtt_LwtValue_Offline[MQTT_MAX_LWTVALUE_STRLEN + 1];
|
char Mqtt_LwtValue_Offline[MQTT_MAX_LWTVALUE_STRLEN + 1];
|
||||||
|
uint32_t Mqtt_PublishInterval;
|
||||||
|
|
||||||
INVERTER_CONFIG_T Inverter[INV_MAX_COUNT];
|
INVERTER_CONFIG_T Inverter[INV_MAX_COUNT];
|
||||||
|
|
||||||
uint64_t Dtu_Serial;
|
uint64_t Dtu_Serial;
|
||||||
uint32_t Dtu_PollInterval;
|
uint32_t Dtu_PollInterval;
|
||||||
uint8_t Dtu_PaLevel;
|
uint8_t Dtu_PaLevel;
|
||||||
|
|
||||||
uint32_t Mqtt_PublishInterval;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConfigurationClass {
|
class ConfigurationClass {
|
||||||
|
|||||||
@ -37,6 +37,9 @@ void ConfigurationClass::init()
|
|||||||
for (uint8_t i = 0; i < INV_MAX_COUNT; i++) {
|
for (uint8_t i = 0; i < INV_MAX_COUNT; i++) {
|
||||||
config.Inverter[i].Serial = 0;
|
config.Inverter[i].Serial = 0;
|
||||||
strlcpy(config.Inverter[i].Name, "", 0);
|
strlcpy(config.Inverter[i].Name, "", 0);
|
||||||
|
for (uint8_t c = 0; c < INV_MAX_CHAN_COUNT; c++) {
|
||||||
|
config.Inverter[0].MaxChannelPower[c] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config.Dtu_Serial = DTU_SERIAL;
|
config.Dtu_Serial = DTU_SERIAL;
|
||||||
@ -117,6 +120,10 @@ void ConfigurationClass::migrate()
|
|||||||
config.Mqtt_PublishInterval = MQTT_PUBLISH_INTERVAL;
|
config.Mqtt_PublishInterval = MQTT_PUBLISH_INTERVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.Cfg_Version < 0x00011100) {
|
||||||
|
init(); // Config will be completly incompatible after this update
|
||||||
|
}
|
||||||
|
|
||||||
config.Cfg_Version = CONFIG_VERSION;
|
config.Cfg_Version = CONFIG_VERSION;
|
||||||
write();
|
write();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user