MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / getConfigs

Function getConfigs

src/settings.cpp:786–939  ·  view source on GitHub ↗

** Function: getConfigs ** getConfigurations from EEPROM or JSON **********************************************************************/

Source from the content-addressed store, hash-verified

784** getConfigurations from EEPROM or JSON
785**********************************************************************/
786void getConfigs() {
787 if (setupSdCard()) {
788 // check if config file exists, otherwise create it with default values
789 config_exists();
790 File file = SDM.open(CONFIG_FILE, FILE_READ);
791 if (file) {
792 DeserializationError error = deserializeJson(settings, file);
793 if (error) {
794 log_i("Failed to read file, using default configuration");
795 goto Default;
796 } else {
797 log_i("getConfigs: deserialized correctly");
798 }
799
800 int count = 0;
801 JsonObject setting = settings[0];
802 if (setting["onlyBins"].is<bool>()) {
803 onlyBins = setting["onlyBins"].as<bool>();
804 } else {
805 count++;
806 log_i("Fail");
807 }
808 if (setting["bootToApp"].is<bool>()) {
809 bootToApp = setting["bootToApp"].as<bool>();
810 } else {
811 count++;
812 log_i("Fail");
813 }
814 if (setting["noDotFiles"].is<bool>()) {
815 noDotFiles = setting["noDotFiles"].as<bool>();
816 } else {
817 count++;
818 log_i("Fail");
819 }
820 if (setting["askSpiffs"].is<bool>()) {
821 askSpiffs = setting["askSpiffs"].as<bool>();
822 } else {
823 count++;
824 log_i("Fail");
825 }
826 if (setting["bright"].is<int>()) {
827 bright = setting["bright"].as<int>();
828 } else {
829 count++;
830 log_i("Fail");
831 }
832 if (setting["dimmerSet"].is<int>()) {
833 dimmerSet = setting["dimmerSet"].as<int>();
834 } else {
835 count++;
836 log_i("Fail");
837 }
838 char *mac;
839 if (setting[get_efuse_mac_as_string()].is<int>()) {
840 rotation = setting[get_efuse_mac_as_string()].as<int>();
841 } else {
842 count++;
843 log_i("Fail");

Callers 4

startWebUiFunction · 0.85
wifiConnectFunction · 0.85
main.cppFile · 0.85
loopFunction · 0.85

Calls 9

config_existsFunction · 0.85
get_efuse_mac_as_stringFunction · 0.85
wifiPwdDecryptFunction · 0.85
saveConfigsFunction · 0.85
setBrightnessFunction · 0.85
saveIntoNVSFunction · 0.85
getFromNVSFunction · 0.85
getWifiFromNVSFunction · 0.85
closeMethod · 0.80

Tested by

no test coverage detected