aboutsummaryrefslogtreecommitdiff
path: root/hw/hank/emisar-d3aa/hwdef.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2025-06-04 00:55:40 -0600
committerSelene ToyKeeper2025-06-04 00:55:40 -0600
commitc8a29a67f286d1d9d84ab000697b5727676b8784 (patch)
treec6f1c9758e6ebaf920fd8b6b4c9edf66769e3c41 /hw/hank/emisar-d3aa/hwdef.c
parentts25-boost: calibrated for new prototype (diff)
parentlockout mode now only does momentary moon/low on 1st and 2nd presses, (diff)
downloadanduril-c8a29a67f286d1d9d84ab000697b5727676b8784.tar.gz
anduril-c8a29a67f286d1d9d84ab000697b5727676b8784.tar.bz2
anduril-c8a29a67f286d1d9d84ab000697b5727676b8784.zip
Merge branch 'trunk' into wurkkos-ts25-boost
* trunk: lockout mode now only does momentary moon/low on 1st and 2nd presses, so it no longer flashes on each click while advancing to other functions emisar-d3aa: reduced preflash by changing timing of power enable steps fix "Error: Missing download info for actions/upload-artifact@v3" fixed model number of hank-lume-x1 in MODELS Added changelogs for 2025-04-29 release. memester egg (was written a long time ago on a whim and never committed, may as well do it now) changed hank-lume-x1 model number back on 2024-09-28 for some reason, and didn't commit... saving now to change branches, but should delete this commit if it turns out there was no reason for it hank-lume-x1: minor calibration and cleaning - calibrated party strobe - removed duplicate or commented-out code - added a basic readme hank-lume-x1 cleanup and calibration, part 1: - changed model number from 0281 to 0171 - cleaned up blink_negative and AUXLED_RGB_DIFFERENT_PORTS a little (but the latter needs a complete refactor, as soon as the hardware abstraction code can handle aux LEDs better) - cleaned up USE_LONG_BLINK_FOR_NEGATIVE_SIGN a little - removed USE_OTG_IN_MOMENTARY since it's not actually used - moved hw/loneoceans/lume-x1-avr32dd20/* files into hw/hank/lume-x1/ - superficial cleanup on hank/lume-x1/hwdef.* - removed some of the extra stuff from hank/lume-x1/anduril.h - adjusted calibration (especially ramp table) on hank-lume-x1 (ramp shape is pretty close to a D4K-boost now, but with more firefly modes) (calibration is based on a sample size of 1, further testing needed) cherry-picked hank-lume-x1 code from https://github.com/loneoceans/anduril/commit/d83ebb75dab8c462b7efa841bccc00a136ff15a2 merged SammysHP's fix for TS10 lower-Vf LEDs, reverted my fix (they are now two separate build targets) wurkkos-ts10-rgbaux: limit max power to 200/255, at Wurkkos's request (because otherwise the light destroys its own LEDs at full power) Add Wurkkos TS10 RGB with reduced FET output
Diffstat (limited to 'hw/hank/emisar-d3aa/hwdef.c')
-rw-r--r--hw/hank/emisar-d3aa/hwdef.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/hw/hank/emisar-d3aa/hwdef.c b/hw/hank/emisar-d3aa/hwdef.c
index be673e1..0ac0ddc 100644
--- a/hw/hank/emisar-d3aa/hwdef.c
+++ b/hw/hank/emisar-d3aa/hwdef.c
@@ -22,15 +22,26 @@ Channel channels[] = {
};
+inline void nfet_delay() {
+ #if IN_NFET_DELAY_TIME > 0
+ delay_4ms(IN_NFET_DELAY_TIME/4);
+ #else
+ delay_zero();
+ delay_zero();
+ #endif
+}
+
void set_level_zero() {
DAC_LVL = 0; // DAC off
DAC_VREF = V10; // low Vref
HDR_ENABLE_PORT &= ~(1 << HDR_ENABLE_PIN); // HDR off
- // prevent post-off flash
- IN_NFET_ENABLE_PORT |= (1 << IN_NFET_ENABLE_PIN);
- delay_4ms(IN_NFET_DELAY_TIME/4);
- IN_NFET_ENABLE_PORT &= ~(1 << IN_NFET_ENABLE_PIN);
+ if (actual_level) {
+ // prevent post-off flash
+ IN_NFET_ENABLE_PORT |= (1 << IN_NFET_ENABLE_PIN);
+ nfet_delay();
+ IN_NFET_ENABLE_PORT &= ~(1 << IN_NFET_ENABLE_PIN);
+ }
// turn off boost last
BST_ENABLE_PORT &= ~(1 << BST_ENABLE_PIN); // BST off
@@ -45,11 +56,9 @@ void set_level_main(uint8_t level) {
if ((! actual_level) && (level < HDR_ENABLE_LEVEL_MIN)) {
noflash = 1;
IN_NFET_ENABLE_PORT |= (1 << IN_NFET_ENABLE_PIN);
+ //nfet_delay();
}
- // BST on first, to give it a few extra microseconds to spin up
- BST_ENABLE_PORT |= (1 << BST_ENABLE_PIN);
-
// pre-load ramp data so it can be assigned faster later
// DAC level register is left-aligned
PWM1_DATATYPE dac_lvl = PWM1_GET(level) << 6;
@@ -66,9 +75,15 @@ void set_level_main(uint8_t level) {
DAC_LVL = dac_lvl;
DAC_VREF = dac_vref;
+ // if turning on from off, let things stabilize before enabling power
+ if (noflash) { nfet_delay(); }
+
+ // BST on last, after its inputs are set and stabilized
+ BST_ENABLE_PORT |= (1 << BST_ENABLE_PIN);
+
if (noflash) {
// wait for flash prevention to finish
- delay_4ms(IN_NFET_DELAY_TIME/4);
+ nfet_delay();
IN_NFET_ENABLE_PORT &= ~(1 << IN_NFET_ENABLE_PIN);
}
}