From 6f9f9f63ed215f5a519bda319ac4baacdad72119 Mon Sep 17 00:00:00 2001 From: feanaro Date: Tue, 15 Jun 2021 15:01:35 +0200 Subject: [PATCH] Bugfixes --- GetWired New Firmware/main.ino | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/GetWired New Firmware/main.ino b/GetWired New Firmware/main.ino index 39a214a..799cd5e 100644 --- a/GetWired New Firmware/main.ino +++ b/GetWired New Firmware/main.ino @@ -160,6 +160,16 @@ void setup() { float Vcc = ReadVcc(); // mV + // POWER SENSOR + #if defined(POWER_SENSOR) && !defined(FOUR_RELAY) + PS.SetValues(PS_PIN, MVPERAMP, RECEIVER_VOLTAGE, MAX_CURRENT, POWER_MEASURING_TIME, Vcc); + #elif defined(POWER_SENSOR) && defined(FOUR_RELAY) + PS[RELAY_ID_1].SetValues(PS_PIN_1, MVPERAMP, RECEIVER_VOLTAGE, MAX_CURRENT, POWER_MEASURING_TIME, Vcc); + PS[RELAY_ID_2].SetValues(PS_PIN_2, MVPERAMP, RECEIVER_VOLTAGE, MAX_CURRENT, POWER_MEASURING_TIME, Vcc); + PS[RELAY_ID_3].SetValues(PS_PIN_3, MVPERAMP, RECEIVER_VOLTAGE, MAX_CURRENT, POWER_MEASURING_TIME, Vcc); + PS[RELAY_ID_4].SetValues(PS_PIN_4, MVPERAMP, RECEIVER_VOLTAGE, MAX_CURRENT, POWER_MEASURING_TIME, Vcc); + #endif + // OUTPUT #ifdef DOUBLE_RELAY IOD[RELAY_ID_1].SetValues(RELAY_OFF, 4, BUTTON_1, RELAY_1); @@ -236,16 +246,6 @@ void setup() { #endif #endif - // POWER SENSOR - #if defined(POWER_SENSOR) && !defined(FOUR_RELAY) - PS.SetValues(PS_PIN, MVPERAMP, RECEIVER_VOLTAGE, MAX_CURRENT, POWER_MEASURING_TIME, Vcc); - #elif defined(POWER_SENSOR) && defined(FOUR_RELAY) - PS[RELAY_ID_1].SetValues(PS_PIN_1, MVPERAMP, RECEIVER_VOLTAGE, MAX_CURRENT, POWER_MEASURING_TIME, Vcc); - PS[RELAY_ID_2].SetValues(PS_PIN_2, MVPERAMP, RECEIVER_VOLTAGE, MAX_CURRENT, POWER_MEASURING_TIME, Vcc); - PS[RELAY_ID_3].SetValues(PS_PIN_3, MVPERAMP, RECEIVER_VOLTAGE, MAX_CURRENT, POWER_MEASURING_TIME, Vcc); - PS[RELAY_ID_4].SetValues(PS_PIN_4, MVPERAMP, RECEIVER_VOLTAGE, MAX_CURRENT, POWER_MEASURING_TIME, Vcc); - #endif - // EXTERNAL THERMOMETER #ifdef EXTERNAL_TEMP #ifdef DHT22 @@ -589,6 +589,8 @@ void receive(const MyMessage &message) { int NewPosition = atoi(message.data); NewPosition = NewPosition > 100 ? 100 : NewPosition; NewPosition = NewPosition < 0 ? 0 : NewPosition; + RS.NewState = 2; + RSUpdate(); MovementTime = RS.ReadNewPosition(NewPosition); } #endif