Skip to content

Commit

Permalink
Merge pull request #74 from SV-Zanshin/Development_v1.0.13
Browse files Browse the repository at this point in the history
Development v1.0.14
  • Loading branch information
Arnd authored Dec 2, 2020
2 parents 7d37218 + 1ae3892 commit 1ba2bbd
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 235 deletions.
3 changes: 2 additions & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## ##
## Date Developer Comments ##
## ========== ============== ====================================================================== ##
## 2020-07-12 SV-Zanshin Updated to version v1.0.14 ##
## 2020-07-12 SV-Zanshin Updated to version v1.0.13 ##
## 2020-06-30 SV-Zanshin Updated to version v1.0.12 ##
## 2020-06-06 SV-Zanshin Updated to version v1.0.11 ##
Expand All @@ -11,7 +12,7 @@
######################################################################################################
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = INA2xx
PROJECT_NUMBER = "Version 1.0.13"
PROJECT_NUMBER = "Version 1.0.14"
PROJECT_BRIEF = "Arduino Library for INA2xx power measurement devices"
PROJECT_LOGO = images/horizontal_narrow_small.png
OUTPUT_DIRECTORY =
Expand Down
5 changes: 3 additions & 2 deletions examples/BackgroundRead/BackgroundRead.ino
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
*
* Version | Date | Developer | Comments
* ------- | ---------- | ----------- | ------------------------------------------------------------
* 1.0.5 | 2020-12-01 | SV-Zanshin | Corrected "alertOnConversion()" call
* 1.0.4 | 2019-02-16 | SV-Zanshin | ifdef so that sketch won't compile on incompatible platforms
* 1.0.3 | 2019-01-09 | SV-Zanshin | Cleaned up doxygen formatting
* 1.0.2 | 2018-12-28 | SV-Zanshin | Converted comments to doxygen format
Expand Down Expand Up @@ -133,7 +134,7 @@ void setup() {
#ifdef __AVR_ATmega32U4__ // If this is a 32U4 processor, wait 2 seconds for initialization
delay(2000);
#endif
Serial.print(F("\n\nBackground INA Read V1.0.1\n"));
Serial.print(F("\n\nBackground INA Read V1.0.5\n"));
uint8_t devicesFound = 0;
while (deviceNumber == UINT8_MAX) // Loop until we find the first device
{
Expand All @@ -159,7 +160,7 @@ void setup() {
INA.setBusConversion(8244, deviceNumber); // Maximum conversion time 8.244ms
INA.setShuntConversion(8244, deviceNumber); // Maximum conversion time 8.244ms
INA.setMode(INA_MODE_CONTINUOUS_BOTH, deviceNumber); // Bus/shunt measured continuously
INA.AlertOnConversion(true, deviceNumber); // Make alert pin go low on finish
INA.alertOnConversion(true, deviceNumber); // Make alert pin go low on finish
} // of method setup()

void loop() {
Expand Down
3 changes: 2 additions & 1 deletion examples/BackgroundRead_ESP32/BackgroundRead_ESP32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
*
* Version | Date | Developer | Comments
* ------- | ---------- | ----------- | --------
* 1.0.3 | 2020-12-02 | SV-Zanshin | Corrected call to "AlertOnConversion()"
* 1.0.2 | 2020-06-30 | SV-Zanshin | Issue #58 - clang-formatted document
* 1.0.1 | 2020-03-24 | SV-Zanshin | Issue #53 - Doxygen documentation
* 1.0.0 | 2019-02-17 | SV-Zanshin | Cloned and adapted from "BackgroundRead.ino" program
Expand Down Expand Up @@ -143,7 +144,7 @@ void setup() {
INA.setBusConversion(8244, deviceNumber); // Maximum conversion time 8.244ms
INA.setShuntConversion(8244, deviceNumber); // Maximum conversion time 8.244ms
INA.setMode(INA_MODE_CONTINUOUS_BOTH, deviceNumber); // Bus/shunt measured continuously
INA.AlertOnConversion(true, deviceNumber); // Make alert pin go low on finish
INA.alertOnConversion(true, deviceNumber); // Make alert pin go low on finish
} // of method setup()

void loop() {
Expand Down
40 changes: 22 additions & 18 deletions examples/DisplayReadings/DisplayReadings.ino
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
*
* Version | Date | Developer | Comments
* ------- | ---------- | ----------- | --------
* 1.0.8 | 2020-12-01 | SV-Zanshin | Issue #72, allow dynamic memory allocation instead of EEPROM
* 1.0.7 | 2020-06-30 | SV-Zanshin | Issue #58, changed formatting to use clang-format
* 1.0.6 | 2020-06-29 | SV-Zanshin | Issue #57, changed case of functions "Alert..."
* 1.0.5 | 2020-05-03 | SV-Zanshin | Moved setting of maxAmps and shunt to constants
Expand Down Expand Up @@ -78,11 +79,14 @@
/**************************************************************************************************
** Declare program constants, global variables and instantiate INA class **
**************************************************************************************************/
const uint32_t SERIAL_SPEED = 115200; ///< Use fast serial speed
const uint32_t SHUNT_MICRO_OHM = 100000; ///< Shunt resistance in Micro-Ohm, e.g. 100000 is 0.1 Ohm
const uint16_t MAXIMUM_AMPS = 1; ///< Max expected amps, values are 1 - clamped to max 1022
uint8_t devicesFound = 0; ///< Number of INAs found
INA_Class INA; ///< INA class instantiation
const uint32_t SERIAL_SPEED{115200}; ///< Use fast serial speed
const uint32_t SHUNT_MICRO_OHM{100000}; ///< Shunt resistance in Micro-Ohm, e.g. 100000 is 0.1 Ohm
const uint16_t MAXIMUM_AMPS{1}; ///< Max expected amps, clamped from 1A to a max of 1022A
uint8_t devicesFound{0}; ///< Number of INAs found
INA_Class INA; ///< INA class instantiation to use EEPROM
// INA_Class INA(0); ///< INA class instantiation to use EEPROM
// INA_Class INA(5); ///< INA class instantiation to use dynamic memory rather
// than EEPROM. Allocate storage for up to (n) devices

void setup() {
/*!
Expand All @@ -98,22 +102,22 @@ void setup() {
#ifdef __AVR_ATmega32U4__ // If a 32U4 processor, then wait 2 seconds to initialize
delay(2000);
#endif
Serial.print("\n\nDisplay INA Readings V1.0.7\n");
Serial.print("\n\nDisplay INA Readings V1.0.8\n");
Serial.print(" - Searching & Initializing INA devices\n");
/************************************************************************************************
** The INA.begin call initializes the device(s) found with an expected ±1 Amps maximum current **
** and for a 0.1Ohm resistor, and since no specific device is given as the 3rd parameter all **
** devices are initially set to these values. **
************************************************************************************************/
devicesFound = INA.begin(
MAXIMUM_AMPS, SHUNT_MICRO_OHM); // Set to the expected Amp maximum and shunt resistance
while (INA.begin(MAXIMUM_AMPS, SHUNT_MICRO_OHM) == 0) {
Serial.println("No INA device found, retrying in 10 seconds...");
delay(10000); // Wait 10 seconds before retrying
} // while no devices detected
Serial.print(" - Detected ");
devicesFound = INA.begin(MAXIMUM_AMPS, SHUNT_MICRO_OHM); // Expected max Amp & shunt resistance
while (devicesFound == 0) {
Serial.println(F("No INA device found, retrying in 10 seconds..."));
delay(10000); // Wait 10 seconds before retrying
devicesFound = INA.begin(MAXIMUM_AMPS, SHUNT_MICRO_OHM); // Expected max Amp & shunt resistance
} // while no devices detected
Serial.print(F(" - Detected "));
Serial.print(devicesFound);
Serial.println(" INA devices on the I2C bus");
Serial.println(F(" INA devices on the I2C bus"));
INA.setBusConversion(8500); // Maximum conversion time 8.244ms
INA.setShuntConversion(8500); // Maximum conversion time 8.244ms
INA.setAveraging(128); // Average each reading n-times
Expand All @@ -134,8 +138,8 @@ void loop() {
static char sprintfBuffer[100]; // Buffer to format output
static char busChar[8], shuntChar[10], busMAChar[10], busMWChar[10]; // Output buffers

Serial.print("Nr Adr Type Bus Shunt Bus Bus\n");
Serial.print("== === ====== ======== =========== =========== ===========\n");
Serial.print(F("Nr Adr Type Bus Shunt Bus Bus\n"));
Serial.print(F("== === ====== ======== =========== =========== ===========\n"));
for (uint8_t i = 0; i < devicesFound; i++) // Loop through all devices
{
dtostrf(INA.getBusMilliVolts(i) / 1000.0, 7, 4, busChar); // Convert floating point to char
Expand All @@ -148,7 +152,7 @@ void loop() {
} // for-next each INA device loop
Serial.println();
delay(10000); // Wait 10 seconds before next reading
Serial.print("Loop iteration ");
Serial.print(F("Loop iteration "));
Serial.print(++loopCounter);
Serial.print("\n\n");
Serial.print(F("\n\n"));
} // method loop()
6 changes: 3 additions & 3 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=INA2xx
version=1.0.13
version=1.0.14
author=https://github.com/SV-Zanshin
maintainer=https://github.com/SV-Zanshin
sentence=Read current and voltage data from multiple INA2xx devices
paragraph=This library allows a number of INA2xx devices (mixed supported types) to be read and controlled simultaneously.
sentence=Read current, voltage and power data from one or more INA2xx device(s)
paragraph=This library allows a number of INA2xx devices (mixed types allowed) to be read and controlled simultaneously.
category=Sensors
url=https://github.com/SV-Zanshin/INA
architectures=*
Loading

0 comments on commit 1ba2bbd

Please sign in to comment.