Browse Source

just create empty cspot_config at first boot - release

philippe44 2 years ago
parent
commit
b48e9fe1fa
2 changed files with 2 additions and 11 deletions
  1. 1 1
      components/spotify/Shim.cpp
  2. 1 10
      main/esp_app_main.c

+ 1 - 1
components/spotify/Shim.cpp

@@ -256,7 +256,7 @@ void ShimAudioSink::feedPCMFrames(const uint8_t *data, size_t bytes) {
 /****************************************************************************************
  * NVSFile class to store config
  */
- bool NVSFile::readFile(std::string filename, std::string &fileContent) {
+bool NVSFile::readFile(std::string filename, std::string &fileContent) {
 	auto search = files.find(filename);
     
 	// cache 

+ 1 - 10
main/esp_app_main.c

@@ -369,17 +369,8 @@ void register_default_nvs(){
     register_default_string_val("dhcp_tmout","8");
 	register_default_string_val("target", CONFIG_TARGET);
 #ifdef CONFIG_CSPOT_SINK
-	char * host_hame = config_alloc_get_default(NVS_TYPE_STR, "host_name", NULL, 0);
 	register_default_string_val("enable_cspot", STR(CONFIG_CSPOT_SINK));
-	cJSON * cspot_config = cJSON_CreateObject();
-	cJSON_AddStringToObject(cspot_config, "deviceName", host_hame);
-	cJSON_AddNumberToObject(cspot_config, "format", 1);
-	cJSON_AddNumberToObject(cspot_config, "volume", 32767);
-	char * cspot_config_str = cJSON_PrintUnformatted(cspot_config);
-	register_default_string_val("cspot_config", cspot_config_str);
-	cJSON_Delete(cspot_config);
-	FREE_AND_NULL(cspot_config_str);
-	FREE_AND_NULL(host_hame);
+	register_default_string_val("cspot_config", "");
 #endif
 	wait_for_commit();
 	ESP_LOGD(TAG,"Done setting default values in nvs.");