Version 1.1 posted (see OP)
Includes firmware for an LDO OTSM TA build. Latest Build instructions will be maintained in the Manual, and the OP, but the excerpt is below.
Also split the dual switch build into a noinit version and an OTSM version. The OTSM version is specifically targeted at lexel's "option 3", but an option 1 configuration should arrive soon.
These are not tested builds/firmwares, but the differences from the regular OTSM versions are fairly straightforward and those differences have each been independently tested. The LDO build should work. Dual switch, enh, probably. No guarantee or implied anything.
VIII.1b Parts and build for TAv1 board for LDO (2S, 3S etc)
Quick version:
See section VIII.1a for mcu, cap and diode selection.
Place the diode on the R7 resistor pad with the anode (+ side) pointing away
from C2. No OTC cap is needed. Use the following divider resistors, in ohms.
R1 R2
2S: 1780 2210
3S: 2250 1500
4S: 2870 1100
Should be 1% or better. Dropping R2 by 1% or 2% might help get full range of voltage read on the very top end and the risk of pushing the specs slightly at the low end. Not a big deal either way. The default calibration is centered around the values above though.
No bleeder. That's it.
For all other parts, stick with the original Texas Avenger instructions.
Long version:
For 2S or more build, the attiny must be fed power by some form of voltage
regulation such an LDO. This means that Vcc (input voltage) cannot be used to
measure the battery voltage. The divider must be used. Furthermore because
the divider pin must stay logic high to indicate power on, the 1.1V reference
cannot be used. The REFERENCE_DIVIDER_READS_TO_VCC option must be used (It's
compiled into the LDO firmware) This reads pin voltage as a fraction of Vcc
with Vcc being the max, allowing the highest possible divider voltages.
There's some difficulty here because a low battery, 2.5V/cell is 0.6 the
voltage of a full battery: 4.2V/cell. 0.6Vcc is also the maximum trigger level
for a pin change interrupt, which indicates a click and puts the light into
sleep. In reality the trigger level should be below this, but by spec it can be
this high. So we need the divider voltage to really stay as high as possible.
Furhtermore Vcc is reduced from the LDO voltage by the diode voltage. This
fluctuates slightly with temperature and current, so we need to estimate this
max voltage as well as possible. From the diode spec sheet a maximum diode
voltage of about 0.4V at 2 to 4mA is seen, but more typical is 0.35V and this
should be correct within 0.1V even when hot.
Parts:
Using a TA generation 1 (v1) LDO board, a diode must be added, the same one as
for the 1S configuration above. The diode can be added in place of the R7
0-ohm resistor. The same caps are used as for the 1S OTSM version.
The only other difference is the correct resistor values should be chosen. We
want a total resistance R2+R1= about 4kOhms. We need the voltage on pin 7 to be
equal to the LDO voltage minus the diode voltage, ie Vcc, when the batteries
are at max voltage, Vbm.
So the divider should be R2/(R1+R2) = Vcc/Vbm.
Following the TA build specs and the diode used here, Vcc is 5.0-0.35 = 4.65V
This gives R2 = Vcc/Vbm *4kOhm.
And R1 = 4kOhm-R2
here is the calculated table for various voltage levels:
R1 R2 Vcc/Vbm ideal:
2S: 1786 2214 0.5536
3S: 2524 1476 0.3690
4s: 2892 1107 0.2768
Of course these resistors don't exist, so we need to look for something close,
with the ratio being the most important thing.
R1 R2 Divider Error %
2S: 1780 2210 0.06
3S: 2250 1500 0.36
4S: 2870 1100 0.1
These should be in 1% tolerance or better. Any inaccuracy here pushes the
measureable voltage range up against the spec limits.