automatically initialize new device with webui username and password

This commit is contained in:
Siwat Sirichai 2023-12-03 02:37:50 +07:00
parent 9e2efddfc9
commit dae545a63e
1 changed files with 8 additions and 0 deletions

View File

@ -247,6 +247,14 @@ void eeprom_retrieve_init()
#ifdef ENABLE_WEBUI
ESPMega_FRAM.read(EEPROM_ADDRESS_WEBUI_USERNAME, (uint8_t *)WEBUI_USERNAME, 32);
ESPMega_FRAM.read(EEPROM_ADDRESS_WEBUI_PASSWORD, (uint8_t *)WEBUI_PASSWORD, 32);
if(strlen(WEBUI_USERNAME)==0) {
strcpy(WEBUI_USERNAME,"admin");
ESPMega_FRAM.write(EEPROM_ADDRESS_WEBUI_USERNAME, (uint8_t *)WEBUI_USERNAME, 32);
}
if(strlen(WEBUI_PASSWORD)==0) {
strcpy(WEBUI_PASSWORD,"admin");
ESPMega_FRAM.write(EEPROM_ADDRESS_WEBUI_PASSWORD, (uint8_t *)WEBUI_PASSWORD, 32);
}
#endif
// EEPROM Data Retrival
#ifdef ENABLE_CLIMATE_MODULE