622 Commits

Author SHA1 Message Date
Kuba Szczodrzyński
29303f7ec9 [boards] Add generic-rtl8720cf-2mb-896k board
Some checks failed
Push (dev), Pull Request / Run Clang lint (push) Has been cancelled
Push (dev), Pull Request / Run Python lint (push) Has been cancelled
Push (master) / Deploy docs (push) Has been cancelled
2025-11-17 20:32:54 +01:00
Kuba Szczodrzyński
c6b06d4be6 [release] v1.9.2
Some checks failed
Release / Run Clang lint (push) Has been cancelled
Release / Publish PlatformIO platform (push) Has been cancelled
Release / Publish GitHub release (push) Has been cancelled
v1.9.2
2025-09-19 22:44:44 +02:00
Kuba Szczodrzyński
c9b2f9dd23 [boards] Fix syntax error in WB02A 2025-09-19 22:44:44 +02:00
Kuba Szczodrzyński
40590d174f [core] Update ltchiptool to v4.12.2 2025-09-19 22:39:47 +02:00
Rishab Mehta
780fb72bba [docs] Update README.md (#323) 2025-09-19 22:37:02 +02:00
Henri Chain
e9977a26e4 [boards] Add WB02A board (#332) 2025-09-19 22:36:51 +02:00
Piotr Szulc
1d97f0ce84 [core] Avoid re-defining C++ round() method (#321) 2025-09-19 22:36:35 +02:00
Luca Olivetti
895b6e89c5 [lightning-ln882h] Fix GPIO interrupt support (#326)
* 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>
2025-09-19 22:25:03 +02:00
Kuba Szczodrzyński
9114bc4c49 [release] v1.9.1
Some checks failed
Release / Run Clang lint (push) Has been cancelled
Release / Publish PlatformIO platform (push) Has been cancelled
Release / Publish GitHub release (push) Has been cancelled
v1.9.1
2025-06-01 19:38:36 +02:00
Kuba Szczodrzyński
9eae0cd253 [common] Add Arduino emptyString declaration 2025-06-01 19:38:11 +02:00
Kuba Szczodrzyński
37f096d3b5 [release] v1.9.0
Some checks failed
Release / Run Clang lint (push) Has been cancelled
Release / Publish PlatformIO platform (push) Has been cancelled
Release / Publish GitHub release (push) Has been cancelled
v1.9.0
2025-05-28 15:51:09 +02:00
Kuba Szczodrzyński
6bf549b104 [misc] Update .clang-format style 2025-05-28 15:50:18 +02:00
lamauny
3054db9d9b [lightning-ln882h] Fix analog read, add Wi-Fi calibration, add generic board (#319)
* [ln882x] fix analog read

* [ln882h] add wifi temp calibration task

* [ln882h] add generic-ln882hki board

* [ln882h] fix wifi null pointer crash
2025-05-28 15:45:10 +02:00
lamauny
69e7e2debe [lightning-ln882h] Add support for Lightning LN882H family (#312)
* fix mbedtls bad pointer in function call (prototype mismatch)

* fix issue with weak families functions implemented in static library, it will never be linked. fixed by redefining prototypes inside families

* [ln882x] add support for lightning ln882x & ln882h families

* add i2c (wire) support

* add analog (adc) support

* add watchdog support

* [ln882x] changed default uart 0/1 pins; added board wl2s

* [ln882x] fix IRQ & ADC pins

* [ln882x] boards cosmetic

* [ln882x] wifi sta use otp mac addr by default; re-enabled wifi powersave mode

* [ln882x] clang-format clean code

* [ln882x] clang-format clean code

* Update families.json

* Apply suggestions from code review

* [ln882x] reformat json board files

* [ln882x] os_queue cleanup

* [ln882x] removed Beken auto-download command

* [ln882x] removed personal script file

* [ln882x] removed unusefull pi section in debugging.md

* [ln882x] removed Arduino.h and changed private I2C definition

* [ln882x] updated README.md

* [ln882x] changed pin naming scheme to PA/PB

* [ln882x] clean code

* [ln882x] clean code

* [ln882x] add ota image verification

* Update push-dev.yml

* [ln882x] fix boards ADC missing inputs]

* [ln882x] removed reg_xxx fixup files and use include guards instead

* [ln882x] cleanup code

* [ln882x] cleanup code

* [ln882x] fix lt_init weak functions linking

* [ln882x] revert lt_api.h modification, fixed with previous commit

* [ln882x] setup UF2 firmware for flasher with partitions

* [ln882x] update README.md

* [ln882x] include ln_wifi.h and ln_serial.h to avoid including bad headers on case insensitive systems

* [ln882x] Replace RingBuffer by SerialRingBuffer

* [ln882x] clang-format

* [ln882x] update README.md

* Apply suggestions from code review

* Reformat board JSON files

* Add mkdocs link redirect

* Update ltchiptool to v4.12.0

---------

Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
2025-03-25 17:26:53 +01:00
Kuba Szczodrzyński
6083cca72e [misc] Update style to clang-format 19, black 25 and isort 6 2025-01-30 18:50:55 +01:00
Kuba Szczodrzyński
d17ea4da0f [release] v1.8.0
Some checks failed
Release / Run Clang lint (push) Has been cancelled
Release / Publish PlatformIO platform (push) Has been cancelled
Release / Publish GitHub release (push) Has been cancelled
v1.8.0
2025-01-14 22:13:16 +01:00
Hajo Noerenberg
2ea0066536 [common] Make Serial RX buffer size configurable, increase default to 256 bytes (#313)
* Make Serial RX buffer configurable and set default to 256 bytes

* Replace RingBuffer by SerialRingBuffer
2025-01-13 12:14:41 +01:00
Martin Prokopič
3d23211c1e [realtek-ambz2] Fix partition table & bootloader flashing via UART (#307) 2024-12-17 17:13:04 +01:00
shilga
1769680d9e [realtek-ambz2] Fix C linkage for sys_now() in lwipopts (#286) 2024-12-17 11:50:44 +01:00
kuwoyuki
92351c0b92 [boards] Add RTL8710BX AFW121T board (#305)
* feat: afw121t board

* Update layout, regenerate with boardgen

---------

Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
2024-12-16 15:46:36 +01:00
Kuba Szczodrzyński
0f6c31386b [release] v1.7.0
Some checks failed
Release / Run Clang lint (push) Has been cancelled
Release / Publish PlatformIO platform (push) Has been cancelled
Release / Publish GitHub release (push) Has been cancelled
v1.7.0
2024-09-05 16:41:10 +02:00
Kuba Szczodrzyński
a9009a8cee [misc] Update .clang-format style 2024-09-05 16:36:55 +02:00
Piotr Szulc
31e1d51dbd [common] Cleanup mDNS code, cache service records (#263)
* 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>
2024-09-05 15:54:04 +02:00
Luca Olivetti
41819f2fd6 [beken-72xx] Fix CHANGE interrupt logic (#290)
* fix CHANGE interrupt for beken-72xx

* Update cores/beken-72xx/arduino/src/wiring_irq.c

---------

Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
2024-09-05 14:46:42 +02:00
David Woodhouse
17043f634f [beken-72xx] Add IPv6 and lwIP 2.2.0 support (#292)
* 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>
2024-09-05 14:46:13 +02:00
devgs
e1c5761df9 [beken-72xx] Allow setting deep sleep wake-up pins as floating (#275)
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.
2024-09-05 14:45:48 +02:00
Kuba Szczodrzyński
fbaae21011 [release] v1.6.0
Some checks failed
Release / Run Clang lint (push) Has been cancelled
Release / Publish PlatformIO platform (push) Has been cancelled
Release / Publish GitHub release (push) Has been cancelled
v1.6.0
2024-05-31 15:01:17 +02:00
Jaco Malan
fa2064b957 [realtek-ambz] Temporarily workaround CHANGE interrupts not supported (#282)
* fix change interruptsnot supported on rtl8710b

* Update cores/realtek-amb/arduino/src/wiring_irq.c

---------

Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
2024-05-31 14:59:46 +02:00
Kuba Szczodrzyński
21a194f43d [core] Fix lwIP debugging support 2024-05-31 14:58:38 +02:00
devgs
b255402659 [beken-72xx] Fix race condition when checking Wi-Fi SSID (#274)
* 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>
2024-05-31 14:54:41 +02:00
Kuba Szczodrzyński
dfabfbb921 [beken-72xx] Increase MBEDTLS_ENTROPY_MAX_SOURCES 2024-05-18 13:50:25 +02:00
Kuba Szczodrzyński
3b36a70c9a [core] Fix ESP_LOG#() macro syntax 2024-05-18 13:50:10 +02:00
Piotr Szulc
d1386a8e9d [libs] Fix mDNS string memory corruption, print error on record add failure (#260)
* 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
2024-03-08 12:21:14 +01:00
Kuba Szczodrzyński
67b92b7f56 [release] v1.5.1
Some checks failed
Release / Run Clang lint (push) Has been cancelled
Release / Publish PlatformIO platform (push) Has been cancelled
Release / Publish GitHub release (push) Has been cancelled
v1.5.1
2024-02-29 14:14:01 +01:00
Hajo Noerenberg
a1f8516e60 [realtek-ambz] Fix crash after WiFi scan (#258) 2024-02-26 21:35:35 +01:00
cap9qd
cf52021d38 [core] Split reboot reasons due to wakeup (#254)
* Updates to break out wakeup reasons.

Per https://github.com/libretiny-eu/libretiny/issues/234

* Update cores/common/base/api/lt_device.h

Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>

* fix clang-format

* Fix formatting of python files.

* Update lt_device.h

---------

Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
2024-02-25 18:45:22 +01:00
cap9qd
b78c9387a6 [beken-72xx] Fix duration rollover in deep sleep (#253) 2024-02-22 20:24:40 +01:00
Kuba Szczodrzyński
b748d99437 [release] v1.5.0
Some checks failed
Release / Run Clang lint (push) Has been cancelled
Release / Publish PlatformIO platform (push) Has been cancelled
Release / Publish GitHub release (push) Has been cancelled
v1.5.0
2024-02-20 17:16:15 +01:00
Anna
9a33fc0a69 [docs] Improve getting started guide (#252)
* 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>
2024-02-20 17:14:12 +01:00
Hajo Noerenberg
4cddc01f22 [libs] Fix MD5 calculation during OTA update (#240) 2024-01-17 22:49:33 +01:00
Piotr Szulc
1d80b5fff7 [beken-72xx] Free list returned by wlan_sta_scan_result() (#226)
* 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.
2024-01-06 19:41:01 +01:00
Cossid
140cf07173 [docs] Use official ESPHome version, add LT dev version guide (#223)
* 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>
2024-01-06 19:40:44 +01:00
Piotr Szulc
1e3a82f439 [beken-72xx] Improve ddev ADC support (#220) 2024-01-06 19:40:33 +01:00
Cossid
c90794e9f5 [beken-72xx] Allow connecting to specific BSSID if provided (#209)
* 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>
2024-01-06 19:40:08 +01:00
Kuba Szczodrzyński
03c723c73d [docs] Add draft Beken key extraction docs 2024-01-06 19:20:03 +01:00
Gerard Du Pre
bad2ffdd07 [docs] Update docker compose image name (#225)
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
2023-12-25 19:42:53 +01:00
Piotr Szulc
eed39c9cfb [beken-72xx] Pause PWM instead of stopping, track PWM state (#222)
* Pause PWM instead of stopping on duty cycle 0.

* Merged paused and stopped conditions
2023-12-16 13:57:47 +01:00
Piotr Szulc
7bd6d1d815 [beken-72xx] Fix stopping PWM, use pin-scoped PWM struct (#215)
* Fixed stopping PWM

* Clang-formatted as required

* Use separate memory block for each pwm pin
2023-12-08 19:20:41 +01:00
Piotr Szulc
bb7fcd5c4d [docs] Add more UPK key descriptions (#219)
* 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>
2023-12-08 19:13:15 +01:00
Kuba Szczodrzyński
9b8e00c7fa [boards] Support and validate MCU name aliases 2023-11-14 22:38:22 +01:00