Giter Club home page Giter Club logo

Comments (5)

SV-Zanshin avatar SV-Zanshin commented on May 28, 2024

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.

avaldebe avatar avaldebe commented on May 28, 2024

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.

SV-Zanshin avatar SV-Zanshin commented on May 28, 2024

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.

SV-Zanshin avatar SV-Zanshin commented on May 28, 2024

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:

  1. They must work
  2. 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
  3. 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.

avaldebe avatar avaldebe commented on May 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.