Commit Graph

847 Commits

Author SHA1 Message Date
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
9922aec8df add prestate for berry 2025-04-13 09:45:19 +02:00
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
XJ
04ab04ccfc HASS - Sensor name 'Battery' also for BATTERY_CHANNEL_SENSOR (#1583)
* Sensor name 'Battery' also for BATTERY_CHANNEL_SENSOR

* .

* changed unique_id to battery_ch to avoid collision

* spaces

* updated comment
2025-03-26 22:15:18 +01:00
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
7ace8c31ba tr6260 (#1564) 2025-03-13 09:01:58 +01:00
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
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
XJ
1cc0603748 Cmd Flags 64bit repair + webui (#1548)
* flags 64bit cmd repair + webui

* uint32

* flags 0 webui strange char repair
2025-03-01 06:17:38 +01:00
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
XJ
3c22b5e4ad Twin BL0942 mod - Two BL0942 on two UARTs on one power metering device (#1531)
* Twin BL0942 mod

* Energy data more checks for index 0

* BL09XX_ResetEnergyCounter reset lastSavedEnergyCounterValue

* added ENABLE_BL_TWIN compiler option, default disabled

* added more ENABLE_BL_TWIN
2025-02-26 11:51:22 +01:00
974d97acda try ln flash read (#1547)
* try flash read

* fx

* clera buffer so we won't get nonsense

* clear buffer
2025-02-25 22:58:29 +01:00
1ea3519307 script pwm 2025-02-23 20:35:18 +01:00
d4d6c69be3 BK7238 (#1527)
* beken new sdk + bk7238

* fix bk7238
2025-02-14 22:22:59 +01:00
6ac1f260ed RTL8710B/RTL8711AM (#1501)
* --

* test

* ota

* ameba1/rtl8711am

* workflow build

* uart tcp bridge driver

* fix build

* Static ip fix

* fix

* Rework amebaz ota

---------

Co-authored-by: Tester23 <85486843+openshwprojects@users.noreply.github.com>
2025-02-01 19:04:23 +01:00
7495c70322 f div 1000 type 2025-01-28 04:56:25 +01:00
ed1d815d20 respect CHANNEL_MAX in channels API 2025-01-27 06:22:11 +01:00
77efc7ebca make startup command multiline
* step 1

* step2

* Update cmd_script.c

* Update cmd_script.c

* Update obk_config.h

* Update cmd_script.c

* Update cmd_script.c

* fx

* Update obk_config.h

* Update OpenW800

* Update OpenW800

* Update obk_config.h

* f

* fix waitfor

* Update obk_config.h

* Update Makefile

* json escap9ijgng

* crash checks and size check

* w600 bmp

* fx

* Update Makefile

* test

* fx

* Tokenizer_GetPin

* fix

* fix

* ln882h pins

* Update new_http.c

* Update new_http.c

* Update new_http.c

* aht

* aht

* Update obk_config.h

* drv_sht3x

* aht pins

* f

* fx

* aht

* sunset fx

* ln owm

* Update CMakeLists.txt
2025-01-23 23:10:35 +01:00
eb5b1ca2d0 Allow to disable more drivers and features in order to reduce binary size (#1500)
* Update obk_config.h

* Update obk_config.h

* shared

* fx

* he

* fix

* fx

* ffff

* F

* T

* tre

* fcx

* leeed

* ww

* w

* fx

* t

* ENABLE_OLD_YAML_GENERATOR

* w

* startyuip[

* dis all

* remove test post

* ENABLE_HTTP_SEND

* extra guard

* ENABLE_TCP_COMMANDLINE

* better OBK_DISABLE_ALL_DRIVERS

* tr

* ENABLE_PING_WATCHDOG

* ENABLE_HA_DISCOVERY

* TEST WITH EMPTY USER_MAIN

* fx

* no mqtt

* nm

* tr

* ENABLE_MQTT

* Update cmd_newLEDDriver.c

* tr

* header

* fx

* Update user_main.c

* t

* Update hal_main_bk7231.c

* w

* ENABLE_DRIVER_IR

* RESTORE

* fx

* #warning "Platform not defined"

* fx 1

* Update obk_config.h

* ENABLE_DRIVER_TESTPOWER

* DS1820

* fx

* fx

* enable DHT on W800

* Update Makefile

* ntp w800

* ntp

* ssdp

* OWM AND CHARTS

* why utils net has flash pub included

* nmakefile only, no refs

* makefile only

* drv

* Update Makefile

* drcs

* ENABLE_DRIVER_BMP280

* Update Makefile

* d

* ENABLE_I2C

* Update Makefile

* fin
2025-01-10 19:50:17 +01:00
6eb8162b45 static rtl (#1492)
* Update hal_wifi_rtl87x0c.c

* Update hal_wifi_rtl87x0c.c

* test

* fx

* test
2025-01-05 22:57:17 +01:00
3a1c3e9bbf BatteryLevelPercent for HA 2025-01-05 14:39:19 +01:00
0efec12de6 feat(httpserver): improved mimetype handling for frontend files (#1481) 2025-01-04 10:41:36 +01:00
2a9a7270f2 RTL8710C/RTL8720C support (#1468)
* Move delay us and wdt to hals, update workflow

* rtl8720c initial

* move uart to hal

* rtl uart

* obk adjustments

* sdk adjustments, fix ota

* add some features

* fix some warnings

* esp uart + tr6260/esp tcp_msl

* add bl0937, adjust ota

* enable artifacts merge

* add forgotten ln882h delay

* fix mqtt, pwm on boot

* irq fix

* fix wifi disconnect

* update sdk, change lfs location and size

* Update Makefile
2025-01-01 12:11:49 +01:00
f80457a631 submit test code - pin visualize and bl0942 dump 2024-12-31 15:29:27 +01:00
1f51f65816 OTA for W800 + "Simple OTA" w/o httpd (#1471)
* OTA for W800
Removed unnecessary (and wasting resources) fetching of "index?status=1" on pages not using "state" div
Added simple "internal OTA" (just POST-ing a file)
Basic tests done - try avoiding other TCP connections to save memory
Somtimes there are memory related messages in log like "Thread create HTTP Client - errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY".

OTA working in most cases, somtimes device crashes during update.
Device will immediatly reboot after OTA completion, even printfs after writing last bytes was not visible in console.

* Add some more warnings
Make file selector accepting images on extension for platform
For Beken: Check magic "RBL" and future Platform name in header

* Changed way to verify firmware files: must match OBK file structure for the platform
As suggested by @NonPIayerCharacter added "NO_PLATFORM_OTA" in obk_config.h
For platforms w/o OTA the page will be only showing a hint.

* Fix page for non OTA devices

* streamlined tests
moved platform dependent #define for OTA extension to obk_config.h

* Optimized JS code

Only show hint for ".rbl" file on Beken platforms

Added a #define OBK_OTA_NAME_EXTENSION, actually only for LN882H
(here UART and OTA file are identicaly except an "_OTA" in the file name).
Otherwise the UART file would also match the template
(this file would not be flashed because of additional checks, but if we can prevent this ...)
2024-12-30 23:20:21 +01:00
3331f721b0 Try no state request on pages with no "state" div (#1464)
* Try no state request on pages with no "state" div

* move test for psence of "state" div
2024-12-29 11:00:46 +01:00
532a90313c TR6260 support (#1446)
* TR6260 initial

* fix gh-actions

* various fixes/features

* wifi fast connect fix

* fix gpio, add i2c

* move config to obk
2024-12-12 18:55:26 +01:00
65082bb390 EXPERIMENTAL: Try to fix OTA for LN882H (#1441)
ota_persistent_write() might crash the device, it doesn't check if 4k buffer limits were ignored, writing outside the defined memory...
we might have a buffer so large, that we need to write multiple 4K segments (at least 2)
2024-12-04 09:29:17 +01:00
5490fac28d extend Ch command so that it can also force an index to send... 2024-12-02 00:31:56 +01:00
dbc2cc4b49 proj 2024-12-01 13:08:16 +01:00
XJ
5201043ab8 Ssid2 retain mod - last used SSID will be preserved /Beken Only/ (#1440)
* SSID2 add retain SSID on reboot using setLastSSIDChannel command in early.bat

* func name

* save repair

* Cmd StartupSSID

* save repair 2

* cmd text

* .

* .

* Cmd disable on platforms without SSID2
2024-11-27 09:21:04 +01:00
XJ
926db0041d HASS MQTT patch typo (#1433) 2024-11-21 16:16:51 +01:00
96a248078c Fix bug preventing divider of 2 to work properly for home assistant auto discovery (#1424)
* Update README.md

Add intention for fork

* Update README.md

Improve Readme

* Update hass.c

Fix issue of not using divider other than 1 for home assistant auto discovery val_tpl

* Update README.md

update Fork intention

* Update README.md

Revert Readme to original state
2024-11-12 21:57:15 +01:00
c50515603a ESP32 support (#1344)
* esp-idf

* fix, add s2, s3

* fix + ci

* fix naming

* ota

* adc

* reboot reason

* wdt + uart

* dht + ds1820

* fix esp32

* pwm

* uart hack

* fix build

* charts

* increase stack size

* tests

* fix timer

* optimize

* further c2 optimization

* gpio test, wifi reconnect fix

* gpio test

* Revert ledc freq

* cht83xx, increase inttemp stack size

* fix

* S3 fix, enable sht3x, pwm freq selection

* gpio & i2c fix attempt

* s2 fix

* Update defines for DHT

* Update sdk

---------

Co-authored-by: openshwprojects <85486843+openshwprojects@users.noreply.github.com>
2024-11-06 14:47:22 +01:00
df400e3d73 config menu button label capitalisation consistency (#1410)
* config menu button label capitalisation consistency

* WebApp?
2024-11-03 20:54:36 +01:00
cc73ba88ac wifi&web page grammar/consistency (#1411)
* wifi&web page grammar/consistency

* colon spacing

* button capitals

* T
2024-11-02 21:38:51 +01:00
c0a2566f4a stub custom HASS publish, self test, part 1 of sim power 2024-11-01 11:48:35 +01:00
87a2da9e81 A few fixes for HASS MQTT for Energy (#1398)
* HASS MQTT json update

* HASS MQTT json update

* HASS MQTT json update

* HASS MQTT json update strlen
2024-10-31 12:18:49 +01:00
539a427789 Clearify "internal Temperature" as SoC temperature (#1395)
* Clearify "internal Temperature" as SoC temperature

* Change to "Chip temperature"
2024-10-28 07:27:40 +01:00
b2b4d2b338 Ssid2modv2 (#1274)
* SSID2 autoswitch BEKEN only

* SSID2 autoswitch BEKEN only v2

---------

Co-authored-by: Tester23 <openshwprojects@gmail.com>
2024-10-20 10:05:39 +02:00
46fa0b18e0 drivers define change
* Charts test for Ln882h and w800

* Update cmd_if.c

Try fix for DRV_GetReading without ENABLE_DRIVER_BL0937

* Update obk_config.h

* Update cmd_if.c

next try to fix Drivers w/o OBK_DISABLE_ALL_DRIVERS

* Update cmd_channels.c

... and another "DRV_GetReading" ...

* Update hass.c

... next problem: DRV_GetEnergySensorNames

* Update hass.c

.. more disabling code w/o energy driver

* Update http_fns.c

... and even more

* Update json_interface.c

... and energy drivers in json_interface.c

* Update user_main.c

another use of BL09X

* Update obk_config.h to remove define for charts driver
2024-09-29 21:54:54 +02:00
94f370ba8a allow get sufix removal 2024-09-29 20:01:39 +02:00
2c7cfd5909 Pin cfg: Sort Driver / pin function list alphabeticaly (#1361)
* Pin cfg: Sort Driver / pin function list alphabeticaly

* Let pins alias have fixed size
2024-09-29 19:39:23 +02:00
8cf98cfa1e nges to charts without changes to obk_config (#1364) 2024-09-29 07:49:24 +02:00
400e48f242 fix warnings p2 2024-09-27 18:10:44 +02:00
20d21d0a53 testing (#1354)
* run

* print socketg error on change

* typo

* resa

* fix??

* try

* try error

* fix error, add more info

* some tests

* more self tests

* tests
2024-09-21 07:21:19 +02:00
5583cac32f allow setting index refresh interval 2024-09-11 14:36:53 +02:00
89f49da09e LN882H - static ip (#1342)
* First changes for static IP on LN882H - WiP - need to set DNS server IP

Needs change in SDK in components/net/lwip-2.1.3/src/port/ln_osal/netif/ethernetif.c
to make sure, DHCP isn't called after we set the IP:

diff --git a/components/net/lwip-2.1.3/src/port/ln_osal/netif/ethernetif.c b/components/net/lwip-2.1.3/src/port/ln_osal/netif/ethernetif.c
index e2b485e..2884ef3 100644
--- a/components/net/lwip-2.1.3/src/port/ln_osal/netif/ethernetif.c
+++ b/components/net/lwip-2.1.3/src/port/ln_osal/netif/ethernetif.c
@@ -16,6 +16,7 @@

 #define IF_NAME_STA "ST" // Only support two ascii characters
 #define IF_NAME_AP  "AP" // Only support two ascii characters
+static int STA_USE_DHCP = 1;

 typedef struct {
     struct netif              nif;
@@ -267,9 +268,10 @@ int netdev_set_state(netif_idx_t nif_idx, netdev_state_t state)

             netif_set_status_callback(nif, sta_netif_status_changed_cb);
             netif_set_link_callback(nif, sta_netif_link_changed_cb);
-
             netifapi_dhcp_stop(nif);
+       if (STA_USE_DHCP) {
             netifapi_dhcp_start(nif);
+            }
         }
         else
         {
@@ -362,6 +364,8 @@ int netdev_set_ip_info(netif_idx_t nif_idx, tcpip_ip_info_t *ip_info)

     if (ndev && ip_info) {
         netifapi_netif_set_addr(netdev2netif(ndev), &ip_info->ip, &ip_info->netmask, &ip_info->gw);
+        // we set an IP in STA mode? --> disable DHCP, or it will be overwritten
+        if (nif_idx == NETIF_IDX_STA) STA_USE_DHCP = 0;
         return 0;
     }
     return -1;

* set DNS with dns_setserver()

* Changed code so during STA init a golbal variable is set, wheter static IP is used.
This will be respected in netif (see OpenLN882H PR#17)
2024-09-09 12:44:22 +02:00
c6057abf3b charts driver part 1 2024-09-06 10:57:48 +02:00