test

Dependencies:   ad5422_arduino mbed LT1446 ADS1248-1 LM35-1 Flash FT813 PGA280_ADS1259

Files at this revision

API Documentation at this revision

Comitter:
nikmaos
Date:
Tue Sep 01 10:52:34 2020 +0000
Parent:
6:cfe7cb0bdb1a
Commit message:
1.09.2020;

Changed in this revision

FT813.lib Show annotated file Show diff for this revision Revisions of this file
PerifConfig.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.Calibration.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.Draw_ChromeTest.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.GetTouch.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.PidScreen.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.myWidgets.cpp Show annotated file Show diff for this revision Revisions of this file
display.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/FT813.lib	Fri Aug 14 14:16:03 2020 +0000
+++ b/FT813.lib	Tue Sep 01 10:52:34 2020 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/nikmaos/code/FT813/#f0980f7a75ae
+https://os.mbed.com/users/nikmaos/code/FT813/#5959af2ac87a
--- a/PerifConfig.cpp	Fri Aug 14 14:16:03 2020 +0000
+++ b/PerifConfig.cpp	Tue Sep 01 10:52:34 2020 +0000
@@ -23,11 +23,12 @@
 DigitalOut PosAw(PB_15); 
 DigitalOut PosBw(PC_7); 
 
-DigitalOut ads1259_pin_Start(PG_2);
-DigitalOut ads1259_pin_CS(PD_2);
-DigitalIn ads1259_pin_Drdy(PG_3);
 
-SPI AD1248_SPI(PC_12, PC_11, PC_10);//MOSI,MISO,SCK
+DigitalOut ads1259_pin_CS(D10);
+DigitalOut ads1259_pin_Start(D9);
+DigitalIn ads1259_pin_Drdy(D8);
+
+SPI AD1248_SPI(D11, D12, D13);//MOSI,MISO,SCK
 /*Конец*/
 
 //выводы для костыльного SPI для ЦАП
--- a/TFT/display.Calibration.cpp	Fri Aug 14 14:16:03 2020 +0000
+++ b/TFT/display.Calibration.cpp	Tue Sep 01 10:52:34 2020 +0000
@@ -7,7 +7,7 @@
 {           
         if(calibration[0]==0xFF||(re>0)){
         (*_TFT).Calibrate();//Калибровка дисплея
-        for (int i = 0; i < 24; i++)
+        for (int i = 0; i <24; i++)
         //запись в буфер памяти
             {
             calibration[i]=(*_TFT).Rd8(REG_TOUCH_TRANSFORM_A + i);
@@ -15,7 +15,7 @@
         }
         else{
     //char calibration[25] = {98, 99, 0, 0, 182, 254, 255, 255, 245, 142, 248, 255, 117, 254, 255, 255, 34, 98, 0, 0, 123, 154, 248, 255};
-    for (int i = 0; i < 24; i++) {
+    for (int i = 0; i <24; i++) {
         (*_TFT).Wr8(REG_TOUCH_TRANSFORM_A + i, calibration[i]);}
     }
 }
\ No newline at end of file
--- a/TFT/display.Draw_ChromeTest.cpp	Fri Aug 14 14:16:03 2020 +0000
+++ b/TFT/display.Draw_ChromeTest.cpp	Tue Sep 01 10:52:34 2020 +0000
@@ -5,32 +5,9 @@
         //"Parameters"
         (*_TFT).DL(CLEAR_COLOR_RGB(255, 255, 255));
         (*_TFT).DL(CLEAR(1, 1, 1));
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(31));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(CELL(80));
-        (*_TFT).DL(VERTEX2F(1148, -4));
-        (*_TFT).DL(CELL(97));
-        (*_TFT).DL(VERTEX2F(1252, -4));
-        (*_TFT).DL(CELL(114));
-        (*_TFT).DL(VERTEX2F(1344, -4));
-        (*_TFT).DL(CELL(97));
-        (*_TFT).DL(VERTEX2F(1404, -4));
-        (*_TFT).DL(CELL(109));
-        (*_TFT).DL(VERTEX2F(1496, -4));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(1640, -4));
-        (*_TFT).DL(CELL(116));
-        (*_TFT).DL(VERTEX2F(1728, -4));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(1784, -4));
-        (*_TFT).DL(CELL(114));
-        (*_TFT).DL(VERTEX2F(1872, -4));
-        (*_TFT).DL(CELL(115));
-        (*_TFT).DL(VERTEX2F(1932, -4));
-        (*_TFT).DL(RESTORE_CONTEXT());
+        (*_TFT).DL(COLOR_RGB(0, 0, 0));        
+        (*_TFT).Text(287, 0 , 31, 0, "Parameters");
+        
         //кнопка "текущая температура"
         (*_TFT).DL(TAG_MASK(1));//пометки что это изменено относительно генератора кода
         (*_TFT).DL(TAG(CHROM_TEMP_PRESS));//
@@ -44,170 +21,27 @@
         (*_TFT).DL(END());
         //
         (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2II(16, 263, 18, 'T'));
-        (*_TFT).DL(VERTEX2II(24, 263, 18, 'e'));
-        (*_TFT).DL(VERTEX2II(32, 263, 18, 'm'));
-        (*_TFT).DL(VERTEX2II(40, 263, 18, 'p'));
-        (*_TFT).DL(VERTEX2II(48, 263, 18, 'K'));
-        (*_TFT).DL(VERTEX2II(56, 263, 18, 'o'));
-        (*_TFT).DL(VERTEX2II(64, 263, 18, 'l'));
-        (*_TFT).DL(VERTEX2II(72, 263, 18, ' '));
-        (*_TFT).DL(VERTEX2II(80, 263, 18, 'C'));
-        (*_TFT).DL(VERTEX2II(88, 263, 18, 'u'));
-        (*_TFT).DL(VERTEX2II(96, 263, 18, 'r'));
-        (*_TFT).DL(VERTEX2II(104, 263, 18, 'r'));
-        (*_TFT).DL(VERTEX2II(112, 263, 18, 'e'));
-        (*_TFT).DL(VERTEX2II(120, 263, 18, 'n'));
-        (*_TFT).DL(VERTEX2II(128, 263, 18, 't'));
-        (*_TFT).DL(VERTEX2II(136, 263, 18, ':'));
-        (*_TFT).DL(RESTORE_CONTEXT());
+        (*_TFT).Text(16, 263 , 27, 0, "TempKol Current:");
         (*_TFT).DL(TAG_MASK(0));//конец обработки нажатия кнопки
         //
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));
+        (*_TFT).DL(COLOR_RGB(0, 0, 0));        
         char str[5]={0};
-        sprintf(str,"%2.2f",temp);        
-        (*_TFT).DL(VERTEX2II(149, 263, 18, str[0]));
-        (*_TFT).DL(VERTEX2II(157, 263, 18, str[1]));
-        (*_TFT).DL(VERTEX2II(162, 263, 18, str[2]));
-        (*_TFT).DL(VERTEX2II(170, 263, 18, str[3]));
-        (*_TFT).DL(VERTEX2II(178, 263, 18, str[4]));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2II(169+20, 260, 18, 'o'));//
-        (*_TFT).DL(VERTEX2II(177+20, 263, 18, 'C'));
-        (*_TFT).DL(VERTEX2II(185+20, 263, 18, ' '));
-        (*_TFT).DL(VERTEX2II(193+20, 263, 18, '/'));
-        (*_TFT).DL(VERTEX2II(201+20, 263, 18, ' '));
-        (*_TFT).DL(VERTEX2II(209+20, 263, 18, 'S'));
-        (*_TFT).DL(VERTEX2II(217+20, 263, 18, 'E'));
-        (*_TFT).DL(VERTEX2II(225+20, 263, 18, 'T'));
-        (*_TFT).DL(VERTEX2II(233+20, 263, 18, ':'));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));        
+        sprintf(str,"%2.2f",temp);
+        (*_TFT).Text(150, 263 , 27, 0, str);
+        (*_TFT).Text(189, 260 , 27, 0, "o");
+        (*_TFT).Text(197, 263 , 27, 0, "C / SET: ");        
         sprintf(str,"%02d",temp_u);
