Flashlight Firmware Repository

Just starting to get back to modding after I had my shoulder operated on and trying to catch up. Wow you guys move fast.!!

Anyone have a VERY basic program with a hidden strobe, like a minidvr with strobe? How about something simple that starts on high? I see the one that can start on high set up for “stars” but I’m talking about something for a basic FET driver.

I don't have anything very basic... Smile

I got a somewhat hidden strobe in a e-switch driver: click for ON to 1st mode or next mode, hold for prev mode, long hold for strobe. Once a mode is set for ~1.2 secs, next click turns the light OFF. My favorite modes for this driver is 5, including a moonlight as the 1st.

A little while ago I asked about a single mode program with LVP. Nobody really had one. Could the standard nlite program just be modified so that each mode is 100%?

^ That (Tom E's post above) is absolutely my favorite momentary switch FW Tom. I use it in all my momentary lights (which is slowly becoming all of them).

Do you think you could make a variation that doesn't turn off?

It would force lock out to turn off. Most of buck drivers and zenier DD's have pretty bad parasitic drain.

Yep I have used that one and it’s great thanks. Anyway I can make that work on a clicky light?

Toykeeper has a STAR_1mode firmware in her repository.

I doubt the temperature is the issue. Being hot makes the timings shorter, so it should be easier to get med/long presses while hot and harder to get short presses. But you’re only getting short presses, and it sounds like it’s acting worse than it would if it was below freezing.

If you used 1912 and 4701 resistors, the temperature sensitivity is greatly reduced. 22k and 4701 is where the temperature issue happens.

Anyway, if you can’t get the OTC to show different values for different off-times, the only options are the mem-decay/noinit method or on-time.

You might be able to get a STAR variant to do it… depends on how much code you’re willing to change, and how you define “hidden”.

For example, you could do an offtime-based driver which goes H/M/L/H/M/L/strobe (like EagleTac does), or go with _the_'s approach where on-time will reset the normal mode loop after it has been on a while. So, you could loop H/M/L over and over as much as you like, as long as you pause at least once per cycle to let it reset. The only way to move past it is to go through the cycle twice quickly.

Nope, clicky switch lights and e-switch lights need completely different firmware.

Thanks for the info toykeeper. I might have to give that H-M-L H-M-L strobe a try. That just might do it. I know I used that one before but I can’t remember exactly which one it was. I’ll go and look through them again.

I don’t think any of them do that by default, but it should be a relatively easy change to write.

I think I should be able to figure it out. If it works out I’ll let you know. Thanks again

ok. I am completely lost. I have read every post on this thread and multiple other threads like this one and this one and this one. I am using a Mac, which makes it worse because most of the info is about using AVRDude. I downloaded Crosspack-AVR. I am unsure if there is anything else I need. Is there a step by step guide on how to do this programming? I read the info at Ladyada.net and I still don’t understand it at all. I saw a thread that had screenshots, but none of the pictures were viewable. I have built 2 of the USB devices to flash the MCU’s but I don’t even know how to properly test them. I have 20 Nanjg 101-AK-A1 that I want to change the firmware on and I have 20 separate Attiny13a’s that I’ve ordered just sitting there. Where is the guide for morons for this? I just want to do simple programs, but it seems I may have just wasted money. I don’t usually let stuff get to me, but I just can’t wrap my brain around this stuff.

I haven’t used a Mac, but I took a look at the ladyada tutorial and AvrMacPack (now CrossPack), and I think I might be able to explain it.

Basically, CrossPack (after being installed) gives you a setup very similar to what I’m using in Linux. This means you should have avr-gcc and avrdude and the other necessary tools, but you will need to use them all from a command line. Are you at all familiar with using a terminal?

You’ll also need a decent text editor. I hear TextMate, SublimeText, and Kod are good. I’m using Vim, and have also seriously used Emacs, but I wouldn’t suggest either one to start with.

You might also want to install bzr, so you can grab and update the sources automatically, make your own branches, etc.

If I understand correctly, after you have all the parts you need, the process would be something like this (bold means it happens in a terminal):

  • Download and unzip a copy of the firmware repository. Or just bzr branch lp:flashlight-firmware if you have bzr.
  • cd flashlight-firmware to change directory into the code tree.
  • Pick a project and cd into it, like cd ToyKeeper/blf-a6 . You can probably tab-complete most of the command line (type a couple letters then hit Tab and it’ll finish the rest if it’s unique).
  • Edit the code in a text editor.
  • Compile the code. …/…/bin/build.sh blf-a6
  • Flash the code to an attiny: Type in ./flash-noinit.sh blf-a6.hex but don’t press Enter. Connect your clip to the attiny, plug it all in to USB, then hit Enter.

The build process and flashing script may vary from project to project.

I’d also recommend getting familiar with other common command line programs, but that’s mostly optional. I think all you really need is ‘cd’ and some scripts in the code repo and perhaps ‘make’ for projects which have a Makefile. Might be nice to use ‘ls’ or ‘ls -al’ too (list contents of the current directory, perhaps [a]ll files in [l]ong format), to avoid the need to switch to a file-browser window all the time.

hi again,

today I’m trying to flash the blf-a6.hex -file, but I’m getting an error. I’m trying it with a bare MCU, wanted to do that before soldering it to the driver board, don’t know if that makes a difference.

I usually see the verification errors only if there’s a pin not connected during flashing. Six pins are required:

  • 1 RST
  • 4 GND
  • 5 MOSI
  • 6 MISO
  • 7 SCK
  • 8 VCC (don’t forget VCC, even though it’s not in bold in the table below)

BTW, it can still be flashed after soldering to the PCB… but only if you don’t have any extra pins grounded or stars soldered. I reflash MCUs on drivers all the time.

Yeah I agree with TK, usually I only get that error if I bump it while flashing

Thanks Toykeeper (EDIT) and pilotdog,

the connection didn’t seem to be the issue. I checked with following command from Hoop’s guide:

avrdude -p t13 -c usbasp -n

I have tried to flash different firmwares to these new bare MCUs I ordered, everytime I got the same error. When I tried to flash these firmwares to MCUs that were sitting on a 105C already, it worked.

Now I changed the jumper on the USBasp to the 5V setting and guess what… it worked with the bare MCUs. I have no clue why that is, but I’m glad it worked.

I’ll let you know how I like the firmware when I finally manage to get a driver soldered together and have it installed in a light.

Ah, I forgot about the 3.3V / 5V jumper. Mine came configured for 5V and it has never been an issue.

BTW, the avrdude connection check will still pass even with VCC not connected. I flashed drivers for several weeks (with verify errors each time) before I figured out there was a physical connection issue on my VCC, but after fixing that things have been much better.

Not sure if this is the right place but I know TK had seen problems with the OTF cap timing when using a 22K resistor. Would there be the same problem, or worse, with a 36K resistor? I'm seeing awful results - when cold, quick clicks don't change modes, then after a few clicks it starts working, but as a long click (in the BLF A6 driver, moon to hidden turbo, etc.), then after a while the quick clicks work the way they should, but long clicks seem impossibly long... Ugh it's pretty useless in this setup - guess could be a bad part, but again, first time I'm trying a zener mod with the 36K resistor on a 22mm wight FET+1 board (https://budgetlightforum.com/t/-/31559).