aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSelene ToyKeeper2026-03-14 16:52:44 -0600
committerSelene ToyKeeper2026-03-14 16:52:44 -0600
commite7ef591138edc625815b1208ce1e012370621e04 (patch)
tree1ce34ca52773118462ade5009f8efdbe08d9897d /arch
parentadded &hank-kr1aa build for new Emisar / Noctigon KR1AA (diff)
parentcalibrated for latest TS26 sample (diff)
downloadanduril-e7ef591138edc625815b1208ce1e012370621e04.tar.gz
anduril-e7ef591138edc625815b1208ce1e012370621e04.tar.bz2
anduril-e7ef591138edc625815b1208ce1e012370621e04.zip
Merge branch 'wurkkos-ts26' into trunkHEADtrunk
I guess the hardware is shipping now? So, time to release. I never heard back about some calibration details, particularly about whether the floor level is reliable on many items or just mine... but I guess it must have been fine if it's shipping. * wurkkos-ts26: calibrated for latest TS26 sample wurkkos-ts26: increase default floor to 5/150 to reduce flicker (by request) renamed wurkkos-ts25-boost to wurkkos-ts26 wurkkos ts25-boost: calibrated for 20250210 prototype ts25-boost: calibrated for new prototype - battery voltage readings - RGB button aux - less moon flicker (but brighter, less efficient moon) - reduced blink brightness (old brightness was so high it was throwing off battery readings) ts25-boost: reduced visible PWM, made party strobe less blurry wurkkos-ts25-boost: calibrated the battery voltage measurements attiny1616 mcu_vdivider_raw2cooked: factor in the offset, not just slope added wurkkos-ts25-boost (early version made from spec, no clue if it works) # Conflicts: # MODELS
Diffstat (limited to 'arch')
-rw-r--r--arch/attiny1616.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/attiny1616.c b/arch/attiny1616.c
index 02e64b1..5d46111 100644
--- a/arch/attiny1616.c
+++ b/arch/attiny1616.c
@@ -129,14 +129,15 @@ inline uint16_t mcu_vdd_raw2fine(uint16_t measurement) {
#ifdef USE_VOLTAGE_DIVIDER
inline uint8_t mcu_vdivider_raw2cooked(uint16_t measurement) {
- // In : 4095 * Vdiv / 1.1V
+ // In : (4095 * Vdiv / 1.1V) << 4
// Out: uint8_t: Vbat * 50
// Vdiv = Vbat / 4.3 (typically)
// 1.1 = ADC Vref
const uint16_t adc_per_volt =
(((uint16_t)ADC_44 << 4) - ((uint16_t)ADC_22 << 4))
/ (dV * (44-22));
- uint8_t result = measurement / adc_per_volt;
+ const uint16_t adc_offset = (ADC_22 - (ADC_44 - ADC_22)) << 4;
+ uint8_t result = (measurement - adc_offset) / adc_per_volt;
return result;
}
#endif