Русифицированная версия программы для измерения температуры и отн. влажности и вывода информации на сенсорный TFT
Dependencies: FT800_2 HYT mbed
statistics.h
00001 #include "mbed.h" 00002 00003 #ifndef STATISTICS_H_ 00004 #define STATISTICS_H_ 00005 00006 #define INIT_STATISTICS_NUMBER 32767 00007 #define DELTA_HUMIDITY 6 00008 #define DELTA_TEMPERATURE 1 00009 #define TEMPERATURE_MULTIPLIER 10 00010 00011 /************************************************************************************************************************** 00012 ************************** User class for calculate statistics for last 24 hrs ******************************************** 00013 **************************************************************************************************************************/ 00014 00015 class Statistics 00016 { 00017 public: 00018 // xxxx24hrs[][] arrays contains all 24-hrs statistics data: 00019 // 1. xxxx24hrs[0][0...287] - Average values calculated for each five-minute interval 00020 // 2. xxxx24hrs[1][0...287] - Minimums calculated for each five-minute interval 00021 // 2. xxxx24hrs[2][0...287] - Maximums calculated for each five-minute interval 00022 // p.s. there are 288 five-minute intervals in 24 hours 00023 00024 short int humidity24hrs[3][288]; 00025 short int temperature24hrs[3][288]; 00026 00027 uint64_t UpdateStatistics(float humidity, float temperature, uint64_t seconds, uint64_t changeSecondsOffset); 00028 void InitValues(float humidity, float temperature); 00029 00030 private: 00031 00032 // functions called every second to update average value, minimum and maximum in current five-minute interval 00033 void CalculateTemperature(float temperature, short int secondsIn5min); 00034 void CalculateHumididty(float humidity, short int secondsIn5min); 00035 // function called every 5 minutes to add new value to xxxx24hrs[][] arrays 00036 uint64_t Update24hrsData(uint64_t changeSecondsOffset); 00037 00038 // counter of five-minute intervals (0...287) 00039 short int Counter24hrs; 00040 // values for calculations "inside" five-minute interval 00041 short int humidity5min[300], temperature5min[300]; 00042 int humidity5minAverage, temperature5minAverage; 00043 int humidity5minSum, temperature5minSum; 00044 short int humidity5minMax, humidity5minMin, temperature5minMax, temperature5minMin; 00045 }; 00046 00047 #endif /* STATISTICS_H_ */
Generated on Wed Jul 13 2022 04:41:34 by 1.7.2