Curtis Mattull
/
PANEL_GUI_hello_world
basic functional test of FT810 LCD via SPI
Diff: main.cpp
- Revision:
- 14:52a03b4a0365
- Parent:
- 13:8f23699b9c9f
- Child:
- 15:25cbc8345067
--- a/main.cpp Tue Apr 05 19:56:46 2016 +0000 +++ b/main.cpp Fri Apr 08 19:54:19 2016 +0000 @@ -26,7 +26,7 @@ #include "MCP4725.h" #define K20 // used to simplify defining for different microcontroller platforms -#define Program_Button // used add easy way to reprogram without using the phsyical button. +//#define Program_Button // used add easy way to reprogram without using the phsyical button. //#define Debug_Swipe // reads back touch data in real time on the screen #ifdef K20 @@ -210,7 +210,7 @@ PFWflowrate = PFW_fcal; // store filtered value in feedback variable TFT.DL(COLOR_RGB(255,255,255)); // set text feedback text color to white sprintf(buffer, "%.1f", PFWflowrate); // write feedback to LCD - TFT.Text(285,95,31,0,buffer); + TFT.Text(305,95,31,0,buffer); TFT.Text(385, 95, 31, 0, " L/min"); // write units to LCD /***************************************************************************************************/ @@ -232,16 +232,16 @@ TFT.DL(VERTEX2F(295*16,265*16)); TFT.DL(VERTEX2F(505*16,330*16)); TFT.DL(END()); - PSEpressure = (PSEpressure_raw.read_u16() - 10440) * (1.0) / (52350 - 10440) + 0; // calibration and scaling math for the PFW feedback, 52350 = 20mA, 10440 = 4mA + PSEpressure = ((PSEpressure_raw.read_u16() - 10440) * (1.0) / (52350 - 10440) + 0)*145.0377; // calibration and scaling math for the PFW feedback, 52350 = 20mA, 10440 = 4mA PSE_fcal = PSEpressure; // moving average filter PSE_fcal *= avg1; PSE_fcal += PSE_pre * avg2; PSE_pre = PSE_fcal; PSEpressure = PSE_fcal; // store the filtered value in feedback variable TFT.DL(COLOR_RGB(255,255,255)); // set text color to white - sprintf(buffer, "%.2f", PSEpressure); // write feedback to screen + sprintf(buffer, "%.1f", PSEpressure); // write feedback to screen TFT.Text(300,275,31,0,buffer); - TFT.Text(405, 275, 31, 0, " MPa"); // write units to LCD + TFT.Text(405, 275, 31, 0, " PSI"); // write units to LCD /***************************************************************************************************/ #ifdef Debug_Swipe // writes touch data to screen @@ -330,6 +330,9 @@ /****************************************************************************/ void initialize_Images() { + while(card_present.read()) { // checks for SD card, if not present hold program until a SD card is inserted + error_screen("Error!","Insert SD card!"); // write error screen to LCD + } TFT.DLstart(); // start a new display command list TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer @@ -396,6 +399,7 @@ TFT.WaitCmdfifo_empty(); // wait till coprocessor completes the operation while(1) { + Main_Screen(); // paint new screen curY = TFT.Rd32(REG_TOUCH_SCREEN_XY)& 0xffff; // get the current touch screen position curX = TFT.Rd32(REG_TOUCH_SCREEN_XY)>>16; // if not touch the results are 0x8000 for x and y ft_uint8_t tagval = 0; // initialize return tag value @@ -433,18 +437,8 @@ touched=0; // Reset for the next touch // If not being touched } else { - //page 4 location - if (location < - 2300 && location > -2500) { // If you are close to the edge of the fourth Page - if (velocity) { // and you have some velocity - velocity = (location + 2400)/-5; // adjust velocity based on how close to the edge - location += (int16_t) velocity; // move the location at the speed of velocity - paslocation = location; - } else { // velocity will become zero as you get closer to the edge when this happens finish the move - location = -2400; - } - } //page 3 location - else if (location < - 1500 && location > -1700) { // repeat for each page + if (location < - 1500 && location > -1700) { // repeat for each page if (velocity) { velocity = (location + 1600)/-5; location += (int16_t) velocity; @@ -496,7 +490,6 @@ } } SupplyPressure_Check(ITVpressure1_input_scaled, ITVpressure2_input_scaled); // check to see if theres enough supply pressure for the ITVs - Main_Screen(); // paint new screen TFT.Sleep(10); // wait 10ms for next time to repaint the screen } // end of display loop } \ No newline at end of file