RPiPico-Holonome2023/Monitoring.c

63 lines
1.3 KiB
C
Raw Normal View History

2023-04-28 21:51:43 +00:00
#include "pico/stdlib.h"
#include <stdio.h>
#include "Monitoring.h"
2023-04-28 21:51:43 +00:00
uint32_t temps_cycle_min = UINT32_MAX;
uint32_t temps_cycle_max=0;
int lock=0;
uint32_t debug_var=0;
float debug_varf=0;
2023-04-28 21:51:43 +00:00
void temps_cycle_check(){
static uint32_t temps_old;
uint32_t temps, temps_cycle;
temps = time_us_32();
temps_cycle = temps - temps_old;
if(temps_cycle < temps_cycle_min){
temps_cycle_min = temps_cycle;
}
if(temps_cycle > temps_cycle_max){
temps_cycle_max = temps_cycle;
}
temps_old=time_us_32();
}
void temps_cycle_reset(){
temps_cycle_min = UINT32_MAX;
temps_cycle_max=0;
}
void Monitoring_display(){
while(1){
temps_cycle_display();
}
}
2023-04-28 21:51:43 +00:00
void temps_cycle_display(){
uint32_t temps;
temps = time_us_32()/1000;
printf(">T_cycle_min(us):%ld:%d\n", temps, temps_cycle_min);
printf(">T_cycle_max(us):%ld:%d\n", temps, temps_cycle_max);
printf(">DebugVar:%ld:%d\n", temps, debug_var);
printf(">DebugVarf:%ld:%f\n", temps, debug_varf);
2023-04-28 21:51:43 +00:00
temps_cycle_reset();
}
uint32_t temps_cycle_get_min(){
return temps_cycle_min;
}
uint32_t temps_cycle_get_max(){
return temps_cycle_max;
}
void set_debug_var(uint32_t variable){
debug_var = variable;
}
void set_debug_varf(float variable){
debug_varf = variable;
}