-        (*_TFT).DL(VERTEX2II(244+20, 263, 18, str[0]));
-        (*_TFT).DL(VERTEX2II(252+20, 263, 18, str[1]));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2II(264+20, 260, 18, 'o'));//
-        (*_TFT).DL(VERTEX2II(272+20, 263, 18, 'C'));
-        (*_TFT).DL(RESTORE_CONTEXT());
+        (*_TFT).Text(264, 263 , 27, 0, str);
+        (*_TFT).Text(264+20, 260 , 27, 0, "o");
+        (*_TFT).Text(292, 263 , 27, 0, "C");
         //"Set Tempkol"
         (*_TFT).DL(TAG_MASK(1));//пометки что это изменено относительно генератора кода
         (*_TFT).DL(TAG(CHROM_SET_TEMP_PRESS));//           
         (*_TFT).DL(COLOR_RGB(255, 255, 255));
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(15));
-        (*_TFT).DL(CELL(0));
-        (*_TFT).DL(BITMAP_SOURCE(-2097076));
-        (*_TFT).DL(BITMAP_LAYOUT_H(0, 0));
-        (*_TFT).DL(BITMAP_LAYOUT(L8, 1, 25));
-        (*_TFT).DL(BITMAP_SIZE_H(0, 0));
-        (*_TFT).DL(BITMAP_SIZE(NEAREST, REPEAT, BORDER, 390, 50));
-        (*_TFT).DL(COLOR_MASK(0, 0, 0, 1));
-        (*_TFT).DL(BLEND_FUNC(ZERO, ZERO));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2F(1620, 980));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 1));
-        (*_TFT).DL(BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA));
-        (*_TFT).DL(LINE_WIDTH(48));                     
-        (*_TFT).DL(BEGIN(RECTS));
-        (*_TFT).DL(COLOR_RGB(255, 255, 255));        
-        (*_TFT).DL(VERTEX2F(1630, 990));
-        (*_TFT).DL(VERTEX2F(3166, 1166));
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(VERTEX2F(1636, 996));
-        (*_TFT).DL(VERTEX2F(3172, 1172));
-        (*_TFT).DL(COLOR_RGB(0, 56, 112));
-        (*_TFT).DL(VERTEX2F(1632, 992));
-        (*_TFT).DL(VERTEX2F(3168, 1168));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(COLOR_MASK(0, 0, 0, 1));
-        (*_TFT).DL(BLEND_FUNC(DST_ALPHA, ZERO));
-        (*_TFT).DL(VERTEX2F(1620, 980));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 0));
-        (*_TFT).DL(BLEND_FUNC(DST_ALPHA, ONE_MINUS_DST_ALPHA));
-        (*_TFT).DL(COLOR_RGB(255, 255, 255));
-        if (pressedButton == CHROM_SET_TEMP_PRESS) {//
-        (*_TFT).DL(COLOR_RGB(0, 0, 0)); //
-        }//
-        (*_TFT).DL(VERTEX2F(1620, 980));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 1));
-        (*_TFT).DL(BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA));
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(CELL(83));
-        (*_TFT).DL(VERTEX2F(2224, 1044));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(2256, 1044));
-        (*_TFT).DL(CELL(116));
-        (*_TFT).DL(VERTEX2F(2288, 1044));
-        (*_TFT).DL(CELL(32));
-        (*_TFT).DL(VERTEX2F(2320, 1044));
-        (*_TFT).DL(CELL(84));
-        (*_TFT).DL(VERTEX2F(2352, 1044));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(2384, 1044));
-        (*_TFT).DL(CELL(109));
-        (*_TFT).DL(VERTEX2F(2416, 1044));
-        (*_TFT).DL(CELL(112));
-        (*_TFT).DL(VERTEX2F(2448, 1044));
-        (*_TFT).DL(CELL(75));
-        (*_TFT).DL(VERTEX2F(2480, 1044));
-        (*_TFT).DL(CELL(111));
-        (*_TFT).DL(VERTEX2F(2512, 1044));
-        (*_TFT).DL(CELL(108));
-        (*_TFT).DL(VERTEX2F(2544, 1044));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //тоже, изменение цвета
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(CELL(83));
-        (*_TFT).DL(VERTEX2F(2228, 1048));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(2260, 1048));
-        (*_TFT).DL(CELL(116));
-        (*_TFT).DL(VERTEX2F(2292, 1048));
-        (*_TFT).DL(CELL(32));
-        (*_TFT).DL(VERTEX2F(2324, 1048));
-        (*_TFT).DL(CELL(84));
-        (*_TFT).DL(VERTEX2F(2356, 1048));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(2388, 1048));
-        (*_TFT).DL(CELL(109));
-        (*_TFT).DL(VERTEX2F(2420, 1048));
-        (*_TFT).DL(CELL(112));
-        (*_TFT).DL(VERTEX2F(2452, 1048));
-        (*_TFT).DL(CELL(75));
-        (*_TFT).DL(VERTEX2F(2484, 1048));
-        (*_TFT).DL(CELL(111));
-        (*_TFT).DL(VERTEX2F(2516, 1048));
-        (*_TFT).DL(CELL(108));
-        (*_TFT).DL(VERTEX2F(2548, 1048));
-        (*_TFT).DL(RESTORE_CONTEXT());
+        if(pressedButton == CHROM_SET_TEMP_PRESS)        
+        (*_TFT).Button(405, 245, 390, 50, 27, OPT_FLAT, "Set TempKol");    
+        else
+        (*_TFT).Button(405, 245, 390, 50, 27, 0, "Set TempKol");        
         (*_TFT).DL(TAG_MASK(0));//конец обработки нажатия кнопки
         //
         (*_TFT).DL(COLOR_RGB(85, 255, 127));
@@ -217,175 +51,28 @@
         (*_TFT).DL(END());
         //
         (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2II(21, 324, 18, 'R'));
-        (*_TFT).DL(VERTEX2II(29, 324, 18, 'a'));
-        (*_TFT).DL(VERTEX2II(37, 324, 18, 's'));
-        (*_TFT).DL(VERTEX2II(45, 324, 18, 'h'));
-        (*_TFT).DL(VERTEX2II(53, 324, 18, 'o'));
-        (*_TFT).DL(VERTEX2II(61, 324, 18, 'd'));
-        (*_TFT).DL(VERTEX2II(69, 324, 18, ' '));
-        (*_TFT).DL(VERTEX2II(77, 324, 18, 'C'));
-        (*_TFT).DL(VERTEX2II(85, 324, 18, 'u'));
-        (*_TFT).DL(VERTEX2II(93, 324, 18, 'r'));
-        (*_TFT).DL(VERTEX2II(101, 324, 18, 'r'));
-        (*_TFT).DL(VERTEX2II(109, 324, 18, 'e'));
-        (*_TFT).DL(VERTEX2II(117, 324, 18, 'n'));
-        (*_TFT).DL(VERTEX2II(125, 324, 18, 't'));
-        (*_TFT).DL(VERTEX2II(133, 324, 18, ':'));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));
+        (*_TFT).Text(16, 324 , 27, 0, "Rashod Current:");
+        //        
         sprintf(str,"%2.2f",ras);//
