Skip to content

Commit 1ba2bbd

Browse files
author
Arnd
authored
Merge pull request #74 from SV-Zanshin/Development_v1.0.13
Development v1.0.14
2 parents 7d37218 + 1ae3892 commit 1ba2bbd

File tree

7 files changed

+199
-235
lines changed

7 files changed

+199
-235
lines changed

Doxyfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## ##
44
## Date Developer Comments ##
55
## ========== ============== ====================================================================== ##
6+
## 2020-07-12 SV-Zanshin Updated to version v1.0.14 ##
67
## 2020-07-12 SV-Zanshin Updated to version v1.0.13 ##
78
## 2020-06-30 SV-Zanshin Updated to version v1.0.12 ##
89
## 2020-06-06 SV-Zanshin Updated to version v1.0.11 ##
@@ -11,7 +12,7 @@
1112
######################################################################################################
1213
DOXYFILE_ENCODING = UTF-8
1314
PROJECT_NAME = INA2xx
14-
PROJECT_NUMBER = "Version 1.0.13"
15+
PROJECT_NUMBER = "Version 1.0.14"
1516
PROJECT_BRIEF = "Arduino Library for INA2xx power measurement devices"
1617
PROJECT_LOGO = images/horizontal_narrow_small.png
1718
OUTPUT_DIRECTORY =

