Commit Graph

977 Commits

Author SHA1 Message Date
NonPIayerCharacter
61d035f616 bk new spi & spidma (#1745)
* bk new spi & spidma

* long app version fix

* esp fix
2025-08-03 11:01:31 +02:00
atomphil
bc64926da3 Tuya mcu automatic sending (#1739)
* Update drv_tuyaMCU.h

* Update drv_tuyaMCU.c
2025-07-29 08:13:17 +02:00
Steffen
c7d48e427c SM16703P: learn to handle RGBCW, e.g. more than 3 channels per pixel. (#1736) 2025-07-28 13:29:58 +02:00
giedriuslt
6bb7a5743d Fix spacing in main page (#1738) 2025-07-26 15:53:54 +02:00
NonPIayerCharacter
728066de76 esp8266 dout mode by default (#1713)
* esp8266 dout mode by default
enable float printf

* irq fix

* timer stack
2025-07-19 19:18:38 +02:00
MaxineMuster
1c7cdd4881 Ds1820 simple+full as separate drivers (#1705)
* Seperate simple and full driver, introduce "common" for shared code

* Fix command prefixes

* Generate command as multiline if requested

* Fix JS linebreak

* Only use simple dirver - check sizes of firmware images

* Update obk_config.h - enable Full driver for all platforms to allow testing

* Change parsing sttring to device address to allow compact form
Change obk_config.h: remove extra entry for W800, add "FULL" driver to windows build

* fix windows code for "fake" DS18B20

* fix missing files in openBeken_win32_mvsc2017.vcxproj

* fix handle missing task.h for windows

* change Windows emulation to MAX/2 fake sensors

* try fix BL602

* change "fake temperature" of sensors in windows

* change windows sensor temperature once more

* shorten commands by alias

* fix escaping linebreak

* Fix broken JS code ...

* Fix ESP32 is crashing if interrupts are disabled during OWReset for > 480us

* Change output for unused channels
Test if DS1820 channels are in use

* fix warning/error for channel (<=64) printed into a char[5] value

* removeunuses quotes for address

* Fix language

* Capial "S" in Menu entry "Sensors"

* restore obk_config - #define ENABLE_DRIVER_DS1820_FULLonly for WINDOWS and SENSORS variant
2025-07-19 08:03:46 +02:00
NonPIayerCharacter
a261a71ab1 Update ESP-IDF to v5.5-beta1 and add minimal ESP8266 support (#1707)
* update esp-idf

* esp8266

* fix

* pwm, uart and wifi fix

* fix ota

* fix 1m and ps

* update workflow
2025-07-06 07:54:23 +02:00
openshwprojects
69121fb252 merge gosund sw2 port (not clear if it will be used) 2025-06-30 21:56:13 +02:00
NonPIayerCharacter
3b99b17cc2 Xradios (#1695)
* Xradios

* deep sleep

* xr806

* small adjustments
2025-06-30 18:47:47 +02:00
openshwprojects
3564ed7013 AC TCL 3 (#1659)
* Update obk_config.h

* fan fx

* fan mode

* fan_only

* swings for climate

* test html

* better

* bew cfg

* Update obk_config.h
2025-06-26 15:56:39 +02:00
Tester23
45ff821a2f tuyamcu calib if non zero 2025-06-26 10:24:25 +02:00
NonPIayerCharacter
af37e093d0 bk7231u/bk7231s/bk7252/bk7252n/bk7231t alt. (#1680)
* bk7231u/bk7231t/bk7252 new sdk

* 7252n
2025-06-24 13:16:27 +02:00
NonPIayerCharacter
fac2cf081c w800 + berry (#1629)
* w800 + berry

* fix w600

* Update XR and makefile

* Berry cmake

* BL602 lfs test

* Update w800

* Fix

* W600 heap

* sensors & bl602

* bl602 delay_us
2025-06-20 09:35:00 +02:00
openshwprojects
10e20f9a9b allow tuyamcu 0x04 (paired) state if no mqtt configured at all 2025-06-20 00:29:04 +02:00
openshwprojects
25ed1bd135 merge old Max31855 driver (#1403)
* MAX31855

* tabl

* fx

* fx

* test

* try

* fx

* statics

* defines

* aa

* dd

* fx

* fixces

* Update obk_config.h
2025-06-19 00:55:08 +02:00
Tester23
c849575a01 doc typo fix 2025-06-18 23:37:32 +02:00
David Bauer
273549950e tuyaMCU: introduce battery-powered device ack-delay (#1497)
This introduces a delay for sending the ACKs on battery powered TuyaMCU
sensors.

Rationale is to allow users to delay the return to sleep state. This is
useful when e.g. changing settings on the device.

Currently the device is sent back to sleep after the status has been
read and commited to MQTT. This can be less than 5 seconds of uptime.

Set this value to a sane default, which allows the device to retain
online for enough time for a user to change configuration.

Signed-off-by: David Bauer <mail@david-bauer.net>
2025-06-18 22:54:36 +02:00
Tester23
b02068e485 docs refresh 2025-06-17 18:01:35 +02:00
Tester23
e663cf5d30 allow TuyaMCU VCP calibration 2025-06-17 17:20:30 +02:00
Tester23
2d27d1d7ed fix syntax 2025-06-04 12:26:07 +02:00
Tester23
59f6d3549f RAW_V2C3P3 2025-06-04 12:25:07 +02:00
openshwprojects
1e201d6be4 fix mem leaks in sim (#1665)
* Update drv_spiLED.c

* Update drv_spiLED.c

* Update drv_spiLED.c

* Update asan.suppressions

* Update drv_spiLED.c

* try

* mcu clear

* return cmd

* free alias leak
2025-06-01 10:06:09 +02:00
openshwprojects
d6f7678dc6 TCL AC driver progress + LowMidHigh etc channels HA discovery
* Buzzer

* Update obk_config.h

* Display

* uart test stub

* unfinished TCL_DoDiscovery

* ha

* Update drv_tclAC.c

* ha mode send

* unfinished not working

* Update drv_tclAC.c

* Update hass.h

* better discovery

* Update obk_config.h
2025-05-30 16:10:36 +02:00
Bartosz Nitka
46fe6736ca Fix out-of-bounds access on g_cfg.pins.channelTypes (#1652)
This place expected -1 for "unmapped", but -999 can come from this line:
fe51ee8f47/src/driver/drv_tuyaMCU.c (L883)

This was detected with ASAN (#1651), the error message:
```
=================================================================
==2532658==ERROR: AddressSanitizer: global-buffer-overflow on address 0x5642389c5e37 at pc 0x564237e67492 bp 0x7fff17726e50 sp 0x7fff17726e40
READ of size 1 at 0x5642389c5e37 thread T0
    #0 0x564237e67491 in CHANNEL_GetType src/new_cfg.c:427
    #1 0x564237dfc933 in TuyaMCU_ApplyMapping src/driver/drv_tuyaMCU.c:1126
    #2 0x564237dff92f in TuyaMCU_ParseStateMessage src/driver/drv_tuyaMCU.c:1632
    #3 0x564237e019fa in TuyaMCU_ProcessIncoming src/driver/drv_tuyaMCU.c:1977
    #4 0x564237e027ee in TuyaMCU_RunReceive src/driver/drv_tuyaMCU.c:2178
    #5 0x564237e02dc2 in TuyaMCU_RunFrame src/driver/drv_tuyaMCU.c:2335
    #6 0x564237dd2ce6 in DRV_RunQuickTick src/driver/drv_main.c:536
    #7 0x564237ec4037 in QuickTick src/user_main.c:946
    #8 0x564237eca8a5 in Sim_RunFrame src/win_main.c:106
    #9 0x564237eca993 in Sim_RunFrames src/win_main.c:134
    #10 0x564237ebce4a in Test_TuyaMCU_Basic src/selftest/selftest_tuyaMCU.c:369
    #11 0x564237ecab1f in Win_DoUnitTests src/win_main.c:194
    #12 0x564237ecba57 in main src/win_main.c:535
    #13 0x7fb55312ed8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #14 0x7fb55312ee3f in __libc_start_main_impl ../csu/libc-start.c:392
    #15 0x564237cb16b4 in _start (/home/niteria/tmp/broken-realloc/OpenBK7231T_App/build/win_main+0xcf6b4)

0x5642389c5e37 is located 51 bytes to the right of global variable 'stat_deduper_culled_tooFast' defined in 'src/mqtt/new_mqtt_deduper.c:40:12' (0x5642389c5e00) of size 4
0x5642389c5e37 is located 9 bytes to the left of global variable 'g_mutex' defined in 'src/mqtt/new_mqtt_deduper.c:42:26' (0x5642389c5e40) of size 4
SUMMARY: AddressSanitizer: global-buffer-overflow src/new_cfg.c:427 in CHANNEL_GetType
Shadow bytes around the buggy address:
  0x0ac8c7130b70: 04 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0ac8c7130b80: 00 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0ac8c7130b90: 04 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0ac8c7130ba0: 00 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9
  0x0ac8c7130bb0: 04 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
=>0x0ac8c7130bc0: 04 f9 f9 f9 f9 f9[f9]f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0ac8c7130bd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ac8c7130be0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ac8c7130bf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ac8c7130c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ac8c7130c10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==2532658==ABORTING
```
2025-05-25 17:42:08 +02:00
openshwprojects
5899b0c7e5 CSE stub (unfinished)
* test1

* Update CMakeLists.txt

* Update drv_cse7761.c

* tr

* dbg

* Update hal_uart_espidf.c

* Update hal_uart_espidf.c

* Update hal_uart_espidf.c

* cmnt
2025-05-23 10:23:01 +02:00
openshwprojects
d07c72a0ca AC TCL driver - part 1
* ac t1

* test

* fx

* fx

* p

* build_set_cmd

* try enable

* makefile

* make

* header

* self test

* parsing - not tested

* rename for easier testing

* add src

* print len

* parity

* FIX PARITY - 2

* SwingH and SwingV

* w

* files

* Update drv_tclAC.c

* display vals

* few berry tests

* disable
2025-05-18 18:24:21 +02:00
openshwprojects
acd46ad682 add PIR driver
* tt

* Update selftest_berry.c

* Update obk_config.h

* some more fixes

* fixes

* IOR_PWM_ScriptOnly_n

* fx

* Update OpenBeken.mk

* disable
2025-05-16 10:07:38 +02:00
Tester23
5ea78582e0 fix header 2025-05-15 23:55:04 +02:00
Tester23
4196afda4d unfinished PIR code 2025-05-15 18:08:53 +02:00
giedriuslt
5916fbd8a7 Update BL602 code to work with latest sdk. (#1487)
* Support new BL602 SDK

* Update .gitmodules

---------

Co-authored-by: openshwprojects <85486843+openshwprojects@users.noreply.github.com>
2025-05-02 14:42:14 +02:00
openshwprojects
0ea1983049 add IRRemoteESP8266 IR alternate version to online builds (vfonov PR)
* add IRRemoteSP

* fx

* Update IRsend.cpp

* f

* fix

* s

* irRemoteESP

* Update obk_config_irRemoteESP.h

* w
2025-04-18 18:24:13 +02:00
Tester23
5a78713c90 add missing prestate check 2025-04-13 19:34:37 +02:00
openshwprojects
00890d1cf4 API CHANGE - extend http callback for drivers so it includes bPreState boolean so we can add HTML either before state div (without refresh) or in state div (refreshing) 2025-04-13 19:18:30 +02:00
openshwprojects
eadba42f9f Berry integration part 1
* t

* fx

* split closure handler

* setTimeout, setInterval

* split berry frm SVM, but I need to move event waiter to separate struct?

* fx

* fx

* split relations

* remvoe ode duplciaton

* POC - pass value to berry

* POC - pass str to berry

* berry preps + lfs test

* lfs test + bytes

* save

* remove code duplication

* try dpid calls

* working test for bytes

* tyuamcu to file in eberry

* str for berry test

* tuyamcu to berry glue

* fx1

* fixes

* try berry http

* fix

* tests

* test  vaar lifespan

* test

* test

* test if

* berry in html

* #if ENABLE_OBK_BERRY

* fx

* better

* fx

* test nested loop

* free mem

* simpler

* split lfs run

* arg

* fx

* fix

* #if ENABLE_OBK_BERRY

* comamnd hook

* vars access, ntp

* finalize?

* unfinished
2025-04-12 16:56:24 +02:00
David Bauer
4973295415 tuyaMCU: avoid state machine interfering with reset AP mode (#1597)
Don't continue with the state machine if the device is in Open WiFi mode
based on a user button press.

This avoids the device shutting down itself when in recovery mode. The
MCU will reset the device after 90 seconds automatically.

Communicate to the MCU the device is in configuration mode. This will
change the status LED blink pattern to reflect the state.

Signed-off-by: David Bauer <mail@david-bauer.net>
2025-04-06 09:10:26 +02:00
David Bauer
9e3bcf72af tuyaMCU: replace network state magic values (#1596)
Replace magic values present in the code with the more descriptive
macros.

As these macros are redundant with the comments, drop the repsective
comments.

Signed-off-by: David Bauer <mail@david-bauer.net>
2025-04-05 21:51:03 +02:00
divadiow
8fad535e4e typos + releaserc update (#1575)
* Update drv_tuyaMCU.c

* Update drv_spi.c

* Update drv_spi.h

* Update .releaserc.yaml
2025-03-31 00:27:31 +02:00
XJ
be5aca62b3 ENABLE_BL_TWIN mode - reset energy_today also for channel B (#1587) 2025-03-30 21:03:19 +02:00
XJ
28ba3622e6 Moving Avg mod {default disabled) (#1586) 2025-03-29 18:10:15 +01:00
XJ
71ce6d33bc tuyaMcu_sendCmd without second param bugfix (#1585) 2025-03-28 23:23:28 +01:00
openshwprojects
2d43185902 Port Simulator to Linux - p1
* intial makefile for windows sim

* netdb

* tr

* fx

* fxes

* fxes

* fxes

f

* fxes

* fxes

* fxes

* fx

* fx

* fxes?

* fxes

* better?

* stubs

* more

* fxes

* fx?

* comment out sleep

* but only in self test

* add assertion keyword

---------

Co-authored-by: Alexandre Oliveira <rockytvbr@gmail.com>
2025-03-26 22:13:39 +01:00
XJ
5810db7ae1 BL0492 Frequency to HASS (MQTT) + Energy calculation in TWIN_BL_ENABLED mode for channel 2 (#1578)
* twinbl energy for channel 2

* .

* removed movavg

* Added HASS MQTT frequency (both standard and TWIN_MODE)

* .

* simplify, store total only IX0

* Ext BugFix: addChangeHandler Power < 20 appears broken #1543
2025-03-26 13:24:34 +01:00
Tester23
b80fff5d40 added TuyaMCU delta option for per-dpID calibration like temperature, etc 2025-03-23 09:23:57 +01:00
Pavel Rochnyak
c30dcbf205 DS1820: Fixes and style improvement (#1572)
* drv_ds1820_simple.c: Refactor using "Return Early Pattern"

Function DS1820_OnEverySecond() has too much nesting conditions.
Nonlinear flow of the code is hard to follow.

Also added define for magic constants.

* drv_ds1820_simple.c: Fixed incorrect first reading

DS1820_DiscoverFamily() call between OWReset() and OWWriteByte(Pin, COMMAND) causes command to ignore.

Closes: #1571

* drv_ds1820_simple.c: reset all state variables on driver start

* drv_ds1820_simple.c: Implemented DS1820_SetResolution command

* drv_ds1820_simple.c: Mark functions as static

* drv_ds1820_simple.c: Call DS1820_DiscoverFamily() from DS1820_driver_Init() so DS1820_SetResolution could be called from autoexec.bat
2025-03-17 08:38:45 +01:00
NonPIayerCharacter
9ad08c17b6 bl0937 (#1569) 2025-03-16 08:25:42 +01:00
NonPIayerCharacter
544f48d022 ECR6600 (#1553)
* ECR6600

* fix macstr

* uart, bl0937

* vbat adc, ota

* pwm freq

* static ip, change mac

* update partitions
2025-03-07 22:11:42 +01:00
alexsandroz
86fbfe90e0 Mqtt-mbedtls (#960)
* Update package.json

Update repo url for build

* MQTT over TLS first build

* MQTT TLS boot ok

* Funcional version MQTT secure TLS

* Add option for mqtt to use tls in web config

* Versao funcional pendente otimizacao de rom

* Versao funcional com verify certificate disabled

* Adicao de informacoes para debug

* Versao funcional com verificacao do certificado

* Otimizacoes de rom e heap usage

* Versao com webserver enable/disable

* Versao boa para mqtt mbedtls boa uso

* Invert CFG enable_web_server to disable_web_server

* MQTT over TLS first build

* MQTT TLS boot ok

* Funcional version MQTT secure TLS

* Add option for mqtt to use tls in web config

* Versao funcional pendente otimizacao de rom

* Versao funcional com verify certificate disabled

* Adicao de informacoes para debug

* Versao funcional com verificacao do certificado

* Otimizacoes de rom e heap usage

* Versao com webserver enable/disable

* Versao boa para mqtt mbedtls boa uso

* Invert CFG enable_web_server to disable_web_server

* Same documentation

* Rever submodulos configuration

* Rever ignore submodules

Rever ignore submodules

* Fix for git actions

* Fix build start_type_pub only in platform Beken

* Fix build git w600

* Fix BL602 build

* Remove format only changes

* Delete src/driver/drv_ir.cpp

Space changes only

* Updates to pull request

* Revert space only changes

* Change cfg bool to byte and some documentation

* Fix get initial time from compile time

* Fix base64.c duplicate module

* Fix base64.c duplicate module for git workflow

* Fix strange behavior on BK7231n. Connection completed only in the second callback WIFI_STA_CONNECTED

* MQTT-MBEDTLS default disable

* Fix SERIOUS bug breaking all platforms except BK7231N (did you want to set g_bHasWiFiConnected  in #else?)

---------

Co-authored-by: Tester23 <85486843+openshwprojects@users.noreply.github.com>
2025-03-05 19:27:51 +01:00
NonPIayerCharacter
969e5bfa50 RTL8720D (#1550)
* ambd

* update sdk, get current fw idx

* test

* ota

* reset if hard fault

* revert and fix

* uart flow control

* disable uart tcp debug by default

* test

* wifi test

* adjust lwip
adjust scan

* increase timeout

* enable ssdp, close uart tcp sockets on restart

* test

* pwm

* fix bl0942

* cut some code
2025-02-28 08:43:00 +01:00
Tester23
23e67076c3 ip parse test 2025-02-26 22:32:11 +01:00
Tester23
e67d605964 Fix warnign 2025-02-26 22:27:33 +01:00