Fix ESp8266 compile completely

This commit is contained in:
brentru 2025-04-17 11:15:41 -04:00
parent 79f6042161
commit f70f9ae888
2 changed files with 10 additions and 0 deletions

View file

@ -162,7 +162,11 @@ void WipperSnapper_LittleFS::fsHalt(String msg, ws_led_status_t status_state) {
/**************************************************************************/
void WipperSnapper_LittleFS::GetSDCSPin() {
// Attempt to open and deserialize the config.json file
#if defined(ARDUINO_ESP8266_ADAFRUIT_HUZZAH)
File file_cfg = LittleFS.open("/config.json", "r");
#else
File file_cfg = LittleFS.open("/config.json");
#endif
if (!file_cfg)
WsV2.pin_sd_cs = 255;

View file

@ -90,11 +90,13 @@ void ws_sdcard::calculateFileLimits() {
bool ws_sdcard::InitDS1307() {
_rtc_ds1307 = new RTC_DS1307();
if (!_rtc_ds1307->begin()) {
#ifndef ARDUINO_ARCH_ESP8266
if (!_rtc_ds1307->begin(&Wire1)) {
WS_DEBUG_PRINTLN("[SD] Runtime Error: Failed to initialize DS1307 RTC");
delete _rtc_ds1307;
return false;
}
#endif
}
if (!_rtc_ds1307->isrunning())
_rtc_ds1307->adjust(DateTime(F(__DATE__), F(__TIME__)));
@ -112,11 +114,13 @@ bool ws_sdcard::InitDS3231() {
WS_DEBUG_PRINTLN("Begin DS3231 init");
_rtc_ds3231 = new RTC_DS3231();
if (!_rtc_ds3231->begin(&Wire)) {
#ifndef ARDUINO_ARCH_ESP8266
if (!_rtc_ds3231->begin(&Wire1)) {
WS_DEBUG_PRINTLN("[SD] Runtime Error: Failed to initialize DS3231 RTC");
delete _rtc_ds3231;
return false;
}
#endif
}
if (_rtc_ds3231->lostPower())
_rtc_ds3231->adjust(DateTime(F(__DATE__), F(__TIME__)));
@ -135,12 +139,14 @@ bool ws_sdcard::InitPCF8523() {
if (!_rtc_pcf8523->begin(&Wire)) {
WS_DEBUG_PRINTLN(
"[SD] Runtime Error: Failed to initialize PCF8523 RTC on WIRE");
#ifndef ARDUINO_ARCH_ESP8266
if (!_rtc_pcf8523->begin(&Wire1)) {
WS_DEBUG_PRINTLN(
"[SD] Runtime Error: Failed to initialize PCF8523 RTC on WIRE1");
delete _rtc_pcf8523;
return false;
}
#endif
}
if (!_rtc_pcf8523->initialized() || _rtc_pcf8523->lostPower()) {
_rtc_pcf8523->adjust(DateTime(F(__DATE__), F(__TIME__)));