From eb2ceacf05db5f4a9c47d535b86dd35c36326d63 Mon Sep 17 00:00:00 2001 From: Benedikt Seeger Date: Tue, 7 Sep 2021 12:36:28 +0200 Subject: [PATCH] fiexed sample freq watchdog --- Inc/freertos_cubemx.h | 2 +- Src/freertos.cpp | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Inc/freertos_cubemx.h b/Inc/freertos_cubemx.h index a677c5f..dea5cb7 100755 --- a/Inc/freertos_cubemx.h +++ b/Inc/freertos_cubemx.h @@ -78,7 +78,7 @@ extern "C" { #include "SEGGER_RTT.h" #include "tim64extender.h" #define VERSION_MAJOR 0 -#define VERSION_MINOR 6 +#define VERSION_MINOR 7 #define VERSION_PATCH 1 const uint8_t UDP_TARGET_DEFAULT_IP_ADDRESS[4] = { 192, 168, 0, 200 }; diff --git a/Src/freertos.cpp b/Src/freertos.cpp index 75cfc90..7b17f59 100644 --- a/Src/freertos.cpp +++ b/Src/freertos.cpp @@ -437,8 +437,21 @@ void StartBlinkThread(void const *argument) { SEGGER_RTT_printf(0, "Sensor ID %u nopminal sample freq %d actual sample freq %d \n", i, (int) nominalFreq, (int) deltaSamples); - if ((deltaSamples > nominalFreq * 1.25) - || (deltaSamples < (nominalFreq * 0.75))) { + bool freqToHigh=deltaSamples > (nominalFreq * 1.25); + bool freqToLow=deltaSamples < (nominalFreq * 0.75); + if (freqToHigh or freqToLow){ + if(freqToHigh) + { + SEGGER_RTT_printf(0, + "Sensor ID %u Freq to HIGH\n", + i) ; + } + else + { + SEGGER_RTT_printf(0, + "Sensor ID %u Freq to LOW\n", + i) ; + } if (justRestarted == false) { Sensor0.disableDataReadyInterrupt(); Sensor1.disableDataReadyInterrupt(); @@ -470,6 +483,10 @@ void StartBlinkThread(void const *argument) { Sensor1.enableDataReadyInterrupt(); } + else + { + justRestarted = false;// reset just restarted flag + } } }