logo elektroda
logo elektroda
X
logo elektroda

Testing OBK Config for Smaller Builds on OpenBK7231T - Feedback Needed

p.kaczmarek2 1785 65
ADVERTISEMENT
  • #1 21381261
    p.kaczmarek2
    Moderator Smart Home
    I'm adding extra defines to obk_config.h so we can get a reduced size build. New changes include:
    - ability to turn off some of HTML pages, like flags, etc, as they are possible to set via console command
    - ability to turn off LED driver (the classic RGBCW PWM one)
    - ability to turn off the BL0942/BL0937 shared code
    - ability to turn off some drivers that were included by default in the past
    Currently, a reduced size build resides in:
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1500

    OpenBK7231N_1500_merge_f2af436bf134.rbl is 405 200 bytes, while last public release, 1.18.12, is 500 800 bytes

    Can anyone try to run https://github.com/openshwprojects/OpenBK7231T_App/pull/1500 on BK7231 via wires and give me some feedback, is it working at all, etc?
    Also, do we have all required commands in order to remove WiFi, IP, etc, config pages from HTML? Everything would have to be done via text commands.

    @divadiow @insmod @DeDaMrAz @max4elektroda

    Added after 2 [minutes]:

    PS: On my side on BK721N:
    OBK_DevBoard_CB3S user interface with configuration menu.

    Added after 1 [minutes]:

    Defines:
    Screenshot of a code editor showing a fragment of the openBeken_win32_msvc2017 file.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #2 21381284
    insmod
    Level 25  
    Can't run, but seeing this and remembering that there are commands for setting up wifi via cmd gave me an idea about opl1000.
    But, something needs to be done about uart command line then, because right now if i remember correctly it is beken only.

    Good idea overall.
    SHT3X should be enabled by default, as there is a tuya battery sensor utilizing it.
  • #3 21381294
    p.kaczmarek2
    Moderator Smart Home
    The drivers enabled by default on public releases are up to discussion, because there were some things that were enabled without a good reason due to my fault/oversight. For example, ShiftRegister or MCP9808 did not have their own ENABLE_DRIVER_SHIFTREGISTER-like defines and instead they were just enabled for Windows, Beken, etc...

    We will just need some testing once everything is done, just to make sure that I didn't forget anything important, @divadiow , do you have both RGBCW devices and power devices (BL0942 etc)?

    Another thing that I may try to implement soon is a 100% alternative web panel that is just basically a "command line" window in HTML. It would certainly be even more lightweight that what we have now, even stripped...

    Build size reduction may be also somewhat useful for my another idea, which is a LUA scripting integration.
    Helpful post? Buy me a coffee.
  • #4 21381295
    divadiow
    Level 34  
    cool beans. I need to do @max4elektroda's clock/ntp bits first. I've been distracted by Realtek. Is this one step closer to point-and-click easy user custom builds?

    Added after 2 [minutes]:

    p.kaczmarek2 wrote:
    @divadiow , do you have both RGBCW devices and power devices (BL0942 etc)


    most likely. I have many bulbs and 2 BL0942 devices though one is TuyaMCU. Not sure I have BL0942SPI though.
  • #5 21381298
    p.kaczmarek2
    Moderator Smart Home
    Maybe not point and click, but we could consider integrating like 3 or 4 predefined "build driver sets" for Github. I don't know how long they would build, but maybe doing build twice is not as bad as long w don't have to fetch whole repository again and don't delete intermediate linker files? I am speaking about Github Actions/Workflow, of course.

    Some things are very strongly exclusive, like, for example LED driver (RGBCW PWM and SM2135, etc, etc) won't be needed along with power metering mechanism (BL0942, BL0937), so, in theory, we could have a "LED" build and "metering" build
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #6 21381738
    max4elektroda
    Level 20  
    I really like the idea! Sadly I can't do much testing atm, will be back this weekend.
  • #7 21381742
    p.kaczmarek2
    Moderator Smart Home
    I've pushed futher changes, now SendGET and SendPOST commands are determined by ENABLE_HTTP_SEND define. I don't even know if we even tested them on other platforms.

    Ah, and it's now possible to compile without classic RGBCW PWM LED driver - ENABLE_LED_BASIC

    Added after 4 [minutes]:

    EDIT: By the way, this is strange: I always assumed that if something is not referenced, it will be removed by linker, but instead, on Windows, I get "unreferenced function XYZ" even while it's not called? I hope it's just Windows fault, not anything else... I need to investigate more.
    Helpful post? Buy me a coffee.
  • #9 21382317
    p.kaczmarek2
    Moderator Smart Home
    BK7231N RBL latest public release: 500KB
    BK7231N RBL with current state of stripping down (removed even HA discovery, basic functionality and MQTT left): 388KB
    BK7231N RBL with empty main in HAL: 280KB (so totally without OBK)

    I wonder what is taking so much space in "empty" binary, WiFi, OTA, etc?

    Added after 40 [minutes]:

    This may be taking space:
    https://github.com/openshwprojects/OpenBK7231...1t/bk7231t_os/beken378/driver/common/dd.c#L82
    Helpful post? Buy me a coffee.
  • #10 21382838
    p.kaczmarek2
    Moderator Smart Home
    BK7231N RBL - now removed MQTT - with current state of stripping down (removed even HA discovery, basic functionalityt): 376KB

    Added after 33 [minutes]:

    I forgot about IR. I disabled IR and BK7231N RBL is down to 335KB.

    Added after 1 [minutes]:

    Btw, very strange. I added this to drv_ir.cpp:
    Code: C / C++
    Log in, to see the code

    Why in BL602 build do I get:
    
    In file included from /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/drv_ir.cpp:2:
    /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/../obk_config.h:20:5: warning: "PLATFORM_XR809" is not defined, evaluates to 0 [-Wundef]
     #if PLATFORM_XR809
         ^~~~~~~~~~~~~~
    /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/../obk_config.h:25:7: warning: "PLATFORM_W600" is not defined, evaluates to 0 [-Wundef]
     #elif PLATFORM_W600
           ^~~~~~~~~~~~~
    /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/../obk_config.h:36:7: warning: "PLATFORM_W800" is not defined, evaluates to 0 [-Wundef]
     #elif PLATFORM_W800
           ^~~~~~~~~~~~~
    /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/../obk_config.h:45:7: warning: "WINDOWS" is not defined, evaluates to 0 [-Wundef]
     #elif WINDOWS
           ^~~~~~~
    /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/../obk_config.h:98:7: warning: "PLATFORM_BL602" is not defined, evaluates to 0 [-Wundef]
     #elif PLATFORM_BL602
           ^~~~~~~~~~~~~~
    /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/../obk_config.h:124:7: warning: "PLATFORM_BEKEN" is not defined, evaluates to 0 [-Wundef]
     #elif PLATFORM_BEKEN
           ^~~~~~~~~~~~~~
    /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/../obk_config.h:130:7: warning: "PLATFORM_LN882H" is not defined, evaluates to 0 [-Wundef]
     #elif PLATFORM_LN882H
           ^~~~~~~~~~~~~~~
    /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/../obk_config.h:150:7: warning: "PLATFORM_ESPIDF" is not defined, evaluates to 0 [-Wundef]
     #elif PLATFORM_ESPIDF
           ^~~~~~~~~~~~~~~
    /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/../obk_config.h:176:7: warning: "PLATFORM_TR6260" is not defined, evaluates to 0 [-Wundef]
     #elif PLATFORM_TR6260
           ^~~~~~~~~~~~~~~
    /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/../obk_config.h:190:7: warning: "PLATFORM_RTL87X0C" is not defined, evaluates to 0 [-Wundef]
     #elif PLATFORM_RTL87X0C
           ^~~~~~~~~~~~~~~~~
    /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/../obk_config.h:215:2: error: #error "Platform not defined"
     #error "Platform not defined"
      ^~~~~
    /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/../obk_config.h:220:5: warning: "ENABLE_DRIVER_BL0937" is not defined, evaluates to 0 [-Wundef]
    

    Global platform PLATFORM_BL602 define is not defined in BL602 in cpp files?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #11 21384037
    DeDaMrAz
    Level 20  
    Latest build from 8th January is working on WBR3 module

    A screenshot of the OpenRTL87X0C test interface showing system information.

    It is working on N module with DHT test

    Screenshot of DHT_test interface with DHT11 sensor data.

    DHT sensor is working but it will need more attention at some point as well.

    T module is working as well

    Configuration screen of the testOBK_T interface with various configuration options.

    Note, all of these are test boards with very limited or none of drivers running or devices attached. I did try to run some of the drivers (without problems) but without external devices I can't provide more relevant data at this point.
  • #12 21384088
    p.kaczmarek2
    Moderator Smart Home
    W600 DHT works:
    OpenW600 user interface with temperature and humidity data
    Drivers in W600 (DHT is not listed as driver, sorry):
    
    Available drivers:
    - NTP
    - BL0937
    - DGR
    

    Test in WBR3:
    Screenshot of the OpenRTL87X0C interface with DHT11 sensor data.
    
    Available drivers:
    - TuyaMCU
    - tmSensor
    - NTP
    - I2C
    - BL0942
    - BL0937
    - CSE7766
    - DGR
    - Wemo
    - SM2135
    - BP5758D
    - BP1658CJ
    - SM2235
    - BMPI2C
    - CHT83XX
    - AHT2X
    - DS1820
    

    Test on CB3S:
    Screenshot of a control panel with an LED temperature slider and connection information.
    Drivers:
    
    Available drivers:
    - TuyaMCU
    - tmSensor
    - PixelAnim
    - NTP
    - HTTPButtons
    - I2C
    - BL0942
    - BL0942SPI
    - BL0937
    - CSE7766
    - SM16703P
    - SM15155E
    - IR
    - DDP
    - SSDP
    - DGR
    - Wemo
    - Hue
    - PWMToggler
    - DoorSensor
    - SM2135
    - BP5758D
    - BP1658CJ
    - SM2235
    - BMP280
    - CHT83XX
    - KP18058
    - ADCSmoother
    - DS1820
    - Battery
    - Bridge
    


    Who can test futher and tell me if it still works as main release? HASS Discovery? Anything else? LittleFS? I don't want to break release.
    Helpful post? Buy me a coffee.
  • #13 21384099
    DeDaMrAz
    Level 20  
    HA Discovery and LFS on RTL87X0C works.


    User interface of RTL87X0C device management system displaying diagnostic information and logbook.

    I only got powersave 1 in lfs but it is working on every startup and lfs is there after the reboot.
  • #14 21384150
    divadiow
    Level 34  
    This is potentially a lot to test...

    OTA on CB3S from 1.18.13 to sizetest2_2b234efa753e. DS1820 already configured. still works. so does SSDP


    Screenshot of OpenBK7231N user interface with temperature information, MQTT connection status, and configuration buttons.

    MQTT connected OK (I manually returned to home - are we to wait for some confirmation of something?)
    OpenBK7231N interface displaying version and device connection information.

    Screenshot of the OpenBK7231N interface with Home Assistant and MQTT configuration options. User interface of a device control panel displaying firmware information and logs. Screenshot of a text editor with the /autoexec.bat file open containing a script.
  • #15 21384155
    p.kaczmarek2
    Moderator Smart Home
    LN882H DHT works:
    Screenshot of the OpenLN882H interface with temperature and humidity data.
    Drivers:
    
    Available drivers:
    - NTP
    - BL0937
    - DGR
    - Wemo
    - Hue
    - SM2135
    - BP5758D
    - BP1658CJ
    - SM2235
    - DS1820
    


    Added after 38 [seconds]:

    divadiow wrote:

    MQTT connected OK (I manually returned to home - are we to wait for some confirmation of something?)

    Well, how it behaves in public release?
    Helpful post? Buy me a coffee.
  • #16 21384164
    divadiow
    Level 34  
    p.kaczmarek2 wrote:
    Well, how it behaves in public release?

    not used it for a long time tbh. will check
  • #18 21384178
    divadiow
    Level 34  
    more a general comment on it reading like we're to expect something to happen when it does connect. off-topic. back to testing
  • #19 21384179
    p.kaczmarek2
    Moderator Smart Home
    Let's do something more exciting, I will test this build on my room lights. If I break them, I will have to sit in the dark.
    User interface for a lighting control system based on the BK7231T chip with two adjustment sliders.
    Autoexec copy:
    
    startDriver PWMToggler
    toggler_channel0 0
    toggler_name0 Window
    
    toggler_channel1 1
    toggler_name1 Wardrobe
    
    alias on backlog toggler_enable0 1; toggler_enable1 1;
    alias up backlog on; toggler_set0 +10; toggler_set1 +10;
    alias down backlog on; toggler_set0 -10; toggler_set1 -10;
    
    addEventHandler OnClick 0 up 
    addEventHandler OnClick 1 down
    

    Template:
    Code: JSON
    Log in, to see the code

    Testing my lights in 3, 2, 1...

    Ok, I lost my autoexec.bat, but rest is still working. We really need to add warning for that autoexec.bat or shrink default LFS size AGAIN.

    The lights are still working.
    Helpful post? Buy me a coffee.
  • #20 21384187
    divadiow
    Level 34  
    LN OTA from 1.17.765 to sizetest2_2b234efa753e
    BL0937 and DS1820, LFS, NTP, MQTT = ok

    Screenshot of OpenLN882H interface displaying temperature and energy data. Screenshot of a device interface displaying device info, sensors, and event log.

    Added after 21 [minutes]:

    what to test next...? what do you want to see? everything...?
  • #21 21384228
    p.kaczmarek2
    Moderator Smart Home
    Maybe just go over manually the drivers list, get them via:
    
    startDriver anyNonExistingName
    

    and just double-check if everything we need in public is included... and we will merge this PR.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #22 21384266
    divadiow
    Level 34  
    OK. I know you've posted some anyway, but here's mine

    LN882H
    Code: Text
    Log in, to see the code


    BK7231N
    Code: Text
    Log in, to see the code


    BK7231T
    Code: Text
    Log in, to see the code


    ESP32C2
    Code: Text
    Log in, to see the code


    ESP32S3
    Code: Text
    Log in, to see the code


    W600
    Code: Text
    Log in, to see the code


    W800
    Code: Text
    Log in, to see the code


    ESP32C6
    Code: Text
    Log in, to see the code


    BL602
    Code: Text
    Log in, to see the code


    ESP32
    Code: Text
    Log in, to see the code
  • #23 21384274
    p.kaczmarek2
    Moderator Smart Home
    And OTA back to Release still works on all?

    If OTA works, then I will most likely merge this PR...

    Then we will have to sort out merge conflicts with @insmod PR, or maybe, @insmod can you tomorrow update your PR from main? There are no changes in code except the added #ifdef in some places.
    Helpful post? Buy me a coffee.
  • #24 21384392
    divadiow
    Level 34  
    TR6260
    Code: Text
    Log in, to see the code


    XR809 (same result for GA)
    Code: Text
    Log in, to see the code


    Added after 5 [minutes]:

    p.kaczmarek2 wrote:
    And OTA back to Release still works on all?

    todo
  • #25 21384891
    p.kaczmarek2
    Moderator Smart Home
    I've enabled DS18B20 on W600, most likely for the first time ever. I had to fix one small type error:
    User interface on the OpenW600 configuration page with temperature and humidity information.
    This makefiles in App change by Max (if I remember correctly) is very useful.
    W600 microcontroller on a breadboard with a connected DS18B20 sensor.
    W600 microcontroller connected to a DS18B20 temperature sensor on a breadboard.
    Close-up of a PCB with a W600-BA00 chip and an LED diode.
    Close-up of a DS18B20 chip on a breadboard with colored wires.
    Helpful post? Buy me a coffee.
  • #26 21385028
    max4elektroda
    Level 20  
    p.kaczmarek2 wrote:
    Global platform PLATFORM_BL602 define is not defined in BL602 in cpp files?

    The define is only set in "CFLAGS" in https://github.com/openshwprojects/OpenBL602/blob/master/make_scripts_riscv/project.mk#L363

    Screenshot showing a fragment of a makefile used in the OpenBL602 project. In line 363, CFLAGS is set to -DPLATFORM_BL6021.

    and since this is a .cpp file, I would expect it should be also in CXXFLAGS or in CPPFLAGS like

    CXXFLAGS += -DPLATFORM_BL602=1


    Sorry, can't do a PR atm...

    Added after 19 [minutes]:

    Just made
    https://github.com/openshwprojects/OpenBL602/pull/6
  • #27 21385068
    p.kaczmarek2
    Moderator Smart Home
    Ok merged, thank you, but I will update SDKs a bit later. Still, I think I will merge this #define PR today.
    Helpful post? Buy me a coffee.
  • #28 21385102
    max4elektroda
    Level 20  
    p.kaczmarek2 wrote:
    I've enabled DS18B20 on W600, most likely for the first time ever. I had to fix one small type error:

    It won't break anything, but make the function not working if device is up for some time (hence xTaskGetTickCount() is big). Maybe we should use "portTickType" here?


    Code snippet in an editor with a comment about changing the variable type.

    Added after 4 [minutes]:

    ... since its used in "src/driver/drv_bl_shared.c" code, it should be present in all/most SDKs.

    Added after 6 [minutes]:

    And/Or I can move this whole code section into a #define for debugging, since it's only used if the timing is not working and should not be needed if usleep works o.k. on the platform.
  • #29 21385177
    p.kaczmarek2
    Moderator Smart Home
    I will merge that PR and I'll let you do adjustments.

    First, I have another problem.

    Did W801 require anything else besides power off/on after flashing?

    The W801 board I received can be flashed, but is silent over UART and creates no APP:
    Screenshot of CMD console showing a device flashing process for W801.
    Terminal window showing the flashing process of the W801 device.
    W801 microcontroller board placed on a wooden table.
    PCB with W801 microcontroller, showing pin labels.
    PCB board with pin layout and labels on a wooden background.
    It's 100% silent over UART:
    Screenshot of RealTerm serial capture program showing no data on a black background.
    Tested with:
    - OpenW800_1.17.215.fls
    - OpenW800_1.18.14.fls
    The same happens. And it is my first time flashing this W801, I remember other W80X worked for me well.

    Do anyone also have W80X and can check whether those releases work there? Do they print over UART?
    Helpful post? Buy me a coffee.
  • #30 21385192
    divadiow
    Level 34  
    mine have always printed over UART/USB-C - same as flashing. will flash now

Topic summary

Dyskusja dotyczy wprowadzenia mniejszych kompilacji w projekcie OpenBK7231T, w tym dodania nowych definicji do pliku obk_config.h, co pozwala na redukcję rozmiaru budowy. Użytkownicy omawiają możliwość wyłączenia niektórych stron HTML, sterowników LED oraz kodu wspólnego dla BL0942/BL0937. Testy wykazały, że nowa kompilacja osiąga rozmiar 388KB w porównaniu do 500KB w ostatnim publicznym wydaniu. Uczestnicy dyskusji dzielą się doświadczeniami z testowaniem różnych urządzeń, takich jak DHT, BL0942, oraz omawiają problemy związane z OTA i nowymi komendami startowymi. Wskazano również na potrzebę dalszych testów i integracji z innymi platformami.
Summary generated by the language model.
ADVERTISEMENT