HASwitchPlate / openHASP

HomeAutomation Switchplate based on lvgl for ESP32
https://www.openhasp.com
MIT License
703 stars 182 forks source link

GPIO output in inverted mode starts in low level (ON) and toggling it always causes writing 0 (ON) to the correspondent pin #464

Open fantasmisiciliani opened 1 year ago

fantasmisiciliani commented 1 year ago

Perform all steps below and tick them with [x]

Describe the bug

I tested some GPIO outputs with relay type and inverted mode: on boot they start in low level (ON) and, when I toggle them, the function _gpio_set_outputvalue() always writes 0 to the pin for both states ON and OFF. I have a WT32-SC01 Plus with openHASP 0.7.0-rc2 flashed.

To Reproduce

1- Set up a GPIO output with relay type and inverted mode, restart the plate. 2- Measure the pin voltage level or call the command output## with no payload (## is the pin number) 3- Toggle it and measure the pin voltage or insert in the function _gpio_set_outputvalue() an instruction that logs the value written on the digital output

Expected behavior

fantasmisiciliani commented 1 year ago

Tested 0.7.0-rc8 f28627c and I confirm that switching an output in inverted mode now works as expected. But on boot it is still at ON state, that it means LOW level in case of cold boot and last logic level in case of warm boot (hardware output and firmware states not matching, see issue #476).