Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor for more flexibility #10

Open
ss89 opened this issue Oct 16, 2022 · 3 comments
Open

Refactor for more flexibility #10

ss89 opened this issue Oct 16, 2022 · 3 comments
Labels
discussion discuss some things

Comments

@ss89
Copy link
Contributor

ss89 commented Oct 16, 2022

Currently for each new meter we want to add, we do need to add a lot of code.

This should be more flexible in my opinion, as in the easiest case i should only have to raise the number of meters and recompile my firmware (maybe not even that?). Depending on the setup of the pins, we'd have to predefine all possible meter to pin configurations.

If we ignore the most flexible way, then i could think of some pre-compiler stuff and we'd be good.

Maybe there is an even smarter way, that doesn't even need pre-compiler magic?

@Eisbaeeer
Copy link
Owner

The framework allow flexible pin definitions. Perhaps we can define the pin definitions by dropdown selection. The project starts with one meter. The additional meters where requested by users. Actually there was no user with more the 4 requested. I don´t know if there is a user with >4 ?

@Eisbaeeer Eisbaeeer added the discussion discuss some things label Oct 17, 2022
@ss89
Copy link
Contributor Author

ss89 commented Oct 17, 2022

I've seen the history of the project (at least from the iobroker forum entries) and i saw that someone requested 7 meters (which i think should be possible?) here: https://forum.iobroker.net/topic/35404/ferraris-z%C3%A4hler-mit-tcrt5000-und-esp8266/17?_=1666024770196&lang=de
If i see the wiring correctly, then i only need to connect all modules to the same ground and have the digital pin go to an individual pin on the board. For the wemos d1 mini that'd be 9 digital pins => 9 potential meters i could read.
Am i wrong?

I guess a dropdown allows the configuration to be as flexible for the user as possible, i don't know if there is any input validation on the web stuff though. Yet another construction site that i haven't digged into too much 🙈

@EtlamGit
Copy link
Collaborator

I started with refactoring, progress can be followed here:
https://github.com/EtlamGit/Ferraris_MQTT_Energy_Counter_Meter_TCRT5000/tree/refactoring-2023

  1. move code into multiple files
  2. en-capsule a single Ferraris meter into own class
  3. -> enable easy change of number of Ferraris meters

Selection will be at compile time as IOT Framework does not allow dynamic web pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion discuss some things
Projects
None yet
Development

No branches or pull requests

3 participants