ver: mega-20190202
1) Sonoff and PCF8574 are connected via i2c
2) Three buttons are connected to PCF8574 (1,2,3 inputs) and 3 LEDs (4,5,6 inputs through 100 kOhm resistor)
3) It is also connected via i2c to oled for diagnostics, BH1750 as a working sensor
4) dht-11 is connected to gpio-14
In normal mode, everything works.
But, if you press a button (any connected to PCF8574) more than 2 times per second, or just all three buttons at the same time, the sonoff goes into reboot.
Rules:
Code: Select all
on PCF8574_1#switch do
if [PCF8574_1#switch]=1
if [led#led_01]=0
TaskValueSet,4,1,1
TaskRun,4
else
TaskValueSet,4,1,0
TaskRun,4
endif
endon
on PCF8574_2#switch do
if [PCF8574_2#switch]=1
if [led#led_02]=0
TaskValueSet,4,2,1
TaskRun,4
else
TaskValueSet,4,2,0
TaskRun,4
endif
endon
on PCF8574_3#switch do
if [PCF8574_3#switch]=1
if [led#led_03]=0
TaskValueSet,4,3,1
TaskRun,4
else
TaskValueSet,4,3,0
TaskRun,4
endif
endon
on led#led_01 do
if [led#led_01]=0
PCFGPIO,5,0
OLED,4,1,###
else
PCFGPIO,5,1
OLEDCMD,on
OLED,4,1,___
endif
endon
on led#led_02 do
if [led#led_02]=0
PCFGPIO,6,0
OLED,4,5,###
else
PCFGPIO,6,1
OLEDCMD,on
OLED,4,5,___
endif
endon
on led#led_03 do
if [led#led_03]=0
PCFGPIO,7,0
OLED,4,10,###
else
PCFGPIO,7,1
OLEDCMD,on
OLED,4,10,___
endif
endon
Code: Select all
345558: Lev.1: [else]=false
345578: EVENT: led#led_03=0.00 Processing time:137 milliSeconds
345581: EVENT: led#=0.00
345632: EVENT: led#=0.00 Processing time:51 milliSeconds
345640: Lev.2: [else]=false
345684: EVENT: PCF8574_1#Switch=1.00 Processing time:658 milliSeconds
345942: PCF : Port=1 State=0 Output value=0
345946: EVENT: PCF8574_1#Switch=0.00
345958: Lev.1: [if 0=1]=false
346066: EVENT: PCF8574_1#Switch=0.00 Processing time:121 milliSeconds
>> NetworkError when attempting to fetch resource. <<
8581: PCF : Port=1 State=1 Doubleclick=3
8584: EVENT: PCF8574_1#Switch=3.00
8597: Lev.1: [if 3=1]=false
8666: EVENT: PCF8574_1#Switch=3.00 Processing time:82 milliSeconds
8777: PCF : Port=1 State=0 Output value=0
8780: EVENT: PCF8574_1#Switch=0.00
8792: Lev.1: [if 0=1]=false