Speaking of FETs, I wasn’t happy with the moon level on mine… so I added a feature to let me fine-tune the output of moon. Using fast PWM=0 I was getting like 0.05 lm. But fast PWM=1 gave me about 11 lm. And phase-correct PWM=1 gave me like 6 lm or so. I wanted something closer to 0.3 lm.
So, I added PFM to moon mode, and only to moon mode. This means, instead of doing fast PWM=0/255, I can adjust the brightness gradually. I settled on 0/40 for this particular light, where a lower denominator makes the output brighter. I might go further, to 0/30, for an even brighter moon.
An example is here:
http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/view/head:/ToyKeeper/s7/cypreus.c
This also means that moon mode pulses a lot faster. In the case of 0/40, it pulses at about 120 kHz.
I should mention that the output is still highly voltage-sensitive, especially on PWM=0, so it will still get extremely dim as the cell gets low. The battery and FET just can’t get up to full power in the ten-millionth of a second the pulse lasts, and that’s especially true when the cell isn’t full. The highest mode may drop to half its original output on a low cell, but moon will drop pretty much all the way to zero.
But at least moon is a nice comfy level for the first half of each charge cycle.