-        (*_TFT).DL(VERTEX2II(145, 324, 18, str[0]));//
-        (*_TFT).DL(VERTEX2II(153, 324, 18, str[1]));//
-        (*_TFT).DL(VERTEX2II(158, 324, 18, str[2]));//
-        (*_TFT).DL(VERTEX2II(166, 324, 18, str[3]));//        
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2II(166+10, 324, 18, 'c'));
-        (*_TFT).DL(VERTEX2II(174+10, 324, 18, 'm'));
-        (*_TFT).DL(VERTEX2II(182+10, 324, 18, '3'));
-        (*_TFT).DL(VERTEX2II(190+10, 324, 18, '/'));
-        (*_TFT).DL(VERTEX2II(198+10, 324, 18, 'm'));
-        (*_TFT).DL(VERTEX2II(206+10, 324, 18, 'i'));
-        (*_TFT).DL(VERTEX2II(214+10, 324, 18, 'n'));
-        (*_TFT).DL(VERTEX2II(222+10, 324, 18, ' '));
-        (*_TFT).DL(VERTEX2II(230+10, 324, 18, '/'));
-        (*_TFT).DL(VERTEX2II(238+10, 324, 18, ' '));
-        (*_TFT).DL(VERTEX2II(246+10, 324, 18, 'S'));
-        (*_TFT).DL(VERTEX2II(254+10, 324, 18, 'E'));
-        (*_TFT).DL(VERTEX2II(262+10, 324, 18, 'T'));
-        (*_TFT).DL(VERTEX2II(270+10, 324, 18, ':'));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));
+        (*_TFT).Text(145, 324 , 27, 0, str);
+        (*_TFT).Text(176+3, 324 , 27, 0, "cm");
+        (*_TFT).Text(192+8, 321 , 27, 0, "3");
+        (*_TFT).Text(200+8, 324 , 27, 0, "/min | SET: ");        
         sprintf(str,"%2.2f",ras_u);
-        (*_TFT).DL(VERTEX2II(280+10, 324, 18, str[0]));
-        (*_TFT).DL(VERTEX2II(288+10, 324, 18, str[1]));
-        (*_TFT).DL(VERTEX2II(293+10, 324, 18, str[2]));
-        (*_TFT).DL(VERTEX2II(301+10, 324, 18, str[3]));        
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2II(300+20, 324, 18, 'c'));
-        (*_TFT).DL(VERTEX2II(308+20, 324, 18, 'm'));
-        (*_TFT).DL(VERTEX2II(316+20, 324, 18, '3'));
-        (*_TFT).DL(VERTEX2II(324+20, 324, 18, '/'));
-        (*_TFT).DL(VERTEX2II(332+20, 324, 18, 'm'));
-        (*_TFT).DL(VERTEX2II(340+20, 324, 18, 'i'));
-        (*_TFT).DL(VERTEX2II(348+20, 324, 18, 'n'));
-        (*_TFT).DL(RESTORE_CONTEXT());
+        (*_TFT).Text(290, 324 , 27, 0, str);
+        (*_TFT).Text(321+3, 324 , 27, 0, "cm");
+        (*_TFT).Text(336+8, 321 , 27, 0, "3");
+        (*_TFT).Text(344+8, 324 , 27, 0, "/min");
         //установить расход
         (*_TFT).DL(TAG_MASK(1));//пометки что это изменено относительно генератора кода
         (*_TFT).DL(TAG(CHROM_SET_RASHOD_PRESS));//
         (*_TFT).DL(COLOR_RGB(255, 255, 255));
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(15));
-        (*_TFT).DL(CELL(0));
-        (*_TFT).DL(BITMAP_SOURCE(-2097076));
-        (*_TFT).DL(BITMAP_LAYOUT_H(0, 0));
-        (*_TFT).DL(BITMAP_LAYOUT(L8, 1, 25));
-        (*_TFT).DL(BITMAP_SIZE_H(0, 0));
-        (*_TFT).DL(BITMAP_SIZE(NEAREST, REPEAT, BORDER, 390, 50));
-        (*_TFT).DL(COLOR_MASK(0, 0, 0, 1));
-        (*_TFT).DL(BLEND_FUNC(ZERO, ZERO));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2F(1620, 1220));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 1));
-        (*_TFT).DL(BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA));
-        (*_TFT).DL(LINE_WIDTH(48));
-        (*_TFT).DL(BEGIN(RECTS));
-        (*_TFT).DL(COLOR_RGB(255, 255, 255));
-        (*_TFT).DL(VERTEX2F(1630, 1230));
-        (*_TFT).DL(VERTEX2F(3166, 1406));
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(VERTEX2F(1636, 1236));
-        (*_TFT).DL(VERTEX2F(3172, 1412));
-        (*_TFT).DL(COLOR_RGB(0, 56, 112));
-        (*_TFT).DL(VERTEX2F(1632, 1232));
-        (*_TFT).DL(VERTEX2F(3168, 1408));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(COLOR_MASK(0, 0, 0, 1));
-        (*_TFT).DL(BLEND_FUNC(DST_ALPHA, ZERO));
-        (*_TFT).DL(VERTEX2F(1620, 1220));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 0));
-        (*_TFT).DL(BLEND_FUNC(DST_ALPHA, ONE_MINUS_DST_ALPHA));
-        (*_TFT).DL(COLOR_RGB(255, 255, 255));
-        if (pressedButton == CHROM_SET_RASHOD_PRESS) {//
-        (*_TFT).DL(COLOR_RGB(0, 0, 0)); //
-        }//
-        (*_TFT).DL(VERTEX2F(1620, 1220));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 1));
-        (*_TFT).DL(BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA));
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(CELL(83));
-        (*_TFT).DL(VERTEX2F(2240, 1284));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(2272, 1284));
-        (*_TFT).DL(CELL(116));
-        (*_TFT).DL(VERTEX2F(2304, 1284));
-        (*_TFT).DL(CELL(32));
-        (*_TFT).DL(VERTEX2F(2336, 1284));
-        (*_TFT).DL(CELL(82));
-        (*_TFT).DL(VERTEX2F(2368, 1284));
-        (*_TFT).DL(CELL(97));
-        (*_TFT).DL(VERTEX2F(2400, 1284));
-        (*_TFT).DL(CELL(115));
-        (*_TFT).DL(VERTEX2F(2432, 1284));
-        (*_TFT).DL(CELL(104));
-        (*_TFT).DL(VERTEX2F(2464, 1284));
-        (*_TFT).DL(CELL(111));
-        (*_TFT).DL(VERTEX2F(2496, 1284));
-        (*_TFT).DL(CELL(100));
-        (*_TFT).DL(VERTEX2F(2528, 1284));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //цвет букв "Set Rashod"
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(CELL(83));
-        (*_TFT).DL(VERTEX2F(2244, 1288));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(2276, 1288));
-        (*_TFT).DL(CELL(116));
-        (*_TFT).DL(VERTEX2F(2308, 1288));
-        (*_TFT).DL(CELL(32));
-        (*_TFT).DL(VERTEX2F(2340, 1288));
-        (*_TFT).DL(CELL(82));
-        (*_TFT).DL(VERTEX2F(2372, 1288));
-        (*_TFT).DL(CELL(97));
-        (*_TFT).DL(VERTEX2F(2404, 1288));
-        (*_TFT).DL(CELL(115));
-        (*_TFT).DL(VERTEX2F(2436, 1288));
-        (*_TFT).DL(CELL(104));
-        (*_TFT).DL(VERTEX2F(2468, 1288));
-        (*_TFT).DL(CELL(111));
-        (*_TFT).DL(VERTEX2F(2500, 1288));
-        (*_TFT).DL(CELL(100));
-        (*_TFT).DL(VERTEX2F(2532, 1288));
-        (*_TFT).DL(RESTORE_CONTEXT());
+        if(pressedButton == CHROM_SET_RASHOD_PRESS)        
+        (*_TFT).Button(405, 305, 390, 50, 27, OPT_FLAT, "Set Rashod");
+        //activeScreen=}    
+        else
+        (*_TFT).Button(405, 305, 390, 50, 27, 0, "Set Rashod");        
         (*_TFT).DL(TAG_MASK(0));//конец обработки нажатия кнопки
