Xpg3 2d, vs 219c high cri for triple or quad optic

I’m no TK, but I have enjoyed modding Bistro. If you could put together a first swag on how you’d like the adjustments to go, I’ll give it a shot. Say 75% PWM above 4 volts, 80% above 3.8 volts, etc.

It will be tough to get something to work perfectly with all setups, but a generic logarithm would be a good start. It might take some experimenting as well.

Two setup I would be interested in would be based around the 219c high cri. A single and a triple setup. They will be different because of max amps desired and battery sag.

If you can write some code to implement this idea I can test it. It would be great if the code included some variables that could easily be changed while testing.

One of the biggest factors is code space. We are very limited in available code. Flinkrock is working on some mods as well, you might talk to him so it can all be tied together.

As far as how to do it, I was thinking either some form of table like the voltage table we use now that has a multiplier for each voltage (or possibly adding it to the existing table). The issue here is space, I think it will take up far too much of it unless it can somehow be combined with the existing table. It would also be a lot harder to calibrate, although the results could be better.

All of these should be easily adjusted in the defines.

So the simpler and smaller option is a simple multiplier with options in the Defines to make adjustment on a per light basis easier.

Something like “starting voltage” which is the base voltage point that nothing is added or removed.

Then a “multiplier ratio” that will add or subtract X percent PWM per .1V of voltage change.

There should also be a place to define which channels are effected by this multiplier. The 7135’s should not be effected by it for example but in another driver that I have in the works at least 2 channels will need this.

So for example in the case of the 219C it might (just guessing here) have the base voltage set to 3.9V, which is the voltage where I want it to give 100% duty on the FET as that will be the correct max current level, this will obviously take some trial and error which is why I would like for it to be a simple to adjust define.

The multiplier might then be 10% for easy numbers. So when the voltage is 4.2V it is subtracting 30% of the duty and thus keeps the total current far more consistent (obviously not perfect but I am not worried about perfection, just good enough).

For the mid range modes the same thing applies. For example a mode of 128 pwm would also be biased by the same 30% when the voltage is at 4.2V, thus netting you a final PWM of 90 to hopefully keep the current fairly consistent. In the lower modes it also has the benefit of raising the PWM as voltage drops. So for example at 3.6V it would add 30% to the duty.

It could be useful to add a further bias for voltage that causes the multiplier to change more the larger the “voltage gap” between your set point and the actual voltage. Although we would not know if it is needed or not till we were able to test how well it maintains the current without it. It is possible that as the voltage falls for example it may take exponentially more PWM to maintain the current, the same for when the voltage is fully charged. If you see an easy way to implement this feel free but if it is not easy I would not worry with it till we see if we need it. It will also take up a bit more space.

Lukily all of this is pretty basic math and so it should not be that hard to code or get working I would think, basically grab the final PWM output just before it leaves the MCU and run it through a formula before sending it out.