Skip to content

Commit 4a6364e

Browse files
committed
[SD] dynamic pin refactor 2
1 parent c2a2e42 commit 4a6364e

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

src/Wippersnapper_Boards.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@
125125
#define BOARD_ID "qtpy-esp32s3"
126126
#define USE_TINYUSB
127127
#define USE_STATUS_NEOPIXEL
128-
#define STATUS_NEOPIXEL_PIN PIN_NEOPIXEL
128+
#define STATUS_NEOPIXEL_PIN PIN_NEOPIXELa
129129
#elif defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2)
130130
#define BOARD_ID "qtpy-esp32s3-n4r2"
131131
#define USE_TINYUSB
132132
#define USE_STATUS_NEOPIXEL
133133
#define STATUS_NEOPIXEL_PIN PIN_NEOPIXEL
134-
#define STATUS_NEOPIXEL_NUM 1
134+
#define STATUS_NEOPIXEL_NUM 1a
135135
#define USE_PSRAM ///< Board has PSRAM, use it for dynamic memory allocation
136136
#elif defined(ARDUINO_ADAFRUIT_QTPY_ESP32C3)
137137
#define BOARD_ID "qtpy-esp32c3"

src/Wippersnapper_V2.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ void Wippersnapper_V2::provisionV2() {
105105
#endif
106106

107107
// Are we using sd-card/offline mode?
108-
WsV2._fileSystemV2->GetSDCSPin(); // TODO: Implement this for LittleFS TOO
108+
#ifdef USE_TINYUSB
109+
_fileSystemV2->GetSDCSPin();
110+
// TODO: Implement this for LittleFS TOO and do an elseif for USE_LITTLEFS
111+
#endif
109112
if (WsV2._sdCardV2->InitSDCard())
110113
return;
111114

src/provisioning/littlefs/WipperSnapper_LittleFS_V2.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,25 @@ void WipperSnapper_LittleFS_V2::fsHalt(String msg) {
155155
}
156156
}
157157

158+
void WipperSnapper_LittleFS_V2::GetSDCSPin() {
159+
160+
BRENT YOU WERE HERE YOU WERE HERE !!!
161+
162+
File file_cfg = LittleFS.open("/config.json");
163+
if (!file_cfg) {
164+
WsV2.pin_sd_cs = 255;
165+
return;
166+
}
167+
DeserializationError error = deserializeJson(doc, file_cfg);
168+
// failed to deserialize the config file, bail out
169+
if (error) {
170+
file_cfg.close();
171+
WsV2.pin_sd_cs = 255;
172+
return;
173+
}
174+
JsonObject exportedFromDevice = doc["exportedFromDevice"];
175+
WsV2.pin_sd_cs = exportedFromDevice["sd_cs_pin"] | 255;
176+
file_cfg.close();
177+
}
178+
158179
#endif

src/provisioning/littlefs/WipperSnapper_LittleFS_V2.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class WipperSnapper_LittleFS_V2 {
3434
~WipperSnapper_LittleFS_V2();
3535
void parseSecrets();
3636
void fsHalt(String msg);
37+
void GetSDCSPin();
3738
};
3839
extern Wippersnapper_V2 WsV2;
3940
#endif // WIPPERSNAPPER_LITTLEFS_H

src/provisioning/tinyusb/Wippersnapper_FS_V2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Wippersnapper_FS_V2::~Wippersnapper_FS_V2() {
162162
wipperFatFs_v2.end();
163163
}
164164

165-
void GetSDCSPin() {
165+
void Wippersnapper_FS_V2::GetSDCSPin() {
166166
File32 file_cfg = wipperFatFs_v2.open("/config.json");
167167
if (!file_cfg) {
168168
WsV2.pin_sd_cs = 255;

0 commit comments

Comments
 (0)