From 6a936da474a268f241c22e718eecf52a9467a536 Mon Sep 17 00:00:00 2001 From: George Alexandre Silva Date: Sun, 5 May 2024 15:36:14 -0300 Subject: [PATCH] SDCard enabled --- src/drivers/devices/esp322432s028r.h | 13 +++++++++++++ src/drivers/storage/SDCard.cpp | 19 ++++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/drivers/devices/esp322432s028r.h b/src/drivers/devices/esp322432s028r.h index 856daaa..57b1178 100644 --- a/src/drivers/devices/esp322432s028r.h +++ b/src/drivers/devices/esp322432s028r.h @@ -7,4 +7,17 @@ #define LED_PIN 4 // Red pin #define LED_PIN_G 16 // Green pin #define LED_PIN_B 17 // Green pin + +// Pin defines for the SD card interface +// This is working for both, ESP32 2432S028R and ESP 2432S028_2USB boards +// -------------------------------------- +// use SPI interface +// (default SPI unit provided by ) +// setup SPI pins. + +#define SDSPI_CS 5 +#define SDSPI_CLK 18 +#define SDSPI_MOSI 23 +#define SDSPI_MISO 19 + #endif \ No newline at end of file diff --git a/src/drivers/storage/SDCard.cpp b/src/drivers/storage/SDCard.cpp index e5ed7e0..e21b7a0 100644 --- a/src/drivers/storage/SDCard.cpp +++ b/src/drivers/storage/SDCard.cpp @@ -96,9 +96,13 @@ bool SDCard::loadConfigFile(TSettings* Settings) if (!error) { serializeJsonPretty(json, Serial); - Serial.print('\n'); - Settings->WifiSSID = json[JSON_KEY_SSID] | Settings->WifiSSID; - Settings->WifiPW = json[JSON_KEY_PASW] | Settings->WifiPW; + Serial.print('\n'); + if (json.containsKey(JSON_KEY_SSID)) { + Settings->WifiSSID = json[JSON_KEY_SSID] | Settings->WifiSSID; + } + if (json.containsKey(JSON_KEY_PASW)) { + Settings->WifiPW = json[JSON_KEY_PASW] | Settings->WifiPW; + } Settings->PoolAddress = json[JSON_KEY_POOLURL] | Settings->PoolAddress; strcpy(Settings->PoolPassword, json[JSON_KEY_POOLPASS] | Settings->PoolPassword); strcpy(Settings->BtcWallet, json[JSON_KEY_WALLETID] | Settings->BtcWallet); @@ -108,8 +112,13 @@ bool SDCard::loadConfigFile(TSettings* Settings) Settings->Timezone = json[JSON_KEY_TIMEZONE].as(); if (json.containsKey(JSON_KEY_STATS2NV)) Settings->saveStats = json[JSON_KEY_STATS2NV].as(); - if (json.containsKey(JSON_KEY_INVCOLOR)) - Settings->saveStats = json[JSON_KEY_INVCOLOR].as(); + if (json.containsKey(JSON_KEY_INVCOLOR)) { + Settings->invertColors = json[JSON_KEY_INVCOLOR].as(); + } else { + Settings->invertColors = false; + } + // Serial.printf("Carteira Lida SD:%s\n", Settings.BtcWallet); + Serial.printf("Carteira Lida SDs:%s\n", Settings->BtcWallet); return true; } else