Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MI32 legacy: add config operations for Berry #22458

Merged
merged 1 commit into from
Nov 10, 2024

Conversation

Staars
Copy link
Contributor

@Staars Staars commented Nov 10, 2024

Description:

Add a few BLE operations to configure some options of the BLE stack at runtime when acting as a central device. These are executed immediately.
This can be helpful to emulate other devices like AirTags for educational purposes or explore projects like openhaystack.

Op code | function:
231 - set own address to random:

        var m = bytes(aabbccddeeff).reverse() # directly set value of ble_addr_t, which is reversed
        BLE.set_MAC(m,1) # 1 -> address type random
        BLE.run(231)

232 - set advertising parameters with bytes()-descriptor of length 5 [advType:byte, minInterval:uint16_t, max interval: uint16_t]

   #BLE_GAP_CONN_MODE_NON    (0) - not connectable advertising
   #BLE_GAP_CONN_MODE_DIR    (1) - directed connectable advertising
   #BLE_GAP_CONN_MODE_UND    (2) - undirected connectable advertising

    var minitvl = int(1000 / 0.625) # in 0.625ms units
    var maxitvl = int(2000 / 0.625) # in 0.625ms units
    cbuf.setbytes(0,bytes("050200000000")) # 5 bytes, type 2 
    cbuf.seti(2,minitvl,2)
    cbuf.seti(4,maxitvl,2)
    BLE.run(232)

233 - set GAP name of the device

var name = "Tasmota BLE“
    cbuf[0] = size(name) + 1
    cbuf.setbytes(1,bytes().fromstring(name))
    BLE.run(233)

A partial backport of esp-nimble-cpp is included, but there are many other breaking changes upstream. Thus we will not update the whole library for now.

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.8
  • The code change is tested and works with Tasmota core ESP32 V.3.1.0.241030
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@s-hadinger s-hadinger merged commit 448ca1c into arendst:development Nov 10, 2024
59 checks passed
@Staars Staars deleted the mi32_config_ops branch December 18, 2024 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants