diff options
| author | Selene ToyKeeper | 2024-08-19 13:10:04 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2024-08-19 13:10:04 -0600 |
| commit | 4c2bbf92194ff5f41a87baa95c5388b325a27d2d (patch) | |
| tree | 2d2b51fc3ef800e55009bc5f01ef7119d4c32d6e /arch | |
| parent | ts25-boost: reduced visible PWM, made party strobe less blurry (diff) | |
| parent | removed "Off -> 3H" strobe/mood mode access from Extended Simple UI (diff) | |
| download | anduril-4c2bbf92194ff5f41a87baa95c5388b325a27d2d.tar.gz anduril-4c2bbf92194ff5f41a87baa95c5388b325a27d2d.tar.bz2 anduril-4c2bbf92194ff5f41a87baa95c5388b325a27d2d.zip | |
Merge branch 'trunk' into wurkkos-ts25-boost
# By Selene ToyKeeper (20) and others
* trunk: (25 commits)
removed "Off -> 3H" strobe/mood mode access from Extended Simple UI
include hardware-specific readme files in the release .zip
added change log for 2024-04-20 release
Forgot to update model count after the last couple additions
use low aux for chan-aux level 0
MODELS: added emisar-d3aa
make-release.sh should use version-string.sh instead of duplicating code
d3aa: fixed voltage calculation to use 0.02V units instead of 0.025V
d3aa weak battery test: blink 3x instead of 2x, and omit number readout
use smooth steps in lockout mode, if enabled
fixed Tactical Mode's strobes when Momentary Mode not enabled
increased voltage precision from 0.025V to 0.02V (so 0 to 255 now goes from 0.00V to 5.10V)
weak battery detection: use different thresholds for AA and Li-Ion (also, fixed bug where a totally empty li-ion didn't get limited)
d3aa: got weak battery detection actually working, and not letting the magic smoke out of updi adapters any more (probably)
dammit, got alkaline detection half working and then my flashing adapter died (saving progress here so I can work on a different branch)
fixed inaccurate comment (thanks to xikteny for spotting it)
d3aa fine-tuning: - new ramp - production style config defaults (simple mode, Hank config) - candle tuning - fixed way-too-fast thermal regulation (might still be a bit fast, but it's a lot better)
d3aa: fixed voltage measurement
Allow manually running GitHub actions workflows
Bugfix: Prevent switching channel modes when in tactical mode
...
# Conflicts:
# arch/attiny1616.c (fixed)
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/attiny1616.c | 12 | ||||
| -rw-r--r-- | arch/attiny1616.h | 2 | ||||
| -rw-r--r-- | arch/attiny1634.c | 12 | ||||
| -rw-r--r-- | arch/attiny1634.h | 2 | ||||
| -rw-r--r-- | arch/attiny85.c | 10 | ||||
| -rw-r--r-- | arch/attiny85.h | 2 | ||||
| -rw-r--r-- | arch/avr32dd20.c | 6 | ||||
| -rw-r--r-- | arch/avr32dd20.h | 2 |
8 files changed, 24 insertions, 24 deletions
diff --git a/arch/attiny1616.c b/arch/attiny1616.c index 317552d..5d46111 100644 --- a/arch/attiny1616.c +++ b/arch/attiny1616.c @@ -104,18 +104,18 @@ inline uint16_t mcu_adc_result_volts() { inline uint8_t mcu_vdd_raw2cooked(uint16_t measurement) { // In : 65535 * 1.5 / Vbat - // Out: uint8_t: Vbat * 40 + // Out: uint8_t: Vbat * 50 // 1.5 = ADC Vref #if 0 // 1024 = how much ADC resolution we're using (10 bits) // (12 bits available, but it costs an extra 84 bytes of ROM to calculate) - uint8_t vbat40 = (uint16_t)(40 * 1.5 * 1024) / (measurement >> 6); + uint8_t vbat = (uint16_t)(10 * dV * 1.5 * 1024) / (measurement >> 6); #else // ... spend the extra 84 bytes of ROM for better precision // 4096 = how much ADC resolution we're using (12 bits) - uint8_t vbat40 = (uint32_t)(40 * 1.5 * 4096) / (measurement >> 4); + uint8_t vbat = (uint32_t)(10 * dV * 1.5 * 4096) / (measurement >> 4); #endif - return vbat40; + return vbat; } #if 0 // fine voltage, 0 to 10.24V in 1/6400th V steps @@ -130,12 +130,12 @@ 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) << 4 - // Out: uint8_t: Vbat * 40 + // 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)) - / (4 * (44-22)); + / (dV * (44-22)); const uint16_t adc_offset = (ADC_22 - (ADC_44 - ADC_22)) << 4; uint8_t result = (measurement - adc_offset) / adc_per_volt; return result; diff --git a/arch/attiny1616.h b/arch/attiny1616.h index 940973e..711452d 100644 --- a/arch/attiny1616.h +++ b/arch/attiny1616.h @@ -85,7 +85,7 @@ inline void mcu_adc_vect_clear(); inline uint16_t mcu_adc_result_temp(); inline uint16_t mcu_adc_result_volts(); -// return Volts * 40, range 0 to 6.375V +// return Volts * 50, range 0 to 5.10V #define voltage_raw2cooked mcu_vdd_raw2cooked inline uint8_t mcu_vdd_raw2cooked(uint16_t measurement); inline uint8_t mcu_vdivider_raw2cooked(uint16_t measurement); diff --git a/arch/attiny1634.c b/arch/attiny1634.c index e29d1c3..314ca52 100644 --- a/arch/attiny1634.c +++ b/arch/attiny1634.c @@ -97,30 +97,30 @@ inline uint16_t mcu_adc_result() { inline uint8_t mcu_vdd_raw2cooked(uint16_t measurement) { // In : 65535 * 1.1 / Vbat - // Out: uint8_t: Vbat * 40 + // Out: uint8_t: Vbat * 50 // 1.1 = ADC Vref #if 0 // 1024 = how much ADC resolution we're using (10 bits) // (12 bits available, but it costs an extra 84 bytes of ROM to calculate) - uint8_t vbat40 = (uint16_t)(40 * 1.1 * 1024) / (measurement >> 6); + uint8_t vbat = (uint16_t)(10 * dV * 1.1 * 1024) / (measurement >> 6); #else // ... spend the extra 84 bytes of ROM for better precision // 4096 = how much ADC resolution we're using (12 bits) - uint8_t vbat40 = (uint32_t)(40 * 1.1 * 4096) / (measurement >> 4); + uint8_t vbat = (uint32_t)(10 * dV * 1.1 * 4096) / (measurement >> 4); #endif - return vbat40; + return vbat; } #ifdef USE_VOLTAGE_DIVIDER inline uint8_t mcu_vdivider_raw2cooked(uint16_t measurement) { // In : 4095 * Vdiv / 1.1V - // Out: uint8_t: Vbat * 40 + // 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)) - / (4 * (44-22)); + / (dV * (44-22)); uint8_t result = measurement / adc_per_volt; return result; } diff --git a/arch/attiny1634.h b/arch/attiny1634.h index 559d04e..19920fe 100644 --- a/arch/attiny1634.h +++ b/arch/attiny1634.h @@ -66,7 +66,7 @@ inline void mcu_adc_off(); inline uint16_t mcu_adc_result(); -// return Volts * 40, range 0 to 6.375V +// return Volts * 50, range 0 to 5.10V #define voltage_raw2cooked mcu_vdd_raw2cooked inline uint8_t mcu_vdd_raw2cooked(uint16_t measurement); inline uint8_t mcu_vdivider_raw2cooked(uint16_t measurement); diff --git a/arch/attiny85.c b/arch/attiny85.c index 9e298cc..4ca4b87 100644 --- a/arch/attiny85.c +++ b/arch/attiny85.c @@ -103,24 +103,24 @@ inline uint16_t mcu_adc_result() { return ADC; } inline uint8_t mcu_vdd_raw2cooked(uint16_t measurement) { // In : 65535 * 1.1 / Vbat - // Out: uint8_t: Vbat * 40 + // Out: uint8_t: Vbat * 50 // 1.1 = ADC Vref // 1024 = how much ADC resolution we're using (10 bits) // (12 bits available, but it costs an extra 84 bytes of ROM to calculate) - uint8_t vbat40 = (uint16_t)(40 * 1.1 * 1024) / (measurement >> 6); - return vbat40; + uint8_t vbat = (uint16_t)(10 * dV * 1.1 * 1024) / (measurement >> 6); + return vbat; } #ifdef USE_VOLTAGE_DIVIDER inline uint8_t mcu_vdivider_raw2cooked(uint16_t measurement) { // In : 4095 * Vdiv / 1.1V - // Out: uint8_t: Vbat * 40 + // 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)) - / (4 * (44-22)); + / (dV * (44-22)); uint8_t result = measurement / adc_per_volt; return result; } diff --git a/arch/attiny85.h b/arch/attiny85.h index 3f6ffcb..06a1061 100644 --- a/arch/attiny85.h +++ b/arch/attiny85.h @@ -53,7 +53,7 @@ inline void mcu_adc_off(); inline uint16_t mcu_adc_result(); -// return Volts * 40, range 0 to 6.375V +// return Volts * 50, range 0 to 5.10V #define voltage_raw2cooked mcu_vdd_raw2cooked inline uint8_t mcu_vdd_raw2cooked(uint16_t measurement); inline uint8_t mcu_vdivider_raw2cooked(uint16_t measurement); diff --git a/arch/avr32dd20.c b/arch/avr32dd20.c index 2ac3526..3ada2ee 100644 --- a/arch/avr32dd20.c +++ b/arch/avr32dd20.c @@ -141,10 +141,10 @@ inline uint16_t mcu_adc_result() { inline uint8_t mcu_vdd_raw2cooked(uint16_t measurement) { // In : 65535 * (Vbat / 10) / 1.024V - // Out: uint8_t: Vbat * 40 + // Out: uint8_t: Vbat * 50 // (add 80 to round up near a boundary) - uint8_t vbat40 = (uint16_t)(measurement + 80) / 160; - return vbat40; + uint8_t vbat50 = (uint16_t)(measurement + 64) / 128; + return vbat50; } #if 0 diff --git a/arch/avr32dd20.h b/arch/avr32dd20.h index 09b4096..7d06863 100644 --- a/arch/avr32dd20.h +++ b/arch/avr32dd20.h @@ -71,7 +71,7 @@ inline uint16_t mcu_adc_result(); //inline uint16_t mcu_adc_result_temp(); //inline uint16_t mcu_adc_result_volts(); -// return Volts * 40, range 0 to 6.375V +// return Volts * 50, range 0 to 5.10V #define voltage_raw2cooked mcu_vdd_raw2cooked inline uint8_t mcu_vdd_raw2cooked(uint16_t measurement); |
