TX_POWER on _BLEIO.ADAPTER

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
gjk_baker
 
Posts: 55
Joined: Mon Feb 01, 2021 5:19 pm

TX_POWER on _BLEIO.ADAPTER

Post by gjk_baker »

Good Day.

I use the Feather Sense for a lot of industrial projects.
I have an open request to add TX_POWER to the start_scan to increase the power above the default 0dBm for longer range, to no avail.

I did notice, that the _bleio.Adapter.start_advertising() has a TX_POWER input, and I thought I would give it a try.
Thinking, that if I started advertising and then stopped, maybe the power level would persist.

I have the Nordic scanner on my phone and a PPK2 to monitor power.

I went into the /lib/adafruit_ble/ folder and replaced the __init__.mpy with the __init__.py
I added the following "tx_power", starting at line 195 in __init__.py

Code: Select all

        else:
            self._adapter.start_advertising(
                advertisement_bytes,
                scan_response=scan_response_bytes,
                connectable=advertisement.connectable,
                interval=interval,
                tx_power = 0,
                timeout=0 if timeout is None else timeout,
            )
I know that the parameter was being recognized.
But, changing the tx_power=8 or 0 etc, doesn't effect the power of the transmission.
I know this through the Nordic scanner on my phone, always reading 4dBm and the current never changing in the PPK2.

So, this a bug, or am I missing something?

thx

User avatar
tannewt
 
Posts: 3304
Joined: Thu Oct 06, 2016 8:48 pm

Re: TX_POWER on _BLEIO.ADAPTER

Post by tannewt »

I think it should work. It is set here: https://github.com/adafruit/circuitpyth ... er.c#L828=

I've only used it to lower power below 0. Can you try lowering the power and confirming it through your phone and power monitor?

User avatar
gjk_baker
 
Posts: 55
Joined: Mon Feb 01, 2021 5:19 pm

Re: TX_POWER on _BLEIO.ADAPTER

Post by gjk_baker »

Tried
-4, -8, -12 not changed always 0dBm

Tried -6 and got an error, so the value is being seen.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”