-        
         //тут не кнопка а отображалка сигнал сенсора
         (*_TFT).DL(COLOR_RGB(85, 255, 127));
         (*_TFT).DL(BEGIN(RECTS));
@@ -393,322 +80,49 @@
         (*_TFT).DL(VERTEX2II(395, 415, 0, 0));
         (*_TFT).DL(END());
         //
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2II(20, 383, 18, 'S'));
-        (*_TFT).DL(VERTEX2II(28, 383, 18, 'e'));
-        (*_TFT).DL(VERTEX2II(36, 383, 18, 'n'));
-        (*_TFT).DL(VERTEX2II(44, 383, 18, 's'));
-        (*_TFT).DL(VERTEX2II(52, 383, 18, 'o'));
-        (*_TFT).DL(VERTEX2II(60, 383, 18, 'r'));
-        (*_TFT).DL(VERTEX2II(68, 383, 18, 'S'));
-        (*_TFT).DL(VERTEX2II(76, 383, 18, 'i'));
-        (*_TFT).DL(VERTEX2II(84, 383, 18, 'g'));
-        (*_TFT).DL(VERTEX2II(92, 383, 18, 'n'));
-        (*_TFT).DL(VERTEX2II(100, 383, 18, 'a'));
-        (*_TFT).DL(VERTEX2II(108, 383, 18, 'l'));
-        (*_TFT).DL(VERTEX2II(116, 383, 18, ':'));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2II(127, 383, 18, '0'));
-        (*_TFT).DL(VERTEX2II(135, 383, 18, '0'));
-        (*_TFT).DL(VERTEX2II(143, 383, 18, '0'));
-        (*_TFT).DL(VERTEX2II(151, 383, 18, '4'));
-        (*_TFT).DL(VERTEX2II(159, 383, 18, '2'));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2II(168, 383, 18, ' '));
-        (*_TFT).DL(VERTEX2II(176, 383, 18, '/'));
-        (*_TFT).DL(VERTEX2II(184, 383, 18, ' '));
-        (*_TFT).DL(VERTEX2II(192, 383, 18, 'S'));
-        (*_TFT).DL(VERTEX2II(200, 383, 18, 'e'));
-        (*_TFT).DL(VERTEX2II(208, 383, 18, 'n'));
-        (*_TFT).DL(VERTEX2II(216, 383, 18, 's'));
-        (*_TFT).DL(VERTEX2II(224, 383, 18, 'o'));
-        (*_TFT).DL(VERTEX2II(232, 383, 18, 'r'));
-        (*_TFT).DL(VERTEX2II(240, 383, 18, 'G'));
-        (*_TFT).DL(VERTEX2II(248, 383, 18, 'a'));
-        (*_TFT).DL(VERTEX2II(256, 383, 18, 'n'));
-        (*_TFT).DL(VERTEX2II(264, 383, 18, 'e'));
-        (*_TFT).DL(VERTEX2II(272, 383, 18, 'l'));
-        (*_TFT).DL(VERTEX2II(280, 383, 18, ':'));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2II(293, 383, 18, '0'));
-        (*_TFT).DL(VERTEX2II(301, 383, 18, '0'));
-        (*_TFT).DL(VERTEX2II(309, 383, 18, '1'));
-        (*_TFT).DL(RESTORE_CONTEXT());
+        (*_TFT).DL(COLOR_RGB(0, 0, 0));        
+        (*_TFT).Text(20, 383 , 27, 0, "SensorSignal: 0042 / SensorGane: 001");
         //Set sensor gane
         (*_TFT).DL(TAG_MASK(1));//пометки что это изменено относительно генератора кода
         (*_TFT).DL(TAG(CHROM_SET_SENSGAIN_PRESS));//
         (*_TFT).DL(COLOR_RGB(255, 255, 255));
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(15));
-        (*_TFT).DL(CELL(0));
-        (*_TFT).DL(BITMAP_SOURCE(-2097076));
-        (*_TFT).DL(BITMAP_LAYOUT_H(0, 0));
-        (*_TFT).DL(BITMAP_LAYOUT(L8, 1, 25));
-        (*_TFT).DL(BITMAP_SIZE_H(0, 0));
-        (*_TFT).DL(BITMAP_SIZE(NEAREST, REPEAT, BORDER, 390, 50));
-        (*_TFT).DL(COLOR_MASK(0, 0, 0, 1));
-        (*_TFT).DL(BLEND_FUNC(ZERO, ZERO));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2F(1620, 1460));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 1));
-        (*_TFT).DL(BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA));
-        (*_TFT).DL(LINE_WIDTH(48));
-        (*_TFT).DL(BEGIN(RECTS));
-        (*_TFT).DL(COLOR_RGB(255, 255, 255));        
-        (*_TFT).DL(VERTEX2F(1630, 1470));
-        (*_TFT).DL(VERTEX2F(3166, 1646));
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(VERTEX2F(1636, 1476));
-        (*_TFT).DL(VERTEX2F(3172, 1652));
-        (*_TFT).DL(COLOR_RGB(0, 56, 112));
-        (*_TFT).DL(VERTEX2F(1632, 1472));
-        (*_TFT).DL(VERTEX2F(3168, 1648));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(COLOR_MASK(0, 0, 0, 1));
-        (*_TFT).DL(BLEND_FUNC(DST_ALPHA, ZERO));
-        (*_TFT).DL(VERTEX2F(1620, 1460));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 0));
-        (*_TFT).DL(BLEND_FUNC(DST_ALPHA, ONE_MINUS_DST_ALPHA));
-        (*_TFT).DL(COLOR_RGB(255, 255, 255));
-        if (pressedButton == CHROM_SET_SENSGAIN_PRESS) {//
-        (*_TFT).DL(COLOR_RGB(0, 0, 0)); //
-        }//
-        (*_TFT).DL(VERTEX2F(1620, 1460));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 1));
-        (*_TFT).DL(BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA));
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(CELL(83));
-        (*_TFT).DL(VERTEX2F(2176, 1524));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(2208, 1524));
-        (*_TFT).DL(CELL(116));
-        (*_TFT).DL(VERTEX2F(2240, 1524));
-        (*_TFT).DL(CELL(32));
-        (*_TFT).DL(VERTEX2F(2272, 1524));
-        (*_TFT).DL(CELL(83));
-        (*_TFT).DL(VERTEX2F(2304, 1524));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(2336, 1524));
-        (*_TFT).DL(CELL(110));
-        (*_TFT).DL(VERTEX2F(2368, 1524));
-        (*_TFT).DL(CELL(115));
-        (*_TFT).DL(VERTEX2F(2400, 1524));
-        (*_TFT).DL(CELL(111));
-        (*_TFT).DL(VERTEX2F(2432, 1524));
-        (*_TFT).DL(CELL(114));
-        (*_TFT).DL(VERTEX2F(2464, 1524));
-        (*_TFT).DL(CELL(71));
-        (*_TFT).DL(VERTEX2F(2496, 1524));
-        (*_TFT).DL(CELL(97));
-        (*_TFT).DL(VERTEX2F(2528, 1524));
-        (*_TFT).DL(CELL(110));
-        (*_TFT).DL(VERTEX2F(2560, 1524));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(2592, 1524));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        (*_TFT).DL(TAG_MASK(0));//конец обработки нажатия кнопки        
+        if(pressedButton == CHROM_SET_SENSGAIN_PRESS)        
+        (*_TFT).Button(405, 365, 390, 50, 27, OPT_FLAT, "Set SensorGane");    
+        else
+        (*_TFT).Button(405, 365, 390, 50, 27, 0, "Set SensorGane");        
+        (*_TFT).DL(TAG_MASK(0));//конец обработки нажатия кнопки
         //
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(18));
-        (*_TFT).DL(CELL(83));
-        (*_TFT).DL(VERTEX2F(2180, 1528));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(2212, 1528));
-        (*_TFT).DL(CELL(116));
-        (*_TFT).DL(VERTEX2F(2244, 1528));
-        (*_TFT).DL(CELL(32));
-        (*_TFT).DL(VERTEX2F(2276, 1528));
-        (*_TFT).DL(CELL(83));
-        (*_TFT).DL(VERTEX2F(2308, 1528));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(2340, 1528));
-        (*_TFT).DL(CELL(110));
-        (*_TFT).DL(VERTEX2F(2372, 1528));
-        (*_TFT).DL(CELL(115));
-        (*_TFT).DL(VERTEX2F(2404, 1528));
-        (*_TFT).DL(CELL(111));
-        (*_TFT).DL(VERTEX2F(2436, 1528));
-        (*_TFT).DL(CELL(114));
-        (*_TFT).DL(VERTEX2F(2468, 1528));
-        (*_TFT).DL(CELL(71));
-        (*_TFT).DL(VERTEX2F(2500, 1528));
-        (*_TFT).DL(CELL(97));
-        (*_TFT).DL(VERTEX2F(2532, 1528));
-        (*_TFT).DL(CELL(110));
-        (*_TFT).DL(VERTEX2F(2564, 1528));
-        (*_TFT).DL(CELL(101));
-        (*_TFT).DL(VERTEX2F(2596, 1528));
-        (*_TFT).DL(RESTORE_CONTEXT());
+        
         //Пробоотбор
         (*_TFT).DL(TAG_MASK(1));//пометки что это изменено относительно генератора кода
         (*_TFT).DL(TAG(CHROM_PROBA_PRESS));//
         (*_TFT).DL(COLOR_RGB(255, 170, 0));
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(15));
-        (*_TFT).DL(CELL(0));
-        (*_TFT).DL(BITMAP_SOURCE(-2097076));
-        (*_TFT).DL(BITMAP_LAYOUT_H(0, 0));
-        (*_TFT).DL(BITMAP_LAYOUT(L8, 1, 25));
-        (*_TFT).DL(BITMAP_SIZE_H(0, 0));
-        (*_TFT).DL(BITMAP_SIZE(NEAREST, REPEAT, BORDER, 390, 50));
-        (*_TFT).DL(COLOR_MASK(0, 0, 0, 1));
-        (*_TFT).DL(BLEND_FUNC(ZERO, ZERO));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2F(20, 1700));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 1));
-        (*_TFT).DL(BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA));
-        (*_TFT).DL(LINE_WIDTH(60));
-        (*_TFT).DL(BEGIN(RECTS));
-        (*_TFT).DL(COLOR_RGB(255, 255, 255));        
-        (*_TFT).DL(VERTEX2F(33, 1713));
-        (*_TFT).DL(VERTEX2F(1563, 1883));
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(VERTEX2F(39, 1719));
-        (*_TFT).DL(VERTEX2F(1569, 1889));
-        (*_TFT).DL(COLOR_RGB(0, 56, 112));
-        (*_TFT).DL(VERTEX2F(35, 1715));
-        (*_TFT).DL(VERTEX2F(1565, 1885));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(COLOR_MASK(0, 0, 0, 1));
-        (*_TFT).DL(BLEND_FUNC(DST_ALPHA, ZERO));
-        (*_TFT).DL(VERTEX2F(20, 1700));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 0));
-        (*_TFT).DL(BLEND_FUNC(DST_ALPHA, ONE_MINUS_DST_ALPHA));
-        (*_TFT).DL(COLOR_RGB(255, 255, 255));
-        if (pressedButton == CHROM_PROBA_PRESS) {//
-        (*_TFT).DL(COLOR_RGB(0, 0, 0)); //
-        }//
-        (*_TFT).DL(VERTEX2F(20, 1700));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 1));
-        (*_TFT).DL(BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA));
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(BITMAP_HANDLE(27));
-        (*_TFT).DL(VERTEX2II(156, 439, 27, 'P'));
-        (*_TFT).DL(VERTEX2II(166, 439, 27, 'r'));
-        (*_TFT).DL(VERTEX2II(172, 439, 27, 'o'));
-        (*_TFT).DL(VERTEX2II(182, 439, 27, 'b'));
-        (*_TFT).DL(VERTEX2II(191, 439, 27, 'o'));
-        (*_TFT).DL(VERTEX2II(201, 439, 27, 'o'));
-        (*_TFT).DL(VERTEX2II(211, 439, 27, 't'));
-        (*_TFT).DL(VERTEX2II(218, 439, 27, 'b'));
-        (*_TFT).DL(VERTEX2II(227, 439, 27, 'o'));
-        (*_TFT).DL(VERTEX2II(237, 439, 27, 'r'));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(27));
-        (*_TFT).DL(VERTEX2II(157, 440, 27, 'P'));
-        (*_TFT).DL(VERTEX2II(167, 440, 27, 'r'));
-        (*_TFT).DL(VERTEX2II(173, 440, 27, 'o'));
-        (*_TFT).DL(VERTEX2II(183, 440, 27, 'b'));
-        (*_TFT).DL(VERTEX2II(192, 440, 27, 'o'));
-        (*_TFT).DL(VERTEX2II(202, 440, 27, 'o'));
-        (*_TFT).DL(VERTEX2II(212, 440, 27, 't'));
-        (*_TFT).DL(VERTEX2II(219, 440, 27, 'b'));
-        (*_TFT).DL(VERTEX2II(228, 440, 27, 'o'));
-        (*_TFT).DL(VERTEX2II(238, 440, 27, 'r'));
-        (*_TFT).DL(RESTORE_CONTEXT());
+        if(pressedButton == CHROM_PROBA_PRESS)        
+        (*_TFT).Button(5, 425, 390, 50, 27, OPT_FLAT, "Probootbor");    
+        else
+        (*_TFT).Button(5, 425, 390, 50, 27, 0, "Probootbor");        
         (*_TFT).DL(TAG_MASK(0));//конец обработки нажатия кнопки
         //Analiz
         (*_TFT).DL(TAG_MASK(1));//пометки что это изменено относительно генератора кода
         (*_TFT).DL(TAG(CHROM_ANALIZ_PRESS));//
         (*_TFT).DL(COLOR_RGB(85, 255, 0));
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(15));
-        (*_TFT).DL(CELL(0));
-        (*_TFT).DL(BITMAP_SOURCE(-2097076));
-        (*_TFT).DL(BITMAP_LAYOUT_H(0, 0));
-        (*_TFT).DL(BITMAP_LAYOUT(L8, 1, 25));
-        (*_TFT).DL(BITMAP_SIZE_H(0, 0));
-        (*_TFT).DL(BITMAP_SIZE(NEAREST, REPEAT, BORDER, 390, 50));
-        (*_TFT).DL(COLOR_MASK(0, 0, 0, 1));
-        (*_TFT).DL(BLEND_FUNC(ZERO, ZERO));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(VERTEX2F(1620, 1700));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 1));
-        (*_TFT).DL(BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA));
-        (*_TFT).DL(LINE_WIDTH(60));
-        (*_TFT).DL(BEGIN(RECTS));
-        (*_TFT).DL(COLOR_RGB(255, 255, 255));
-        (*_TFT).DL(VERTEX2F(1633, 1713));
-        (*_TFT).DL(VERTEX2F(3163, 1883));
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(VERTEX2F(1639, 1719));
-        (*_TFT).DL(VERTEX2F(3169, 1889));
-        (*_TFT).DL(COLOR_RGB(0, 56, 112));
-        (*_TFT).DL(VERTEX2F(1635, 1715));
-        (*_TFT).DL(VERTEX2F(3165, 1885));
-        (*_TFT).DL(BEGIN(BITMAPS));
-        (*_TFT).DL(COLOR_MASK(0, 0, 0, 1));
-        (*_TFT).DL(BLEND_FUNC(DST_ALPHA, ZERO));
-        (*_TFT).DL(VERTEX2F(1620, 1700));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 0));
-        (*_TFT).DL(BLEND_FUNC(DST_ALPHA, ONE_MINUS_DST_ALPHA));
+        if(pressedButton == CHROM_ANALIZ_PRESS)        
+        (*_TFT).Button(405, 425, 390, 50, 27, OPT_FLAT, "Analiz");    
+        else
+        (*_TFT).Button(405, 425, 390, 50, 27, 0, "Analiz");        
+        (*_TFT).DL(TAG_MASK(0));//конец обработки нажатия кнопки
+        //Переход в настройки ПИД регулятора        
+        /*(*_TFT).DL(TAG_MASK(1));
+        (*_TFT).DL(TAG(PID_MENU_PRESS));*/
+        if(TouchX>405&&TouchY>185&&TouchX<(405+390)&&TouchY<(185+50))
+        pressedButton=PID_MENU_PRESS;
         (*_TFT).DL(COLOR_RGB(255, 255, 255));
-        if (pressedButton == CHROM_ANALIZ_PRESS) {//
-        (*_TFT).DL(COLOR_RGB(0, 0, 0)); //
-        }//
-        (*_TFT).DL(VERTEX2F(1620, 1700));
-        (*_TFT).DL(COLOR_MASK(1, 1, 1, 1));
-        (*_TFT).DL(BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA));
-        (*_TFT).DL(COLOR_RGB(0, 0, 0));
-        (*_TFT).DL(BITMAP_HANDLE(27));
-        (*_TFT).DL(CELL(65));
-        (*_TFT).DL(VERTEX2F(2308, 1756));
-        (*_TFT).DL(CELL(110));
-        (*_TFT).DL(VERTEX2F(2352, 1756));
-        (*_TFT).DL(CELL(97));
-        (*_TFT).DL(VERTEX2F(2388, 1756));
-        (*_TFT).DL(CELL(108));
-        (*_TFT).DL(VERTEX2F(2424, 1756));
-        (*_TFT).DL(CELL(105));
-        (*_TFT).DL(VERTEX2F(2440, 1756));
-        (*_TFT).DL(CELL(122));
-        (*_TFT).DL(VERTEX2F(2456, 1756));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        //Цвет букв "Analiz"
-        (*_TFT).DL(SAVE_CONTEXT());
-        (*_TFT).DL(VERTEX_FORMAT(2));
-        (*_TFT).DL(BITMAP_HANDLE(27));
-        (*_TFT).DL(CELL(65));
-        (*_TFT).DL(VERTEX2F(2312, 1760));
-        (*_TFT).DL(CELL(110));
-        (*_TFT).DL(VERTEX2F(2356, 1760));
-        (*_TFT).DL(CELL(97));
-        (*_TFT).DL(VERTEX2F(2392, 1760));
-        (*_TFT).DL(CELL(108));
-        (*_TFT).DL(VERTEX2F(2428, 1760));
-        (*_TFT).DL(CELL(105));
-        (*_TFT).DL(VERTEX2F(2444, 1760));
-        (*_TFT).DL(CELL(122));
-        (*_TFT).DL(VERTEX2F(2460, 1760));
-        (*_TFT).DL(RESTORE_CONTEXT());
-        (*_TFT).DL(TAG_MASK(0));//конец обработки нажатия кнопки
+        if(pressedButton == PID_MENU_PRESS)
+        (*_TFT).Button(405, 185, 390, 50, 27, OPT_FLAT, "PID Controller Menu");
+        else
+        (*_TFT).Button(405, 185, 390, 50, 27, 0, "PID Controller Menu");
+        //(*_TFT).DL(TAG_MASK(0));
+        
         (*_TFT).DL(DISPLAY());
