Fix #71: Extend mqtt hostname from 31 characters to 128 characters
This commit is contained in:
parent
80f7ba86d7
commit
35a72acf34
@ -4,7 +4,7 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#define CONFIG_FILENAME "/config.bin"
|
#define CONFIG_FILENAME "/config.bin"
|
||||||
#define CONFIG_VERSION 0x00011300 // 0.1.19 // make sure to clean all after change
|
#define CONFIG_VERSION 0x00011400 // 0.1.20 // make sure to clean all after change
|
||||||
|
|
||||||
#define WIFI_MAX_SSID_STRLEN 31
|
#define WIFI_MAX_SSID_STRLEN 31
|
||||||
#define WIFI_MAX_PASSWORD_STRLEN 64
|
#define WIFI_MAX_PASSWORD_STRLEN 64
|
||||||
@ -14,7 +14,8 @@
|
|||||||
#define NTP_MAX_TIMEZONE_STRLEN 50
|
#define NTP_MAX_TIMEZONE_STRLEN 50
|
||||||
#define NTP_MAX_TIMEZONEDESCR_STRLEN 50
|
#define NTP_MAX_TIMEZONEDESCR_STRLEN 50
|
||||||
|
|
||||||
#define MQTT_MAX_HOSTNAME_STRLEN 31
|
#define MQTT_MAX_HOSTNAME_OLD_STRLEN 31
|
||||||
|
#define MQTT_MAX_HOSTNAME_STRLEN 128
|
||||||
#define MQTT_MAX_USERNAME_STRLEN 32
|
#define MQTT_MAX_USERNAME_STRLEN 32
|
||||||
#define MQTT_MAX_PASSWORD_STRLEN 32
|
#define MQTT_MAX_PASSWORD_STRLEN 32
|
||||||
#define MQTT_MAX_TOPIC_STRLEN 32
|
#define MQTT_MAX_TOPIC_STRLEN 32
|
||||||
@ -50,7 +51,7 @@ struct CONFIG_T {
|
|||||||
char Ntp_TimezoneDescr[NTP_MAX_TIMEZONEDESCR_STRLEN + 1];
|
char Ntp_TimezoneDescr[NTP_MAX_TIMEZONEDESCR_STRLEN + 1];
|
||||||
|
|
||||||
bool Mqtt_Enabled;
|
bool Mqtt_Enabled;
|
||||||
char Mqtt_Hostname[MQTT_MAX_HOSTNAME_STRLEN + 1];
|
char Mqtt_Hostname_Short[MQTT_MAX_HOSTNAME_OLD_STRLEN + 1]; // Deprecated but for config compatibility
|
||||||
uint Mqtt_Port;
|
uint Mqtt_Port;
|
||||||
char Mqtt_Username[MQTT_MAX_USERNAME_STRLEN + 1];
|
char Mqtt_Username[MQTT_MAX_USERNAME_STRLEN + 1];
|
||||||
char Mqtt_Password[MQTT_MAX_PASSWORD_STRLEN + 1];
|
char Mqtt_Password[MQTT_MAX_PASSWORD_STRLEN + 1];
|
||||||
@ -73,6 +74,8 @@ struct CONFIG_T {
|
|||||||
bool Mqtt_Hass_IndividualPanels;
|
bool Mqtt_Hass_IndividualPanels;
|
||||||
bool Mqtt_Tls;
|
bool Mqtt_Tls;
|
||||||
char Mqtt_RootCaCert[MQTT_MAX_ROOT_CA_CERT_STRLEN + 1];
|
char Mqtt_RootCaCert[MQTT_MAX_ROOT_CA_CERT_STRLEN + 1];
|
||||||
|
|
||||||
|
char Mqtt_Hostname[MQTT_MAX_HOSTNAME_STRLEN + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConfigurationClass {
|
class ConfigurationClass {
|
||||||
|
|||||||
@ -147,6 +147,10 @@ void ConfigurationClass::migrate()
|
|||||||
strlcpy(config.Mqtt_RootCaCert, MQTT_ROOT_CA_CERT, sizeof(config.Mqtt_RootCaCert));
|
strlcpy(config.Mqtt_RootCaCert, MQTT_ROOT_CA_CERT, sizeof(config.Mqtt_RootCaCert));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.Cfg_Version < 0x00011400) {
|
||||||
|
strlcpy(config.Mqtt_Hostname, config.Mqtt_Hostname_Short, sizeof(config.Mqtt_Hostname_Short));
|
||||||
|
}
|
||||||
|
|
||||||
config.Cfg_Version = CONFIG_VERSION;
|
config.Cfg_Version = CONFIG_VERSION;
|
||||||
write();
|
write();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label for="inputHostname" class="col-sm-2 col-form-label">Hostname:</label>
|
<label for="inputHostname" class="col-sm-2 col-form-label">Hostname:</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<input type="text" class="form-control" id="inputHostname" maxlength="32"
|
<input type="text" class="form-control" id="inputHostname" maxlength="128"
|
||||||
placeholder="Hostname or IP address" v-model="mqttConfigList.mqtt_hostname" />
|
placeholder="Hostname or IP address" v-model="mqttConfigList.mqtt_hostname" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user