From da859c534fcf9e6ef47692afca78514dab6c641d Mon Sep 17 00:00:00 2001 From: Rob Tillaart Date: Sun, 24 Sep 2023 11:25:28 +0200 Subject: [PATCH] 0.1.5 INA219 --- libraries/INA219/CHANGELOG.md | 6 +++++- libraries/INA219/INA219.cpp | 7 ++----- libraries/INA219/INA219.h | 12 ++++++------ libraries/INA219/README.md | 12 ++++++++++++ libraries/INA219/library.json | 4 ++-- libraries/INA219/library.properties | 2 +- 6 files changed, 28 insertions(+), 15 deletions(-) diff --git a/libraries/INA219/CHANGELOG.md b/libraries/INA219/CHANGELOG.md index 213f4373..d709c1d3 100644 --- a/libraries/INA219/CHANGELOG.md +++ b/libraries/INA219/CHANGELOG.md @@ -6,13 +6,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.1.5] - 2023-09-24 +- Add Wire1 support for ESP32 +- update readme.md + + ## [0.1.4] - 2023-06-12 - improve RP2040 support - add address test in isConnected() - update readme.md - add array example - ## [0.1.3] - 2023-03-31 - fix setBusADC() range check - fix setShuntADC() range check diff --git a/libraries/INA219/INA219.cpp b/libraries/INA219/INA219.cpp index 966b7b73..d83e07fe 100644 --- a/libraries/INA219/INA219.cpp +++ b/libraries/INA219/INA219.cpp @@ -1,6 +1,6 @@ // FILE: INA219.h // AUTHOR: Rob Tillaart -// VERSION: 0.1.4 +// VERSION: 0.1.5 // DATE: 2021-05-18 // PURPOSE: Arduino library for INA219 voltage, current and power sensor // URL: https://github.com/RobTillaart/INA219 @@ -40,7 +40,7 @@ INA219::INA219(const uint8_t address, TwoWire *wire) { _address = address; _wire = wire; - // not calibrated values by default. + // not calibrated values by default. _current_LSB = 0; _maxCurrent = 0; _shunt = 0; @@ -50,7 +50,6 @@ INA219::INA219(const uint8_t address, TwoWire *wire) #if defined (ESP8266) || defined(ESP32) bool INA219::begin(const uint8_t sda, const uint8_t scl) { - _wire = &Wire; _wire->begin(sda, scl); if (! isConnected()) return false; return true; @@ -307,8 +306,6 @@ bool INA219::setMaxCurrentShunt(float maxCurrent, float shunt) } - - //////////////////////////////////////////////////////// // // PRIVATE diff --git a/libraries/INA219/INA219.h b/libraries/INA219/INA219.h index da216a02..ac4c2c74 100644 --- a/libraries/INA219/INA219.h +++ b/libraries/INA219/INA219.h @@ -1,7 +1,7 @@ #pragma once // FILE: INA219.h // AUTHOR: Rob Tillaart -// VERSION: 0.1.4 +// VERSION: 0.1.5 // DATE: 2021-05-18 // PURPOSE: Arduino library for INA219 voltage, current and power sensor // URL: https://github.com/RobTillaart/INA219 @@ -14,7 +14,7 @@ #include "Wire.h" -#define INA219_LIB_VERSION (F("0.1.4")) +#define INA219_LIB_VERSION (F("0.1.5")) class INA219 @@ -63,7 +63,7 @@ public: // factor = 1, 2, 4, 8 bool setGain(uint8_t factor = 1); uint8_t getGain(); - // mask + // mask bool setBusADC(uint8_t mask = 0x03); uint8_t getBusADC(); bool setShuntADC(uint8_t mask = 0x03); @@ -81,12 +81,12 @@ public: bool setModeBusContinuous() { return setMode(6); }; bool setModeShuntBusContinuous() { return setMode(7); }; // default. - + // CALIBRATION // mandatory to set these! read datasheet. // maxCurrent >= 0.001 // shunt >= 0.001 - bool setMaxCurrentShunt(float maxCurrent = 3.4, + bool setMaxCurrentShunt(float maxCurrent = 3.4, float shunt = 0.002); bool isCalibrated() { return _current_LSB != 0.0; }; @@ -104,7 +104,7 @@ public: private: - + uint16_t _readRegister(uint8_t reg); uint16_t _writeRegister(uint8_t reg, uint16_t value); float _current_LSB; diff --git a/libraries/INA219/README.md b/libraries/INA219/README.md index 1a48da2f..d5f88f6d 100644 --- a/libraries/INA219/README.md +++ b/libraries/INA219/README.md @@ -2,8 +2,11 @@ [![Arduino CI](https://github.com/RobTillaart/INA219/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci) [![Arduino-lint](https://github.com/RobTillaart/INA219/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/INA219/actions/workflows/arduino-lint.yml) [![JSON check](https://github.com/RobTillaart/INA219/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/INA219/actions/workflows/jsoncheck.yml) +[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/INA219.svg)](https://github.com/RobTillaart/INA219/issues) + [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/INA219/blob/master/LICENSE) [![GitHub release](https://img.shields.io/github/release/RobTillaart/INA219.svg?maxAge=3600)](https://github.com/RobTillaart/INA219/releases) +[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/INA219.svg)](https://registry.platformio.org/libraries/robtillaart/INA219) # INA219 @@ -257,3 +260,12 @@ to get the values in scientific notation like "3.5e-6" - can't be sure so user is responsible +## Support + +If you appreciate my libraries, you can support the development and maintenance. +Improve the quality of the libraries by providing issues and Pull Requests, or +donate through PayPal or GitHub sponsors. + +Thank you, + + diff --git a/libraries/INA219/library.json b/libraries/INA219/library.json index 2aa58d48..fdf1952c 100644 --- a/libraries/INA219/library.json +++ b/libraries/INA219/library.json @@ -15,9 +15,9 @@ "type": "git", "url": "https://github.com/RobTillaart/INA219.git" }, - "version": "0.1.4", + "version": "0.1.5", "license": "MIT", - "frameworks": "arduino", + "frameworks": "*", "platforms": "*", "headers": "INA219.h" } diff --git a/libraries/INA219/library.properties b/libraries/INA219/library.properties index b7edad3c..1f6751e9 100644 --- a/libraries/INA219/library.properties +++ b/libraries/INA219/library.properties @@ -1,5 +1,5 @@ name=INA219 -version=0.1.4 +version=0.1.5 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for INA219 voltage, current and power sensor.