STAR Firmware by JonnyC - Source Code and Explanation

Do you have an offtime capacitor on that? If so, make sure it isn’t charged, and the noinit thing might speed up. But then, if you have an OTC, it’s probably better to use that instead of noinit. :slight_smile:

True Smile. I think I'm using the OTC pad to solder the e-switch wire to. It was bugging me a few mins ago - couldn't recall if there's some setting brown out detection could work off of. Thought it worked better, maybe PCB design dependent - not sure.

Ohh - I set turbo timeout to 90 seconds and timed it on the bench with a TrustFire - was somewhere between 90 to 91 secs on my stopwatch - impressive! Wonder if it works more accurate configured at 8 Mhz. Only choices for internal clock is 6.4 Mhz and 8 Mhz, at least in the fuse setting app.

So, this was a 25V SSU (same package as a 13A) on a 17mm wight FET+1 driver. Didn't realize the X6R's tailcap switch is a fwd (tactical) clicky - works well, interesting...

Thank you Tom E for sharing your latest WIP. I as hoping to install and try it out this weekend but things came up. Hopefully, I will by the end of the week.

Ok, no prob. Couply of things for you and T_K (anyone else for that matter) on eswitch_NOINIT:

  • e-switch and power button share the same mode table, default is 5 modes with 1st 3 modes using the 7135
  • strobe is not accessible from the power switch - it's not in the table, special only for the e-switch
  • changing modes on the e-switch does not effect the stored mode, so the power switch saved mode is unaffected. I'm not sure if this is a good thing or bad thing, might be more confusing, but seems nice for some usages like tactical - you can program the power button to come up in Hi/turbo if you want, then change modes from the tail, and that will set a new default, including OFF. For now, I'm gonna leave it this way but not sure if this is the best. Might make a nice user configurable option.

I'm also thinking about more functionality, like using the long press to get strobe now, but treat is as an advanced mode set, so another long hold might be battery check, slow strobe, beacons, etc. A good thing I could do, for safety, is if the e-switch is permanently stuck, I could cycle thru the advanced modes and end it with OFF.

Exciting stuff Tom. You rock! I'll be happy to start helping work some more on the temp. sensor stuff, but it's got to wait until next week.

Tom, you keep putting things on my todo list. :slight_smile:

Have you ever tried using git/github or bzr/launchpad? They’re pretty helpful for tracking and generally dealing with code.

We use Git @work, but we have our own server repository. Been using github, but not for my own stuff. I know, really should... I gotta get better organized, overall. I'm off in way too many directions.

Awesome, so it shouldn’t be a big stretch. :slight_smile:

I really need to spend some serious time with git. It’s functionally almost identical to bzr, but everything has different names and options and defaults. And git officially won the DVCS wars, so I should get on board with it. Even Launchpad supports it now, though it’s not widely used there yet.

Followup and new find if interested folks

https://www.fasttech.com/products/0/10012070/2056803-sop8-to-dip8-programming-adapter-socket-module

And a 16 pin one

https://www.fasttech.com/products/0/10012067/2056800-sop16-to-dip16-150mil-programming-board

Thanks to the input of several in this thread I was able to manipulate the code for a 5 hour shutoff on a light using the STAR firmware.

I recently had the timer fail. Instead of shutting off as usual, the light kept running.

Any ideas why something like this would happen?

This was on a light that you had tested working previously? A momentary power glitch or inadvertent MCU reset would be enough to reset the timer.

That’s a good point. It might be a good idea to add a “noinit” attribute to the timer variable, and only set it to zero on boot if the offtime capacitor (or noinit-based offtime sensor) says it was a long press. This would allow the timer to keep counting after a short press or brief interruption.

RMM - yes this the timer on this light had been working. Since I posted yesterday it has failed once again. I’ll test again today to see if it continues to fail.

Toy - as always thanks for the suggestion. I may reach out for a bit of clarification on the specifics of implementing this.

I’ve flashed another circuit with the 5 hour timer for testing and have also had this one fail once in about 10 cycles.

Any additional thoughts here?

Many thanks

It really sounds like it might be resetting or rebooting or something, dropping the timer back to zero. But it’s hard to say for sure.

You could try looking at STAR_noinit for an example of how to let a variable keep its value during short power blips. It might help.

Hi. I am building a driver fet + 7135. I want to flash the firmware of toykeeper blf a6. I want to achieve around 100 lumens on low mode using the 7135 but i don’t have equipment to measure the lumens. Anyone knows what value should should i put ex. 150/255?

What emitter?

xml2 u2

Ok, so according to Match, you get 100 lumens at around 200ma. He tested a T6, but lets assume that the extra gain from the U2 is cancelled out by losses in the lens and reflector.

So 200ma/380ma*255pwm = 134pwm. That should get you close.

That emitter, at 350mA, should put out about 140 or 150 OTF lumens. So, for 100 lumens you’ll want the 7135 chip running at about 69%, or about 175/255.

This is a very rough guess though.

You can get the PWM levels from bin/level_calc.py, if you have the ability to run python scripts. For example, this calculates 9 evenly-spaced levels from 0.5 lm to 1400 lm on a FET+1 driver:

(~/src/torches/trunk/bin/)-]> ./level_calc.py 9 1 8 1400 y 3 0.5 145
1: visually 0.79 (0.50 lm): 0.00/255, 3.00/255
2: visually 2.09 (9.17 lm): 0.00/255, 18.11/255
3: visually 3.39 (39.03 lm): 0.00/255, 70.19/255
4: visually 4.69 (103.24 lm): 0.00/255, 182.17/255
5: visually 5.99 (214.95 lm): 12.30/255, 255.00/255
6: visually 7.29 (387.33 lm): 43.76/255, 255.00/255
7: visually 8.59 (633.53 lm): 88.68/255, 255.00/255
8: visually 9.89 (966.70 lm): 149.48/255, 255.00/255
9: visually 11.19 (1400.00 lm): 255.00/255, 0.00/255
PWM1/FET  values: 0,0,0,0,12,44,89,149,255
PWM2/7135 values: 3,18,70,182,255,255,255,255,0