![](/media/cache/profiles/9f0876a200701e5fdece2e58aa965574.jpg.50x50_q85.jpg)
Русифицированная версия программы для измерения температуры и отн. влажности и вывода информации на сенсорный TFT
Dependencies: FT800_2 HYT mbed
display.Draw_3hrsStatistics.cpp
00001 #include "display.h" 00002 00003 /************************************************************************************************************************** 00004 ************************** Display data about humidity in the three-hour interval ***************************************** 00005 **************************************************************************************************************************/ 00006 00007 void Display::StatHumidity_3hrs(volatile uint64_t seconds, short int statistics24hrs[3][288], uint64_t gridSecondsOffset) 00008 { 00009 // start FT800 display list 00010 StartDL(); 00011 00012 // mark 6 areas for touch input (for zoom in), 00013 // make each every second zone gray, make the active zone green 00014 char ZonesCnt = 0; 00015 for (int i = 25; i < 433; i += 68) { 00016 (*_TFT).DL(COLOR_RGB(255, 255, 255)); 00017 if (ZonesCnt % 2 == 0) { 00018 (*_TFT).DL(COLOR_RGB(233, 233, 233)); 00019 } 00020 if (pressedButton - ZONE_1_PRESS == ZonesCnt) { 00021 (*_TFT).DL(COLOR_RGB(200, 255, 200)); 00022 timePoint30min = 6 * ZonesCnt; 00023 } 00024 (*_TFT).DL(TAG_MASK(1)); 00025 (*_TFT).DL(TAG(ZONE_1_PRESS + ZonesCnt)); 00026 (*_TFT).DL(BEGIN(RECTS)); 00027 (*_TFT).DL(VERTEX2II(i, 100, 0, 0)); 00028 (*_TFT).DL(VERTEX2II(i + 68, 200, 0, 0)); 00029 (*_TFT).DL(TAG_MASK(0)); 00030 ZonesCnt++; 00031 } 00032 00033 // create time string, GridLines, link to main menu 00034 TimeSinceTurnOn(seconds); 00035 VerticalGrid3hrs(gridSecondsOffset); 00036 HorisontalGrid_Statistics_Humidity(); 00037 MainMenuReference(); 00038 00039 // draw graph line 00040 for (int i = 0; i < 36; i++) { 00041 char currentValue = statistics24hrs[0][i + timePoint3hrs]; 00042 char currentMinValue = statistics24hrs[1][i + timePoint3hrs]; 00043 char currentMaxValue = statistics24hrs[2][i + timePoint3hrs]; 00044 if (currentValue != INIT_STATISTICS_NUMBER) { 00045 (*_TFT).DL(COLOR_RGB(9, 0, 63)); 00046 if (currentMaxValue - currentMinValue >= DELTA_HUMIDITY) { 00047 (*_TFT).DL(COLOR_RGB(207, 45, 13)); 00048 (*_TFT).DL(BEGIN(LINES)); 00049 (*_TFT).DL(LINE_WIDTH(16)); 00050 (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentValue) * 16)); 00051 (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentMaxValue) * 16)); 00052 (*_TFT).DL(VERTEX2F(i * 181 + 22 * 16, (200 - currentMaxValue) * 16)); 00053 (*_TFT).DL(VERTEX2F(i * 181 + 28 * 16, (200 - currentMaxValue) * 16)); 00054 (*_TFT).DL(END()); 00055 (*_TFT).DL(BEGIN(LINES)); 00056 (*_TFT).DL(LINE_WIDTH(16)); 00057 (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentValue) * 16)); 00058 (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentMinValue) * 16)); 00059 (*_TFT).DL(VERTEX2F(i * 181 + 22 * 16, (200 - currentMinValue) * 16)); 00060 (*_TFT).DL(VERTEX2F(i * 181 + 28 * 16, (200 - currentMinValue) * 16)); 00061 (*_TFT).DL(END()); 00062 } 00063 (*_TFT).DL(BEGIN(POINTS)); 00064 (*_TFT).DL(POINT_SIZE(45)); 00065 (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentValue) * 16)); 00066 } 00067 } 00068 00069 // write main title 00070 (*_TFT).DL(COLOR_RGB(0, 0, 0)); 00071 CreateStringRussian("Отн. влажность за 3 часа"); 00072 (*_TFT).Text(15, 15, 3, 0, russianStr); 00073 00074 // finish FT800 display list 00075 FinishDL(); 00076 } 00077 00078 /************************************************************************************************************************** 00079 ************************** Display data about temeprature in the three-hour interval ************************************** 00080 **************************************************************************************************************************/ 00081 void Display::StatTemperature_3hrs(volatile uint64_t seconds, short int statistics24hrs[3][288], uint64_t gridSecondsOffset) 00082 { 00083 // start FT800 display list 00084 StartDL(); 00085 00086 // mark 6 areas for touch input (for zoom in), 00087 // make each every second zone gray, make the active zone green 00088 char ZonesCnt = 0; 00089 for (int i = 25; i < 433; i += 68) { 00090 (*_TFT).DL(COLOR_RGB(255, 255, 255)); 00091 if (ZonesCnt % 2 == 0) { 00092 (*_TFT).DL(COLOR_RGB(233, 233, 233)); 00093 } 00094 if (pressedButton - ZONE_1_PRESS == ZonesCnt) { 00095 (*_TFT).DL(COLOR_RGB(200, 255, 200)); 00096 timePoint30min = 6 * ZonesCnt; 00097 } 00098 (*_TFT).DL(TAG_MASK(1)); 00099 (*_TFT).DL(TAG(ZONE_1_PRESS + ZonesCnt)); 00100 (*_TFT).DL(BEGIN(RECTS)); 00101 (*_TFT).DL(VERTEX2II(i, 100, 0, 0)); 00102 (*_TFT).DL(VERTEX2II(i + 68, 200, 0, 0)); 00103 (*_TFT).DL(TAG_MASK(0)); 00104 ZonesCnt++; 00105 } 00106 00107 // create time string, GridLines, link to main menu 00108 TimeSinceTurnOn(seconds); 00109 VerticalGrid3hrs(gridSecondsOffset); 00110 HorisontalGrid_Statistics_Temperature(); 00111 MainMenuReference(); 00112 00113 // draw graph line 00114 for (int i = 0; i < 36; i++) { 00115 char currentValue = (statistics24hrs[0][i + timePoint3hrs] / TEMPERATURE_MULTIPLIER + 50) * 0.57; 00116 char currentMinValue = (statistics24hrs[1][i + timePoint3hrs] / TEMPERATURE_MULTIPLIER + 50) * 0.57; 00117 char currentMaxValue = (statistics24hrs[2][i + timePoint3hrs] / TEMPERATURE_MULTIPLIER + 50) * 0.57; 00118 char delta = statistics24hrs[2][i + timePoint3hrs] - statistics24hrs[1][i + timePoint3hrs]; 00119 00120 if (statistics24hrs[0][i + timePoint3hrs] != INIT_STATISTICS_NUMBER) { 00121 (*_TFT).DL(COLOR_RGB(9, 0, 63)); 00122 if (delta >= DELTA_TEMPERATURE + TEMPERATURE_MULTIPLIER) { 00123 (*_TFT).DL(COLOR_RGB(207, 45, 13)); 00124 (*_TFT).DL(BEGIN(LINES)); 00125 (*_TFT).DL(LINE_WIDTH(16)); 00126 (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentValue) * 16)); 00127 (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentMaxValue) * 16)); 00128 (*_TFT).DL(VERTEX2F(i * 181 + 22 * 16, (200 - currentMaxValue) * 16)); 00129 (*_TFT).DL(VERTEX2F(i * 181 + 28 * 16, (200 - currentMaxValue) * 16)); 00130 (*_TFT).DL(END()); 00131 (*_TFT).DL(BEGIN(LINES)); 00132 (*_TFT).DL(LINE_WIDTH(16)); 00133 (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentValue) * 16)); 00134 (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentMinValue) * 16)); 00135 (*_TFT).DL(VERTEX2F(i * 181 + 22 * 16, (200 - currentMinValue) * 16)); 00136 (*_TFT).DL(VERTEX2F(i * 181 + 28 * 16, (200 - currentMinValue) * 16)); 00137 (*_TFT).DL(END()); 00138 } 00139 (*_TFT).DL(BEGIN(POINTS)); 00140 (*_TFT).DL(POINT_SIZE(45)); 00141 (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentValue) * 16)); 00142 } 00143 } 00144 00145 // write main title 00146 (*_TFT).DL(COLOR_RGB(0, 0, 0)); 00147 CreateStringRussian("Температура за 3 часа"); 00148 (*_TFT).Text(15, 15, 3, 0, russianStr); 00149 00150 // finish FT800 display list 00151 FinishDL(); 00152 }
Generated on Wed Jul 13 2022 04:41:34 by
![doxygen](doxygen.png)