Flashlight Firmware Repository

I’ve updated my firmware and selected;

Which should give me mode memory? Correct? But I still don’t seem to have it. I’m using a zener modded board could this be affecting it?

Also when I start again it gives me my lowest mode. Even in the second group it gives me my lowest of the first. It starts with the lowest of second group then after a second goes to lowest of first group then I can cycle through the modes on the second group like normal.

No, that only controls how that option gets configured. With CONFIG_STARS defined, you can enable mode memory by grounding pin 3. With it not defined, you can enable mode memory by pressing the switch a bunch of times and then turning it off between the second set of two blinks. Neither method turns it on by default.

If you want mode memory hardcoded as on, you’ll need to change some other part of the sources, or use tk-otc.c (which drops the config mode entirely in favor of hard-coding options, but provides more space to add features).

Yesterday I flashed my first driver (stacked 105C, 12x7135) with the S7 firmware, worked fine, very nice firmware. I used the ready to use .hex-file.

Today I wanted to try star_noinit. Therefore I had to create a hex file. I have to say I’m a total newbie to all of this flashing/coding stuff.

I have Atmel Studio 6.2 installed. Finally I’ve been able to get a hex file, but it’s 2685 bytes.

The way I did it was: file~~new>project-> GCC C ExecutableATtiny13A, then deleted that automatically created stuff, copied and pasted in the code,>projectproperties>toolchainOptimization(under AVR/GNU C Compiler)~~>optimize for size (Os), then build>build solution

I just installed AS6.2 without making any changes to whatever settings.

Help would be appreciated. Thanks.

The hex file size isn’t so important; it’s the size of what the hex file represents.

I have .hex files at 2893 bytes which still fit. When I run avr-size on it, it tells me how big the file actually is, and that limit can go up to 1024 bytes. I’m not sure where to get the avr-size data in Atmel Studio though.

Thank you very much, Toykeeper.

The pictures are broken but I think you get the idea. Way back when I started programming these 13a's these instructions worked for me on 6.x.

Hey TK (or anyone else)

In blf-a6, how do I get the tactical strobe into the main loop? I see it is given 253 as a convenience code, but I can’t see anywhere that it’s actually used?

Can I just transplant the code I’ve used in STAR_OT?

//mode_idx254 is the Strobe Mode
if (modes[mode_idx]254) {
while (1) {
PWM_LVL = 255;
_delay_ms(50);
PWM_LVL=0;
_delay_ms(175);

Edit: Just gave it a try, all it takes is to put the convenience code into the normal mode order. easy as pie. Now i feel silly for flapping my lips before switching on my iron. :zipper_mouth_face:

Hi TK,

I decided to take your advice about using the FET + 7135 driver to get the super low mode I want with an XHP setup ( parts are on the way)

What I am wandering now is will I be able to tweak the Star_off_time code to get what I want out of that?

I see that there is a line of code there to enable a second PWM ( line 86)

//#define DUAL_PWM_START 8 // Above what output level should we switch from the alternate PWM output to both PWM outputs?

What else would I need to do to get this rolling with the dual?

Not sure what you and TK talked about, but that’s all that’s needed.

As it sits, and modes under pwm level 8 will use the 7135 channel only, and anything above 8 will use both the 7135 and the FET. (you’ll need to un-comment it [remove the // ])

Is that what you were asking?

^ I think 255 is FET only too with the "stock" code.

EDIT: Sorry, my above response is incorrect. I was thinking about Phase vs Fast. Phase being used for the first and highest modes.

To get it into the main loop, add “STROBE” or 253 to the main channel in one of the two mode groups, and make the other entries longer too. For example, adding it to the end of the second mode group:

#define NUM_MODES2 5
#define MODESNx2 0,0,79,255,STROBE
#define MODES1x2 20,200,255,0,0
#define MODES_PWM2 FAST,FAST,FAST,PHASE,PHASE

I think that looks about right, but I haven’t tried it.

FWIW, I haven’t tried a single 7135 chip on a XHP or MT-G2 or other higher-voltage higher-output emitter. I’m not sure what to expect from it.

As for tweaking Star_off_time, any code can be modified to do pretty much anything. It depends on how much you’re willing to modify it.

By default, Star_off_time uses the same PWM level for both the FET and the 7135 simultaneously, unless the level is below the threshold you quoted above. In that case, it’ll use only the 7135 by itself. Tying the two together makes it simple, but it also means you have less control over each channel individually — it won’t let you ramp up the 7135 alone then turn on the FET only when needed; instead the 7135 and FET will both be active and have a fixed ratio of how much power each one contributes to the whole.

However, if you were going to have a lot of mode groups, the joint-PWM approach only needs to store one number instead of two, so it cuts the storage needs in half.

I just built a quick dual channel driver using an old DD only driver. Loaded it with BLF-A6 unmodified. It doesn't do anything but Moon Light Mode with the OTC in place. It works fine without the OTC in place.

Is that the way this FW is supposed to work stock?

Nope.

Sounds like the OTC calibration is way off. You can get OTC values by flashing battcheck/offtime-cap.hex and then pressing the button for the length of time you want it to use. It should then blink out the OTC value for that amount of time, which can be plugged back into other firmwares. Similar story for voltage calibration, only using battcheck.hex instead.

^ Thank you TK. You must have one of the deepest knowledge bases on BLF in that brain of yours.

Unfortunately, my mod put an AMC7135 on top of the MCU with some wires. Now that I know the QTC is required, I'll first investigate the 1uf Cap. Maybe it was shorted or something. If that doesn't fix the issue, I'll follow your above advice.

Much appreciated :)

Maybe it’s just me, but one of my modding rules is to always make sure the MCU will be accessible (with no extra pins grounded) so I can reflash it later. I reflash pretty much everything from time to time, and I generally expect that I’ll need to flash each one a few times to get the calibration right. There’s always something a little off, whether it’s the PWM level for moon or the OTC timings or the voltage levels or … whatever.

^ That's a very good rule. I just didn't want to wait for the OSH Park DD +7135 boards to arrive. No matter what, I had to solder a wire to at least one of the MCU pins and it was late last night. But you have me thinking that I need to move the 7135 over to the top of the FET.

I have to give you a huge thumbs up TK. I just read much of the parts of this thread that deal with BLF-A6. Wow! Really impressive all the functionality and performance. And that UI diagram. I absolutely love that. It really helped me understand the UI. And what an impressive UI it is. Really excited about this new direction wight and you have opened up. Thank you.

Hey all,

Is there a way to power more than one LED separately using an FET driver and code.

What I mean is this. I am working on a head lamp for a guy that has the one main led that is white. And another LED that is red. His setup now is manual through a multi poll switch and a pile of resistors. Is it possible to get both LEDs included using a momentary switch and FET driver?

Thanks

For two channels of output w/ATTiny13A, yes - we do that now with the FET+1 7135 drivers, accept the 7135 output goes to the same LED+ pad as the FET -- if you separate those outputs, they can drive 2 different LED's. For a 3rd channel, little more tricky - actually I don't think you can PWM on a 3rd channel, but for the 2 channels the FET+1 drivers support, PWM's work great per channel. For 3 PWM outputs, I believe the PIC MCU's are a better choice, as C_K used.

So, you could driver 2 banks of 7135's, or 2 FET's, or the combo as the stock BLF wight FET+1 drivers do. It's all a matter of wiring the outputs.

Hope someone can confirm or clarify this - think I'm wight right Smile.

You’re right. A few people have done it, including myself. Wight even made a driver specifically for driving white and secondary red led’s. (although that driver is a royal pain)