mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 05:36:37 +00:00
Add strings
This commit is contained in:
parent
c9249106fe
commit
9ef3adedf2
@ -80,9 +80,9 @@ void configStartDebug(bool setupdebug, String & configFile)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0
|
#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0
|
||||||
LOG_TRACE(TAG_CONF, F("Loading %s"), configFile.c_str());
|
LOG_TRACE(TAG_CONF, F(D_FILE_LOADING), configFile.c_str());
|
||||||
#else
|
#else
|
||||||
LOG_TRACE(TAG_CONF, F("reading EEPROM"));
|
LOG_TRACE(TAG_CONF, F(D_FILE_LOADING), "EEPROM");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,11 +117,12 @@ void configGetConfig(JsonDocument & settings, bool setupdebug = false)
|
|||||||
String output;
|
String output;
|
||||||
serializeJson(settings, output);
|
serializeJson(settings, output);
|
||||||
String passmask = F(D_PASSWORD_MASK);
|
String passmask = F(D_PASSWORD_MASK);
|
||||||
output.replace(settings[FPSTR(FP_HTTP)][F("pass")].as<String>(), passmask);
|
const __FlashStringHelper * pass = F("pass");
|
||||||
output.replace(settings[FPSTR(FP_MQTT)][F("pass")].as<String>(), passmask);
|
output.replace(settings[FPSTR(FP_HTTP)][pass].as<String>(), passmask);
|
||||||
output.replace(settings[FPSTR(FP_WIFI)][F("pass")].as<String>(), passmask);
|
output.replace(settings[FPSTR(FP_MQTT)][pass].as<String>(), passmask);
|
||||||
|
output.replace(settings[FPSTR(FP_WIFI)][pass].as<String>(), passmask);
|
||||||
LOG_VERBOSE(TAG_CONF, output.c_str());
|
LOG_VERBOSE(TAG_CONF, output.c_str());
|
||||||
LOG_INFO(TAG_CONF, F("Loaded %s"), configFile.c_str());
|
LOG_INFO(TAG_CONF, F(D_FILE_LOADED), configFile.c_str());
|
||||||
|
|
||||||
if(setupdebug) debugSetup();
|
if(setupdebug) debugSetup();
|
||||||
return;
|
return;
|
||||||
@ -143,7 +144,7 @@ void configGetConfig(JsonDocument & settings, bool setupdebug = false)
|
|||||||
configStartDebug(setupdebug, configFile);
|
configStartDebug(setupdebug, configFile);
|
||||||
|
|
||||||
#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0
|
#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0
|
||||||
LOG_ERROR(TAG_CONF, F("Failed to load %s"), configFile.c_str());
|
LOG_ERROR(TAG_CONF, F(D_FILE_LOAD_FAILED), configFile.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -184,13 +185,13 @@ void configWriteConfig()
|
|||||||
|
|
||||||
String settingsChanged((char *)0);
|
String settingsChanged((char *)0);
|
||||||
settingsChanged.reserve(128);
|
settingsChanged.reserve(128);
|
||||||
settingsChanged = F("Settings changed!");
|
settingsChanged = F(D_CONFIG_CHANGED);
|
||||||
|
|
||||||
/* Read Config File */
|
/* Read Config File */
|
||||||
DynamicJsonDocument doc(8 * 256);
|
DynamicJsonDocument doc(8 * 256);
|
||||||
LOG_TRACE(TAG_CONF, F("Config LOADING first %s"), configFile.c_str());
|
LOG_TRACE(TAG_CONF, F(D_FILE_LOADING), configFile.c_str());
|
||||||
configGetConfig(doc, false);
|
configGetConfig(doc, false);
|
||||||
LOG_INFO(TAG_CONF, F("Config LOADED first %s"), configFile.c_str());
|
LOG_INFO(TAG_CONF, F(D_FILE_LOADED), configFile.c_str());
|
||||||
|
|
||||||
// Make sure we have a valid JsonObject to start from
|
// Make sure we have a valid JsonObject to start from
|
||||||
JsonObject settings;
|
JsonObject settings;
|
||||||
@ -300,17 +301,17 @@ void configWriteConfig()
|
|||||||
#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0
|
#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0
|
||||||
File file = HASP_FS.open(configFile, "w");
|
File file = HASP_FS.open(configFile, "w");
|
||||||
if(file) {
|
if(file) {
|
||||||
LOG_TRACE(TAG_CONF, F("Writing %s"), configFile.c_str());
|
LOG_TRACE(TAG_CONF, F(D_FILE_SAVING), configFile.c_str());
|
||||||
size_t size = serializeJson(doc, file);
|
size_t size = serializeJson(doc, file);
|
||||||
file.close();
|
file.close();
|
||||||
if(size > 0) {
|
if(size > 0) {
|
||||||
LOG_INFO(TAG_CONF, F("Saved %s"), configFile.c_str());
|
LOG_INFO(TAG_CONF, F(D_FILE_SAVED), configFile.c_str());
|
||||||
// configBackupToEeprom();
|
// configBackupToEeprom();
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(TAG_CONF, F("Failed to write %s"), configFile.c_str());
|
LOG_ERROR(TAG_CONF, F(D_FILE_SAVE_FAILED), configFile.c_str());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(TAG_CONF, F("Failed to write %s"), configFile.c_str());
|
LOG_ERROR(TAG_CONF, F(D_FILE_SAVE_FAILED), configFile.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -324,7 +325,7 @@ void configWriteConfig()
|
|||||||
|
|
||||||
#if defined(STM32F4xx)
|
#if defined(STM32F4xx)
|
||||||
// Method 2
|
// Method 2
|
||||||
LOG_INFO(TAG_CONF, F("Writing to EEPROM"));
|
LOG_INFO(TAG_CONF, F(F_FILE_SAVING), "EEPROM");
|
||||||
char buffer[1024 + 128];
|
char buffer[1024 + 128];
|
||||||
size_t size = serializeJson(doc, buffer, sizeof(buffer));
|
size_t size = serializeJson(doc, buffer, sizeof(buffer));
|
||||||
if(size > 0) {
|
if(size > 0) {
|
||||||
@ -332,14 +333,14 @@ void configWriteConfig()
|
|||||||
for(i = 0; i < size; i++) eeprom_buffered_write_byte(i, buffer[i]);
|
for(i = 0; i < size; i++) eeprom_buffered_write_byte(i, buffer[i]);
|
||||||
eeprom_buffered_write_byte(i, 0);
|
eeprom_buffered_write_byte(i, 0);
|
||||||
eeprom_buffer_flush();
|
eeprom_buffer_flush();
|
||||||
LOG_INFO(TAG_CONF, F("Saved EEPROM"));
|
LOG_INFO(TAG_CONF, F(F_FILE_SAVED), "EEPROM");
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(TAG_CONF, F("Failed to save config to EEPROM"));
|
LOG_ERROR(TAG_CONF, F(D_FILE_WRITE_FAILED), "EEPROM");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO(TAG_CONF, F("Configuration did not change"));
|
LOG_INFO(TAG_CONF, F(D_CONFIG_NOT_CHANGED));
|
||||||
}
|
}
|
||||||
configOutput(settings, TAG_CONF);
|
configOutput(settings, TAG_CONF);
|
||||||
}
|
}
|
||||||
@ -408,7 +409,7 @@ void configSetup()
|
|||||||
gpioSetConfig(settings[FPSTR(FP_GPIO)]);
|
gpioSetConfig(settings[FPSTR(FP_GPIO)]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LOG_INFO(TAG_CONF, F("User configuration loaded"));
|
LOG_INFO(TAG_CONF, F(D_CONFIG_LOADED));
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ static void oobeSetupQR(const char * ssid, const char * pass)
|
|||||||
lv_qrcode_update(qr, buffer, strlen(buffer));
|
lv_qrcode_update(qr, buffer, strlen(buffer));
|
||||||
|
|
||||||
lv_obj_t * qrlabel = lv_label_create(oobepage[0], NULL);
|
lv_obj_t * qrlabel = lv_label_create(oobepage[0], NULL);
|
||||||
snprintf_P(buffer, sizeof(buffer), PSTR("Scan to connect"));
|
snprintf_P(buffer, sizeof(buffer), PSTR(D_OOBE_SCAN_TO_CONNECT));
|
||||||
lv_label_set_text(qrlabel, buffer);
|
lv_label_set_text(qrlabel, buffer);
|
||||||
|
|
||||||
if(disp->driver.hor_res <= disp->driver.ver_res) {
|
if(disp->driver.hor_res <= disp->driver.ver_res) {
|
||||||
@ -154,7 +154,7 @@ static void oobeSetupQR(const char * ssid, const char * pass)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
lv_obj_t * aplabel = lv_label_create(container, NULL);
|
lv_obj_t * aplabel = lv_label_create(container, NULL);
|
||||||
snprintf_P(buffer, sizeof(buffer), PSTR("Tap the screen to setup WiFi or connect to this Access Point:"));
|
snprintf_P(buffer, sizeof(buffer), PSTR(D_OOBE_MSG));
|
||||||
lv_label_set_text(aplabel, buffer);
|
lv_label_set_text(aplabel, buffer);
|
||||||
lv_label_set_long_mode(aplabel, LV_LABEL_LONG_BREAK);
|
lv_label_set_long_mode(aplabel, LV_LABEL_LONG_BREAK);
|
||||||
|
|
||||||
@ -247,13 +247,13 @@ static void oobeSetupSsid(void)
|
|||||||
|
|
||||||
/* Create a label and position it above the text box */
|
/* Create a label and position it above the text box */
|
||||||
lv_obj_t * pwd_label = lv_label_create(oobepage[1], NULL);
|
lv_obj_t * pwd_label = lv_label_create(oobepage[1], NULL);
|
||||||
snprintf_P(buffer, sizeof(buffer), PSTR(D_TELNET_PASSWORD));
|
snprintf_P(buffer, sizeof(buffer), PSTR(D_PASSWORD));
|
||||||
lv_label_set_text(pwd_label, buffer);
|
lv_label_set_text(pwd_label, buffer);
|
||||||
lv_obj_align(pwd_label, pwd_ta, labelpos, 0, 0);
|
lv_obj_align(pwd_label, pwd_ta, labelpos, 0, 0);
|
||||||
|
|
||||||
/* Create a label and position it above the text box */
|
/* Create a label and position it above the text box */
|
||||||
lv_obj_t * oneline_label = lv_label_create(oobepage[1], NULL);
|
lv_obj_t * oneline_label = lv_label_create(oobepage[1], NULL);
|
||||||
snprintf_P(buffer, sizeof(buffer), PSTR("Ssid:"));
|
snprintf_P(buffer, sizeof(buffer), PSTR(D_SSID));
|
||||||
lv_label_set_text(oneline_label, buffer);
|
lv_label_set_text(oneline_label, buffer);
|
||||||
lv_obj_align(oneline_label, oneline_ta, labelpos, 0, 0);
|
lv_obj_align(oneline_label, oneline_ta, labelpos, 0, 0);
|
||||||
|
|
||||||
|
@ -1,6 +1,22 @@
|
|||||||
#ifndef HASP_LANG_EN_US_H
|
#ifndef HASP_LANG_EN_US_H
|
||||||
#define HASP_LANG_EN_US_H
|
#define HASP_LANG_EN_US_H
|
||||||
|
|
||||||
|
#define D_USERNAME "Username:"
|
||||||
|
#define D_PASSWORD "Password:"
|
||||||
|
#define D_SSID "Ssid:"
|
||||||
|
|
||||||
|
#define D_CONFIG_NOT_CHANGED "Settings did not change"
|
||||||
|
#define D_CONFIG_CHANGED "Settings changed"
|
||||||
|
#define D_CONFIG_LOADED "Settings loaded"
|
||||||
|
|
||||||
|
#define D_FILE_LOADING "Loading %s"
|
||||||
|
#define D_FILE_LOADED "Loaded %s"
|
||||||
|
#define D_FILE_LOAD_FAILED "Failed to load %s"
|
||||||
|
|
||||||
|
#define D_FILE_SAVING "Saving %s"
|
||||||
|
#define D_FILE_SAVED "Saved %s"
|
||||||
|
#define D_FILE_SAVE_FAILED "Failed to save %s"
|
||||||
|
|
||||||
#define D_SERVICE_STARTING "Starting..."
|
#define D_SERVICE_STARTING "Starting..."
|
||||||
#define D_SERVICE_STARTED "Started"
|
#define D_SERVICE_STARTED "Started"
|
||||||
#define D_SERVICE_START_FAILED "Failed to start"
|
#define D_SERVICE_START_FAILED "Failed to start"
|
||||||
@ -33,8 +49,6 @@
|
|||||||
#define D_TELNET_CLIENT_LOGIN_FROM "Client login from %s"
|
#define D_TELNET_CLIENT_LOGIN_FROM "Client login from %s"
|
||||||
#define D_TELNET_CLIENT_CONNECT_FROM "Client connected from %s"
|
#define D_TELNET_CLIENT_CONNECT_FROM "Client connected from %s"
|
||||||
#define D_TELNET_CLIENT_NOT_CONNECTED "Client NOT connected"
|
#define D_TELNET_CLIENT_NOT_CONNECTED "Client NOT connected"
|
||||||
#define D_TELNET_USERNAME "Username:"
|
|
||||||
#define D_TELNET_PASSWORD "Password:"
|
|
||||||
#define D_TELNET_AUTHENTICATION_FAILED "Authorization failed!"
|
#define D_TELNET_AUTHENTICATION_FAILED "Authorization failed!"
|
||||||
#define D_TELNET_INCORRECT_LOGIN_ATTEMPT "Incorrect login attempt from %s"
|
#define D_TELNET_INCORRECT_LOGIN_ATTEMPT "Incorrect login attempt from %s"
|
||||||
#define D_TELNET_STARTED "Telnet console started"
|
#define D_TELNET_STARTED "Telnet console started"
|
||||||
@ -108,4 +122,7 @@
|
|||||||
#define D_HTTP_REBOOT "Restart"
|
#define D_HTTP_REBOOT "Restart"
|
||||||
#define D_HTTP_CONFIGURATION "Configuration"
|
#define D_HTTP_CONFIGURATION "Configuration"
|
||||||
|
|
||||||
|
#define D_OOBE_MSG "Tap the screen to setup WiFi or connect to this Access Point:"
|
||||||
|
#define D_OOBE_SCAN_TO_CONNECT "Scan to connect"
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -1,6 +1,22 @@
|
|||||||
#ifndef HASP_LANG_EN_US_H
|
#ifndef HASP_LANG_EN_US_H
|
||||||
#define HASP_LANG_EN_US_H
|
#define HASP_LANG_EN_US_H
|
||||||
|
|
||||||
|
#define D_USERNAME "Gebruikersnaam:"
|
||||||
|
#define D_PASSWORD "Wachtwoord:"
|
||||||
|
#define D_SSID "Ssid:"
|
||||||
|
|
||||||
|
#define D_CONFIG_NOT_CHANGED "Instellingen ongewijzigd"
|
||||||
|
#define D_CONFIG_CHANGED "Instellingen gewijzigd"
|
||||||
|
#define D_CONFIG_LOADED "Instellingen geladen"
|
||||||
|
|
||||||
|
#define D_FILE_LOADING "%s laden..."
|
||||||
|
#define D_FILE_LOADED "%s geladen"
|
||||||
|
#define D_FILE_LOAD_FAILED "%s laden mislukt"
|
||||||
|
|
||||||
|
#define D_FILE_SAVING "%s bewaren..."
|
||||||
|
#define D_FILE_SAVED "%s bewaard"
|
||||||
|
#define D_FILE_SAVE_FAILED "%s bewaren mislukt"
|
||||||
|
|
||||||
#define D_SERVICE_STARTING "Starten..."
|
#define D_SERVICE_STARTING "Starten..."
|
||||||
#define D_SERVICE_STARTED "Gestart"
|
#define D_SERVICE_STARTED "Gestart"
|
||||||
#define D_SERVICE_START_FAILED "Starten mislukt"
|
#define D_SERVICE_START_FAILED "Starten mislukt"
|
||||||
@ -33,8 +49,6 @@
|
|||||||
#define D_TELNET_CLIENT_LOGIN_FROM "Client aangemeld van %s"
|
#define D_TELNET_CLIENT_LOGIN_FROM "Client aangemeld van %s"
|
||||||
#define D_TELNET_CLIENT_CONNECT_FROM "Client verbonden van %s"
|
#define D_TELNET_CLIENT_CONNECT_FROM "Client verbonden van %s"
|
||||||
#define D_TELNET_CLIENT_NOT_CONNECTED "Client NIET vzebonden"
|
#define D_TELNET_CLIENT_NOT_CONNECTED "Client NIET vzebonden"
|
||||||
#define D_TELNET_USERNAME "Gebruikersnaam:"
|
|
||||||
#define D_TELNET_PASSWORD "Wachtwoord:"
|
|
||||||
#define D_TELNET_AUTHENTICATION_FAILED "Autorisatie mislukt!"
|
#define D_TELNET_AUTHENTICATION_FAILED "Autorisatie mislukt!"
|
||||||
#define D_TELNET_INCORRECT_LOGIN_ATTEMPT "Aanmelding van %s mislukt"
|
#define D_TELNET_INCORRECT_LOGIN_ATTEMPT "Aanmelding van %s mislukt"
|
||||||
#define D_TELNET_STARTED "Telnet console gestart"
|
#define D_TELNET_STARTED "Telnet console gestart"
|
||||||
@ -108,4 +122,7 @@
|
|||||||
#define D_HTTP_REBOOT "Herstarten"
|
#define D_HTTP_REBOOT "Herstarten"
|
||||||
#define D_HTTP_CONFIGURATION "Configuratie"
|
#define D_HTTP_CONFIGURATION "Configuratie"
|
||||||
|
|
||||||
|
#define D_OOBE_MSB "Raak het scherm aan om WiFi in te stellen of meld je aan op AP:"
|
||||||
|
#define D_OOBE_SCAN_TO_CONNECT "Scan code"
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user