-    FinishDL();
+        FinishDL();
 }
\ No newline at end of file
--- a/TFT/display.GetTouch.cpp	Fri Aug 14 14:16:03 2020 +0000
+++ b/TFT/display.GetTouch.cpp	Tue Sep 01 10:52:34 2020 +0000
@@ -5,5 +5,6 @@
 **************************************************************************************************************************/
 char Display::GetTouch()
 {   
+    
     return (*_TFT).Rd8(REG_TOUCH_TAG);
 }
\ No newline at end of file
--- a/TFT/display.PidScreen.cpp	Fri Aug 14 14:16:03 2020 +0000
+++ b/TFT/display.PidScreen.cpp	Tue Sep 01 10:52:34 2020 +0000
@@ -4,6 +4,7 @@
     char key=pressedButton;
     char str_v[48];
     char sel=0;
+    uint16_t tx,ty,tw,th;//временные параметры для обработки касаний;
     
     StartDL();
     (*_TFT).DL(CLEAR_COLOR_RGB(31, 63, 127));
@@ -20,19 +21,26 @@
     sprintf(str_v,"PID Rashod: %0.4f cm3/kg | Power: %04d",ras,power2);
     myWdget_Edit(34,78+44,420,40,0,str_v);
     
-    (*_TFT).DL(TAG_MASK(1));
+    //(*_TFT).DL(TAG_MASK(1));
     
-    (*_TFT).DL(TAG(SEL_P1));
+    //(*_TFT).DL(TAG(SEL_P1));
+    tx=34;    ty=78+44+44;    tw=420/2-2;    th=40;
+    if(TouchX>tx&&TouchY>ty&&TouchX<(tx+tw)&&TouchY<(ty+th))
+    
+    selectedEditor=EDIT_P1;//ниже пояснение
     sprintf(str_v,"P1: %04.2f",PID1->kP);
-    if(selectedEditor==EDIT_P1)
+    if(selectedEditor==EDIT_P1)//повторение из-за того что исправлял старую разработку
     {sel=1;
         myWdget_Edit_change(str_v);        
         sprintf(str_v,"%s",str_edit);
     }    
-    myWdget_Edit(34,78+44+44,420/2-2,40,sel,str_v);    
+    myWdget_Edit(tx,ty,tw,th,sel,str_v);    
     sel=0;
     
-    (*_TFT).DL(TAG(SEL_P2));
+    //(*_TFT).DL(TAG(SEL_P2));
+    tx=34+420/2+2;    ty=78+44+44;    tw=420/2-2;    th=40;
+    if(TouchX>tx&&TouchY>ty&&TouchX<(tx+tw)&&TouchY<(ty+th))
+    selectedEditor=EDIT_P2;
     sprintf(str_v,"P2: %04.2f",PID2->kP);
     if(selectedEditor==EDIT_P2)
     {
@@ -40,10 +48,13 @@
     myWdget_Edit_change(str_v);        
         sprintf(str_v,"%s",str_edit);
     }
-    myWdget_Edit(34+420/2+2,78+44+44,420/2-2,40,sel,str_v);
+    myWdget_Edit(tx,ty,tw,th,sel,str_v);
     sel=0;
     
