Zanduino / INA

Combined Arduino library for reading multiple INA2xx power monitor devices
GNU General Public License v3.0
158 stars 41 forks source link

Multiple devices does not work properly #92

Open johntaves opened 2 years ago

johntaves commented 2 years ago

At 332: readInafromEEPROM(deviceNumber); // Load EEPROM to ina structure ina.maxBusAmps = maxBusAmps > 1022 ? 1022 : maxBusAmps; // Clamp to maximum of 1022A ina.microOhmR = microOhmR; initDevice(deviceNumber); --------------- Should be: readInafromEEPROM(deviceNumber); // Load EEPROM to ina structure inaEE.maxBusAmps = maxBusAmps > 1022 ? 1022 : maxBusAmps; // Clamp to maximum of 1022A inaEE.microOhmR = microOhmR; ina = inaEE; // to execute inaDet with the new values. initDevice(deviceNumber);


This makes no sense _DeviceCount = ((_DeviceCount + 1) % maxDevices); // start again at 0 if overflow

maxDevices should match _expectedDevices when nonzero and of course, _DeviceCount should not overflow back to 0.

if _expectedDevices is nonzero then do not call EEPROM.begin

PRosenb commented 2 years ago

I had this issue as well with using three different shunt resistors and maxBusAmps. @SV-Zanshin, is there a plan when that fix can be released? Shall we create a pull request?

SV-Zanshin commented 2 years ago

I’m travelling for the next week (sailing a regatta from Newport to Bermuda), and will then return home and work on the open issues.

From: Pete @.> Sent: Monday, June 13, 2022 08:23 To: Zanduino/INA @.> Cc: Arnd @.>; Mention @.> Subject: Re: [Zanduino/INA] Multiple devices does not work properly (Issue #92)

I had this issue as well with using three different shunt resistors and maxBusAmps. @SV-Zanshin https://github.com/SV-Zanshin , is there a plan when that fix can be released? Shall we create a pull request?

— Reply to this email directly, view it on GitHub https://github.com/Zanduino/INA/issues/92#issuecomment-1153848161 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AFT5DRDDOIDH77FZPJID3LDVO4RZ5ANCNFSM5WXJBWTQ . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AFT5DRBKDLAZGMA2OKOELH3VO4RZ5A5CNFSM5WXJBWT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOITDFGYI.gif Message ID: @. @.> >

-- This email has been checked for viruses by AVG. https://www.avg.com

PRosenb commented 2 years ago

Many thanks for replying @SV-Zanshin , enjoy your trip.