Skip to content

v1.2.0

Latest

Choose a tag to compare

@milad-nikpendar milad-nikpendar released this 31 Jul 01:14
· 1 commit to main since this release

What's new

  • INT-pin wake detection: begin() now accepts an optional intPin (and intTimeoutMs) parameter. If wired to the IC's L3/INT pin, begin() waits for it to read HIGH before touching SDA/SCL at all — this is the datasheet-correct handshake for the IC's I2C-vs-LED-indicator wake decision, and avoids a real race that could otherwise strand the IC in LED mode for a whole power session. Fully backward compatible: omitting it (intPin = -1, the default) preserves the old best-effort probe behavior.
  • Bug fixes:
    • Fixed a compile-breaking header/cpp signature mismatch on readRegister8.
    • Fixed NTC_Enable() inverted logic (the datasheet bit is active-low; the getter/setter previously passed the raw bit through unchanged).
    • Charging() no longer reads an undocumented register (0x70, not in the vendor register map) — it's now derived from ChargingStatus().
    • Fixed BATChargingCurrent() unit mismatch: the header said mA, the implementation used Amps. Now documented correctly and clamped to the datasheet's 0–3.1A range.
  • Performance: update_setup(), update_status(), and update_inputs() now read each physical register once and decode every packed field locally, instead of one I2C transaction per field — cuts I2C traffic per full poll from ~41 to ~19 transactions.
  • More accurate battery percentage: replaced the old two-point linear voltage map (different formula per charging state, which caused the reported percentage to visibly jump at every state transition) with a single piecewise-linear OCV calibration curve applied uniformly across all states — matches the real non-linear Li-ion/LiPo discharge curve much more closely.
  • Docs refresh: README, both examples, and keywords.txt updated to match the current float/enum-based API (they were still documenting a pre-refactor mV/mA-integer API) and to document the new INT pin and wake-detection caveat.

Full diff: v1.0.0...v1.2.0