* fix interrupt handling for the ln882h
- all GPIOS can generate interrupts
- added calls to NVIC_SetPriority/NVIC_EnableIRQ/NVIC_DisableIRQ
* fix clang formatting error
* only call NVIC_DisableIRQ if no other gpio is using an interrupt
* fix (again) clang-format errors
* add IRQ capability on all pins
* don't bother with NVIC_DisableIRQ
* use pin->gpio instead of interruptNumber, use macro GPIO_GET_PORT for clarity
* Mark interrupts as supported for the LN882H
---------
Co-authored-by: lamauny <pub.elc@free.fr>
* Handle possible failure of mdns_resp_add_service
* One more place where mdns_resp_add_service may fail
* addServiceImpl should always store services
* Register in services when new netif is added
* Refactored handling of cached services.
---------
Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
* mDNS: Fix build against LwIP 2.2.0
* Stop defining ip_addr_t when !CONFIG_IPV6
The only reason we had to do this is because we forgot to define LWIP_IPV4,
which is fixed in our LwIP port now, but keep it around for !CONFIG_IPV6
for now for builds against older LwIP.
* Allow returning IPv6 results from WiFiClass::hostByName()
* Add ipv6 and extra mDNS files for LwIP 2.2.0
* Add IPv6 support to BK72xx WifiSTA
Add an allLocalIPv6() method to return a *vector* of addresses, rather
than just one. It's not clear where the enableIpV6() and localIPv6()
methods came from; they don't seem to be part of the standard Arduino
class.
Eventually at least for ESPHome, I'd like to stop using these classes
and just let the ESPHome wifi component talk directly to LwIP. Or maybe
LibreTiny should offer an API compatible with the esp-idf one which is
a light wrapper around LwIP.
But short of a major refactor, this seems like a reasonable option.
* Update LwIP default to 2.2.0
* Apply suggestions from code review
---------
Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
According to guide `gpio_stay_*_map` are specifically there to prevent
pulling pins to a specific level and let them float during deep sleep.
https://docs.bekencorp.com/sdk_3.0.x/bk7238/build/en/latest/developer-guide/power_save/sleep_test.html
This allows any external low-power circuitry to change a pin level, as
required, to trigger the wake up
This requires changes in BDK and was implemented via fixup. Also, exposed
`gpio_stay_lo_map` parameter via `lt_deep_sleep_keep_floating_gpio` to
manage this configuration for pins in range P0-P31.
* Fix for a race condition in WiFi connection loop
There seems to be the race between the event RW_EVT_STA_CONNECTED
and an actual valid SSID value returned by BDK. If even a small delay
is injected immediately after the event reception the valid value
becomes available. Without this fix, due to a polling nature of ESPHome
WiFiComponent::check_connecting_finished function may observe the
WiFiSTAConnectStatus::CONNECTED status but with an empty SSID value,
leading to `Incomplete connection.` warning and immediate attempt to
start another connection, while the current one was actually established.
* Fixed clang format conformance
* Apply suggestions from code review
* Update cores/beken-72xx/arduino/libraries/WiFi/WiFiEvents.cpp
Co-authored-by: Cossid <83468485+Cossid@users.noreply.github.com>
---------
Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
Co-authored-by: Cossid <83468485+Cossid@users.noreply.github.com>
* Fixed unsafe conversion to underscore string
* Fixed formatting
* Save one byte if underscore not needed
* Don't allocate new string if already underscored
* Fix missing first character while copying
* Renamed function and made it inline
* Don't use signed index variable when searching for service
* Add proper cleanup of LwIPmDNS
- Free allocated memory both on end() and in the destructor
- Unregister callback from netif
* Don't free const pointer
* Removed unneeded casting
* Don't break the loop if failed to add txt record
* Fixed code formatting
* Update Readme & improve md layout
- ESPHome now supports LibreTiny natively
- Added extra PIO docs references
- Reworded some sections slightly, to accomodate proper grammar
- PIO deprecated the `platformio platform install` command, replaced this with the official recommendation/replacement
* Use backslash for line break, revert changing indent
---------
Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
* Free list returned by wlan_sta_scan_result()
* scanAlloc improvements
There were a few things I didn't like about this function:
1) realloc() was called a bit too often.
2) if realloc() failed, the previous memory was not freed.
3) scanAlloc returned previous count or 255 on error. But there was no real check for error and 255 could've been used as index to null. I think it's better to simple return boolean.
4) scanAlloc was clearing memory only up to (and excluding) the new entries.
* Corrected clearing new entries in scanAlloc
* scanAlloc() now returns number of allocated items
* Fixed compilation issues related to goto.
* Update ESPHome documentation
* Update note format
* Switch to https github format, give manual PR checkout instructions until a better method is found.
* Fix yaml sample spacing
* Fix indent
* Add addon migration info
* Replace spaces with tabs
---------
Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
* Switch to bk_wlan_start_sta_adv for specific bssid control.
* Allow split sta/adv_sta configs.
* Add wifi_mode back for regular STA mode.
* Fix apparent bug of setting null/empty wifi key.
Reset STA_ADV_CFG.dhcp_mode in reconnect, as it seems to not survive for some reason.
Do les _CFG setting in reconnect()
* Move all _CFG setting to begin()
* Fix dhcp_mode in STA_ADV_CFG.
* Remove no longer necessary dhcp_mode re-set.
* Formatting cleanups.
* Formatting.
* Update cores/beken-72xx/arduino/libraries/WiFi/WiFiSTA.cpp
* Apply suggestions from code review
---------
Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
The docs about using docker compose for libre tuya had an error.
When setting what image to use in compose you dont have to put docker pull, just the image you are going to use
* Added description of some UPK keys
* More keys described.
This time by experimenting on my PIR-enabled lamp.
Motion is reported correctly via GPIO defined as pirin_pin.
I am also trying to set the PIR sensitivity by applying PWM to the pirsense_pin, and I _think_ it works. More experiments are needed.
* Add UPK2ESPHome link, reformat table
* Add descriptions from BK7231N SDK
* Update docs/resources/tuya-pin-config.md
* Corrected description of cwmaxp
* Description of ambient light sensor values
---------
Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>