Skip to content

[AE-51] BHY2.delay() only works when NiclaConfig set to NICLA_BLE #106

@aliphys

Description

@aliphys

Describe the Problem

An alternative delay function is provided as part of the ArduinoBHY2 library. Defined as follows:

void Arduino_BHY2::delay(unsigned long ms)
{
unsigned long start = millis();
unsigned long elapsed = 0;
if (_niclaConfig & NICLA_BLE) {
while (elapsed < ms) {
bleHandler.poll(ms - elapsed);
elapsed = millis() - start;
}
}
}

The while segment is only activated when the NiclaConfig enumerator is set to NICLA_BLE.

enum NiclaConfig {
NICLA_I2C = 0x1, /*!< I2C */
NICLA_BLE = 0x2, /*!< Bluetooth via ANNA-B112 module */
NICLA_BLE_AND_I2C = NICLA_I2C | NICLA_BLE, /*!< Enable I2C and BLE simultaneously */
NICLA_STANDALONE = 0x4 /*!< Operate in standalone, without external data transfer */
};

Expected behaviour

🙂 While loop does not rely on the bleHandler class
🙂 Regardless of the NiclaConfig enumeration, the delay loop will operate as intended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions