From 7632203d60c1044b498fb5853f3c6b2c402e82c2 Mon Sep 17 00:00:00 2001 From: theFeiter Date: Sun, 3 Jul 2022 18:03:32 +0200 Subject: [PATCH] SPI seems to work simultaniously --- FDRS_Gateway/fdrs_functions.h | 37 +++++++++++++---------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/FDRS_Gateway/fdrs_functions.h b/FDRS_Gateway/fdrs_functions.h index ccbd407..76301e0 100644 --- a/FDRS_Gateway/fdrs_functions.h +++ b/FDRS_Gateway/fdrs_functions.h @@ -252,30 +252,21 @@ void getLoRa() { } void logToSD() { - #ifdef USE_LORA - end_lora(); - #endif - if(begin_SD()){ - DBG("Logging to SD card."); - DynamicJsonDocument doc(24576); - for (int i = 0; i < ln; i++) { - doc[i]["id"] = theData[i].id; - doc[i]["type"] = theData[i].t; - doc[i]["data"] = theData[i].d; - } - String outgoingString; - serializeJson(doc, outgoingString); - - File logfile = SD.open("fdrs_log.txt", FILE_WRITE); - logfile.println(outgoingString); - logfile.close(); - - end_SD(); + DBG("Logging to SD card."); + DynamicJsonDocument doc(24576); + for (int i = 0; i < ln; i++) { + doc[i]["id"] = theData[i].id; + doc[i]["type"] = theData[i].t; + doc[i]["data"] = theData[i].d; } - - #ifdef USE_LORA - begin_lora(); - #endif + String outgoingString; + serializeJson(doc, outgoingString); + + File logfile = SD.open("fdrs_log.txt", FILE_WRITE); + logfile.println(outgoingString); + logfile.close(); + + } void sendESPNOW(uint8_t address) {