diff options
| author | Selene ToyKeeper | 2026-02-23 23:59:50 -0700 |
|---|---|---|
| committer | Selene ToyKeeper | 2026-02-23 23:59:50 -0700 |
| commit | a7dc5522be7220590fe347585a4bb5d7827b10fc (patch) | |
| tree | b2f85f0ddf7e69de90d3e26e40d7e75733486e4a /hw/hank/emisar-d3aa/hwdef.c | |
| parent | added documentation section for Post-Off Voltage Display (POVD) (diff) | |
| download | anduril-a7dc5522be7220590fe347585a4bb5d7827b10fc.tar.gz anduril-a7dc5522be7220590fe347585a4bb5d7827b10fc.tar.bz2 anduril-a7dc5522be7220590fe347585a4bb5d7827b10fc.zip | |
added &hank-kr1aa build for new Emisar / Noctigon KR1AA
It's the same as &hank-emisar-d3aa, but needed some minor tweaks:
- wait longer before measuring the battery,
because it's hard to tighten the tailcap fast enough
- ramp adjustments to compensate for slightly different "gear ratio"
Diffstat (limited to 'hw/hank/emisar-d3aa/hwdef.c')
| -rw-r--r-- | hw/hank/emisar-d3aa/hwdef.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/hw/hank/emisar-d3aa/hwdef.c b/hw/hank/emisar-d3aa/hwdef.c index 0ac0ddc..e6caf46 100644 --- a/hw/hank/emisar-d3aa/hwdef.c +++ b/hw/hank/emisar-d3aa/hwdef.c @@ -64,17 +64,17 @@ void set_level_main(uint8_t level) { PWM1_DATATYPE dac_lvl = PWM1_GET(level) << 6; PWM2_DATATYPE dac_vref = PWM2_GET(level); + // set these in successive clock cycles to avoid getting out of sync + // (minimizes ramp bumps when changing gears) + DAC_LVL = dac_lvl; + DAC_VREF = dac_vref; + // enable HDR on top half of ramp if (level >= (HDR_ENABLE_LEVEL_MIN-1)) HDR_ENABLE_PORT |= (1 << HDR_ENABLE_PIN); else HDR_ENABLE_PORT &= ~(1 << HDR_ENABLE_PIN); - // set these in successive clock cycles to avoid getting out of sync - // (minimizes ramp bumps when changing gears) - DAC_LVL = dac_lvl; - DAC_VREF = dac_vref; - // if turning on from off, let things stabilize before enabling power if (noflash) { nfet_delay(); } @@ -146,9 +146,17 @@ void detect_weak_battery() { uint16_t resting, loaded; - // baseline unloaded measurement set_level(0); - for (uint8_t i=0; i<32; i++) { delay_zero(); } // wait about 10ms + + // wait a moment so user can tighten the tailcap + #ifdef WEAK_BATTERY_TEST_DELAY + for (uint16_t i=0; i<(WEAK_BATTERY_TEST_DELAY * 2 / 3); i++) + delay_zero(); + #else + for (uint8_t i=0; i<32; i++) delay_zero(); // wait about 10ms + #endif + + // baseline unloaded measurement //resting = voltage_raw2cooked(adc_smooth[0]); // probably not settled yet resting = quick_volt_measurement(); |
