It works if recompiled with that option enabled, but it’s necessary to remove both the tactical strobe and bike flasher to make room.
The extended config mode simply converts it to use two config options (mode group and mode memory) instead of one (mode group). But if you’re recompiling anyway, you can set those both at compile time (in tk-otc.c) and have lots of room left over for other stuff.
I might still be able to reduce the size a little, and I’ll definitely try… but for now the default is one config-mode option and one star-based option.
So by ‘enable’ you just mean un-comment it? I prefer to be able to toggle both mode group and memory without disassembly. I also have no problem deleting blinkies.
Still got some time before my flasher arrives and I got a little interested in this. So to use the whole 64 byte eeprom I first must change the 31 to 63 in this line?
eepos=(eepos+1)&31; // wear leveling, use next cell
And then I decrease the eeprom array from 32 to 8 byte and loop over it 8 times? Sounds not very difficult to do and will not take that many more bytes in flash.
Or you could copy save_state() and restore_state() from blf-a6/tk-otc.c, which already fixed the issue. The array is completely unnecessary, since you can simply read one byte at a time. We don’t really care about speed here, just space. It uses all 64 bytes of eeprom, but only requires 1 byte of global-scope RAM and up to 2 more bytes of local-scope RAM.
TK - you probably haven't re-visited the Ferrero-Rocher driver in a while, but today I saved a bunch of bytes by taking "inline" off of next_mode() and prev_mode(). Basically if you call a function more than once, chances are "inline" will waste space. I did this to my version of the e-switch driver the other day, and same thing - saved a lot on program space.
Basically, comment out the ‘#define CONFIG_STARS’ line. Then make room by commenting out the two strobey modes.
I did some code changes today to make this easier. Also, I found some new ways to reduce the size overall, so it’s possible to put in the full config mode plus one of the two strobes, or full config plus both (with the bike flasher simplified). You can try that version here: Index of /torches/pilotdog68
In full config mode, it will blink twice for each config option. Turn the light off between the two blinks to toggle that option. There are only two options though, mode group and mode memory (in that order).
I’m still merging changes into tk-otc.c and generally cleaning up, but it should get published in the trunk branch soon.
Possible, yes. But there is no code for this right now so someone would need to write it. I think it would be reasonably simple though, just wrapping the whole LVP logic clause inside an “if (modegroup == 0)” or similar.
I tried that, actually. I think it’s a matter of compile options, but for me it made no difference at all in the size or content of the build. But if it helps at least sometimes I don’t mind making it default.
Here is what I see when building it (same with/without inline):
Weird - just tried it again, and the difference is 48 bytes saved - 984 with inline, 948 without. I'm using Atmel Studio 6.2, and the -Os option is specified.
The important option there was “-c -std=gnu99”. I added this to my build script and am now getting the same results you are. This also has reduced the size of every firmware I’ve tried so far, so I’m leaving it in as a permanent thing.
This also saved enough room to let the full config mode fit into the blf-a6 firmware without having to remove anything.
The only firmware change I can think of which might be relevant is to change FAST_PWM_START to 255, to force it to use phase-correct PWM. But this would likely only change the numbers by a tiny tiny amount (like half a percent).
The rest is probably due to hardware. You might want to try bypassing springs, checking your measurement setup, using thicker wires anywhere possible, using a hotrod cell, etc. Might also be worth checking to make sure the light hadn’t already stepped down from maximum when the measurement was taken.
The emitter type and vintage makes a big difference too… if it’s a recent XM-L2 it might not be able to go as high as an older XM-L2, for example.
I’m not sure what the best practices are for high-amp measurement, but it seems like most people prefer to use a clamp meter and thick short wires and it probably doesn’t work as well to use a traditional DMM on an open tailcap. I recall a lot of discussion about this on the BLF X6 thread, and how hard it is to accurately measure amps. It might be easier to measure lumens instead.
I use this method on the 84 and 85 as it has 512 bytes. I already have an array of 16 bytes full of different settings not that are changed unless user enters the user programming mode, so before this array gets filled up with the stored settings I use it for looping through as described to find the mode bytes.
On the 13A I’d go withToyKeeper’s suggestion. There is no need for the array really, just use a single byte. You won’t notice any difference in start-up speed, takes less space to program and uses less RAM.
That’s really strange. I’m not as familiar with STAR; I only changed what was necessary to make it work as a 1-mode driver.
Looking again, I see one other thing which could make things a little weird. STAR sets alt PWM (in set_output()) to the same value as the primary channel (regardless of whether it’s compiled to use dual PWM), so it’s turning on both channels on a 2-channel driver. In my blf-a6 tests I found that turbo is actually brighter with only the FET channel — turning on both the FET and 7135 causes lower output. So if you’re using a 2-channel driver it might be that the 7135 is actually getting in the way.
More generally, I’m not certain it’s a good idea to run at full direct-drive amps on a 1-mode light, unless you make the turbo timeout really short. If it’s mounted on a weapon, there’s no skin contact so nobody would notice if it gets really hot.
Wow, interesting... Not sure if the Studio IDE set that somehow by default. It's in the Compile "Miscellaneous" settings. When I create new solutions/projects, I simply copy a previous to begin with.
I was thinking about doing it byte by byte but thought it would be too slow so I went with a 8 byte array instead. I got plenty of space in ram anyway but I may switch later when my flasher arrives. But i don’t want a noticable boot time in my driver.
Edit: Using an array was a bit tricky with a weird pointer to the eeprom adress. Must get my flasher to confirm I got it right.
The attiny13a is running at 4.8 MHz. It only takes a few clock cycles to check each eeprom byte, and there are 64 bytes. Let’s say it takes a dozen cycles each; that’s 768 cycles, which should take about 0.16 ms total. The data sheets suggest an array might save about four clock cycles per byte, but it’ll still be roughly 0.1 ms.
Can you feel a boot-up difference of 0.05 milliseconds?
In general, yes, phase-correct PWM is a good idea on the highest level. It doesn’t usually make any noticeable difference, but it’s nice to make the code default to phase-correct to account for the few cases where it matters. I don’t think the hardware has a default; you have to explicitly tell it to generate pulse waves because those pins can also serve other functions.
Well, the timer is set to arround 1.5minutes- then it ramps down to 50%, the FL body gets only warmer this way ….plus when its mounted on a weapon it lights for usualy 10 seconds tops- i use simple momentary on self made remote switches, made from thick Cu pads: found that those are most reliable, especialy with all that forest fog and moisture
The 7135 thing……you might be right, i have to try the 024 version out then
Once again, 10x for that 1mode version, i waited for this long time