Comments (5)
You are quite correct that I've been wasteful of space in the structure going to the EEPROM, I've been working on the 328 and bigger chips so haven't concentrated on optimizing the structure as I've had ample EEPROM space for the number of devices that I had experimented with (6 of them).
While some columns can be re-computed, I put those values in the common structure to save CPU-Cycles at runtime, but considering that the 16MHz CPU speed is significantly faster that the I2C or sensor speed this might have been overkill.
How far along is your code? If not far along, I can look into making and testing changes here and add them to the master branch.
from ina.
It went faster than expected. I implemented the full reduction to 40bits, in a slightly different way that on my original proposal.
I do not mind to do the testing myself. Have several 219s and 3221s, and I'm waiting for my 226s to arrive. The only downside is that I'm not sure how much time I'll have this week.
In any case, I'll clean up and push the branch tomorrow so you can have a look.
from ina.
I've made the modification of "deviceName" to the structure and code, you can pull that change so that you don't need to do it in your code.
from ina.
I've created a separate branch for the new code and will look at it in more Detail later.
I have somewhat mixed feelings about publicly available libraries for the Arduino, I think that their main purposes are:
- They must work
- They should be written so that non-programmers can understand them. This means both that "tricky" code sections are documented and that priority is given to readability over Efficiency
- They should be efficient in use of scarce resources (Memory and CPU-Cycles)
Some of your excellent optimizations address Point 3, but break Point 2 by using advanced functionality, so I'm still undecided as to how to proceed. By removing the device NAME from the structure it saves space in the structure and if the user doesn't call the "getDeviceName()" function then all of that string spaces is saved as well.
By using bit-Level sizing and 32-bit sized variables to avoid letting the Compiler pad at a Byte Level the EEPROM structure gets a lot smaller already. I might Change your code around a bit for simplicity (like removing the repeated instantiation and putting the code elsewhere.
from ina.
I agree with your comments about Point 2. In my day job I script/program in bash, Python and Fortran95.
My C++ usage strictly recreational. This is my first experience with bit fields, struct inheritance and struct constructors in C++, and I got carried away by how neat/concise the implementation turned out to be.
Maybe an entry on the project wiki can compensate some of the advanced functionality on the implementation?
In any case, just take what you want and discard the rest. I do not need to fit 12 devices on an ATmega168, 6 devices on ATmega328 a will do fine. In fact, I would like to use an STM32F103 (bluepill), but that is another issue/PR (#15/#16) .
from ina.
Related Issues (20)
- Allow an option for the library to not use EEPROM storage for INA-Structure information HOT 3
- INA3221 is supported, how to configure? HOT 7
- Settings for Shunt_Micro_Ohms and Max_Amps HOT 2
- {"One-Line descriptive question title"=>"INA233"} HOT 1
- INA228 Support HOT 50
- Hi Zanduino, Is it Possible to Integrate the INA237 ? Our requirement is to support 85V . HOT 4
- typo HOT 1
- Copy & paste error in Wiki HOT 4
- Max expected amps < 1A HOT 4
- Try to avoid EEPROM footprint HOT 1
- Use 0b111 instead of B111 HOT 5
- Power does not show negative values. HOT 4
- add support for INA239 HOT 1
- Wrong voltage reading with INA226
- Support for Atmega 4809
- Multiple devices does not work properly HOT 3
- Shunt voltage of 0.2mV when there's no load
- Shunt voltage calculation for INA260 uses wrong value
- Ina3221 alerts implementation
- INA233 Addition
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ina.