Reuse Zombieverters Pins

Post Reply
peakPWR
Posts: 8
Joined: Tue Dec 17, 2024 6:49 am
Has thanked: 2 times
Been thanked: 1 time

Reuse Zombieverters Pins

Post by peakPWR »

Hello,
I read about zombieverters IO pins (https://openinverter.org/wiki/ZombieVerter_IO) and some of those are for specific hardware configs (like GS450H, ...).
Suppose I use a Nissan Leaf Stack, those special pins are not needed right?
How can these pins be used as described in the wiki (i.e. for PWM or GPIO)? Do I need to implement their function in the firmware it self or is there an option in the web GUI?
selectable input/output pins that can be used for a number of functions.
If I would like to implement a custom function like triggering a GPIO output when a certain state is active where would I start?

If think this could be done in the firmware itself. I already read through the source code but want to be sure what is the best way to do that before I start to modify the firmware.

I found the tim3_setup() function in hwinit.c which seems promising. The settings from set parameters get checked and according to the desired function the timer get initialized. Can i add own params the same way?

How can "modules" be coded so the new functions get reusable? My thought was to fork damiens repo and add my C code in separate files (and add it to the makefile of course). Is that the preferred way? If yes which files can be changed without interfering with future updates directly ( i know the changes need to be reviewed one by one)..


Thank you for the clarification :)
User avatar
tom91
Posts: 2074
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 177 times
Been thanked: 460 times

Re: Reuse Zombieverters Pins

Post by tom91 »

There is alot of programming involved to get new pin functions in the drop downs. Then the matter of getting new functions to actually do something.

There is not alot of dedicated inputs/outputs left that are not reasignable.

What functions are you looking for?
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
User avatar
jetpax
Posts: 44
Joined: Wed Jan 01, 2020 12:33 am
Has thanked: 13 times
Been thanked: 20 times
Contact:

Re: Reuse Zombieverters Pins

Post by jetpax »

Thats a very good question @peakPWR that I was also struggling with.

Its one of the reasons I built HeadlessZombie the idea being to run a scripting language on the ESP32 (cf OVMS) that can respond to state changes over CAN from OI and send new state requests back to OI as needed.

That way, OI remains largely unchanged, (scripts can be loaded from SDcard for example).

OVMS uses a javascript engine (Duktape), but I rather like the look of Berryscript as used by Tasmota which is more pythonesque, would be interested in what others preference would be?

That only solves the last part of your question, but for the first part I was looking at updating eg digio.c anyway so that it could use SPI or LINbus connected IO and surfacing that in the UI

Anyone else done/doing any work on that? Any thoughts?
“Take the best that exists and make it better”
peakPWR
Posts: 8
Joined: Tue Dec 17, 2024 6:49 am
Has thanked: 2 times
Been thanked: 1 time

Re: Reuse Zombieverters Pins

Post by peakPWR »

tom91 wrote: Tue Jan 14, 2025 9:58 am There is alot of programming involved to get new pin functions in the drop downs. Then the matter of getting new functions to actually do something.

There is not alot of dedicated inputs/outputs left that are not reasignable.

What functions are you looking for?
I was thinking about basic I/O operations like turning on a relay / position stepper motor when a certain condition (more complex than a temperature limit) is met.

Like controlling the stepper motor of the leafs parking brake when the gear switch is turned from park to drive.

I can't find that function implemented and wanted to see where this could be done. C programming is not a problem for me but I don't want to start at the wrong place in the code. So I'm interested in the coding philosophy to put it in other words :)

jetpax wrote: Wed Jan 15, 2025 2:16 pm Thats a very good question @peakPWR that I was also struggling with.

Its one of the reasons I built HeadlessZombie the idea being to run a scripting language on the ESP32 (cf OVMS) that can respond to state changes over CAN from OI and send new state requests back to OI as needed.

That way, OI remains largely unchanged, (scripts can be loaded from SDcard for example).

OVMS uses a javascript engine (Duktape), but I rather like the look of Berryscript as used by Tasmota which is more pythonesque, would be interested in what others preference would be?

