Skip to content

Commit

Permalink
Issue #62
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnd authored and Arnd committed Jul 12, 2020
1 parent 2353e4d commit 09bfe82
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/INA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ uint8_t INA_Class::begin(const uint16_t maxBusAmps, const uint32_t microOhmR,
** RAM available at runtime to allocate sufficient space for 32 devices. **
**********************************************************************************************/
#if defined(ESP32) || defined(ESP8266)
EEPROM.begin(512); // If ESP32 then allocate 512 Bytes
maxDevices = (_EEPROM_offset + 512) / sizeof(inaEE); // and compute number of devices
EEPROM.begin(512 + _EEPROM_offset); // If ESP32 then allocate 512 Bytes
maxDevices = (512) / sizeof(inaEE); // and compute number of devices
#elif defined(__STM32F1__) // Emulated EEPROM for STM32F1
maxDevices = (_EEPROM_offset + EEPROM.maxcount()) / sizeof(inaEE); // Compute max possible
maxDevices = (EEPROM.maxcount() - _EEPROM_offset) / sizeof(inaEE); // Compute max possible
#elif defined(CORE_TEENSY) // TEENSY doesn't have EEPROM.length
maxDevices = (_EEPROM_offset + 2048) / sizeof(inaEE); // defined, so use 2Kb as value
maxDevices = (2048 - _EEPROM_offset) / sizeof(inaEE); // defined, so use 2Kb as value
#elif defined(__AVR__)
maxDevices = (_EEPROM_offset + EEPROM.length()) / sizeof(inaEE); // Compute max possible
maxDevices = (EEPROM.length() - _EEPROM_offset) / sizeof(inaEE); // Compute max possible
#else
maxDevices = 32;
#endif
Expand Down
3 changes: 2 additions & 1 deletion src/INA.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
*
* Version | Date | Developer | Comments
* ------- | ---------- | ----------- | --------
* 1.0.12 | 2020-07-03 | SV-Zanshin | Issue #41. Added "_EEPROM_offset" variable
* 1.0.12 | 2020-07-13 | fg89o | Issue #62. Incorrect "_EEPROM_offset" computation
* 1.0.12 | 2020-07-13 | SV-Zanshin | Issue #41. Added "_EEPROM_offset" variable
* 1.0.12 | 2020-07-03 | sages | Issue #60. Possible Overflow getBus(MicroAmps,MicroWatts)
* 1.0.11 | 2020-06-30 | SV-Zanshin | Issue #58, changed formatting to use clang-format
* 1.0.11 | 2020-06-29 | SV-Zanshin | Issue #57. "Alert..." functions should be "alert..."
Expand Down

0 comments on commit 09bfe82

Please sign in to comment.