20
20
*/
21
21
/* *************************************************************************/
22
22
ws_sdcard::ws_sdcard () {
23
+ is_mode_offline = false ;
23
24
_use_test_data = false ;
24
25
_sz_log_file = 0 ;
25
26
}
@@ -43,14 +44,16 @@ ws_sdcard::~ws_sdcard() {
43
44
otherwise.
44
45
*/
45
46
/* *************************************************************************/
46
- bool ws_sdcard::InitSDCard () {
47
- // Check if GetSDCSPin() threw error
48
- if (WsV2.pin_sd_cs == 255 )
47
+ bool ws_sdcard::InitSDCard (uint8_t pin_cs) {
48
+ /* if (pin_cs == 255)
49
+ return false; */
50
+ if (_sd.begin (pin_cs)) {
51
+ is_mode_offline = true ;
52
+ return is_mode_offline;
53
+ }
49
54
return false ;
50
55
51
- if (!_sd.begin (WsV2.pin_sd_cs ))
52
- return false ;
53
- return true ;
56
+
54
57
}
55
58
56
59
/* *************************************************************************/
@@ -475,14 +478,8 @@ bool ws_sdcard::parseConfigFile() {
475
478
DeserializationError error;
476
479
JsonDocument doc;
477
480
#ifndef OFFLINE_MODE_DEBUG
478
- WS_DEBUG_PRINTLN (" [SD] Parsing config.json from SD card..." );
479
- if (!_sd.exists (" config.json" )) {
480
- WS_DEBUG_PRINTLN (
481
- " [SD] FATAL Error - config.json file not found on SD Card!" );
482
- return false ;
483
- }
484
- file_config = _sd.open (" config.json" , O_RDONLY);
485
- error = deserializeJson (doc, file_config);
481
+ WS_DEBUG_PRINTLN (" [SD] Parsing config.json..." );
482
+ doc = WsV2._config_doc ;
486
483
#else
487
484
// Test Mode - do not use the SD card, use test data instead!
488
485
if (!_use_test_data) {
0 commit comments