Flashlight Firmware Repository

Played with it more (the Roche LS01 - XHP-70), amazing how the timing just progress's - 1st time just blinks current mode, then quick clicks do prev mode, then quick clicks go next mode, and holds go prev mode -- works perfect Smile! Then prev mode takes longer and longer holds til they are no longer accessible... Frown

Of course I got the big flicker every time going from turbo to moon - though turbo is PHASE (not FAST) -- forgot to add a resistor on the FET gate, but I can still do that because I only used 20 AWG LED wires, and left extra length so I can get access to program the driver - nice having a light with a screw down retainer ring on the driver...

Truly bizarre. I don’t know what would cause the OTC decay to change so much over time, but I’m not good with hardware.

Thank you so much for help,I will reflash the driver in a few days.Good idea to also load the 7135 on TURBO,will definitely try it.

Hi, it’s me again having trouble getting things done by myself…

I gave the “S7”-firmware a try, because I wanted off-time memory an a nanjg driver without adding an otc.
Basically I wanted a very simple UI. Three modes, high to low, off-time-no-memory. I know I could have gone with “star_noinit” for this, but I like the battery indication mode that’s in the S7 firmware. So I tried to change the S7 firmware to high, med, low, battcheck mode.

I really have no coding skills at all. Just getting started with this. I managed to get the modes like I wanted them.

changed modes array to

In the main, I commented out all “else if”s after SOLID_MODES except the last one for the BATT_CHECK_MODE.

But now I have no clue how I have to change the part after #ifdef VOLTAGE_MON to make the lvp work as it should. I suppose I have to change something there, right? Because I changed the mode order to high, med, low, battcheck, the lvp would step into high when triggered if I leave it that way, right?

Should I change

