Vitaliy Loginov
/
disp70
Riverdi 70
TFT/display.Draw_MainMenu.cpp@0:e46c1282b39f, 2020-06-18 (annotated)
- Committer:
- vitlog
- Date:
- Thu Jun 18 13:18:02 2020 +0000
- Revision:
- 0:e46c1282b39f
Riverdi EVE 70
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vitlog | 0:e46c1282b39f | 1 | #include "display.h" |
vitlog | 0:e46c1282b39f | 2 | |
vitlog | 0:e46c1282b39f | 3 | /************************************************************************************************************************** |
vitlog | 0:e46c1282b39f | 4 | ************************** Display Main Menu ****************************************************************************** |
vitlog | 0:e46c1282b39f | 5 | **************************************************************************************************************************/ |
vitlog | 0:e46c1282b39f | 6 | void Display::MainMenu(float humidity, float temperature) |
vitlog | 0:e46c1282b39f | 7 | { |
vitlog | 0:e46c1282b39f | 8 | // start FT800 display list |
vitlog | 0:e46c1282b39f | 9 | StartDL(); |
vitlog | 0:e46c1282b39f | 10 | |
vitlog | 0:e46c1282b39f | 11 | // write main title |
vitlog | 0:e46c1282b39f | 12 | (*_TFT).DL(COLOR_RGB(0, 0, 0)); |
vitlog | 0:e46c1282b39f | 13 | (*_TFT).Text(11, 15, 30, 0, "HYT-271 sensor from IST"); |
vitlog | 0:e46c1282b39f | 14 | |
vitlog | 0:e46c1282b39f | 15 | // create blue rectangle with current humididty including |
vitlog | 0:e46c1282b39f | 16 | // rectangle is tagged as CURR_HUM_PRESS |
vitlog | 0:e46c1282b39f | 17 | (*_TFT).DL(TAG_MASK(1)); |
vitlog | 0:e46c1282b39f | 18 | (*_TFT).DL(TAG(CURR_HUM_PRESS)); |
vitlog | 0:e46c1282b39f | 19 | (*_TFT).DL(COLOR_RGB(9, 0, 63)); |
vitlog | 0:e46c1282b39f | 20 | // if rectangle is already pressed, draw it with lighter color |
vitlog | 0:e46c1282b39f | 21 | if (pressedButton == CURR_HUM_PRESS) { |
vitlog | 0:e46c1282b39f | 22 | (*_TFT).DL(COLOR_RGB(75, 70, 108)); |
vitlog | 0:e46c1282b39f | 23 | } |
vitlog | 0:e46c1282b39f | 24 | (*_TFT).DL(BEGIN(RECTS)); |
vitlog | 0:e46c1282b39f | 25 | (*_TFT).DL(VERTEX2II(12, 62, 0, 0)); |
vitlog | 0:e46c1282b39f | 26 | (*_TFT).DL(VERTEX2II(12 + 400, 62 + 93, 0, 0)); |
vitlog | 0:e46c1282b39f | 27 | (*_TFT).DL(COLOR_RGB(255, 255, 255)); |
vitlog | 0:e46c1282b39f | 28 | (*_TFT).Text(12 + 10, 62 + 5, 30, 0, "Current humidity (rH)"); |
vitlog | 0:e46c1282b39f | 29 | CreateStringTempHum(humidityStr, humidity, 0); |
vitlog | 0:e46c1282b39f | 30 | (*_TFT).Text(12 + 10, 62 + 45, 31, 0, humidityStr); |
vitlog | 0:e46c1282b39f | 31 | (*_TFT).DL(TAG_MASK(0)); |
vitlog | 0:e46c1282b39f | 32 | |
vitlog | 0:e46c1282b39f | 33 | // create blue rectangle with current temperature including |
vitlog | 0:e46c1282b39f | 34 | // rectangle is tagged as CURR_TEMP_PRESS |
vitlog | 0:e46c1282b39f | 35 | (*_TFT).DL(TAG_MASK(1)); |
vitlog | 0:e46c1282b39f | 36 | (*_TFT).DL(TAG(CURR_TEMP_PRESS)); |
vitlog | 0:e46c1282b39f | 37 | (*_TFT).DL(COLOR_RGB(9, 0, 63)); |
vitlog | 0:e46c1282b39f | 38 | // if rectangle is already pressed, draw it with lighter color |
vitlog | 0:e46c1282b39f | 39 | if (pressedButton == CURR_TEMP_PRESS) { |
vitlog | 0:e46c1282b39f | 40 | (*_TFT).DL(COLOR_RGB(75, 70, 108)); |
vitlog | 0:e46c1282b39f | 41 | } |
vitlog | 0:e46c1282b39f | 42 | (*_TFT).DL(BEGIN(RECTS)); |
vitlog | 0:e46c1282b39f | 43 | (*_TFT).DL(VERTEX2II(12, 62 + 93 + 12, 0, 0)); |
vitlog | 0:e46c1282b39f | 44 | (*_TFT).DL(VERTEX2II(12 + 400, 62 + 93 + 12 + 93, 0, 0)); |
vitlog | 0:e46c1282b39f | 45 | (*_TFT).DL(COLOR_RGB(255, 255, 255)); |
vitlog | 0:e46c1282b39f | 46 | (*_TFT).Text(12 + 10, 62 + 93 + 12 + 5, 30, 0, "Current temperature"); |
vitlog | 0:e46c1282b39f | 47 | CreateStringTempHum(temperatureStr, temperature, 1); |
vitlog | 0:e46c1282b39f | 48 | (*_TFT).Text(12 + 10, 62 + 93 + 12 + 45, 31, 0, temperatureStr); |
vitlog | 0:e46c1282b39f | 49 | (*_TFT).DL(TAG_MASK(0)); |
vitlog | 0:e46c1282b39f | 50 | |
vitlog | 0:e46c1282b39f | 51 | // finish FT800 display list |
vitlog | 0:e46c1282b39f | 52 | FinishDL(); |
vitlog | 0:e46c1282b39f | 53 | } |
vitlog | 0:e46c1282b39f | 54 |