#include <stdio.h>
#include <signal.h>
#define OVERSAMPLE BMP_OVERSAMPLE_16
#define INTERNAL_FILTER BMP_FILTER_OFF
#define ORDER 2
#define CUTOFF_FREQ 2.0f // 2rad/s, about 0.3hz
#define BMP_CHECK_HZ 25
#define DT 1.0f/BMP_CHECK_HZ
static int running = 0;
static void signal_handler(__attribute__ ((unused)) int dummy)
{
running=0;
return;
}
int main()
{
double filtered_alt;
signal(SIGINT, signal_handler);
running = 1;
if(
rc_bmp_init(OVERSAMPLE, INTERNAL_FILTER))
return -1;
printf("\n");
printf(" temp |");
printf(" pressure |");
printf(" altitude |");
printf(" filtered |");
printf("\n");
while(running){
printf("\r");
printf(
"%6.2lfC |", data.
temp_c);
printf(
"%8.2lfm |", data.
alt_m);
printf("%8.2lfm |", filtered_alt);
fflush(stdout);
}
printf("\n");
return 0;
}