From 48d2a6f012eee960bf24130587adec923e5e761e Mon Sep 17 00:00:00 2001 From: theFeiter Date: Mon, 11 Jul 2022 12:15:55 +0200 Subject: [PATCH] only count seconds_since_reset when logging is enabled --- FDRS_Gateway/FDRS_Gateway.ino | 2 +- FDRS_Gateway/fdrs_functions.h | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/FDRS_Gateway/FDRS_Gateway.ino b/FDRS_Gateway/FDRS_Gateway.ino index b2b2e46..bfb8634 100644 --- a/FDRS_Gateway/FDRS_Gateway.ino +++ b/FDRS_Gateway/FDRS_Gateway.ino @@ -145,7 +145,7 @@ void loop() { timeClient.update(); //update internal clock if possible #endif - #ifndef USE_WIFI + #if defined (USE_SD_LOG) || defined (USE_FS_LOG) unsigned long current_millis = millis(); if(current_millis-last_millis >= 1000){ seconds_since_reset+=(current_millis-last_millis)/1000; diff --git a/FDRS_Gateway/fdrs_functions.h b/FDRS_Gateway/fdrs_functions.h index dfe0a2a..c424dc2 100644 --- a/FDRS_Gateway/fdrs_functions.h +++ b/FDRS_Gateway/fdrs_functions.h @@ -88,12 +88,9 @@ uint8_t LoRa2[] = {mac_prefix[3], mac_prefix[4], LORA2_PEER}; //uint8_t LoRaAddress[] = {0x42, 0x00}; #endif -#ifndef USE_WIFI +#if defined (USE_SD_LOG) || defined (USE_FS_LOG) unsigned long last_millis = 0; unsigned long seconds_since_reset = 0; -#endif - -#if defined (USE_SD_LOG) || defined (USE_FS_LOG) char logBuffer[512]; uint16_t logBufferPos = 0; // datatype depends on size of sdBuffer #endif