Skip to content

tooling: Wire bq27441 into the smoke-test sketch (src/main.cpp) #178

@nedseb

Description

@nedseb

Context

PR #171 (feat(bq27441): Add driver for the on-board Li-Po fuel gauge.) intentionally does NOT wire the new driver into src/main.cpp. PR #172 (mcp23009e) is open in parallel and would touch the same file, so doing the integration inside either feature PR turns the second merge into a conflict — sequencing it after both drivers land is cheaper.

What to do

Edit src/main.cpp after PR #171 is merged to add the BQ27441 alongside the existing on-board drivers:

  1. #include <BQ27441.h> next to the other driver headers.
  2. Instantiate on the internal bus:
    BQ27441 bq27441(internalI2C);
  3. Add a probe section in setup() matching the style of the existing drivers:
    // --- BQ27441 (Li-Po fuel gauge) ---
    if (bq27441.begin()) {
        Serial.print("BQ27441 detected, DEVICE_ID = 0x");
        Serial.println(bq27441.deviceId(), HEX);
        Serial.print("BQ27441 first read: V = ");
        Serial.print(bq27441.voltageMv());
        Serial.print(" mV, SOC = ");
        Serial.print(bq27441.stateOfCharge());
        Serial.println(" %");
    } else {
        Serial.println("BQ27441 not detected");
    }
  4. The STeaMi variant header does not expose a GPOUT wake pin for the gauge, so leave the constructor default (gpout_pin = -1). If a future board revision wires it, pass it as the 4th constructor argument and begin() will pulse the wake sequence automatically.

Acceptance

  • make build (steami env) green.
  • Smoke firmware flashed on a wired STeaMi prints BQ27441 detected with a plausible voltage (3000–4300 mV) and SOC (0–100 %) on a charged board.
  • No regression in the other drivers' output.

Why this is a follow-up

Doing this inside #171 would conflict with #172, which also extends src/main.cpp. Sequencing the smoke-test edit after both feature PRs merge means whichever feature lands second only rebases its own diff — not also a src/main.cpp integration edit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions