STAR Firmware by JonnyC - Source Code and Explanation

Yep, that's 'after' version. (this is on the off-time v1.2, BTW)

#ifdef MODE_MOON
    if ((PINB & (1 << STAR2_PIN)) == 1) {
        modes[mode_cnt++] = MODE_MOON;

used to be

#ifdef MODE_MOON
    if ((PINB & (1 << STAR2_PIN)) == 0) {
        modes[mode_cnt++] = MODE_MOON;

and

 if ((PINB & (1 << STAR3_PIN)) == 0) {
        // High to Low
        mode_dir = 1;
    } else {
        mode_dir = -1;

used to be

  if ((PINB & (1 << STAR3_PIN)) == 0) {
     // High to Low
      mode_dir = -1;
  } else {
        mode_dir = 1;

On these drivers where you have to remove 'em to get at the stars it's easier to just flash it while you're in there.

Not pretty, but it works and doesn't block the clip.

Ah cool nice!

WarHawk and I ran into this before, it can't be...

if ((PINB & (1 << STAR2_PIN)) == 1) {

It has to be...

if ((PINB & (1 << STAR2_PIN)) > 0) {

Cool, thanks. So my kludge enabled moonlight with the pin open, but wouldn't DISable it with the pin grounded?

Hey guys, I added a ghetto strobe to the STAR momentary FW. I don't know what I'm doing, but by some miracle it does work. I decided not to go with a double tap system, instead preferring a press and hold system.

Here's how it works: from off if you hold the button down for about 1 second it will strobe while the button is held down then return off when the button is released. From any mode besides the lowest mode you can enter strobe by holding down the button, the light will then return to the mode you were in when you let go.

You can change the STROBE_DUR value to change how long of a press it takes for the strobe to start, but it has to be longer than the LONG_PRESS_DUR or else you won't be able to cycle backwards.

MOMMOD1.0.c

I've also got a regular clicky STAR FW modified with different mode groups selectable via star. I need to clean up and comment the code then I will upload and share.

Regular clicky STAR with strobe added

STARSTROBE1.0.c

Correct. Since you are doing the programming yourself anyways, I would just ditch the whole star soldering thing and program it the way you want, unless you want to be able to change it up later without having to program it again.

Well, for my own lights, once it's set for moonlight & H-to-L order I don't need to add any jumpers, they all would end up that way anyhow. Anything that might go to other folks who can't do their own flashing, it's nice to keep the options there, just in case.

And you're right about the off-time version, I'm going to have to go through all my lights now and convert them!

Quote from the OSHPark thread but since this is more a software question than hardware I figured I’d put it here.

My digikey order came today so I’ve got mine together (will be replacing the driver in my fenix E12), question about the programming- since the theoretical max is 4.2A if I was shooting for ~2A on high what setting should I start with? I’m thinkin ~120 and adjust from there. What setting are you using for 3.12A (or do to have it set full on and 3.12 is what the battery can do)?

I added strobe mode to my custom version of JC's STAR momentary driver, link to source code here:

Google doc - eswitch.c

Basically what I did was added an extra long hold feature to access strobe. I use more aggressive delays, so mode switching stays very responsive, and my priority (as previous versions) is for one click OFF.

- quick click for + mode (std)

- long click/hold of 1/3 sec for - mode (std)

- one click to turn the light OFF, after 1.2 sec in any mode (custom)

- extra long click/hold of 3/4 sec for strobe mode (any click will return you to original mode) (custom)

So for example:

  • the light is OFF - hold for 3/4 sec - strobe, click or hold turns the light OFF
  • the light is in Hi mode - hold for 3/4 sec - strobe, click to go back to Hi
  • the light is in moonlight mode - hold for 3/4 sec - strobe, click to go back to moonlight

For entering strobe, the long duration next mode will briefly engage (between the 1/3 to 3/4 sec times) but I don't find it much of a distraction, as long as it returns to the original mode you were in.

Tom E., I'll have to try your strobe file and see if I like it better than the one I made and linked to above (last Wednesday)

Ok guys need some help, I attempted to mod STAR1.1 to have 5 normal modes and I’m having a problem with the turbo step-down. Take a look at this quick video (for testing purposes the turbo timer is 10sec).

at the 10sec mark it steps down but then ~.5sec later it steps to off.

Edit found it, I was missing the “#endif” after the turbo step down section, I deleted the code so I dont take up the whole page (feel free to PM me for it). I worked on this issue for [literally] hours and didnt want to bother Richard anymore.

I guess I should build one and see just what all the hub bub is about :stuck_out_tongue:

If you’re referring to the off-time memory: It’s the single best thing ever, the one and only thing the nanjg drivers were truly missing.
Right now I’m in the process of converting almost each and every nanjg/qlite I have to off time, it’s like christmas and thanksgiving at once…
Well, about that kind of hub bub… :smiley:

How does the fast PWM work with the baby FET?

I would like to thank all that were involved with the Star firmware. Off time memory is, in my opinion the best thing that has happened to the 105c. I will never go back.

It also works well for the AK-47.

I just received the capacitors today and have already converted my Convoy C8 and M2. Others are lined up on the bench just awaiting their turn.

Nice! I'm so glad some other smart people realized how to accomplish the off-time by only adding one tiny component :)

It is so simple and obvious, once I read the code! :wink:

I never would have thought of it on my own. I was thinking R-C circuits to keep the controller running long enough to determine short press or not. :stuck_out_tongue:

I like your version very much and I use it now, but is there any way I can turn ON the light with a single short click?
Now when the light is off I can only use long press for entering directly to high, or double click to enter in low… but the single short click does noting.

For me the perfect version would be short click for turning ON/OFF and long click for next mode, with memory and strobe… but I can’t make it :slight_smile:

Weird - one short click should go to the lowest mode. What's the value you are using for the lowest? If you are using 7135's, the lowest mode should be a value of 5, not 1. With a FET, you should be able to use a pwm value of 1. Actually my last BLF17DD build I used 1 as moonlight, and 1 is really, really low - the LED basically barely glows...

Quick single clicks should go to the next, and next mode upward (brighter).