From 1d4f648b285c7cf027e61b36fcc298b09c533a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C5=A1per=20Dobrovoljc?= Date: Wed, 31 May 2023 18:46:03 +0200 Subject: [PATCH] Dodal testne --- .vscode/settings.json | 3 ++ src/main.cpp | 105 +++++++----------------------------------- 2 files changed, 19 insertions(+), 89 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4b5a72a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "C_Cpp.default.compilerPath": "/opt/homebrew/opt/llvm/bin/clang" +} diff --git a/src/main.cpp b/src/main.cpp index 0edd01b..cc179f6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -120,43 +120,6 @@ #define PIN_52_RESERVED 52 // reserved by W5x00 Shield on MEGA #define PIN_53_RESERVED 53 // reserved by W5x00 Shield on MEGA -// WC -#define PIN_WC_LUC_1 24 -#define PIN_WC_LUC_2 25 -#define PIN_WC_ALARM 26 -#define PIN_WC_TEMPHUM 27 - -// Hodnik -#define PIN_HODNIK_VRATA 28 -#define PIN_HODNIK_LUC_1 29 -#define PIN_HODNIK_LUC_2 30 -#define PIN_HODNIK_LUC_3 31 -#define PIN_HODNIK_LUC_4 32 -#define PIN_HODNIK_ZVONEC 33 -#define PIN_HODNIK_LED_OMARA 34 -#define PIN_HODNIK_LED_STROP 35 -#define PIN_HODNIK_ZUNAJ_VHOD 36 -#define PIN_HODNIK_SENZOR_STOPNISCE 37 -#define PIN_HODNIK_SENZOR_VRATA 38 - -// Jedilnica -#define PIN_JEDILNICA_TIPKA_1 40 -#define PIN_JEDILNICA_TIPKA_2 41 -#define PIN_JEDILNICA_TIPKA_3 42 -#define PIN_JEDILNICA_TIPKA_4 43 -#define PIN_JEDILNICA_TIPKA_5 44 -#define PIN_JEDILNICA_LUC_1 45 -#define PIN_JEDILNICA_LUC_2 46 - -// Dnevna -#define PIN_DNEVNA_LUC_VTICNICA 48 -#define PIN_DNEVNA_TEMPHUM_PODSTREHA 49 -#define PIN_DNEVNA_TEMPHUM 50 - -// Otroška soba -#define PIN_OTROSKA_LUC_1 51 -#define PIN_OTROSKA_LUC_2 52 - //****************************************************************************************** // W5x00 Ethernet Shield Information //****************************************************************************************** @@ -245,41 +208,16 @@ void setup() { // specific use case in the ST Phone Application. //****************************************************************************************** // Polling Sensors - static st::IS_Contact wcLuc1(F("tipka_wc_luc_1"), PIN_WC_LUC_1, LOW); - static st::IS_Contact wcLuc2(F("tipka_wc_luc_2"), PIN_WC_LUC_2, LOW); - static st::IS_Contact wcAlarm(F("tipka_wc_alarm"), PIN_WC_ALARM, LOW); - static st::PS_TemperatureHumidity wcTempHum( - F("wc_temp_hum"), 60, 40, PIN_WC_TEMPHUM, - st::PS_TemperatureHumidity::DHT22, "wc_temp", "wc_hum"); - static st::IS_Contact hodnikZvonecTipkalo(F("hodnik_zvonec_tipkalo"), - PIN_HODNIK_ZVONEC, LOW); - static st::IS_Contact jedilnicaTipka1(F("jedilnica_tipka_1"), - PIN_JEDILNICA_TIPKA_1, LOW); - static st::IS_Contact jedilnicaTipka2(F("jedilnica_tipka_2"), - PIN_JEDILNICA_TIPKA_2, LOW); - static st::IS_Contact jedilnicaTipka3(F("jedilnica_tipka_3"), - PIN_JEDILNICA_TIPKA_3, LOW); - static st::IS_Contact jedilnicaTipka4(F("jedilnica_tipka_4"), - PIN_JEDILNICA_TIPKA_4, LOW); - static st::IS_Contact jedilnicaTipka5(F("jedilnica_tipka_5"), - PIN_JEDILNICA_TIPKA_5, LOW); - static st::IS_Contact otroskaTipka1(F("otroska_tipka_1"), PIN_OTROSKA_LUC_1, - LOW); - static st::IS_Contact otroskaTipka2(F("jedilnica_tipka_5"), PIN_OTROSKA_LUC_2, - LOW); + static st::IS_Contact vhod1(F("vhod_24"), 24, LOW); + static st::IS_Contact vhod2(F("vhod_25"), 25, LOW); + static st::IS_Contact vhod3(F("vhod_26"), 26, LOW); + static st::IS_Contact vhod4(F("vhod_27"), 27, LOW); // Executors - static st::EX_Switch hodnikLuc1(F("hodnik_luc_1"), PIN_HODNIK_LUC_1, LOW); - static st::EX_Switch hodnikLuc2(F("hodnik_luc_2"), PIN_HODNIK_LUC_2, LOW); - static st::EX_Switch hodnikLuc3(F("hodnik_luc_3"), PIN_HODNIK_LUC_3, LOW); - static st::EX_Switch hodnikLuc4(F("hodnik_luc_4"), PIN_HODNIK_LUC_4, LOW); - static st::EX_Switch hodnikLedStropAmbient(F("hodnik_led_strop_ambient"), - PIN_HODNIK_LED_STROP, LOW); - static st::EX_Switch hodnikLucZunajVhod(F("hodnik_luc_zunaj_vhod"), - PIN_HODNIK_ZUNAJ_VHOD, LOW); - - static st::EX_Switch hodnikVrataVhod(F("hodnik_vrata_vhod"), PIN_HODNIK_VRATA, - LOW); + static st::EX_Switch izhod1(F("izhod_28"), 28, LOW); + static st::EX_Switch izhod2(F("izhod_29"), 29, LOW); + static st::EX_Switch izhod3(F("izhod_30"), 30, LOW); + static st::EX_Switch izhod4(F("izhod_21"), 31, LOW); //***************************************************************************** // Configure debug print output from each main class @@ -316,29 +254,18 @@ void setup() { //***************************************************************************** // Add each sensor to the "Everything" Class //***************************************************************************** - st::Everything::addSensor(&wcLuc1); - st::Everything::addSensor(&wcLuc2); - st::Everything::addSensor(&wcAlarm); - st::Everything::addSensor(&wcTempHum); - st::Everything::addSensor(&hodnikZvonecTipkalo); - st::Everything::addSensor(&jedilnicaTipka1); - st::Everything::addSensor(&jedilnicaTipka2); - st::Everything::addSensor(&jedilnicaTipka3); - st::Everything::addSensor(&jedilnicaTipka4); - st::Everything::addSensor(&jedilnicaTipka5); - st::Everything::addSensor(&otroskaTipka1); - st::Everything::addSensor(&otroskaTipka2); + st::Everything::addSensor(&vhod1); + st::Everything::addSensor(&vhod2); + st::Everything::addSensor(&vhod3); + st::Everything::addSensor(&vhod4); //***************************************************************************** // Add each executor to the "Everything" Class //***************************************************************************** - st::Everything::addExecutor(&hodnikLuc1); - st::Everything::addExecutor(&hodnikLuc2); - st::Everything::addExecutor(&hodnikLuc3); - st::Everything::addExecutor(&hodnikLuc4); - st::Everything::addExecutor(&hodnikLedStropAmbient); - st::Everything::addExecutor(&hodnikLucZunajVhod); - st::Everything::addExecutor(&hodnikVrataVhod); + st::Everything::addExecutor(&izhod1); + st::Everything::addExecutor(&izhod2); + st::Everything::addExecutor(&izhod3); + st::Everything::addExecutor(&izhod4); //***************************************************************************** // Initialize each of the devices which were added to the Everything Class