if (voltage < ((mode_idx == 0 ) ? ADC_CRIT : ADC_LOW)) {

to

if (voltage < ((mode_idx == 2) ? ADC_CRIT : ADC_LOW)) {

and

if (lowbatt_cnt >= 3) {

if (mode_idx > 0 ) {

mode_idx = 0;

to

if (lowbatt_cnt >= 3) {

if (mode_idx != 2 ) {

mode_idx = 2;

???

Please let me know how stupid my approach is, but don’t be too harsh, I am really new to this stuff…

By the way, I managed to build a FET+7135-driver with BLF-A6-firmware. Really nice firmware! But I strongly recommend using it with a reverse clicky, because until now I’m using it with a forward clicky and I feel it was much more intuitive with a reverse clicky.

To fix LVP, I think you’ll need to make it change the PWM level directly instead of changing the mode index. It kind of assumes that the modes go low to high, but that won’t matter if you cut the PWM in half each time it needs to step down.

I got some DD+7135 boards from OSH Park. So I ditched the old DD boards I modded but was having troubles with. The new boards are working, but I need to fine tune the OTC a little more. Boy TK, I totally see why you recommend tuning the OTC because it totally makes a difference in the UI's performance. Once I got it close, the program was a joy to use. Before that, it was frustrating. I probably would not have had to tune at all if I had known the my supposed 1uF caps were not actually 1uF. They are around .7uF. So I used 2 parallel caps and things got much better. I would not have discovered my caps were underrated were it not for this FW.

I'm curious. This may have already been discussed and I apologize if it has. 1uF seems a tad too big a cap. The stock FW threshold is pretty high at 190. I'm hoping to try like a cap that is about 2/3rds the capacitance and change the FW threshold down to around 140 (just throwing out a guess). Maybe will even try .5uF and then change the FW threshold down to around 95 (another guess). Has anyone done any work in that regard yet? If yes, what did they find out?

The cap isn’t the only thing which affects that. The voltage divider resistors seem to have a pretty big effect too. Ideally, you should try to tune the hardware so that the OTC decays to under 100 within 3 seconds or so, but that’s easier said than done.

In any case, I have to calibrate the OTC for every driver I use, because I’ve gotten them from a variety of sources and each one is a little different. The method I ended up using for best results is to use a metronome at 120bpm and take the average of several samples.

http://toykeeper.net/torches/blf-a6/offtime/

To save time and avoid shipping delays, I also had to teach Manker how to run these tests… which was interesting since we don’t speak any of the same languages. So, I ended up making a wordless video to demonstrate the process.

^ That sounds like quite and effort and challenge.

Tonight, I used just one cap that is measuring about .688uf on a DMM. Set the FW to 140 (from 190). It works so good and reliable that I am going to pass on running the off-time FW. I have 2 more to tune. I may not be as lucky and will run the off-time FW on them if needed. I just don't trust my sense of timing. I will measure and match the capacitors to help ensure success.

Maybe someone can make a spread sheet to see if a pattern develops. Something like this:

Capacitor Diode FW UI Performance

Measurement in LVP R1 R2 Threshold & Reliability

.688uF ? 19K 4.7K 140 Excellent

1.37uF ? 19K 4.7K 190 OK

That’s what the metronome is for. :slight_smile:

Thanks ToyKeeper. Looks like I have to figure out how to do this. By the way, is it possible that the LVP inside star_noinit doesn’t work as it should when you change the mode direction to high->low? I just swapped the 1 and –1 of mode direction in line #194 and #196, but that should make no difference to soldering star 3.

TK wrote:

ImA4Wheelr wrote:
I just don’t trust my sense of timing.


That’s what the metronome is for.

Sounds like a tool for a professional. My luck I would just get hypnotized and not realize my driver has a short.

EDIT: Finished the 3rd driver. Worked great. Seems like measuring capacitance of the OTC is a decent way to get reliable results when the LVP resistors are kept stock. By the way, I really love your BLF-A6 FW. I'm big on momentary switch lights. But I have to admit it, it feels like using a momentary switch. And the UI is really great. Who knew so much could be done with just one button.

It’s definitely possible that LVP won’t work with a different mode order. I haven’t really tested the various flavors of STAR very much. I’ve been meaning to go through every project and LVP-test it then add the results to the meta files, but I only got through a few before I got distracted…

As for modifying the PWM level directly… it’s easy in solid modes, not so easy in blinky modes. Basically replace the stuff about mode_idx with something about PWM_LVL. Like, if (PWM_LVL > 10) { PWM_LVL = PWM_LVL >> 1; } else { PWM_LVL = 0; and the sleep_mode stuff }

That should make it cut power in half each time it needs to step down, then eventually shut the light off. The double angle brackets do a bitwise shift to the right, which has the same effect as dividing by two.

NO KIDDING!! One hell of a job she did :)

Thanks again, ToyKeeper, I really appreciate your help. I’ll give it a try.

I am trying to use the start off time firmware for a 2 mode light with a twisty tail cap. The problem is I cant hardly twist this cap fast enough to get the mode to change. How would I edit the firmware to have the window where the mode changes be open longer?

I think the value you’re looking for is CAP_THRESHOLD.

You can either guess what value to use, or measure it by flashing ToyKeeper/battcheck/offtime-cap.hex . Basically, turn it on, turn it off, wait the amount of time you want to measure, and turn it on again. It’ll blink out the value it read from the capacitor, which can then be plugged into other code.

Nice trick. Sneaky girl you are. :)

Thanks TK

A lower number will give me a longer window right?

Yes, a lower number is a longer amount of time. The capacitor drains while it’s off, following a curve similar to 1/x — quickly at first, then slower and slower and sloooooooower.

So we know that heat can affect OTC timing with certain divider resistors, can heat also affect the LVP itself?

I’m using blf-a6. I tested values with my power supply and battcheck, then rechecked with an actual battery when stuff started acting weird.

This is what’s happening:

If I keep the light out of turbo, LVP steps in at about 3.1v (where i set it). When the light is hot, LVP seems to step in at 3.6v. I turn the light on turbo, the timer steps it down after 60 seconds, and it will stay on medium with no problem. But if I immediately bump it back to turbo, it lasts 5 seconds, then drops to medium for 5 seconds, then drops to low and stays there. It never drops to moon or shuts off. When i take the battery out, it’s right at 3.6v. If I wait for the light to cool down and put the same battery back in, it will work fine as long as I don’t use turbo.