Programming the Nanjg 105 driver. Firmware help needed.

Gentlemen,
I’ve a little project that’s been going on rather a long time, but only recently has time been available to get back to it. It’s simply to ‘make’ my perfect nangj 105 driver and UI. When i say make, i mean reflash the attiny13 and do some small mods on the board. What i’m trying to figure is how to pull a I/O pin high in a certain mode to switch on more amc7135’s. No PWM needed, just to have a pin that goes high in ‘turbo’ mode but stay low in all other modes. I’m using Tidos program, Dr Jones seems easier to understand with my limited experience in C ,but doesnt have the RC pinswitch atm that i like so much…

Having another offset in the mode function array in Tidos code is what i was thinking of doing, with a function that is called to turn say, pin3 high as long as necessary as well as setting PWM on pin6 to 255. Any one know if this is the way to go about it?

I’ve a feeling this has been done before but i dont know where to look.

Any advice, abuse, criticism, code snippets, greatfully received thanks

I already discussed something like that with Tido and I think he was trying out something like it…

There it is: luxdrv - custom modes driver firmware with ramping

I had this idea once, but after calculations of the outcome I decided that it was not worth the effort. Look at the numbers below and decide for yourself. I calculated output(varm), avg.current, runtime on 18650(2600) for a 4 level light in L2 form factor with 10lm-40lm-160lm-640lm (runtimes heavily dependent on actual battery):

XM-L T6 with normal driver 105C, 8x7135:
PWM 1.35%, 10 lm, 38 mA, 64 hr
PWM 5.5%, 40 lm, 154 mA, 14 hr
PWM 22.5%, 160 lm, 630 mA, 3.2 hr
PWM 100%, 640 lm, 2.8 A, 0.3 hr

XM-L T6 with 2x7135 plus 6x7135 in 100% mode:
PWM 4.2%, 10 lm, 29 mA, 83 hr
PWM 16.5%, 40 lm, 116 mA, 19 hr
PWM 68%, 160 lm, 476 mA, 4.2 hr
PWM 100%, 640 lm, 2.8 A, 0.3 hr

Are the short runtimes due to the inefficiency of the linear driver?

No, the drivers efficiency is fine.
The inefficiency is in the battery. If you draw a steady 2.8A you will reach 1000 mAh for only a few of the best brands of battery (based on HKJ’s battery tests). For a fair battery you will get 700-800 mAh when the voltage drops to 3.6V where the light will drop dependent of the Vf of the LED. You will need Vf plus a little (0.5V) for the driver.

Ah, gotcha. So the problem is not inherent to the code, the 105C driver, or any linear/buck driver, right?

I hope the 4.35V cells can provide a longer runtime…

Yes that is mainly why i want to do this, i will be using panasonic 3400mah in my small light running at 1amp most of the time. They have fantastic capacity but cannot maintain a high enough voltage at all times. In my understanding voltage sag occurs to the same extent in all modes. Simple E=IR math.

I have just tried commenting out the strobe program part and replacing with simple bit manipulation to turn a pin high. It works! So now when strobe is selected light would go into turbo mode. Not ideal as i cannot use strobe which i have a use for.
I would still like to add a mode offset function, just need to figure out how to do it without getting a shed load of errors!

EDIT: yes that’s the thread i was trying to find thank you.