-    (*_TFT).DL(TAG(SEL_I1));
+    //(*_TFT).DL(TAG(SEL_I1));
+    tx=34;    ty=78+44*3;    tw=420/2-2;    th=40;
+    if(TouchX>tx&&TouchY>ty&&TouchX<(tx+tw)&&TouchY<(ty+th))
+    selectedEditor=EDIT_I1;
     sprintf(str_v,"I1: %06.1f",PID1->kI);
     if(selectedEditor==EDIT_I1)
     {
@@ -51,10 +62,13 @@
     myWdget_Edit_change(str_v);        
         sprintf(str_v,"%s",str_edit);
     }
-    myWdget_Edit(34,78+44*3,420/2-2,40,sel,str_v);
+    myWdget_Edit(tx,ty,tw,th,sel,str_v);
     sel=0;
     
-    (*_TFT).DL(TAG(SEL_I2));
+    //(*_TFT).DL(TAG(SEL_I2));
+    tx=34+420/2+2;    ty=78+44*3;    tw=420/2-2;    th=40;
+    if(TouchX>tx&&TouchY>ty&&TouchX<(tx+tw)&&TouchY<(ty+th))
+    selectedEditor=EDIT_I2;
     sprintf(str_v,"I2: %06.1f",PID2->kI);
     if(selectedEditor==EDIT_I2)
     {
@@ -62,10 +76,13 @@
     myWdget_Edit_change(str_v);        
         sprintf(str_v,"%s",str_edit);
     }
-    myWdget_Edit(34+420/2+2,78+44*3,420/2-2,40,sel,str_v);
+    myWdget_Edit(tx,ty,tw,th,sel,str_v);
     sel=0;
     
-    (*_TFT).DL(TAG(SEL_D1));
+    //(*_TFT).DL(TAG(SEL_D1));
+    tx=34;    ty=78+44*4;    tw=420/2-2;    th=40;
+    if(TouchX>tx&&TouchY>ty&&TouchX<(tx+tw)&&TouchY<(ty+th))
+    selectedEditor=EDIT_D1;
     sprintf(str_v,"D1: %05.2f",PID1->kD);
     if(selectedEditor==EDIT_D1)
     {
@@ -73,10 +90,13 @@
     myWdget_Edit_change(str_v);        
         sprintf(str_v,"%s",str_edit);
     }
-    myWdget_Edit(34,78+44*4,420/2-2,40,sel,str_v);
+    myWdget_Edit(tx,ty,tw,th,sel,str_v);
     sel=0;
     
-    (*_TFT).DL(TAG(SEL_D2));
+    //(*_TFT).DL(TAG(SEL_D2));
+    tx=34+420/2+2;    ty=78+44*4;    tw=420/2-2;    th=40;
+    if(TouchX>tx&&TouchY>ty&&TouchX<(tx+tw)&&TouchY<(ty+th))
+    selectedEditor=EDIT_D2;
     sprintf(str_v,"D2: %05.2f",PID2->kD);
     if(selectedEditor==EDIT_D2)
     {
@@ -85,10 +105,12 @@
     myWdget_Edit_change(str_v);        
         sprintf(str_v,"%s",str_edit);
     }
-    myWdget_Edit(34+420/2+2,78+44*4,420/2-2,40,sel,str_v);
+    myWdget_Edit(tx,ty,tw,th,sel,str_v);
     sel=0;
-    
-    (*_TFT).DL(TAG(BACK_PRESS));
+    //кнопка возврата в меню
+    //(*_TFT).DL(TAG(BACK_PRESS));
+    if(TouchX>34&&TouchY>325&&TouchX<(34+120)&&TouchY<(325+36))
+        pressedButton=BACK_PRESS;
     (*_TFT).DL(COLOR_RGB(255, 255, 255));
     if(key==BACK_PRESS)        
     (*_TFT).Button(34, 325, 120, 36, 27, OPT_FLAT, "Back");    
@@ -96,11 +118,14 @@
     (*_TFT).Button(34, 325, 120, 36, 27, 0, "Back");
     
     
-    (*_TFT).DL(TAG(CANCEL_PRESS));
+    //(*_TFT).DL(TAG(CANCEL_PRESS));
+    tx=325; ty=325; tw=120; th=36;
+    if(TouchX>tx&&TouchY>ty&&TouchX<(tx+tw)&&TouchY<(ty+th))
+    key=CANCEL_PRESS;
     (*_TFT).DL(COLOR_RGB(255, 255, 255));
     if(key==CANCEL_PRESS)
     {
-    (*_TFT).Button(325, 325, 120, 36, 27, OPT_FLAT, "Cancel");
+    (*_TFT).Button(tx, ty, tw, th, 27, OPT_FLAT, "Cancel");
     selectedEditor=EDIT_NONE;
     for(int i=0;i<10;i++)
     str_edit[i]=0;
@@ -108,9 +133,12 @@
     str_edit[0]='_';
     }
     else
-    (*_TFT).Button(325, 325, 120, 36, 27, 0, "Cancel");
+    (*_TFT).Button(tx, ty, tw, th, 27, 0, "Cancel");
     
-    (*_TFT).DL(TAG(APPLY_PRESS));
+    //(*_TFT).DL(TAG(APPLY_PRESS));
+    tx=200; ty=325; tw=120; th=36;
+    if(TouchX>tx&&TouchY>ty&&TouchX<(tx+tw)&&TouchY<(ty+th))
+    key=APPLY_PRESS;
     (*_TFT).DL(COLOR_RGB(255, 255, 255));
     if(key==APPLY_PRESS)
     {
@@ -143,7 +171,10 @@
     else
     (*_TFT).Button(200, 325, 120, 36, 27, 0, "Apply");
     
-    (*_TFT).DL(TAG(SAVE_PRESS));
+    //(*_TFT).DL(TAG(SAVE_PRESS));
+    tx=200; ty=365; tw=120; th=36;
+    if(TouchX>tx&&TouchY>ty&&TouchX<(tx+tw)&&TouchY<(ty+th))
+    pressedButton=key=SAVE_PRESS;
     (*_TFT).DL(COLOR_RGB(255, 255, 255));
     if(key==SAVE_PRESS)        
     (*_TFT).Button(200, 365, 120, 36, 27, OPT_FLAT, "Save");    
@@ -151,22 +182,25 @@
     (*_TFT).Button(200, 365, 120, 36, 27, 0, "Save");
     
     //переключатели ПИДов
-    (*_TFT).DL(TAG(PID1SW_PRESS));    
+    //(*_TFT).DL(TAG(PID1SW_PRESS));
+    tx=260; ty=420; tw=50; th=36;    
+    if(TouchX>tx&&TouchY>ty&&TouchX<(tx+tw)&&TouchY<(ty+th))
+    pressedButton=key=PID1SW_PRESS;    
     (*_TFT).Toggle(260, 420,50,27,0,0,"OFF""\xff""ON");
     if(key==PID1SW_PRESS)
     {PID1->enabled=~PID1->enabled;}
     if(PID1->enabled)
     (*_TFT).Toggle(260, 420,50,27,0,0xFFFF,"OFF""\xff""ON");//ПИД1 вкл
     
-    (*_TFT).DL(TAG(PID2SW_PRESS));    
+    //(*_TFT).DL(TAG(PID2SW_PRESS));
+    tx=385; ty=420; tw=50; th=36;    
+    if(TouchX>tx&&TouchY>ty&&TouchX<(tx+tw)&&TouchY<(ty+th))
+    pressedButton=key=PID2SW_PRESS;   
     (*_TFT).Toggle(385, 420,50,27,0,0,"OFF""\xff""ON");
-    if(key==PID2SW_PRESS)    
+    if(key==PID2SW_PRESS)
     {PID2->enabled=~PID2->enabled;}
     if(PID2->enabled)
-    (*_TFT).Toggle(385, 420,50,27,0,0xFFFF,"OFF""\xff""ON");//ПИД2 вкл
-    (*_TFT).DL(TAG_MASK(0));
-    
-    
+    (*_TFT).Toggle(385, 420,50,27,0,0xFFFF,"OFF""\xff""ON");//ПИД2 вкл    
     
     FinishDL();
 }
