#include #include "config.h" #include #include #include #include #include #include #include /* todo * pobierac temp z onewire (wybierz jakes piny) i aktualizowac w loopie co np 10 sekund. * * po wcisnieciu jakiegos guzika jest powinno być wybudzenie wyświetlacza. * przyciski up/down zaznaczam gdy chce zmienić histereze, temp int lub temp ext. po wybraniu kliknąć * confirm i wtedy up/down do zmiany temeratury, po zakończeniu exit. Do obsługi przycisków masz ezButton. * * zasada będzie taka, że jak jest mniej niż min temp internal to serwo zamyka zupełnie zawór. * jeśli jest między min internal a max external to zawór otworzony w 70%. * Jak więcej niż max external to zawór otworzony na 100%. * * serwo ma 270 stopni, ale uwzględniając przekładnie 3 stopnie na serwie to 1 stopień na zaworze. * 0 stopni to zawór zamknięty (0%) * 270 stopni to 90 stopni na zaworze, czyli jest otwarty w 100%. */ Adafruit_ST7789 tft = Adafruit_ST7789(&SPI, TFT_CS, TFT_DC, TFT_RST); Servo myServo; OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); float tempInternal; float tempCurrent; float temp_min_internal; float temp_max_external; float temp_cur_internal; float temp_cur_external; int deviceCount = 0; void setupSensors(){ sensors.begin(115200); // baud rate Serial.print("Searching for devices.") deviceCount = sensors.getDeviceCount(); if(deviceCount != 0) { Serial.print(deviceCount, DEC); } else { Serial.print("Cannot find any devices connected to One_Wire_Bus"); } } void setupDisplay(){ SPI.begin(TFT_SCLK, -1, TFT_MOSI, TFT_CS); tft.init(240, 240); tft.fillScreen(ST77XX_BLACK); tft.setTextColor(ST77XX_CYAN); tft.setTextSize(3); tft.setCursor(0, 0); tft.print("TEMP INTERNAL"); tft.setCursor(0, 25); tft.print("min: 50,5"); tft.setCursor(0, 50); tft.print("cur: 67,1"); tft.setCursor(0, 90); tft.print("TEMP EXTERNAL"); tft.setCursor(0, 115); tft.print("max: 90,0"); tft.setCursor(0, 140); tft.print("cur: 80,5"); tft.setCursor(0, 180); tft.print("HYST: 5"); tft.setCursor(0, 215); tft.print("VALVE: 70%"); } void setup() { Serial.begin(115200); delay(100); setupDisplay(); } void loop() { }