STAR Firmware by JonnyC - Source Code and Explanation

Both! It was mildly depressing.

I’ve seen both problems when demonstrating flashlights to various people so that’s no surprise. The one-button interface thing is a whole new world. There are some great aspects to FWD clickies, being a good introduction to multi-mode lights is not on the list IMO.

As far as the rest (the whole timing issue with half presses), I’m really curious how much better / worse a momentary firmware would be.

EDIT: to clarify, I meant to say… don’t let it get you down. As I mentioned above, it’s a whole new world for many people: it shouldn’t reflect one way or another on your parents and it doesn’t really say anything about the viability of a flashlight business for you either. Just let this experience advise you on how important it will be to gently introduce neophytes. Picking up a one-button-interface device like a FWD or reverse clicky flashlight and learning to use it is akin to getting on a bicycle for the first time. It’s a desirable product but you do have to learn how to use it! I haven’t spent a lot of time on it, but I really haven’t seen a simple way to quickly get someone who’s totally unfamiliar with the concept up to speed.

That’s what I’m here for. :stuck_out_tongue_winking_eye:

Especially with Zebralights. Nice UI, but genuinely too complicated for a lot of people. I can’t hand a Zebralight to a muggle and expect them not to fail… they’ll generally click the button, turn it on in turbo, hurt their eyes (or someone else’s), click it again in an attempt to shut it off (taking it down to medium), then rapidly click until it starts blinking… and then hand it back to me with a negative comment like “that thing is booby-trapped!”.

Alternately, they might wait just long enough after the initial blast before they start fast-clicking, which makes it toggle between turbo and high.

So, probably a good idea to at least try to make UIs somewhat muggle-friendly… i.e. don’t do anything particularly surprising on single-press-from-off.

I stay with the convention that a WORD is always unsigned 16 bits, DWORD unsigned 32 bits, BYTE unsigned 8 bits. Most C/C++ compilers don't natively support WORD and DWORD, so I usually assign them in a common header. I've worked several times with binary data import/export or comm/dual port interfaces between processors, and it can be a nightmare if you don't have a rigorous set of standard formats. Mixing big Endian (Motorola, etc.) and little Endian (Intel, etc.) is even worse with byte ordering all messed up. In theory the WORD does depend on the processor. The int I make no assumptions on it's size, but guaranteed it's always signed. Some processors it gets debatable what it's WORD size really is. Some do BYTE addressing but have 16 bit registers, or have a mix of 16 bit and 32 bit registers, etc. Usually it's based on memory access or the accumulator size, but that can get complicated too, with different modes.

I've been working on micros as far back as the Intel 8080, Motorola 6800 back when CP/M was the latest. I bought the original IBM PC for $3,500 back in '81 or so, just to play/learn - did a few mod/upgrades on it of course Wink. Actually I still support products using the 68331, which is a variant of the 68000, and also still support 8051 variants.

Yea, thanks for the encouragement wight. I think with a proper 30 second instructional video demonstration it will be easy for the average person. I’ll incorporate it into my product video.

I think they'll stick around for a while, but you may not be able to get them from FT anymore (who seems to get them from Convoy).

Kind of OT: Any thoughts on running an XM-L2 via Qlite from 3x nimh? I haven’t done extensive testing yet but I’m wondering if it’s just not going to be enough voltage. I may end up going strictly 2x 26650 (1s2p) for my mag upgrade kit.

OL has commented on it a couple of times I think. Sounds like 3xNiMH just isn’t enough. 4x is good though, so if you don’t mind doing a quick boring operation to each host…

I haven’t tried it, but I’ve been meaning to. I expect to find that OL is exactly right, so I’m not sure what I’ll do then. Use old XM-L emitters maybe? Or for mag builds the 3xNiMH, XHP50, and a DQG 26650 boost driver might be OK.

Just to be sure, the download link in the OP has the most recent versions, correct?

Yes, it now links directly to the repository.

I’m struggling with how to properly set the dual-pwm output.

Is there a post that details how to set it up? I can’t find it…….

I would want to use the dual pwm for a FET + 7135 driver. Ideally I would want the moonlight and low (maybe also medium?) to use the 7135.

The the STAR firmware I am seeing the dual pwm based on the pwm rate, but how would I turn on the 7135 with no pwm, while keeping the FET off still?

Without making changes to the code, with the clicky version you can't turn the 7135 on to 100% (which is what would be needed for no PWM) and leave the secondary FET output off. With the momentary version it is easy to do that.

What confuses me is that you're talking about two completely different things. At first you're talking about moonlight and low (maybe also medium), then in the next sentence you're talking about turning on the 7135 with no PWM while keeping the FET off.

For the clicky you just set your modes, as normal, then set the threshold PWM level to where you want the secondary output to turn on.

Well I know the moonlight/low would be using pwm, but it would be nice to set the 7135 to on with no pwm as medium.

Gotcha. Well, you could make it happen, but you're going to have to poke around with the code a little bit.

Is there a reason why STAR could not be modified to use the momentary style of modes?

Why are they different?

I’m pretty sure that, yes, STAR could be modified to support that. It probably just hasn’t been yet.

I got a Moonlight Special recently and am planning to make a fairly generic off-time clicky firmware for it. Not sure what the exact feature set will be, but it should at least allow independent control of the 1x7135 vs the FET or Nx7135 pins, and should have both a battery check mode and the ability to do short/med/long presses to do three different actions.

I just have to put a test host together first and make some time to write the code. (fortunately, Monday is a holiday so it might happen very soon)

I’ll be interested to see what you come up with

I wrote a momentary FW based upon STAR momentary with the following mode selection UI.

From OFF:

  • Short press turns ON to last mode.
  • Long press turns ON to moonlight.
  • Double press turns ON to turbo.

From ON:

  • Short press turns OFF.
  • Long press cycles to next mode.
  • Double press cycles to previous mode.

I am trying to replicate the OLight S20 Baton but without flash modes. Any feedback would be welcome.

EDIT: link to code here

Please post your code somewhere and put a link here.

Code can be found here: