Sha256: 04273b1c514aecffd6ebaa6740332a24b999ee022ff1d673760c9111b46f58fd
Contents?: true
Size: 812 Bytes
Versions: 41
Compression:
Stored size: 812 Bytes
Contents
#include "Types.h" #include "TemperatureFilter.h" #include <math.h> static bool initialized; static float temperatureInCelcius; void TemperatureFilter_Init(void) { initialized = FALSE; temperatureInCelcius = -INFINITY; } float TemperatureFilter_GetTemperatureInCelcius(void) { return temperatureInCelcius; } void TemperatureFilter_ProcessInput(float temperature) { if (!initialized) { temperatureInCelcius = temperature; initialized = TRUE; } else { if (temperature == +INFINITY || temperature == -INFINITY || temperature == +NAN || temperature == -NAN) { initialized = FALSE; temperature = -INFINITY; } temperatureInCelcius = (temperatureInCelcius * 0.75f) + (temperature * 0.25); } }
Version data entries
41 entries across 38 versions & 1 rubygems