From 281f5ec702209616210418b6d84604025d704e50 Mon Sep 17 00:00:00 2001 From: elmo128 <60213508+elmo128@users.noreply.github.com> Date: Wed, 13 Sep 2023 03:06:54 +0200 Subject: [PATCH] change path, correct UART output. --- src/drivers/SDCard/SDCard.h | 24 ++++++++++++------------ src/drivers/SPIStorage/SPIStorage.h | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/drivers/SDCard/SDCard.h b/src/drivers/SDCard/SDCard.h index 893e737..dff399a 100644 --- a/src/drivers/SDCard/SDCard.h +++ b/src/drivers/SDCard/SDCard.h @@ -8,8 +8,8 @@ #include #include "..\drivers.h" -#include "..\storage.h" -#include "..\SPIStorage\SPIStorage.h" +#include "storage.h" +#include "SPIStorage.h" #define JSON_CONFIG_FILE "/config.json" @@ -43,13 +43,13 @@ public: if (SD_MMC.cardType() == CARD_NONE) SD_MMC.setPins(SDMMC_CLK, SDMMC_CMD, SDMMC_D0); #else - Serial.println("SD card interface not available."); + Serial.println("SDCard: interface not available."); return false; #endif // dataPinsDefined if ((!SD_MMC.begin("/sdcard", oneBitMode)) || (SD_MMC.cardType() == CARD_NONE)) { - Serial.println("No card available."); + Serial.println("SDCard: No card found."); return false; } return true; @@ -59,27 +59,27 @@ public: { // Load existing configuration file // Read configuration from FS json - Serial.println("Mounting SD card..."); + Serial.println("SDCard: Mounting File System..."); TSettings Settings; if (initSDcard()) { - Serial.println("mounted SD card."); + Serial.println("SDCard: Mounted"); if (SD_MMC.exists(JSON_CONFIG_FILE)) { // The file exists, reading and loading - Serial.println("reading config file from sd."); + Serial.println("SDCard: Reading config file"); File configFile = SD_MMC.open(JSON_CONFIG_FILE, "r"); if (configFile) { - Serial.println("Opened configuration file"); + Serial.println("SDCard: Opened configuration file"); StaticJsonDocument<512> json; DeserializationError error = deserializeJson(json, configFile); configFile.close(); serializeJsonPretty(json, Serial); if (!error) { - Serial.println("Parsing JSON"); + Serial.println("SDCard: Parsing JSON"); strcpy(Settings.WifiSSID, json["SSID"]); strcpy(Settings.WifiPW, json["Password"]); strcpy(Settings.PoolAddress, json["PoolURL"]); @@ -91,7 +91,7 @@ public: else { // Error loading JSON data - Serial.println("Failed to load json config"); + Serial.println("SDCard: Failed to load json config"); } } SD_MMC.end(); @@ -100,7 +100,7 @@ public: else { // Error mounting file system - Serial.println("Failed to mount SD card."); + Serial.println("SDCard: Failed to mount."); } return Settings; } @@ -112,7 +112,7 @@ public: { spifs->saveConfigFile(&Settings); WiFi.begin(Settings.WifiSSID, Settings.WifiPW); - Serial.println("Settings copied from SD card. Rebooting now."); + Serial.println("SDCard: Settings transfered to internal memory. Restarting now."); ESP.restart(); } } diff --git a/src/drivers/SPIStorage/SPIStorage.h b/src/drivers/SPIStorage/SPIStorage.h index 3a3ad35..2661be6 100644 --- a/src/drivers/SPIStorage/SPIStorage.h +++ b/src/drivers/SPIStorage/SPIStorage.h @@ -10,7 +10,7 @@ #include #include "..\drivers.h" -#include "..\storage.h" +#include "storage.h" // JSON configuration file #define JSON_CONFIG_FILE "/config.json" @@ -33,7 +33,7 @@ public: void saveConfigFile(TSettings*Settings) { // Save Config in JSON format - Serial.println(F("Saving configuration...")); + Serial.println(F("SPIFS: Saving configuration...")); // Create a JSON document StaticJsonDocument<512> json; @@ -47,7 +47,7 @@ public: if (!configFile) { // Error, file did not open - Serial.println("failed to open config file for writing"); + Serial.println("SPIFS: failed to open config file for writing"); } // Serialize JSON data to write to file @@ -55,7 +55,7 @@ public: if (serializeJson(json, configFile) == 0) { // Error writing file - Serial.println(F("Failed to write to file")); + Serial.println(F("SPIFS: Failed to write to file")); } // Close file configFile.close(); @@ -75,27 +75,27 @@ public: // SPIFFS.format(); // Read configuration from FS json - Serial.println("Mounting File System..."); + Serial.println("SPIFS: Mounting File System..."); TSettings Settings; // May need to make it begin(true) first time you are using SPIFFS if ((SPIFFSInitialized_)||(init())) { - Serial.println("mounted file system"); + Serial.println("SPIFS: Mounted"); if (SPIFFS.exists(JSON_CONFIG_FILE)) { // The file exists, reading and loading - Serial.println("reading config file"); + Serial.println("SPIFS: Reading config file"); File configFile = SPIFFS.open(JSON_CONFIG_FILE, "r"); if (configFile) { - Serial.println("Opened configuration file"); + Serial.println("SPIFS: Opened configuration file"); StaticJsonDocument<512> json; DeserializationError error = deserializeJson(json, configFile); configFile.close(); serializeJsonPretty(json, Serial); if (!error) { - Serial.println("Parsing JSON"); + Serial.println("SPIFS: Parsing JSON"); strcpy(Settings.PoolAddress, json["poolString"]); strcpy(Settings.BtcWallet, json["btcString"]); @@ -106,7 +106,7 @@ public: else { // Error loading JSON data - Serial.println("Failed to load json config"); + Serial.println("SPIFS: Failed to load json config"); } } } @@ -114,14 +114,14 @@ public: else { // Error mounting file system - Serial.println("Failed to mount FS"); + Serial.println("SPIFS: Failed to mount."); } return Settings; } void deleteConfigFile() { - Serial.println("Erasing config file.."); + Serial.println("SPIFS: Erasing config file.."); SPIFFS.remove(JSON_CONFIG_FILE); //Borramos fichero } };