#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 current_external_wire(EXTERNAL_BUS); OneWire current_internal_wire(INTERNAL_BUS); DallasTemperature current_internal_sensor(¤t_internal_wire); DallasTemperature current_external_sensor(¤t_external_wire); float tempInternal; float tempCurrent; float temp_min_internal; float temp_max_external; float temp_cur_internal; float temp_cur_external; void setupSensors(){ internal_sensor.begin(); external_sensor.begin(); Serial.print("Searching for devices."); int internal_sensor_count = current_internal_sensor.getDeviceCount(); int external_sensor_count = current_external_sensor.getDeviceCount(); Serial.print("Internal sensors found: "); Serial.println(internal_sensor_count); Serial.print("External sensors found: "); Serial.println(external_sensor_count); } 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() { }