The P20 has a dual-switch setup. And based on reading the manual, it sounds like that MODE button may be an e-switch. If LEDs in the tailcap can blink without the light being turned on, there’s juice flowing even with the light turned off. Such is not the case in your run-of-the-mill clicky.
Cool light though! Nitecore, while expensive, does make some nice lights. My P12GT was my first intro into the li-ion world, had me a bit spoiled
I tried your FW the first time today and it works fine for me. Thank you very much gchart!
It is the only one I found for Attiny13 with LVP, Batt Check, Turbo timer and without hardware modification (is there another one…?). And it can be further customized for my needs :+1:
I hate to keep bothering you. Your version of babka based off biscotti is perfect for me. I finally got biscotti to work however, when I try to compile your babka I get several errors in reference to delay in ms:
Hi Frank, no bother at all! It looks like the compiler isn’t finding the “_delay_ms” function. It should be in the “tk-delay.h” include file. Do you have that file in the same directory as your C file? (or nearby with the C file pointing to appropriate directory)
Also, there’s a new version that I just thought to upload, you can find it here. Highlights:
Simplified Turbo Timer options to just Off / On (instead of Off / 3 min / 5 min)
Lots of optimizations (smarter about INLINE functions, register variables, global vars, etc)
Flexible-length mode groups
Increase from 4 mode group options to 14 (can have up to 16)
Fast Presses redundancy
Option for turbo ramp-down instead of abrupt stepdown (set at compile time)
Room for even more, currently compiles to ~956 bytes
Got the tk-delay.h issue resolved however now when I run it as copied from your page it states it is 1132 bytes and 110.5% full. Do I need to disable features or am I doing something wrong in atmelstudio? I have optimization set for –0s.
Wow, that’s a considerable size difference. You shouldn’t need to disable anything. I’m guessing it’s a compile option in Atmel. You say you have “–0s” selected… how about language standard C99? Make sure to use both of those.
Hmm, there’s nothing really in the code for something like that right now. I assume this is for short-tap only, not a full click off-and-on, right?
The first method I could think of for this could use the same ‘ticks’ counting, but you’d need to create a new flag in eeprom to track the fact that the light has been on for more than 3 seconds. Then upon booting, see if that flag is set and if we_did_a_fast_press() is true… then reset mode_idx to 0. It would take some work, but definitely possible.
If the driver drains the MCU fairly quickly during power-off, it can also reset to the first mode with a slightly longer button tap. On some of mine, the threshold is only about a quarter of a second… so a very quick tap goes to the next mode and a slightly longer tap goes back to the first mode. For that, no special on-time counter is needed.
If the driver doesn’t drain very quickly, it can be modded by putting a resistor somewhere to help it discharge faster. Usually this happens through the voltage divider resistors, but I think any spare pin could probably work.