STAR Firmware by JonnyC - Source Code and Explanation

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:

Thanks for posting. I will take a look at this soon!

In the meantime I see that your UI description is very similar to what akv was asking for over in this thread: akv - looking for a good value flashlight so I am going to post a link over there. This sounds very good for akv.

You might be interested in Baton.c / Baton.hex in my code repo, under ToyKeeper/Ferrero_Rocher/ . The link is below, in my signature.

It implements the Olight Baton interface (including soft lockout), but without the flash modes.

Thanks for the link. I took a look and Baton.c and see a lot of similarities with my code.

I compiled the code and ran it on my test breadboard and found one quirk. The first press from off results in a dim light which then switches to either the last mode or moon depending on the duration of the press. I think this is because you used FAST PWM always. Changing PWM_MODE to PHASE eliminated this quirk.

Indeed. That’s why the comment at the top of the file says “FAST has side effects when PWM=0, can’t shut off light without putting the MCU to sleep”. :slight_smile:

Unfortunately, PHASE has some downsides too — it’s often audible (high-pitched whine), and it flashes slow enough that it kind of bothers my eyes. So I usually go with FAST instead, if I use only one.