Skip to content

Commit

Permalink
Trying to fix issue with lamps turning on and off without button press
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenSt committed May 21, 2022
1 parent 6e0ee5d commit 14ab0a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions espMQTT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
// #define ESPMQTT_SOIL
// #define ESPMQTT_DIMMER
// #define ESPMQTT_RELAY
#define ESPMQTT_LIVINGROOM
// #define ESPMQTT_LIVINGROOM
// #define ESPMQTT_BBQTEMP
// #define ESPMQTT_GOODWE

Expand All @@ -64,7 +64,7 @@
// #define ESPMQTT_IRRIGATION
// #define ESPMQTT_BLITZWOLF
// #define ESPMQTT_QSWIFIDIMMERD01
// #define ESPMQTT_QSWIFIDIMMERD02
#define ESPMQTT_QSWIFIDIMMERD02
// #define ESPMQTT_SONOFF4CH //ESP8285
// #define ESPMQTT_SONOFFDUAL
// #define ESPMQTT_SONOFFS20_PRINTER
Expand Down Expand Up @@ -152,6 +152,7 @@ SDM sdm(serSDM, 2400);
#define APONBOOT
#define QSWIFIDIMMERCHANNELS 1
#include "qswifidimmer.h"
#undef CPUSLEEP
#define CPUSLEEP 5
#endif

Expand All @@ -160,6 +161,7 @@ SDM sdm(serSDM, 2400);
#define APONBOOT
#define QSWIFIDIMMERCHANNELS 2
#include "qswifidimmer.h"
#undef CPUSLEEP
#define CPUSLEEP 5
#endif

Expand Down
3 changes: 3 additions & 0 deletions qswifidimmer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ void qswifidimmer_handle()
}
yield();

// Filter ghost pulses
if (Stime[dimchannel] + 150 < msec) Scounter[dimchannel] = 0;

// When switch was pressed for more then 5 pulses and released for about 100ms switch from on to off or from off to on and also reset counters etc.
if ((Scounter[dimchannel] > 5) && (Stime[dimchannel] + 100 < msec))
{
Expand Down

0 comments on commit 14ab0a8

Please sign in to comment.