Skip to content

Commit

Permalink
fiexed sample freq watchdog
Browse files Browse the repository at this point in the history
  • Loading branch information
BeSeeTek committed Sep 7, 2021
1 parent 2c8d7dd commit eb2ceac
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Inc/freertos_cubemx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down
21 changes: 19 additions & 2 deletions Src/freertos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -470,6 +483,10 @@ void StartBlinkThread(void const *argument) {
Sensor1.enableDataReadyInterrupt();

}
else
{
justRestarted = false;// reset just restarted flag
}
}

}
Expand Down

0 comments on commit eb2ceac

Please sign in to comment.