\ No newline at end of file
--- a/TFT/display.myWidgets.cpp	Fri Aug 14 14:16:03 2020 +0000
+++ b/TFT/display.myWidgets.cpp	Tue Sep 01 10:52:34 2020 +0000
@@ -21,11 +21,58 @@
 
 void Display::myWdget_NumPad(uint16_t x,uint16_t y)
 {
-    char key=pressedButton;
-    (*_TFT).Keys(x, y, 240, 60, 29, key, "123");
-    (*_TFT).Keys(x, y+63, 240, 60, 29, key, "456");
-    (*_TFT).Keys(x, y+63+63, 240, 60, 29, key, "789");
-    (*_TFT).Keys(x, y+63+63+63, 240, 60, 29, key, ".0<");
+    //шарина одной кнопки = 240/3
+    //высота 60
+    //расстояние между 2
+    char key;
+    uint16_t y1=y; //для отрисовки
+    if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60))
+    key='1';
+    pressedButton=key;
+    if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60))
+    key='2';
+    pressedButton=key;
+    if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60))
+    key='3';
+    pressedButton=key;
+    
+    y+=63;
+    if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60))
+    key='4';
+    pressedButton=key;
+    if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60))
+    key='5';
+    pressedButton=key;
+    if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60))
+    key='6';
+    pressedButton=key;
+    
+    y+=63;
+    if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60))
+    key='7';
+    pressedButton=key;
+    if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60))
+    key='8';
+    pressedButton=key;
+    if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60))
+    key='9';
+    pressedButton=key;
+    
+    y+=63;
+    if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60))
+    key='.';
+    pressedButton=key;
+    if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60))
+    key='0';
+    pressedButton=key;
+    if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60))
+    key='<';
+    pressedButton=key;
+    
+    (*_TFT).Keys(x, y1, 240, 60, 29, key, "123");
+    (*_TFT).Keys(x, y1+63, 240, 60, 29, key, "456");
+    (*_TFT).Keys(x, y1+63+63, 240, 60, 29, key, "789");
+    (*_TFT).Keys(x, y1+63+63+63, 240, 60, 29, key, ".0<");
 }
 
 void Display::myWdget_Edit_change(char * text)
--- a/display.h	Fri Aug 14 14:16:03 2020 +0000
+++ b/display.h	Tue Sep 01 10:52:34 2020 +0000
@@ -32,24 +32,13 @@
     CHROM_SET_SENSGAIN_PRESS,       //установить коэффициент усиления PGA
     CHROM_ANALIZ_PRESS,             //анализ
     CHROM_PROBA_PRESS,              //пробоотбор
-    NUMB_0,
-    NUMB_1,
-    NUMB_2,
-    NUMB_3,
-    NUMB_4,
-    NUMB_5,
-    NUMB_6,
-    NUMB_7,
-    NUMB_8,
-    NUMB_9,
-    SYM_DOT,
+    PID_MENU_PRESS,                 //переход в меню ПИД регуляторов
     BACK_PRESS,
     CANCEL_PRESS,
     APPLY_PRESS,
     SAVE_PRESS,
     PID1SW_PRESS,
-    PID2SW_PRESS,
-        
+    PID2SW_PRESS,        
     SEL_P1,
     SEL_I1,
     SEL_D1,    
@@ -108,6 +97,7 @@
     // variables using for navigation between screens
     char pressedButton;
     char activeScreen;
+    int16_t TouchX,TouchY;
     
     selectedEditor_t selectedEditor;
     unsigned char str_edit[12];
--- a/main.cpp	Fri Aug 14 14:16:03 2020 +0000
+++ b/main.cpp	Tue Sep 01 10:52:34 2020 +0000
@@ -34,10 +34,10 @@
 Ticker PID2; //ПИД для расхода
 /*Конец*/
 //InterruptIn button(USER_BUTTON);
-InterruptIn ADSRdy(PG_3);
+InterruptIn ADSRdy(D8);
 
 //настройка SPI для дисплея
-FT813 TFT (D11, D12, D13, D10, D9, D8); //mosi, miso, sck, ss, int, pd
+FT813 TFT (PC_12, PC_11, PC_10, PD_2, PG_2, PG_3); //mosi, miso, sck, ss, int, pd
 Display disp(&TFT);
 //конец
 
@@ -417,7 +417,7 @@
     disp.pressedButton = NONE_PRESS;
     disp.str_edit[0]='_';
     disp.cursor=0;
-    
+    uint32_t XY=0;
     //ADS1248CalibrateSoft(&ads1,BufToFloat); //эксперимент
     
     // change active screen depending on pressed area
@@ -425,17 +425,32 @@
         
         if(TFT.IsOn())//проверка включения дисплея
         {
-        disp.pressedButton = disp.GetTouch();
+        //получение координат касания
         
+        /*XY=TFT.GetTouchTagXY();
+        disp.TouchX=-(uint16_t)((XY>>16)*0xFFFF);
+        disp.TouchY=-(uint16_t)(XY*0xFFFF);*/
+        disp.TouchX=TFT.GetTouchTagX();
+        disp.TouchY=TFT.GetTouchTagY();;
+        disp.pressedButton=TFT.GetTouchTag();
+        if(disp.TouchX==-32768&&disp.TouchY==-32768)
+        disp.pressedButton = NONE_PRESS;
+        else UART.printf("X %d | Y %d\r\n",disp.TouchX,disp.TouchY);        
+        wait_ms(35);
+        
+            
         //-------------------------------ChromTestScreen------------------------
         if (disp.activeScreen == TEST_CHROM_SCREEN) {
             disp.ChromTest(LM35_0.temp,RAS.temp,temp,rashod_u);
-            if(disp.pressedButton){
-                wait_ms(100);
+            if(disp.pressedButton){                
                 if(disp.pressedButton==CHROM_TEMP_PRESS){
                      disp.pressedButton = NONE_PRESS;
                     disp.activeScreen=MENU_SCREEN;
                     }
+                if(disp.pressedButton==PID_MENU_PRESS){
+                    disp.pressedButton=NONE_PRESS;
+                    disp.activeScreen=PID_SCREEN;
+                    }
                 }
             }
         // ---------------------------------------------------------------------
@@ -445,7 +460,7 @@
             disp.selectedEditor=(selectedEditor_t)disp.pressedButton;            
            // else disp.selectedEditor=(selectedEditor_t)NONE_PRESS;
                 disp.PidScreen(&BufToFloat,LM35_0.temp,RAS.temp,LT1446_0.dacB.Code,LT1446_0.dacA.Code,&Mem.PID,&Mem.PID_R);}
-                wait_ms(100);
+                
                 if(disp.pressedButton==SAVE_PRESS)
                 {
                     Mem_write();//сохраняем настройки
@@ -501,7 +516,7 @@
         if (disp.activeScreen == MENU_SCREEN) {
             disp.MainMenu(LM35_0.temp, LM35_0.temp);//сюда писать значения (наверное) (расход/температура)
             if (disp.pressedButton) {
-                wait_ms(150);
+                //wait_ms(150);
                 if (disp.pressedButton == CURR_TEMP_PRESS) {
                     disp.activeScreen = CURR_TEMP_SCREEN;
                 } else if (disp.pressedButton == CURR_HUM_PRESS) {