That only solves the last part of your question, but for the first part I was looking at updating eg digio.c anyway so that it could use SPI or LINbus connected IO and surfacing that in the UI

Anyone else done/doing any work on that? Any thoughts?
I quietly read your post. Very interesting idea!
I like the idea of modules and especially the abstraction idea. Would be interested in discussing/ thinking about some implementations of that idea. Would make the zombieverter fw more accessible for many people.
But currently I need to understand the basic concept first that's why I asked that question. But maybe I can help with you idea once I got an overview of the current situation.
User avatar
tom91
Posts: 2074
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 177 times
Been thanked: 460 times

Re: Reuse Zombieverters Pins

Post by tom91 »

peakPWR wrote: Sun Jan 19, 2025 12:17 am o I'm interested in the coding philosophy to put it in other words
Layer and layers of code. It is not structured well at the moment, this is being worked on. This happens when things are layered upon each other without defining what needs to be achieved.
The leaf "stepper" motor, is an SR motor and needs a dedicated driver and such. Currently the Zombie code does not have any code structure to deal with any kind of parking brake.
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
peakPWR
Posts: 8
Joined: Tue Dec 17, 2024 6:49 am
Has thanked: 2 times
Been thanked: 1 time

Re: Reuse Zombieverters Pins

Post by peakPWR »

tom91 wrote: Sun Jan 19, 2025 3:30 am Layer and layers of code. It is not structured well at the moment, this is being worked on. This happens when things are layered upon each other without defining what needs to be achieved.
The leaf "stepper" motor, is an SR motor and needs a dedicated driver and such. Currently the Zombie code does not have any code structure to deal with any kind of parking brake.
Ok i see and also read about that before.
Any chance I can support on that clean up?

And also the modularization ideas from the headlesszombie could be incorporated.
I think an extensive discussion about the needs and todos would enable us to share the work load. Or am I missing something?
I know about the Leafs parking brake controller requirements and an external driver hardware driver is needed. But this driver (which mostly is controlled like a stepper driver) can be controlled from 3 gpio pins. And that control is what I was asking about. How would one implement the basic control of 3 output pins in a certain order? (The c logic is very easy for that even when I was thinking about a "motor homing" control, but the location jn the code is not obvious to me)

If you can pick me up where the current structural problems are i could help in cleaning up?
User avatar
tom91
Posts: 2074
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 177 times
Been thanked: 460 times

Re: Reuse Zombieverters Pins

Post by tom91 »

The software is what is it is at the moment, needs someone with understanding of most of the logic to start unpick it one function group at a time. This is the work I am doing.

Programming IO is "easy", however programming it in a a way that it retains the right level of flexibility is the challenge. Feel free to look at the code and make forks with your own changes and proposals.
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
peakPWR
Posts: 8
Joined: Tue Dec 17, 2024 6:49 am
Has thanked: 2 times
Been thanked: 1 time

Re: Reuse Zombieverters Pins

Post by peakPWR »

Ok I am currently doing that. Will PR if something useable is there :)
Where is your dev branch? Or where can I look into current efforts of cleaning up? Maybe I can get a better idea that way?

You are totally right IO is easy but the right way especially in such a project isn't that easy that's why I thought asking first is the best way to go :)
Thank you for your help and motivation on that project :)

One question: Is the need for a cleanup a "problem" for zombieverter fw only or is it something the general OI struggles as well?
User avatar
tom91
Posts: 2074
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 177 times
Been thanked: 460 times

Re: Reuse Zombieverters Pins

Post by tom91 »

peakPWR wrote: Sun Jan 19, 2025 2:57 pm Or where can I look into current efforts of cleaning up?
The main github branch, I make small changes and push them into the main branch once tested.
peakPWR wrote: Sun Jan 19, 2025 2:57 pm general OI struggles
The code is written and modified loads, most is approached with a "if it works do not change it" so you find "old" code mixed in with new and parameter/variable naming is the same thus it becomes quite a chore to work out how certain functions work within the code.

also due to the large level of complexity in both ZombieVerter or other OI code bases you get multi layered and interlinked code that makes following logic path and calculations quite tedious.
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
Post Reply