examples/BackgroundRead/BackgroundRead.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
*
6464
* Version | Date | Developer | Comments
6565
* ------- | ---------- | ----------- | ------------------------------------------------------------
66+
* 1.0.5 | 2020-12-01 | SV-Zanshin | Corrected "alertOnConversion()" call
6667
* 1.0.4 | 2019-02-16 | SV-Zanshin | ifdef so that sketch won't compile on incompatible platforms
6768
* 1.0.3 | 2019-01-09 | SV-Zanshin | Cleaned up doxygen formatting
6869
* 1.0.2 | 2018-12-28 | SV-Zanshin | Converted comments to doxygen format
@@ -133,7 +134,7 @@ void setup() {
133134
#ifdef __AVR_ATmega32U4__ // If this is a 32U4 processor, wait 2 seconds for initialization
134135
delay(2000);
135136
#endif
136-
Serial.print(F("\n\nBackground INA Read V1.0.1\n"));
137+
Serial.print(F("\n\nBackground INA Read V1.0.5\n"));
137138
uint8_t devicesFound = 0;
138139
while (deviceNumber == UINT8_MAX) // Loop until we find the first device
139140
{
@@ -159,7 +160,7 @@ void setup() {
159160
INA.setBusConversion(8244, deviceNumber); // Maximum conversion time 8.244ms
160161
INA.setShuntConversion(8244, deviceNumber); // Maximum conversion time 8.244ms
161162
INA.setMode(INA_MODE_CONTINUOUS_BOTH, deviceNumber); // Bus/shunt measured continuously
162-
INA.AlertOnConversion(true, deviceNumber); // Make alert pin go low on finish
163+
INA.alertOnConversion(true, deviceNumber); // Make alert pin go low on finish
163164
} // of method setup()
164165

165166
void loop() {

examples/BackgroundRead_ESP32/BackgroundRead_ESP32.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
*
6565
* Version | Date | Developer | Comments
6666
* ------- | ---------- | ----------- | --------
67+
* 1.0.3 | 2020-12-02 | SV-Zanshin | Corrected call to "AlertOnConversion()"
6768
* 1.0.2 | 2020-06-30 | SV-Zanshin | Issue #58 - clang-formatted document
6869
* 1.0.1 | 2020-03-24 | SV-Zanshin | Issue #53 - Doxygen documentation
6970
* 1.0.0 | 2019-02-17 | SV-Zanshin | Cloned and adapted from "BackgroundRead.ino" program
@@ -143,7 +144,7 @@ void setup() {
143144
INA.setBusConversion(8244, deviceNumber); // Maximum conversion time 8.244ms
144145
INA.setShuntConversion(8244, deviceNumber); // Maximum conversion time 8.244ms
145146
INA.setMode(INA_MODE_CONTINUOUS_BOTH, deviceNumber); // Bus/shunt measured continuously
146-
INA.AlertOnConversion(true, deviceNumber); // Make alert pin go low on finish
147+
INA.alertOnConversion(true, deviceNumber); // Make alert pin go low on finish
147148
} // of method setup()
148149

149150
void loop() {

examples/DisplayReadings/DisplayReadings.ino

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
*
4949
* Version | Date | Developer | Comments
5050
* ------- | ---------- | ----------- | --------
51+
* 1.0.8 | 2020-12-01 | SV-Zanshin | Issue #72, allow dynamic memory allocation instead of EEPROM
5152
* 1.0.7 | 2020-06-30 | SV-Zanshin | Issue #58, changed formatting to use clang-format
5253
* 1.0.6 | 2020-06-29 | SV-Zanshin | Issue #57, changed case of functions "Alert..."
5354
* 1.0.5 | 2020-05-03 | SV-Zanshin | Moved setting of maxAmps and shunt to constants
@@ -78,11 +79,14 @@
7879
/**************************************************************************************************
7980
** Declare program constants, global variables and instantiate INA class **
8081
**************************************************************************************************/
81-
const uint32_t SERIAL_SPEED = 115200; ///< Use fast serial speed
82-
const uint32_t SHUNT_MICRO_OHM = 100000; ///< Shunt resistance in Micro-Ohm, e.g. 100000 is 0.1 Ohm
83-
const uint16_t MAXIMUM_AMPS = 1; ///< Max expected amps, values are 1 - clamped to max 1022
84-
uint8_t devicesFound = 0; ///< Number of INAs found
85-
INA_Class INA; ///< INA class instantiation
82+
const uint32_t SERIAL_SPEED{115200}; ///< Use fast serial speed
83+
const uint32_t SHUNT_MICRO_OHM{100000}; ///< Shunt resistance in Micro-Ohm, e.g. 100000 is 0.1 Ohm
84+
const uint16_t MAXIMUM_AMPS{1}; ///< Max expected amps, clamped from 1A to a max of 1022A
85+
uint8_t devicesFound{0}; ///< Number of INAs found
86+
INA_Class INA; ///< INA class instantiation to use EEPROM
87+
// INA_Class INA(0); ///< INA class instantiation to use EEPROM
88+
// INA_Class INA(5); ///< INA class instantiation to use dynamic memory rather
89+
// than EEPROM. Allocate storage for up to (n) devices
8690

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

137-
Serial.print("Nr Adr Type Bus Shunt Bus Bus\n");
138-
Serial.print("== === ====== ======== =========== =========== ===========\n");
141+
Serial.print(F("Nr Adr Type Bus Shunt Bus Bus\n"));
142+
Serial.print(F("== === ====== ======== =========== =========== ===========\n"));
139143
for (uint8_t i = 0; i < devicesFound; i++) // Loop through all devices
140144
{
141145
dtostrf(INA.getBusMilliVolts(i) / 1000.0, 7, 4, busChar); // Convert floating point to char
@@ -148,7 +152,7 @@ void loop() {
148152
} // for-next each INA device loop
149153
Serial.println();
150154
delay(10000); // Wait 10 seconds before next reading
151-
Serial.print("Loop iteration ");
155+
Serial.print(F("Loop iteration "));
152156
Serial.print(++loopCounter);
153-
Serial.print("\n\n");
157+
Serial.print(F("\n\n"));
154158
} // method loop()

library.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=INA2xx
2-
version=1.0.13
2+
version=1.0.14
33
author=https://github.com/SV-Zanshin
44
maintainer=https://github.com/SV-Zanshin
5-
sentence=Read current and voltage data from multiple INA2xx devices
6-
paragraph=This library allows a number of INA2xx devices (mixed supported types) to be read and controlled simultaneously.
5+
sentence=Read current, voltage and power data from one or more INA2xx device(s)
6+
paragraph=This library allows a number of INA2xx devices (mixed types allowed) to be read and controlled simultaneously.
77
category=Sensors
88
url=https://github.com/SV-Zanshin/INA
99
architectures=*

0 commit comments

Comments
 (0)