Skip to content

Fixed BLE pin code gets ignored #109

@lincomatic

Description

@lincomatic

In the companion_radio_ble build, the a fixed BLE pin code gets ignored if the device previously was flashed with a dynamic pin code. I flashed a build with display support into a device by accident. Subsequently, flashed a build with BLE_PIN_CODE defined to be nonzero, and it was still generating dynamic pin codes (which I couldn't see, because the device had no display).

The offending code is in main.cpp:

  #ifdef BLE_PIN_CODE
    if (_prefs.ble_pin == 0) {
    #ifdef DISPLAY_CLASS
      _active_ble_pin = trng.nextInt(100000, 999999);  // random pin each session
    #else
      _active_ble_pin = BLE_PIN_CODE;  // otherwise static pin
    #endif
    } else {
      _active_ble_pin = _prefs.ble_pin;
    }
  #else
    _active_ble_pin = 0;
  #endif` 

Note than if _prefs.ble == 0, it ignores BLE_PIN_CODE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions