From 150eb720699e53b5c88ea5c3b80a32ac655638b6 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Fri, 28 Jan 2022 21:50:48 +0100 Subject: [PATCH 1/4] update comments in board hal files --- src/hal/heltec.h | 2 +- src/hal/heltecv2.h | 2 +- src/hal/heltecv21.h | 2 +- src/hal/lolin32lite.h | 2 +- src/hal/lolin32litelora.h | 2 +- src/hal/ttgov1.h | 2 +- src/hal/ttgov21new.h | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hal/heltec.h b/src/hal/heltec.h index 47877577..55f7332a 100644 --- a/src/hal/heltec.h +++ b/src/hal/heltec.h @@ -18,7 +18,7 @@ #define CFG_sx1276_radio 1 #define HAS_DISPLAY 1 // OLED-Display on board -#define HAS_LED LED_BUILTIN // white LED on board +#define HAS_LED LED_BUILTIN // white LED on board (set to NOT_A_PIN to disable) #define HAS_BUTTON KEY_BUILTIN // button "PROG" on board // Pins for I2C interface of OLED Display diff --git a/src/hal/heltecv2.h b/src/hal/heltecv2.h index b33863ff..b6aab088 100644 --- a/src/hal/heltecv2.h +++ b/src/hal/heltecv2.h @@ -20,7 +20,7 @@ #define CFG_sx1276_radio 1 #define HAS_DISPLAY 1 // OLED-Display on board -#define HAS_LED LED_BUILTIN // white LED on board +#define HAS_LED LED_BUILTIN // white LED on board (set to NOT_A_PIN to disable) #define HAS_BUTTON KEY_BUILTIN // button "PROG" on board #define BAT_MEASURE_ADC ADC2_GPIO13_CHANNEL // battery probe GPIO pin diff --git a/src/hal/heltecv21.h b/src/hal/heltecv21.h index 9586edfd..a24d875a 100644 --- a/src/hal/heltecv21.h +++ b/src/hal/heltecv21.h @@ -20,7 +20,7 @@ #define CFG_sx1276_radio 1 #define HAS_DISPLAY 1 // OLED-Display on board -#define HAS_LED LED_BUILTIN // white LED on board +#define HAS_LED LED_BUILTIN // white LED on board (set to NOT_A_PIN to disable) #define HAS_BUTTON KEY_BUILTIN // button "PROG" on board #define BAT_MEASURE_ADC ADC1_GPIO37_CHANNEL // battery probe GPIO pin diff --git a/src/hal/lolin32lite.h b/src/hal/lolin32lite.h index 1c860393..3f9f9fe0 100644 --- a/src/hal/lolin32lite.h +++ b/src/hal/lolin32lite.h @@ -10,7 +10,7 @@ // Hardware related definitions for lolin32lite (without LoRa shield) #define HAS_LED LED_BUILTIN // on board LED on GPIO5 -#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW +#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW (set to NOT_A_PIN to disable) #define MY_SDA SDA #define MY_SCL SCL diff --git a/src/hal/lolin32litelora.h b/src/hal/lolin32litelora.h index f0b99250..d3ae2133 100644 --- a/src/hal/lolin32litelora.h +++ b/src/hal/lolin32litelora.h @@ -15,7 +15,7 @@ #define HAS_DISPLAY 1 // OLED-Display on board //#define MY_DISPLAY_FLIP 1 // uncomment this for rotated display -#define HAS_LED 22 // ESP32 GPIO12 (pin22) On Board LED +#define HAS_LED 22 // ESP32 GPIO12 (pin22) On Board LED (set to NOT_A_PIN to disable) #define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW #define HAS_RGB_LED SmartLed rgb_led(LED_WS2812, 1, GPIO_NUM_13) // ESP32 GPIO13 (pin13) On Board Shield WS2812B RGB LED #define HAS_BUTTON 15 // ESP32 GPIO15 (pin15) Button is on the LoraNode32 shield diff --git a/src/hal/ttgov1.h b/src/hal/ttgov1.h index bb1b63e7..cc0493c8 100644 --- a/src/hal/ttgov1.h +++ b/src/hal/ttgov1.h @@ -14,7 +14,7 @@ #define HAS_DISPLAY 1 // OLED-Display on board //#define MY_DISPLAY_FLIP 1 // uncomment this for rotated display -#define HAS_LED LED_BUILTIN +#define HAS_LED LED_BUILTIN // set to NOT_A_PIN to disable #define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW #define HAS_BUTTON KEY_BUILTIN diff --git a/src/hal/ttgov21new.h b/src/hal/ttgov21new.h index 71c22bca..5c531423 100644 --- a/src/hal/ttgov21new.h +++ b/src/hal/ttgov21new.h @@ -16,10 +16,10 @@ #define CFG_sx1276_radio 1 // HPD13A LoRa SoC // enable only if you want to store a local paxcount table on the device -#define HAS_SDCARD 2 // // this board has a SDMMC card-reader/writer +#define HAS_SDCARD 2 // this board has a SDMMC card-reader/writer #define HAS_DISPLAY 1 -#define HAS_LED (25) // green on board LED +#define HAS_LED (25) // green on board LED (set to NOT_A_PIN to disable) #define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7 #define BAT_VOLTAGE_DIVIDER 2 // voltage divider 100k/100k on board From db60afe05d0ecb8f2568383d82e63e4725f94fe0 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Fri, 28 Jan 2022 22:17:17 +0100 Subject: [PATCH 2/4] remove unused ENS/CWA code --- README.md | 20 ++----- include/corona.h | 16 ------ include/display.h | 4 -- include/globals.h | 1 - include/main.h | 1 - include/senddata.h | 4 -- src/TTN/packed_decoder.js | 5 -- src/TTNv3/packed_decodeUplink.js | 5 -- src/TTNv3/plain_decodeUplink.js | 7 --- src/configmanager.cpp | 1 - src/corona.cpp | 54 ------------------- src/display.cpp | 14 +---- .../opensource/esp32-paxcounter-packed.js | 7 +-- src/main.cpp | 6 --- src/paxcounter_orig.conf | 4 -- src/rcommand.cpp | 11 +--- src/senddata.cpp | 4 -- src/sensor.cpp | 12 ----- 18 files changed, 9 insertions(+), 167 deletions(-) delete mode 100644 include/corona.h delete mode 100644 src/corona.cpp diff --git a/README.md b/README.md index e8ad0b69..a61d400a 100644 --- a/README.md +++ b/README.md @@ -216,15 +216,6 @@ Paxcounter can be used to sync a wall clock which has a DCF77 or IF482 time tele This describes how to set up a mobile PaxCounter:
Follow all steps so far for preparing the device, selecting the packed payload format. In `paxcounter.conf` set PAYLOAD_OPENSENSEBOX to 1. Register a new sensebox on https://opensensemap.org/. In the sensor configuration select "TheThingsNetwork" and set decoding profile to "LoRa serialization". Enter your TTN Application and Device ID. Setup decoding option using `[{"decoder":"latLng"},{"decoder":"uint16",sensor_id":"yoursensorid"}]` -# Covid-19 Exposure Notification System beacon detection (currently NOT working with v3.0.x, use v2.4.x for this feature) - -Bluetooth low energy service UUID 0xFD6F, used by Google/Apple COVID-19 Exposure Notification System, can be monitored and counted. By comparing with the total number of observed devices this gives an indication how many people staying in proximity are using Apps for tracing COVID-19 exposures, e.g. in Germany the "Corona Warn App". To achive best results with this funcion, use following settings in `paxcounter.conf`: - - #define COUNT_ENS 1 // enable ENS monitoring function - #define BLECOUNTER 1 // enable bluetooth sniffing - #define WIFICOUNTER 0 // disable wifi sniffing (improves BLE scan speed) - #define HAS_SENSOR_1 1 // optional, in board's hal file: transmit ENS counter data to server - # SD-card Data can be stored on an SD-card if one is availabe. Simply choose the file in src/hal and add the following lines to your hal-file: @@ -384,7 +375,7 @@ Hereafter described is the default *plain* format, which uses MSB bit numbering. **Ports #10, #11, #12:** User sensor data - Format is specified by user in function `sensor_read(uint8_t sensor)`, see `src/sensor.cpp`. Port #10 is also used for ENS counter (2 bytes = 16 bit), if ENS is compiled AND ENS data transfer is enabled + Format is specified by user in function `sensor_read(uint8_t sensor)`, see `src/sensor.cpp`. # Remote control @@ -504,7 +495,7 @@ Send for example `83` `86` as Downlink on Port 2 to get battery status and time/ 0x02 = RESERVED_DATA 0x04 = MEMS_DATA 0x08 = GPS_DATA - 0x10 = SENSOR_1_DATA (also ENS counter) + 0x10 = SENSOR_1_DATA 0x20 = SENSOR_2_DATA 0x40 = SENSOR_3_DATA 0x80 = BATT_DATA @@ -525,10 +516,9 @@ Send for example `83` `86` as Downlink on Port 2 to get battery status and time/ 0 = disabled 1 = enabled [default] -0x18 set ENS counter on/off +0x18 reserved - 0 = disabled [default] - 1 = enabled + unused, does nothing 0x19 set sleep cycle @@ -622,4 +612,4 @@ Thanks to - [terrillmoore](https://github.com/mcci-catena) for maintaining the LMIC for arduino LoRaWAN stack - [sbamueller](https://github.com/sbamueller) for writing the tutorial in Make Magazine - [Stefan](https://github.com/nerdyscout) for paxcounter opensensebox integration -- [August Quint](https://github.com/AugustQu) for adding SD card data logger, SDS011 and ENS support +- [August Quint](https://github.com/AugustQu) for adding SD card data logger and SDS011 support diff --git a/include/corona.h b/include/corona.h deleted file mode 100644 index 9af0d314..00000000 --- a/include/corona.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _CORONA_h -#define _CORONA_H - -// inspired by https://github.com/kmetz/BLEExposureNotificationBeeper -// (c) by Kaspar Metz -// modified for use in the Paxcounter by AQ - -#include "globals.h" -#include - -bool cwa_init(void); -void cwa_mac_add(uint16_t hashedmac); -void cwa_clear(void); -uint16_t cwa_report(void); - -#endif diff --git a/include/display.h b/include/display.h index 2b00aa44..62cdf363 100644 --- a/include/display.h +++ b/include/display.h @@ -6,10 +6,6 @@ #include "qrcode.h" #include "power.h" -#if (COUNT_ENS) -#include "corona.h" -#endif - #if (HAS_DISPLAY) == 1 #include #elif (HAS_DISPLAY) == 2 diff --git a/include/globals.h b/include/globals.h index fb2e773e..9b141b09 100644 --- a/include/globals.h +++ b/include/globals.h @@ -71,7 +71,6 @@ typedef struct __attribute__((packed)) { uint8_t wifiant; // 0=internal, 1=external (for LoPy/LoPy4) uint8_t rgblum; // RGB Led luminosity (0..100%) uint8_t payloadmask; // bitswitches for payload data - uint8_t enscount; // 0=disabled 1= enabled #ifdef HAS_BME680 uint8_t diff --git a/include/main.h b/include/main.h index a0772b03..6fa72b11 100644 --- a/include/main.h +++ b/include/main.h @@ -18,7 +18,6 @@ #include "sensor.h" #include "lorawan.h" #include "timekeeper.h" -#include "corona.h" #include "boot.h" #include "libpax_helpers.h" #include "power.h" diff --git a/include/senddata.h b/include/senddata.h index 4ae83018..6c44dfa7 100644 --- a/include/senddata.h +++ b/include/senddata.h @@ -10,10 +10,6 @@ #include "display.h" #include "sdcard.h" -#if (COUNT_ENS) -#include "corona.h" -#endif - extern struct count_payload_t count_from_libpax; void SendPayload(uint8_t port); diff --git a/src/TTN/packed_decoder.js b/src/TTN/packed_decoder.js index f338e6df..7230fb46 100644 --- a/src/TTN/packed_decoder.js +++ b/src/TTN/packed_decoder.js @@ -84,11 +84,6 @@ function Decoder(bytes, port) { } } - if (port === 10) { - // ENS count - return decode(bytes, [uint16], ['ens']); - } - } diff --git a/src/TTNv3/packed_decodeUplink.js b/src/TTNv3/packed_decodeUplink.js index a010f3dc..94c1ec8b 100644 --- a/src/TTNv3/packed_decodeUplink.js +++ b/src/TTNv3/packed_decodeUplink.js @@ -90,11 +90,6 @@ function decodeUplink(input) { data = decode(input.bytes, [uint32, uint8], ['time', 'timestatus']); } } - - if (input.fPort === 10) { - // ENS count - data = decode(input.bytes, [uint16], ['ens']); - } data.bytes = input.bytes; // comment out if you do not want to include the original payload data.port = input.fPort; // comment out if you do not want to inlude the port diff --git a/src/TTNv3/plain_decodeUplink.js b/src/TTNv3/plain_decodeUplink.js index d19feb48..0b1b8c23 100644 --- a/src/TTNv3/plain_decodeUplink.js +++ b/src/TTNv3/plain_decodeUplink.js @@ -84,13 +84,6 @@ function decodeUplink(input) { } } - if (input.fPort === 10) { - var i = 0; - if (input.bytes.length >= 2) { - data.ens = (input.bytes[i++] << 8) | input.bytes[i++]; - } - } - if (data.hdop) { data.hdop /= 100; data.latitude /= 1000000; diff --git a/src/configmanager.cpp b/src/configmanager.cpp index 7de8d127..256c9f2d 100644 --- a/src/configmanager.cpp +++ b/src/configmanager.cpp @@ -57,7 +57,6 @@ static void defaultConfig(configData_t *myconfig) { myconfig->wifiant = 0; // 0=internal, 1=external (for LoPy/LoPy4) myconfig->rgblum = RGBLUMINOSITY; // RGB Led luminosity (0..100%) myconfig->payloadmask = PAYLOADMASK; // payloads as defined in default - myconfig->enscount = COUNT_ENS; // 0=disabled, 1=enabled #ifdef HAS_BME680 // initial BSEC state for BME680 sensor diff --git a/src/corona.cpp b/src/corona.cpp deleted file mode 100644 index bd20fb17..00000000 --- a/src/corona.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// routines for counting the number of devices which advertise Exposure -// Notification Service e.g. "Corona Warn App" in Germany - -// copied from https://github.com/kmetz/BLEExposureNotificationBeeper -// (c) by Kaspar Metz -// modified for use in the Paxcounter by AQ - -#if (COUNT_ENS) && !(BLECOUNTER) -#warning ENS-Counter needs Bluetooth, but Bluetooth compile option is disabled -#endif - -#if (COUNT_ENS) - -// Local logging tag -static const char TAG[] = __FILE__; - -#define BT_BD_ADDR_HEX(addr) \ - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] - -#include "corona.h" - -// When to forget old senders ** currently not used ** -#define FORGET_AFTER_MINUTES 2 - -// array of timestamps for seen notifiers: hash -> timestamp[ms] -static std::map cwaSeenNotifiers; - -// Remove notifiers last seen over FORGET_AFTER_MINUTES ago. -void cwa_clear() { -#ifdef VERBOSE - ESP_LOGV(TAG, "CWA: forget old notifier: %d", cwaSeenNotifiers.size()); - for (auto const ¬ifier : cwaSeenNotifiers) { - ESP_LOGD(TAG, "CWA forget <%04X>", notifier.first); - // } - } -#endif - // clear everything, otherwise we would count the same device again, as in the - // next cycle it likely will advertise with a different hash-value - cwaSeenNotifiers.clear(); -} - -// return the total number of devices seen advertising ENS -uint16_t cwa_report(void) { return cwaSeenNotifiers.size(); } - -bool cwa_init(void) { - ESP_LOGD(TAG, "init BLE-scanner for ENS"); - return true; -} - -void cwa_mac_add(uint16_t hashedmac) { - cwaSeenNotifiers[hashedmac] = millis(); // hash last seen at .... -} - -#endif diff --git a/src/display.cpp b/src/display.cpp index fdf70904..10722fa3 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -268,12 +268,7 @@ void dp_drawPage(bool nextpage) { else dp_printf("WIFI:off"); if (cfg.blescan) -#if (COUNT_ENS) - if (cfg.enscount) - dp_printf(" CWA:%-5d", cwa_report()); - else -#endif - dp_printf("BLTH:%-5d", count_from_libpax.ble_count); + dp_printf("BLTH:%-5d", count_from_libpax.ble_count); else dp_printf(" BLTH:off"); #elif ((WIFICOUNTER) && (!BLECOUNTER)) @@ -284,12 +279,7 @@ void dp_drawPage(bool nextpage) { #elif ((!WIFICOUNTER) && (BLECOUNTER)) if (cfg.blescan) dp_printf("BLTH:%-5d", count_from_libpax.ble_count); -#if (COUNT_ENS) - if (cfg.enscount) - dp_printf("(CWA:%d)", cwa_report()); - else -#endif - dp_printf("BLTH:off"); + dp_printf("BLTH:off"); #else dp_printf("Sniffer disabled"); #endif diff --git a/src/lorawan-devices-repo/vendor/opensource/esp32-paxcounter-packed.js b/src/lorawan-devices-repo/vendor/opensource/esp32-paxcounter-packed.js index d82e56e9..b9fc15a1 100644 --- a/src/lorawan-devices-repo/vendor/opensource/esp32-paxcounter-packed.js +++ b/src/lorawan-devices-repo/vendor/opensource/esp32-paxcounter-packed.js @@ -90,12 +90,7 @@ function decodeUplink(input) { data = decode(input.bytes, [uint32, uint8], ['time', 'timestatus']); } } - - if (input.fPort === 10) { - // ENS count - data = decode(input.bytes, [uint16], ['ens']); - } - + data.bytes = input.bytes; // comment out if you do not want to include the original payload data.port = input.fPort; // comment out if you do not want to inlude the port diff --git a/src/main.cpp b/src/main.cpp index 82398073..4bc007ab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -337,15 +337,9 @@ void setup() { // initialize sensors #if (HAS_SENSORS) #if (HAS_SENSOR_1) -#if (COUNT_ENS) - ESP_LOGI(TAG, "init CWA-counter"); - if (cwa_init()) - strcat_P(features, " CWA"); -#else strcat_P(features, " SENS(1)"); sensor_init(); #endif -#endif #if (HAS_SENSOR_2) strcat_P(features, " SENS(2)"); sensor_init(); diff --git a/src/paxcounter_orig.conf b/src/paxcounter_orig.conf index 0fe927b9..a96a8c53 100644 --- a/src/paxcounter_orig.conf +++ b/src/paxcounter_orig.conf @@ -27,10 +27,6 @@ #define BLESCANWINDOW 80 // [milliseconds] scan window, see below, 3 .. 10240, default 80ms #define BLESCANINTERVAL 80 // [illiseconds] scan interval, see below, 3 .. 10240, default 80ms = 100% duty cycle -// Corona Exposure Notification Service(ENS) counter -#define COUNT_ENS 0 // count found number of devices which advertise Exposure Notification Service - // set to 1 if you want to enable this function [default=0] - /* Note: guide for setting bluetooth parameters * * |< Scan Window > |< Scan Window > | ... |< Scan Window > | diff --git a/src/rcommand.cpp b/src/rcommand.cpp index 08c7618d..ecaadca7 100644 --- a/src/rcommand.cpp +++ b/src/rcommand.cpp @@ -397,15 +397,6 @@ void set_flush(uint8_t val[]) { // used to open receive window on LoRaWAN class a nodes }; -void set_enscount(uint8_t val[]) { - ESP_LOGI(TAG, "Remote command: set ENS_COUNT to %s", val[0] ? "on" : "off"); - cfg.enscount = val[0] ? 1 : 0; - if (val[0]) - cfg.payloadmask |= (uint8_t)SENSOR1_DATA; - else - cfg.payloadmask &= (uint8_t)~SENSOR1_DATA; -} - void set_loadconfig(uint8_t val[]) { ESP_LOGI(TAG, "Remote command: load config from NVRAM"); loadConfig(); @@ -430,7 +421,7 @@ static const cmd_t table[] = { {0x10, set_rgblum, 1}, {0x13, set_sensor, 2}, {0x14, set_payloadmask, 1}, {0x15, set_bme, 1}, {0x16, set_batt, 1}, {0x17, set_wifiscan, 1}, - {0x18, set_enscount, 1}, {0x19, set_sleepcycle, 2}, + {0x18, set_flush, 0}, {0x19, set_sleepcycle, 2}, {0x20, set_loadconfig, 0}, {0x21, set_saveconfig, 0}, {0x80, get_config, 0}, {0x81, get_status, 0}, {0x83, get_batt, 0}, {0x84, get_gps, 0}, diff --git a/src/senddata.cpp b/src/senddata.cpp index bc9ee702..9b7a5e57 100644 --- a/src/senddata.cpp +++ b/src/senddata.cpp @@ -159,10 +159,6 @@ void sendData() { payload.reset(); payload.addSensor(sensor_read(1)); SendPayload(SENSOR1PORT); -#if (COUNT_ENS) - if (cfg.countermode != 1) - cwa_clear(); -#endif break; #endif #if (HAS_SENSOR_2) diff --git a/src/sensor.cpp b/src/sensor.cpp index 21f212f5..2d077175 100644 --- a/src/sensor.cpp +++ b/src/sensor.cpp @@ -2,12 +2,6 @@ #include "globals.h" #include "sensor.h" -#if (COUNT_ENS) -#include "payload.h" -#include "corona.h" -extern PayloadConvert payload; -#endif - // Local logging tag static const char TAG[] = __FILE__; @@ -53,16 +47,10 @@ uint8_t *sensor_read(uint8_t sensor) { case 1: // insert user specific sensor data frames here - // note: Sensor1 fields are used for ENS count, if ENS detection enabled -#if (COUNT_ENS) - if (cfg.enscount) - payload.addCount(cwa_report(), MAC_SNIFF_BLE_ENS); -#else buf[0] = length; buf[1] = 0x01; buf[2] = 0x02; buf[3] = 0x03; -#endif break; case 2: From 51c6a41180040a3498e422a98e5dc14e883d536b Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 29 Jan 2022 13:47:59 +0100 Subject: [PATCH 3/4] flush to sd card before sleep --- include/reset.h | 1 + include/sdcard.h | 3 ++- src/reset.cpp | 5 +++++ src/sdcard.cpp | 8 +++++++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/reset.h b/include/reset.h index bffff1bc..64d25437 100644 --- a/include/reset.h +++ b/include/reset.h @@ -8,6 +8,7 @@ #include "lorawan.h" #include "display.h" #include "power.h" +#include "sdcard.h" void reset_rtc_vars(void); void do_reset(bool warmstart); diff --git a/include/sdcard.h b/include/sdcard.h index 4d04f3ab..6718616b 100644 --- a/include/sdcard.h +++ b/include/sdcard.h @@ -61,7 +61,8 @@ #define SDCARD_FILE_HEADER_VOLTAGE ",voltage" #endif -bool sdcard_init(void); +bool sdcard_init(bool create = true); +bool sdcard_close(void); void sdcardWriteData(uint16_t, uint16_t, uint16_t = 0); #endif // _SDCARD_H diff --git a/src/reset.cpp b/src/reset.cpp index d21a042d..b67d8dae 100644 --- a/src/reset.cpp +++ b/src/reset.cpp @@ -126,6 +126,11 @@ void enter_deepsleep(const uint64_t wakeup_sec, gpio_num_t wakeup_gpio) { sds011_sleep(); #endif +// flush & close sd card, if we have +#if (HAS_SDCARD) + sdcard_close(); +#endif + // wait a while (max 100 sec) to clear send queues ESP_LOGI(TAG, "Waiting until send queues are empty..."); for (i = 100; i > 0; i--) { diff --git a/src/sdcard.cpp b/src/sdcard.cpp index 396f5257..da204982 100644 --- a/src/sdcard.cpp +++ b/src/sdcard.cpp @@ -13,7 +13,13 @@ static void createFile(void); File fileSDCard; -bool sdcard_init() { +bool sdcard_close(void) { + ESP_LOGD(TAG, "unmounting SD-card"); + fileSDCard.flush(); + fileSDCard.end(); +} + +bool sdcard_init(bool create) { ESP_LOGI(TAG, "looking for SD-card..."); // for usage of SD drivers on ESP32 platform see From d97f57faa07b5262c2dc58e9cf08cc129ee41fe5 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 29 Jan 2022 13:49:12 +0100 Subject: [PATCH 4/4] reset.h: add missing forward declaration sds011 --- include/reset.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/reset.h b/include/reset.h index 64d25437..6ce2661e 100644 --- a/include/reset.h +++ b/include/reset.h @@ -9,6 +9,7 @@ #include "display.h" #include "power.h" #include "sdcard.h" +#include "sds011read.h" void reset_rtc_vars(void); void do_reset(bool warmstart);