#include "SPI.h" #include "Wire.h" #include "DHT.h" #include "FT_VM801B43.h" FT801IMPL_SPI FTImpl(FT_CS_PIN,FT_PDN_PIN,FT_INT_PIN); //------------------------------------------ Temperatuta-Wilgonosc------------------------------- DHT dht; //------------------------------------------ Koniec Temperatuta-Wilgonosc------------------------ //------------------------------------------ SD ------------------------------------------------- FT_SD FtSd(FT_SD_CSPIN); FT_SDStatus sd_present; FT_SDFile Imagefile; //------------------------------------------ Koniec SD ------------------------------------------- //------------------------------------------ Tablica Kalibracyjna--------------------------------- uint8_t touchCallibration[24] = { 0xB1, 0x63, 0x0, 0x0, 0xF, 0xFC, 0xFF, 0xFF, 0x77, 0xF9, 0xFB, 0xFF, 0x60, 0x0, 0x0, 0x0, 0xBE, 0x63, 0x0, 0x0, 0x79, 0x4A, 0xF9, 0xFF }; //------------------------------------------ Koniec Tablicy Kalibracyjnej ------------------------- //------------------------------------------ Kalibracja ------------------------------------------- void kalibracja() { FTImpl.DLStart(); // Otwieramy liste wyswietlania FTImpl.ClearColorRGB(0x00, 0x00, 0x00); // Kolor czyszczenia czarny FTImpl.Clear(1, 1, 1); // Czyścimy ekran FTImpl.ColorRGB(0xFF, 0xFF, 0xFF); // Ustawiamy kolor bialy (R,G,B) FTImpl.Cmd_Text((FT_DISPLAYWIDTH / 2), (FT_DISPLAYHEIGHT / 2), 30, FT_OPT_CENTER, "Dotknij punkty"); FTImpl.Cmd_FGColor(0xFFFF00); // Kolor pierwszego planu FTImpl.Cmd_BGColor(0x444400); // Kolor drugiego planu FTImpl.Cmd_Calibrate(0); // Kalibracja FTImpl.DLEnd(); // Zamykamy liste wyswietlania FTImpl.Finish(); // Renderujemu liste i czekamy na ukonczeni FTImpl.SetCTouchMode(FT_CTOUCH_MODE_EXTENDED); // Pobranie zawartosci 12 rejestrow i wyswietlenie w konsoli Serial.println("uint8_t touchCallibration[24] = {"); for (uint8_t i = 0; i < 24; i++) { if ((i % 4 == 0) && (i > 0)) Serial.println(); Serial.print("0x"); Serial.print(FTImpl.Read(REG_CTOUCH_TRANSFORM_A + i), HEX); if (i < 23) Serial.print(", "); } Serial.println(); Serial.println("};"); } //------------------------------------------ Koniec Kalibracji ------------------------------------------- //------------------------------------------ Konfiguracja Ekranu ----------------------------------------- boolean DisplayInit() { uint32_t chipid = 0; Serial.println("Inicjalizacja ekranu"); // Inicjalizujemy ekran FTImpl.Init(FT_DISPLAY_RESOLUTION); delay(20); // Pobieramy ID ukladu i sprawdzamy czy to FT801 chipid = FTImpl.Read32(FT_ROM_CHIPID); if (chipid != FT801_CHIPID) { Serial.print("Nie obslugiwany uklad: 0x"); Serial.println(chipid, HEX); return false; } Serial.print("Obslugiwany uklad: 0x"); Serial.println(chipid, HEX); // Wlaczamy ekran FTImpl.SetDisplayEnablePin(FT_DISPENABLE_PIN); FTImpl.SetAudioEnablePin(FT_AUDIOENABLE_PIN); FTImpl.DisplayOn(); FTImpl.AudioOn(); return true; } //------------------------------------------ Koniec Konfiguracja Ekranu ----------------------------------- //------------------------------------------ Sprawdzenie Karty SD ----------------------------------------- void CheckStorageDevicePrecence(){ while(sd_present){ FTImpl.DLStart(); FTImpl.Clear(1,1,1); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(FT_DISPLAYWIDTH>>1,FT_DISPLAYHEIGHT>>1,29,FT_OPT_CENTER,"STORAGE DEVICE NOT FOUND"); FTImpl.DLEnd(); FTImpl.Finish(); delay(5000); } } //------------------------------------------ Koniec Sprawdzenie Karty SD ------------------------------------ //------------------------------------------ Wybór grafiki tła ---------------------------------------------- #define MAX_IMAGESc 13 // 0 1 2 3 4 5 6 7 8 9 10 11 12 char imagenamec[MAX_IMAGESc][13] = {"tlo1.jpg","tlo2.jpg","tlo3.jpg","tlo4.jpg","tlo5.jpg","tlo6.jpg","tlo7.jpg","tlo8.jpg","tlo9.jpg","tlo10.jpg","tlo11.jpg","tlo12.jpg","tlo13.jpg"}; // 480x272 int IDimagen = 10; //nr.obrazka //------------------------------------------ Koniec Wybór grafiki tła ---------------------------------------- //------------------------------------------------------------------------------------------------------------ float Temp; long previousMillis = 0; // will store last time was updated //long interval = 1000; // 1 sec long interval = 500; // 0.5 sec //long interval = 150; // 0.15 sec //long interval = 100; // 0.1 sec //long interval = 50; // 0.05 sec //------------------------------------------------------------------------------------------------------------ //-------------------------------------- załaduj grafikę z Karty SD do G-RAM --------------------------------- void OpenJPGSD() { FtSd.OpenFile(Imagefile,imagenamec[IDimagen]); //480x272 FTImpl.WriteCmd(CMD_LOADIMAGE); FTImpl.BitmapSource((0)); FTImpl.WriteCmd(480L*2*272); //480x272 Load_Jpeg(Imagefile); } void Load_Jpeg(FT_SDFile &r) { uint8_t imbuff[512]; uint16_t blocklen; while (r.Offset < r.Size) { uint16_t n = min(512, r.Size - r.Offset); n = (n + 3) & ~3; // force 32-bit alignment r.ReadSector(imbuff); FTImpl.WriteCmd(imbuff,n); } } //-------------------------------------- koniec załaduj grafikę z Karty SD do G-RAM -------------------------- //-------------------------------------- załaduj grafikę z G-RAM -------------------------------------------- void SeeJPG() { FTImpl.BitmapHandle(1); FTImpl.BitmapSource((0)); FTImpl.BitmapLayout(FT_RGB565,480L*2,272); //480x272 FTImpl.BitmapSize(FT_NEAREST,FT_BORDER,FT_BORDER,480,272); //480x272 FTImpl.Begin(FT_BITMAPS); FTImpl.Vertex2ii(0, 0,1, 0); } //-------------------------------------- koniec załaduj grafikę z G-RAM ------------------------------------- //-------------------------------------- Odbiór danych z com ------------------------------------------------- String inputString = ""; // a String to hold incoming data bool stringComplete = false; // whether the string is complete void odbior_danych_com() { while (Serial.available()) { char inChar = Serial.read(); if (inChar != '\n') inputString += inChar; else { stringComplete = true; } } } //-------------------------------------- koniec Odbiór danych z com ------------------------------------------ String inputString2 = ""; String inputString3 = ""; String inputString4 = ""; String czujnikSwiatla = ""; byte scena = 0; //--scena //-------------------------------------------SCENA-1---------------------------------------------------------- void Scena_1() { //------------------------------------------ Mainboard ------------------------------------------------------- if (inputString.indexOf("M") > -1) { int mainboardNameStart = inputString.indexOf("M:"); int mainboardNameEnd = inputString.indexOf("|", mainboardNameStart); String mainboardString = inputString.substring(mainboardNameStart +2, mainboardNameEnd); sTagXY sTagxy; FTImpl.GetTagXY(sTagxy); FTImpl.TagMask(1); FTImpl.DLStart(); SeeJPG(); FTImpl.Tag(3); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_FGColor(0x444444); //--kolor guzika przed wcisnieciem int tagoption = 0; if (sTagxy.tag == 3) { tagoption = FT_OPT_FLAT; //--guzik FTImpl.Cmd_FGColor(0x880000); //--kolor guzika po wcisnieciu //FTImpl.ColorRGB(0, 0, 255); //--kolor tekstu po wcisnieciu scena = 3; //--scena nr.3 } FTImpl.Cmd_Button(6, 6, 23, 23, 27, tagoption, "S"); //--guzik //const char Display_string[12] = "<--"; //--teks //FTImpl.Cmd_Text(426, -7, 30, tagoption, Display_string); //--tekst FTImpl.TagMask(0); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(150, 5, 18, 0, mainboardString.c_str()); //**** Nazwa Płyty //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Name ------------------------------------------------------- if (inputString.indexOf("CPU") > -1) { int cpuNameStart = inputString.indexOf("CPU:"); int cpuNameEnd = inputString.indexOf("|", cpuNameStart); String cpuString = inputString.substring(cpuNameStart +4, cpuNameEnd); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(120, 20, 18, 0, cpuString.c_str()); //**** Nazwa Procesora //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ Core #1 - #6 Temperature ---------------------------------------- if (inputString.indexOf("CPUtem") > -1) { int cpuTempStart = inputString.indexOf("CPUtem:"); int cpuTempEnd = inputString.indexOf("|", cpuTempStart); String cpuTempString = inputString.substring(cpuTempStart +7, cpuTempEnd); String degreeChar = String(char(248)); const char tempC[12] = "C"; String CPU_temp = ("CPU Temp. " + cpuTempString); sTagXY sTagxy; FTImpl.GetTagXY(sTagxy); FTImpl.TagMask(1); FTImpl.Tag(1); FTImpl.ColorRGB(0,255,0); int tagoption = 0; if (sTagxy.tag == 1) { FTImpl.ColorRGB(0, 0, 255); scena = 2; //--scena nr.2 } //FTImpl.DLStart(); FTImpl.ColorRGB(0,255,0); FTImpl.Cmd_Text(170, 40, 28, tagoption, CPU_temp.c_str()); //**** Core #1 - #6 Temperature FTImpl.Cmd_Text(350, 43, 19, 0, degreeChar.c_str()); //--degree FTImpl.Cmd_Text(357, 40, 28, 0, tempC); FTImpl.TagMask(0); //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Core #1 MHz ------------------------------------------------- if (inputString.indexOf("CPUz1") > -1) { int cpu1ClockStart = inputString.indexOf("CPUz1:"); int cpu1ClockEnd = inputString.indexOf("|", cpu1ClockStart); String cpu1ClockString = inputString.substring(cpu1ClockStart +6, cpu1ClockEnd); String CPU_1_MHz = ("CPU Core 1 " + cpu1ClockString + " MHz"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(60, 65, 18, 0, CPU_1_MHz.c_str()); //**** CPU Core #1 MH //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Core #2 MHz ------------------------------------------------- if (inputString.indexOf("CPUz2") > -1) { int cpu2ClockStart = inputString.indexOf("CPUz2:"); int cpu2ClockEnd = inputString.indexOf("|", cpu2ClockStart); String cpu2ClockString = inputString.substring(cpu2ClockStart +6, cpu2ClockEnd); String CPU_2_MHz = ("CPU Core 2 " + cpu2ClockString + " MHz"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(60, 80, 18, 0, CPU_2_MHz.c_str()); //**** CPU Core #2 MH //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Core #3 MHz ------------------------------------------------- if (inputString.indexOf("CPUz3") > -1) { int cpu3ClockStart = inputString.indexOf("CPUz3:"); int cpu3ClockEnd = inputString.indexOf("|", cpu3ClockStart); String cpu3ClockString = inputString.substring(cpu3ClockStart +6, cpu3ClockEnd); String CPU_3_MHz = ("CPU Core 3 " + cpu3ClockString + " MHz"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(60, 95, 18, 0, CPU_3_MHz.c_str()); //**** CPU Core #3 MH //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Core #4 MHz ------------------------------------------------- if (inputString.indexOf("CPUz4") > -1) { int cpu4ClockStart = inputString.indexOf("CPUz4:"); int cpu4ClockEnd = inputString.indexOf("|", cpu4ClockStart); String cpu4ClockString = inputString.substring(cpu4ClockStart +6, cpu4ClockEnd); String CPU_4_MHz = ("CPU Core 4 " + cpu4ClockString + " MHz"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(60, 110, 18, 0, CPU_4_MHz.c_str()); //**** CPU Core #4 MH //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Core #5 MHz ------------------------------------------------- if (inputString.indexOf("CPUz5") > -1) { int cpu5ClockStart = inputString.indexOf("CPUz5:"); int cpu5ClockEnd = inputString.indexOf("|", cpu5ClockStart); String cpu5ClockString = inputString.substring(cpu5ClockStart +6, cpu5ClockEnd); String CPU_5_MHz = ("CPU Core 5 " + cpu5ClockString + " MHz"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(60, 125, 18, 0, CPU_5_MHz.c_str()); //**** CPU Core #5 MH //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Core #6 MHz ------------------------------------------------- if (inputString.indexOf("CPUz6") > -1) { int cpu6ClockStart = inputString.indexOf("CPUz6:"); int cpu6ClockEnd = inputString.indexOf("|", cpu6ClockStart); String cpu6ClockString = inputString.substring(cpu6ClockStart +6, cpu6ClockEnd); String CPU_6_MHz = ("CPU Core 6 " + cpu6ClockString + " MHz"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(60, 140, 18, 0, CPU_6_MHz.c_str()); //**** CPU Core #6 MH //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Core #1 % ------------------------------------------------- if (inputString.indexOf("CPUo1") > -1) { int cpu1LoadStart = inputString.indexOf("CPUo1:"); int cpu1LoadEnd = inputString.indexOf("|", cpu1LoadStart); String cpu1LoadString = inputString.substring(cpu1LoadStart +6, cpu1LoadEnd); String CPU_1_p = ("CPU Core 1 " + cpu1LoadString + " %"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(250, 65, 18, 0, CPU_1_p.c_str()); //**** CPU Core #1 % //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Core #2 % ------------------------------------------------- if (inputString.indexOf("CPUo2") > -1) { int cpu2LoadStart = inputString.indexOf("CPUo2:"); int cpu2LoadEnd = inputString.indexOf("|", cpu2LoadStart); String cpu2LoadString = inputString.substring(cpu2LoadStart +6, cpu2LoadEnd); String CPU_2_p = ("CPU Core 2 " + cpu2LoadString + " %"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(250, 80, 18, 0, CPU_2_p.c_str()); //**** CPU Core #2 % //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Core #3 % ------------------------------------------------- if (inputString.indexOf("CPUo3") > -1) { int cpu3LoadStart = inputString.indexOf("CPUo3:"); int cpu3LoadEnd = inputString.indexOf("|", cpu3LoadStart); String cpu3LoadString = inputString.substring(cpu3LoadStart +6, cpu3LoadEnd); String CPU_3_p = ("CPU Core 3 " + cpu3LoadString + " %"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(250, 95, 18, 0, CPU_3_p.c_str()); //**** CPU Core #3 % //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Core #4 % ------------------------------------------------- if (inputString.indexOf("CPUo4") > -1) { int cpu4LoadStart = inputString.indexOf("CPUo4:"); int cpu4LoadEnd = inputString.indexOf("|", cpu4LoadStart); String cpu4LoadString = inputString.substring(cpu4LoadStart +6, cpu4LoadEnd); String CPU_4_p = ("CPU Core 4 " + cpu4LoadString + " %"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(250, 110, 18, 0, CPU_4_p.c_str()); //**** CPU Core #4 % //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Core #5 % ------------------------------------------------- if (inputString.indexOf("CPUo5") > -1) { int cpu5LoadStart = inputString.indexOf("CPUo5:"); int cpu5LoadEnd = inputString.indexOf("|", cpu5LoadStart); String cpu5LoadString = inputString.substring(cpu5LoadStart +6, cpu5LoadEnd); String CPU_5_p = ("CPU Core 5 " + cpu5LoadString + " %"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(250, 125, 18, 0, CPU_5_p.c_str()); //**** CPU Core #5 % //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Core #6 % ------------------------------------------------- if (inputString.indexOf("CPUo6") > -1) { int cpu6LoadStart = inputString.indexOf("CPUo6:"); int cpu6LoadEnd = inputString.indexOf("|", cpu6LoadStart); String cpu6LoadString = inputString.substring(cpu6LoadStart +6, cpu6LoadEnd); String CPU_6_p = ("CPU Core 6 " + cpu6LoadString + " %"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(250, 140, 18, 0, CPU_6_p.c_str()); //**** CPU Core #6 % //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ CPU Bus Speed ------------------------------------------------- if (inputString.indexOf("CPUbu") > -1) { int bsClockStart = inputString.indexOf("CPUbu:"); int bsClockEnd = inputString.indexOf("|", bsClockStart); String bsClockString = inputString.substring(bsClockStart +6, bsClockEnd); String CPU_Bus_Speed = ("CPU Bus Speed " + bsClockString + " MHz"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(150, 155, 18, 0, CPU_Bus_Speed.c_str()); //**** CPU Bus Speed //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ GPU Name ------------------------------------------------- if (inputString.indexOf("GPU") > -1) { int gpuNameStart = inputString.indexOf("GPU:"); int gpuNameEnd = inputString.indexOf("|", gpuNameStart); String gpuString = inputString.substring(gpuNameStart +4, gpuNameEnd); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(140, 175, 18, 0, gpuString.c_str()); //**** Nazwa Karty Graficznej //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ GPU Temperature ------------------------------------------------- if (inputString.indexOf("GPUtem") > -1) { int gpuTempStart = inputString.indexOf("GPUtem:"); int gpuTempEnd = inputString.indexOf("|", gpuTempStart); String gpuTempString = inputString.substring(gpuTempStart +7, gpuTempEnd); String GPU_temp = ("GPU Temp. " + gpuTempString); String degreeChar2 = String(char(248)); const char tempGC[12] = "C"; //FTImpl.DLStart(); FTImpl.ColorRGB(0,255,0); FTImpl.Cmd_Text(170, 190, 28, 0, GPU_temp.c_str()); //**** GPU Temperature FTImpl.Cmd_Text(350, 193, 19, 0, degreeChar2.c_str()); //--degree FTImpl.Cmd_Text(357, 190, 28, 0, tempGC); //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ GPU Core Clock------------------------------------------------- if (inputString.indexOf("GPUz") > -1) { int gpuClockStart = inputString.indexOf("GPUz:"); int gpuClockEnd = inputString.indexOf("|", gpuClockStart); String gpuClockString = inputString.substring(gpuClockStart +5, gpuClockEnd); String GPU_Clock = ("GPU Core Clock " + gpuClockString + " MHz"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(20, 215, 18, 0, GPU_Clock.c_str()); //**** GPU Core Clock //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ GPU Memory Clock ------------------------------------------------- if (inputString.indexOf("GPUzm") > -1) { int gpuMemoryStart = inputString.indexOf("GPUzm:"); int gpuMemoryEnd = inputString.indexOf("|", gpuMemoryStart); String gpuMemoryString = inputString.substring(gpuMemoryStart +6, gpuMemoryEnd); String GPU_Memory_Clock = ("GPU Memory Clock " + gpuMemoryString + " MHz"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(230, 215, 18, 0, GPU_Memory_Clock.c_str()); //**** GPU Memory Clock //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ RAM Used Memory ------------------------------------------------- if (inputString.indexOf("Ru") > -1) { int ramUsedStart = inputString.indexOf("Ru:"); int ramUsedEnd = inputString.indexOf("|", ramUsedStart); String ramUsedString = inputString.substring(ramUsedStart +3, ramUsedEnd); String RAM_Used_Memory = ("RAM Used " + ramUsedString + " GB"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,0,0); FTImpl.Cmd_Text(230, 235, 18, 0, RAM_Used_Memory.c_str()); //**** RAM Used Memory //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ RAM Available Memory ---------------------------------------------- if (inputString.indexOf("Rw") > -1) { int ramAvailablStart = inputString.indexOf("Rw:"); int ramAvailablEnd = inputString.indexOf("|", ramAvailablStart); String ramAvailablString = inputString.substring(ramAvailablStart +3, ramAvailablEnd); String RAM_Available_Memory = ("RAM Available " + ramAvailablString + " GB"); //FTImpl.DLStart(); FTImpl.ColorRGB(0,85,255); FTImpl.Cmd_Text(20, 235, 18, 0, RAM_Available_Memory.c_str()); //**** RAM Available Memory //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ HDD Name ---------------------------------------------------------- if (inputString.indexOf("HDD") > -1) { int hddNameStart = inputString.indexOf("HDD:"); int hddNameEnd = inputString.indexOf("|", hddNameStart); String hddString = inputString.substring(hddNameStart +4, hddNameEnd); String HDD_Name = ("HDD " + hddString); //FTImpl.DLStart(); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(20, 255, 18, 0, HDD_Name.c_str()); //**** Nazwa Dysku //FTImpl.DLEnd();// Zamykamy liste wyswietlania //FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } //------------------------------------------ HDD Used ---------------------------------------------------------- if (inputString.indexOf("HDDu") > -1) { int hddUsedStart = inputString.indexOf("HDDu:"); int hddUsedEnd = inputString.indexOf("|", hddUsedStart); String hdduString = inputString.substring(hddUsedStart +5, hddUsedEnd); String HDD_Used = ("HDD Used " + hdduString + " %"); //FTImpl.DLStart(); FTImpl.ColorRGB(255,0,0); FTImpl.Cmd_Text(230, 255, 18, 0, HDD_Used.c_str()); //**** Nazwa Dysku FTImpl.DLEnd();// Zamykamy liste wyswietlania FTImpl.Finish();// Renderujemu liste i czekamy na ukonczenie } } //------------------------------------------ Koniec wyświetlania odebranych danych ---------------------------------- //-------------------------------------------Koniec SCENA-1---------------------------------------------------------- //-------------------------------------------SCENA-2----------------------------------------------------------------- void Scena_2() { sTagXY sTagxy; FTImpl.GetTagXY(sTagxy); FTImpl.TagMask(1); FTImpl.DLStart(); SeeJPG(); FTImpl.Tag(2); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_FGColor(0x444444); //--kolor guzika po wcisnieciu int tagoption = 0; if (sTagxy.tag == 2) { tagoption = FT_OPT_FLAT; //--guzik FTImpl.Cmd_FGColor(0x880000); //--kolor guzika po wcisnieciu //FTImpl.ColorRGB(0, 0, 255); //--kolor tekstu po wcisnieciu scena = 1; //--scena nr.1 } FTImpl.Cmd_Button(449, 6, 23, 23, 27, tagoption, "<"); //--guzik //const char Display_string[12] = "<--"; //--teks //FTImpl.Cmd_Text(426, -7, 30, tagoption, Display_string); //--tekst FTImpl.TagMask(0); if (stringComplete) { if (inputString.indexOf("CPUtem") > -1) { int cpuTempStart = inputString.indexOf("CPUtem:"); int cpuTempEnd = inputString.indexOf("|", cpuTempStart); String cpuTempString = inputString.substring(cpuTempStart +7, cpuTempEnd); FTImpl.ColorRGB(223,0,0); const char Display_cputem[12] = "CPU Temp."; FTImpl.Cmd_Text(45, 144, 30, 0, Display_cputem); const char Display_o[12] = "o"; FTImpl.ColorRGB(223,0,0); FTImpl.Cmd_Text(365, 140, 27, 0, Display_o); //--o String CPU_temp = (cpuTempString); FTImpl.ColorRGB(223,0,0); FTImpl.Cmd_Text(235, 140, 31, 0, CPU_temp.c_str()); //**** Core #1 - #6 Temperature const char Display_c[12] = "C"; FTImpl.ColorRGB(223,0,0); FTImpl.Cmd_Text(370, 140, 31, 0, Display_c); //--c } } inputString4 = (dht.getTemperature()); if (inputString4.indexOf('\n')) { FTImpl.ColorRGB(255,255,255); const char Display_tem[12] = "Temperatura"; FTImpl.Cmd_Text(45, 50, 29, 0, Display_tem); const char Display_o[12] = "o"; FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(345, 41, 27, 0, Display_o); //--o String temperatura = (inputString4 + " C"); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(235, 40, 31, 0, temperatura.c_str()); //**** Temperatura } FTImpl.DLEnd(); FTImpl.Finish(); } //-------------------------------------------Koniec SCENA-2---------------------------------------------------------- //-------------------------------------------SCENA-3----------------------------------------------------------------- void Scena_3() { sTagXY sTagxy; FTImpl.GetTagXY(sTagxy); FTImpl.TagMask(1); FTImpl.DLStart(); SeeJPG(); FTImpl.Tag(3); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_FGColor(0x444444); //--kolor guzika po wcisnieciu int tagoption = 0; if (sTagxy.tag == 3) { tagoption = FT_OPT_FLAT; //--guzik FTImpl.Cmd_FGColor(0x880000); //--kolor guzika po wcisnieciu //FTImpl.ColorRGB(0, 0, 255); //--kolor tekstu po wcisnieciu scena = 1; //--scena nr.1 } FTImpl.Cmd_Button(449, 6, 23, 23, 27, tagoption, "<"); //--guzik //const char Display_string[12] = "<--"; //--teks //FTImpl.Cmd_Text(426, -7, 30, tagoption, Display_string); //--tekst FTImpl.TagMask(0); inputString2 = (dht.getHumidity()); inputString3 = (dht.getTemperature()); if (inputString2.indexOf('\n')) { FTImpl.ColorRGB(255,255,255); const char Display_wil[12] = "Wilgotnosc"; FTImpl.Cmd_Text(55, 120, 29, 0, Display_wil); String wilgotnosc = (inputString2 + " %"); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(235, 110, 31, 0, wilgotnosc.c_str()); //**** Wilgotność } if (inputString3.indexOf('\n')) { FTImpl.ColorRGB(255,255,255); const char Display_tem[12] = "Temperatura"; FTImpl.Cmd_Text(45, 50, 29, 0, Display_tem); const char Display_o[12] = "o"; FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(345, 41, 27, 0, Display_o); //--o String temperatura = (inputString3 + " C"); FTImpl.ColorRGB(255,255,255); FTImpl.Cmd_Text(235, 40, 31, 0, temperatura.c_str()); //**** Temperatura } int fotoPin = 0; int fotoDane; if (fotoDane = analogRead(fotoPin)) { czujnikSwiatla = String(fotoDane); //********** int na string } if (czujnikSwiatla.indexOf('\n')) { FTImpl.ColorRGB(255,255,255); const char Display_nat[12] = "Natezenie"; FTImpl.Cmd_Text(60, 178, 29, 0, Display_nat); String lux = (czujnikSwiatla + " Lux"); FTImpl.ColorRGB(255,255,0); FTImpl.Cmd_Text(235, 170, 31, 0, lux.c_str()); //**** Temperatura //delay(500); } FTImpl.DLEnd(); FTImpl.Finish(); } //-------------------------------------------Koniec SCENA-3---------------------------------------------------------- //--------------------------------------- Load Spinner -------------------------------------------------------------- void load() { FTImpl.DLStart(); // Otwieramy liste wyswietlania FTImpl.Cmd_Gradient (-3,32,32767,347,162,8388352); FTImpl.ColorRGB(255, 0, 0); FTImpl.Cmd_Text(117, 80, 28, 0, "Czekam na dane z com "); FTImpl.Cmd_Spinner(228, 140, 1, 0); FTImpl.DLEnd(); // Zamykamy liste wyswietlania FTImpl.Finish(); // Renderujemu liste i czekamy na ukonczenie } //--------------------------------------- Koniec Load Spinner -------------------------------------------------------- void setup() { Serial.begin(9600); inputString.reserve(200); dht.setup(2); // data pin 2 //******************** Kalibracja ******************************************* //kalibracja(); // tylko raz zobacz film https://www.youtube.com/watch?v=TLOuicryrKM // Jesli mamy juz skalibrowany while (!DisplayInit()) {} FTImpl.SetCTouchMode(FT_CTOUCH_MODE_EXTENDED); for (uint8_t i = 0; i < 24; i++) { FTImpl.Write(REG_CTOUCH_TRANSFORM_A + i, touchCallibration[i]); } //******************** Koniec Kalibracji *********************************** sd_present = FtSd.Init(); //--Odpalenie SD CheckStorageDevicePrecence(); //--Sprawdzenie SD OpenJPGSD(); load(); scena = 1; //--scena nr.1 } void loop() { odbior_danych_com(); switch (scena) { case 1: if (stringComplete) { Scena_1(); inputString = ""; stringComplete = false; } break; case 2: if (stringComplete) { Scena_2(); inputString = ""; String inputString2 = ""; String inputString3 = ""; String inputString4 = ""; String czujnikSwiatla = ""; stringComplete = false; } break; case 3: if (stringComplete) { Scena_3(); inputString = ""; String inputString2 = ""; String inputString3 = ""; String czujnikSwiatla = ""; stringComplete = false; } break; default: if (stringComplete) { Scena_1(); inputString = ""; stringComplete = false; } } } /* Nothing beyond this */