Babka firmware development

My NC P20 is a clicky and it has this function. I’m a noob at this firmware stuff so no idea how they do it

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 :slight_smile:

A couple minor updates, see the changlog in OP

A couple minor updates, see OP for details

Can you do a setting so that it always get on at 100% another tap gets you to strobe then reversed mode toggle
Tactical configuration for self defense

I’ve never used a tactical setup. So basically just 100% and Strobe, no memory?

I’m right at the max size of the code as it is, but I’ll see if I can trim something down for some new options like that.

Yeah for tactical no memory and starting at 100% is ok group can stay as it is just reversed with hidden modes

For defence just turn light on and get max output is important

perfect firmware,thanks gchart for helping me out perfecting git even more! Quite helpull BLF fella

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:

Hello Gchart,

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:

Do you have any suggestions?

Thank you,

Frank

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:

  1. Simplified Turbo Timer options to just Off / On (instead of Off / 3 min / 5 min)
  2. Lots of optimizations (smarter about INLINE functions, register variables, global vars, etc)
  3. Flexible-length mode groups
  4. Increase from 4 mode group options to 14 (can have up to 16)
  5. Fast Presses redundancy
  6. Option for turbo ramp-down instead of abrupt stepdown (set at compile time)
  7. Room for even more, currently compiles to ~956 bytes

Thank you gchart! I will double check when I get home from work today, and will be trying the new version!

Frank

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.

Thank you,

Frank

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.

Worked like a charm gchart. This is my favorite firmware so far thank you again for the help.

Great! You’re welcome :+1:

-Gabe

Hi, I just noticed you updated this. I copied the changes into my repository.

Thanks for doing that TK! Shoulda mentioned it to ya.

gchart, where could I add something like

if (ticks > (TICKS_PER_MINUTE/40)) {mode_idx = 0};

to make the light go to the first mode on next tap if it has been on for 3 seconds?

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.