STAR Firmware by JonnyC - Source Code and Explanation

Now that sounds like a really nice firmware.

Well I did have my 12A Nanjg 32*7135 SRK driver running on the momentary, but I think I might have smoked it (shorted the + lead on the emitter base…smelled the smoke)

I like the momentary short press goes from L~~H, long button press (.5s or longer) it steps back or from off goes H~~>L

I did a custom compile of 5 levels (moonlight, then regular settings [0,5,16,32,125,255] stock 90 second turbo timeout)

Sharing here
https://www.dropbox.com/sh/7722v3uy5qxiuu5/q6tkiEGgNb

Hey guys,

Not really tested yet, but I have a version for the firmware out there that utilizes off-time memory with a 1uF capacitor (Digi-Key 587-1241-1-ND) connected to star 4, as previously discussed (does an ADC calculation at start up). There are probably bugs, but I wanted to get it out there for anyone that wants to play around with it. It really is tedious going through and testing every scenario (star combinations, mode count, etc), but I'll get around to it at some point. Once my dedome is done I'll be testing it in a HD2010 to work out the bugs and to see how reliable the mode switching is.

http://www.jcapsolutions.com/wp-content/uploads/2014/03/STAR_off_time_1.0.c

Here's a list of the other firmwares that I will try to keep updated. Don't mind the site, a work in progress :)

http://www.jcapsolutions.com/flashlights/firmware/

Excited for the off-time driver! I had bought some 1uF caps in anticipation.

INCREDIBLE!!!

Thanks again!

Off_time mod, means that it will “keep alive” long enough to memorize last known setting correct?

The capacitor is used on start up to determine if the light has been off for more than 1 second or so (still need to measure the timing and possibly tweak it), and if it was, it won't switch modes. So the only way to switch modes is to turn off and back on within that second.

This is how my first real budget light operated (Solarforce dropin), and it took a while to get used to the 105C style of switching, which is not very intuitive for non-flashaholics.

Awaiting for your final code. It is much easier to add one component instead of three.

Hi,

great work here!
Here is an Off Time Memory Firmware I found a while ago from a german guy (credit goes to LegolasGT!): Nanjg 105c.c
It always starts in low Mode with the following modes: 0.5–5–40–100
You need to solder a 200k resistor and a 10µF capacitor in parallel between stars 2 and 3 for off-time measurement.
Maybe it is a little inspiration or helps with the off-time memory feature, as the stupid on-time memory really sucks on the otherwise awesome 105c.

Thanks to all the coders for their effort!

WOW! Excellent…thanks!

My poor attempt at translation
https://www.dropbox.com/sh/v31xqxmiwoe6okc/cicq7Rchkw

Wow…compiled fine…even in German…guess light doesn’t care what language it is haha

Anyone want levels comparable to JohnnyC’s build?
14, 39, 120, 255
5.49, 15.3, 47, 100

Very cool. In theory you should also be able to mount this on the backside of the board between Pin 2 and the ground ring if you want to keep the spring side "naked", ala "ComfyNakedFET" style.

Updated OP with new link.

Nice! Thanks

Accurate withing ±10-15 seconds…the thing is, it steps down EVERY time…
Not like you are setting your watch on the TURBO timeout stepdown :smiley:

Welcome to the forum! :beer: :beer:

Sorry guys, finally got a light together and am testing the off-time program now. The off-time mode switching works rather well. I'm not sure how consistent it is. I set a ADC voltage threshold value of 100 out of 255 (so about .43v) but I don't know exactly what that equates to in off-time. I was trying to unscientifically do a short press on a reverse clicky with the same intervals just over 1 second or so to see if it never switched modes, but it did a few times. Up that to two seconds between presses and it never switches. I might bump that threshold value down to 70 or so. This is using a 1uF cap btw.

I just tried turbo (which I set to 2 minutes) and my High and Turbo aren't spaced out enough for me to really determine when it steps down. I think it stepped down around 2:30 though (I'm seeing spots for staring at the damn ceiling waiting for it to step down), which would be way way off. I need to change the code too because no longer will a short press bring it back to turbo, it moves to low. Easy change though.

Anyways, I'll be doing some debugging tonight and in the process test the 4 possible star combinations as well.

Cool! Was planning on trying it out last night but ran out of time.

Here's a pic of the driver with the SMD cap, and you can see part of my ghetto test setup behind it.

I'm digging the test setup! At least your switch is mounted...mine just floats there. One of my next goals is to build a dedicated driver test board with integrated volt and amp meters, switches, MT-G2 and XM-L2 LEDs, and easy connections. Getting sick of digging everything out and soldering together connections with every driver I build.

That would be amazing!

I'm an idiot. I have to raise the ADC value to decrease the time, so I went to 130 and it's now down to about a half of a second which is prefect for me. I tried 70 and it actually seems to require a good 10 seconds before turning it back on otherwise it will go to the next mode ! I'm using a completely different cap now compared to when I did my original testing with my ocsilloscope, so I'll have to hook that thing up and get some readings because it's surely different.

Now time to toss it in the freezer and see if the timing changes much...

Still the 1uF?