From 8d022eba3b741bd2a1253df09c01d75e340b492a Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 3 Nov 2023 06:39:50 -0600 Subject: renamed cfg.h -> anduril.h so each UI can have its own cfg (part 1) (still need to update file contents afterward, but doing it in a separate commit so git can detect renames easier) --- .../boost-fwaa-mp3432-hdr-dac-rgb/anduril.h | 116 ++++++++++++++++++++ hw/thefreeman/boost-fwaa-mp3432-hdr-dac-rgb/cfg.h | 116 -------------------- .../boost21-mp3431-hdr-dac-argb/anduril.h | 119 +++++++++++++++++++++ hw/thefreeman/boost21-mp3431-hdr-dac-argb/cfg.h | 119 --------------------- hw/thefreeman/lin16dac/anduril.h | 61 +++++++++++ hw/thefreeman/lin16dac/cfg.h | 61 ----------- 6 files changed, 296 insertions(+), 296 deletions(-) create mode 100644 hw/thefreeman/boost-fwaa-mp3432-hdr-dac-rgb/anduril.h delete mode 100644 hw/thefreeman/boost-fwaa-mp3432-hdr-dac-rgb/cfg.h create mode 100644 hw/thefreeman/boost21-mp3431-hdr-dac-argb/anduril.h delete mode 100644 hw/thefreeman/boost21-mp3431-hdr-dac-argb/cfg.h create mode 100644 hw/thefreeman/lin16dac/anduril.h delete mode 100644 hw/thefreeman/lin16dac/cfg.h (limited to 'hw/thefreeman') diff --git a/hw/thefreeman/boost-fwaa-mp3432-hdr-dac-rgb/anduril.h b/hw/thefreeman/boost-fwaa-mp3432-hdr-dac-rgb/anduril.h new file mode 100644 index 0000000..e30a218 --- /dev/null +++ b/hw/thefreeman/boost-fwaa-mp3432-hdr-dac-rgb/anduril.h @@ -0,0 +1,116 @@ +// thefreeman's BCK-FWAA-MP3432 (li-ion / AA) +// Copyright (C) 2023 TBD (thefreeman), Selene ToyKeeper +// SPDX-License-Identifier: GPL-3.0-or-later +#pragma once + +#define MODEL_NUMBER "1632" +#include "thefreeman/boost-fwaa-mp3432-hdr-dac-rgb/hwdef.h" +// ATTINY: 1616 + +// HPRsense : 4.2+0.3+20 = 24.5mR (DMN1004UFDF+trace resistance+20mR) +// R1=165k Vsense=49.02 Iout=2001mA +// LPRsense : 2R +// transition DAC lvl 14, ramp lvl 51 +// fifth power ramp 0.06mA to 2001mA + +#define RAMP_SIZE 150 + +// 4 ramp segments: +// - low 0.55V +// - low 2.5V +// - high 0.55V +// - high 2.5V +// PWM1: DAC Data +#define PWM1_LEVELS 2, 3, 4, 5, 6, 8, 9, 11, 14, 16, 19, 23, 26, 31, 35, 41, 47, 54, 61, 69, 78, 89,100,112,125,140,155,173,191,212,234, \ + 56, 62, 68, 74, 82, 89, 97,106,115,125,136,147,159,172,186,200,215,232,249, \ + 14, 15, 17, 18, 19, 20, 22, 23, 25, 26, 28, 30, 32, 34, 36, 38, 40, 43, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81, 86, 90, 95, 99,104,109,114,120,126,131,138,144,150,157,164,171,179,187,195,203,212,221,230,239,249, \ + 57, 59, 61, 64, 66, 69, 72, 74, 77, 80, 83, 86, 90, 93, 96,100,103,107,111,115,119,123,127,132,136,141,145,150,155,160,166,171,176,182,188,194,200,206,213,219,226,233,240,247,255 +// PWM Tops: VREF selector (0.55V=16,1.1V=17, 2.5V=18, 4.3V=19, 1.5V=20) +#define PWM_TOPS 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \ + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, \ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \ + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 + +#define MAX_1x7135 50 +#define DEFAULT_LEVEL 44 +#define HDR_ENABLE_LEVEL_MIN 51 // when HDR FET turns ON + +// no PWM, so MCU clock speed can be slow +#define HALFSPEED_LEVEL 46 +#define QUARTERSPEED_LEVEL 45 // seems to run fine at 10kHz/4, try reducing more + +#define RAMP_SMOOTH_FLOOR 1 +#define RAMP_SMOOTH_CEIL 130 // ~50% power, ~??? mA / ??? lm +#define RAMP_DISCRETE_FLOOR 1 +#define RAMP_DISCRETE_CEIL 130 +#define RAMP_DISCRETE_STEPS 7 + +// 20 [45] 70 95 120 +#define SIMPLE_UI_FLOOR 20 +#define SIMPLE_UI_CEIL 120 // ~37% power, ~??? mA / ??? lm +#define SIMPLE_UI_STEPS 5 + +// don't blink mid-ramp +#ifdef BLINK_AT_RAMP_MIDDLE +#undef BLINK_AT_RAMP_MIDDLE +#endif + +// thermal config + +// temperature limit +#define THERM_FASTER_LEVEL 130 +#define MIN_THERM_STEPDOWN MAX_1x7135 + +//#define THERM_LOOKAHEAD 2 // 4 by default -> decrease for longer turbo +//#define THERM_NEXT_WARNING_THRESHOLD 48 // 24 by default -> increase for fewer adjustments (more stable output on large time scale) +//#define THERM_RESPONSE_MAGNITUDE 16 // 64 by default -> decrease for smaller adjustments (removes dip post turbo) +//#define THERM_WINDOW_SIZE 1 // 2 by default -> decrease for tighter temperature regulation + + +// UI + +//#define SIMPLE_UI_ACTIVE 0 // advanced UI by default + +// allow Aux Config and Strobe Modes in Simple UI +#define USE_EXTENDED_SIMPLE_UI + +// Allow 3C in Simple UI for switching between smooth and stepped ramping +#define USE_SIMPLE_UI_RAMPING_TOGGLE + +#define DEFAULT_2C_STYLE 1 // enable 2 click turbo + + +// AUX + +// this light has three aux LED channels: R, G, B +#define USE_AUX_RGB_LEDS + +// show each channel while it scroll by in the menu +#define USE_CONFIG_COLORS + +// blink numbers on the main LEDs by default +#define DEFAULT_BLINK_CHANNEL CM_MAIN + +// use aux red + aux blue for police strobe +#define USE_POLICE_COLOR_STROBE_MODE +#define POLICE_STROBE_USES_AUX +#define POLICE_COLOR_STROBE_CH1 CM_AUXRED +#define POLICE_COLOR_STROBE_CH2 CM_AUXBLU + +// the aux LEDs are front-facing, so turn them off while main LEDs are on +#ifdef USE_INDICATOR_LED_WHILE_RAMPING +#undef USE_INDICATOR_LED_WHILE_RAMPING +#endif + + +// Misc + +#define PARTY_STROBE_ONTIME 1 // slow down party strobe +#define STROBE_OFF_LEVEL 1 // keep the regulator chip on between pulses + +// smoother candle mode with bigger oscillations +#define CANDLE_AMPLITUDE 40 + +// enable 13H factory reset so it can be used on tail e-switch lights +#define USE_SOFT_FACTORY_RESET + diff --git a/hw/thefreeman/boost-fwaa-mp3432-hdr-dac-rgb/cfg.h b/hw/thefreeman/boost-fwaa-mp3432-hdr-dac-rgb/cfg.h deleted file mode 100644 index e30a218..0000000 --- a/hw/thefreeman/boost-fwaa-mp3432-hdr-dac-rgb/cfg.h +++ /dev/null @@ -1,116 +0,0 @@ -// thefreeman's BCK-FWAA-MP3432 (li-ion / AA) -// Copyright (C) 2023 TBD (thefreeman), Selene ToyKeeper -// SPDX-License-Identifier: GPL-3.0-or-later -#pragma once - -#define MODEL_NUMBER "1632" -#include "thefreeman/boost-fwaa-mp3432-hdr-dac-rgb/hwdef.h" -// ATTINY: 1616 - -// HPRsense : 4.2+0.3+20 = 24.5mR (DMN1004UFDF+trace resistance+20mR) -// R1=165k Vsense=49.02 Iout=2001mA -// LPRsense : 2R -// transition DAC lvl 14, ramp lvl 51 -// fifth power ramp 0.06mA to 2001mA - -#define RAMP_SIZE 150 - -// 4 ramp segments: -// - low 0.55V -// - low 2.5V -// - high 0.55V -// - high 2.5V -// PWM1: DAC Data -#define PWM1_LEVELS 2, 3, 4, 5, 6, 8, 9, 11, 14, 16, 19, 23, 26, 31, 35, 41, 47, 54, 61, 69, 78, 89,100,112,125,140,155,173,191,212,234, \ - 56, 62, 68, 74, 82, 89, 97,106,115,125,136,147,159,172,186,200,215,232,249, \ - 14, 15, 17, 18, 19, 20, 22, 23, 25, 26, 28, 30, 32, 34, 36, 38, 40, 43, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81, 86, 90, 95, 99,104,109,114,120,126,131,138,144,150,157,164,171,179,187,195,203,212,221,230,239,249, \ - 57, 59, 61, 64, 66, 69, 72, 74, 77, 80, 83, 86, 90, 93, 96,100,103,107,111,115,119,123,127,132,136,141,145,150,155,160,166,171,176,182,188,194,200,206,213,219,226,233,240,247,255 -// PWM Tops: VREF selector (0.55V=16,1.1V=17, 2.5V=18, 4.3V=19, 1.5V=20) -#define PWM_TOPS 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \ - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, \ - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \ - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 - -#define MAX_1x7135 50 -#define DEFAULT_LEVEL 44 -#define HDR_ENABLE_LEVEL_MIN 51 // when HDR FET turns ON - -// no PWM, so MCU clock speed can be slow -#define HALFSPEED_LEVEL 46 -#define QUARTERSPEED_LEVEL 45 // seems to run fine at 10kHz/4, try reducing more - -#define RAMP_SMOOTH_FLOOR 1 -#define RAMP_SMOOTH_CEIL 130 // ~50% power, ~??? mA / ??? lm -#define RAMP_DISCRETE_FLOOR 1 -#define RAMP_DISCRETE_CEIL 130 -#define RAMP_DISCRETE_STEPS 7 - -// 20 [45] 70 95 120 -#define SIMPLE_UI_FLOOR 20 -#define SIMPLE_UI_CEIL 120 // ~37% power, ~??? mA / ??? lm -#define SIMPLE_UI_STEPS 5 - -// don't blink mid-ramp -#ifdef BLINK_AT_RAMP_MIDDLE -#undef BLINK_AT_RAMP_MIDDLE -#endif - -// thermal config - -// temperature limit -#define THERM_FASTER_LEVEL 130 -#define MIN_THERM_STEPDOWN MAX_1x7135 - -//#define THERM_LOOKAHEAD 2 // 4 by default -> decrease for longer turbo -//#define THERM_NEXT_WARNING_THRESHOLD 48 // 24 by default -> increase for fewer adjustments (more stable output on large time scale) -//#define THERM_RESPONSE_MAGNITUDE 16 // 64 by default -> decrease for smaller adjustments (removes dip post turbo) -//#define THERM_WINDOW_SIZE 1 // 2 by default -> decrease for tighter temperature regulation - - -// UI - -//#define SIMPLE_UI_ACTIVE 0 // advanced UI by default - -// allow Aux Config and Strobe Modes in Simple UI -#define USE_EXTENDED_SIMPLE_UI - -// Allow 3C in Simple UI for switching between smooth and stepped ramping -#define USE_SIMPLE_UI_RAMPING_TOGGLE - -#define DEFAULT_2C_STYLE 1 // enable 2 click turbo - - -// AUX - -// this light has three aux LED channels: R, G, B -#define USE_AUX_RGB_LEDS - -// show each channel while it scroll by in the menu -#define USE_CONFIG_COLORS - -// blink numbers on the main LEDs by default -#define DEFAULT_BLINK_CHANNEL CM_MAIN - -// use aux red + aux blue for police strobe -#define USE_POLICE_COLOR_STROBE_MODE -#define POLICE_STROBE_USES_AUX -#define POLICE_COLOR_STROBE_CH1 CM_AUXRED -#define POLICE_COLOR_STROBE_CH2 CM_AUXBLU - -// the aux LEDs are front-facing, so turn them off while main LEDs are on -#ifdef USE_INDICATOR_LED_WHILE_RAMPING -#undef USE_INDICATOR_LED_WHILE_RAMPING -#endif - - -// Misc - -#define PARTY_STROBE_ONTIME 1 // slow down party strobe -#define STROBE_OFF_LEVEL 1 // keep the regulator chip on between pulses - -// smoother candle mode with bigger oscillations -#define CANDLE_AMPLITUDE 40 - -// enable 13H factory reset so it can be used on tail e-switch lights -#define USE_SOFT_FACTORY_RESET - diff --git a/hw/thefreeman/boost21-mp3431-hdr-dac-argb/anduril.h b/hw/thefreeman/boost21-mp3431-hdr-dac-argb/anduril.h new file mode 100644 index 0000000..2ed8fae --- /dev/null +++ b/hw/thefreeman/boost21-mp3431-hdr-dac-argb/anduril.h @@ -0,0 +1,119 @@ +// thefreeman's BST21 BST20-FWxA (no button LED) +// Copyright (C) 2023 TBD (thefreeman), Selene ToyKeeper +// SPDX-License-Identifier: GPL-3.0-or-later +#pragma once + +#define MODEL_NUMBER "1631" +#include "thefreeman/boost21-mp3431-hdr-dac-argb/hwdef.h" +// ATTINY: 1616 + +// HPRsense : 1.7+0.3+5 = 7mR (DMN22M5UFG+trace resistance+5mR) +// Vsense=42.46mV, R1= 191k +// LPRsense : 1R +// transition DAC level 8, ramp level 45 +// fifth power ramp 0.1mA to 6066mA + +#define RAMP_SIZE 150 + +// 4 ramp segments: +// - low 0.55V +// - low 2.5V +// - high 0.55V +// - high 2.5V +// PWM1: DAC Data +#define PWM1_LEVELS 2, 3, 4, 5, 7, 9, 11, 13, 16, 19, 23, 28, 33, 39, 45, 53, 61, 71, 81, 93,106,121,137,155,175,196,220,246, \ + 60, 67, 74, 82, 91,100,110,121,133,146,159,174,190,207,224,244, \ + 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 23, 24, 26, 27, 29, 31, 33, 35, 37, 40, 42, 45, 47, 50, 53, 56, 59, 62, 66, 69, 73, 77, 81, 85, 90, 94, 99,104,109,114,120,126,132,138,144,151,158,165,173,180,188,196,205,214,223,232,242,252, \ + 57, 60, 62, 65, 67, 70, 73, 76, 78, 82, 85, 88, 91, 95, 98,102,105,109,113,117,121,126,130,135,139,144,149,154,159,164,170,175,181,187,193,199,206,212,219,225,232,240,247,255 +// PWM Tops: VREF selector (0.55V=16,1.1V=17, 2.5V=18, 4.3V=19, 1.5V=20) +#define PWM_TOPS 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \ + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, \ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \ + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 + +#define MAX_1x7135 44 +#define DEFAULT_LEVEL 44 +#define HDR_ENABLE_LEVEL_MIN 45 // when HDR FET turns ON + +// no PWM, so MCU clock speed can be slow +#define HALFSPEED_LEVEL 41 +#define QUARTERSPEED_LEVEL 40 // seems to run fine at 10kHz/4, try reducing more + +#define RAMP_SMOOTH_FLOOR 1 +#define RAMP_SMOOTH_CEIL 130 // 50% / 3A / 1000 lm +// 1 22 [44] 65 87 108 130 +#define RAMP_DISCRETE_FLOOR 1 +#define RAMP_DISCRETE_CEIL 130 +#define RAMP_DISCRETE_STEPS 7 + +// 20 [45] 70 95 120 +#define SIMPLE_UI_FLOOR 20 +#define SIMPLE_UI_CEIL 120 // ~2.25A / ~750 lm +#define SIMPLE_UI_STEPS 5 + +// don't blink mid-ramp +#ifdef BLINK_AT_RAMP_MIDDLE +#undef BLINK_AT_RAMP_MIDDLE +#endif + +// thermal config + +// temperature limit +#define THERM_FASTER_LEVEL 130 // stop panicking at 50%/3A +#define MIN_THERM_STEPDOWN MAX_1x7135 + +//#define THERM_LOOKAHEAD 4 // 4 by default -> decrease for longer turbo +#define THERM_NEXT_WARNING_THRESHOLD 48 // 24 by default -> increase for fewer adjustments (more stable output on large time scale) +#define THERM_RESPONSE_MAGNITUDE 32 // 64 by default -> decrease for smaller adjustments (removes dip post turbo) +//#define THERM_WINDOW_SIZE 1 // 2 by default -> decrease for tighter temperature regulation + + +// UI + +//#define SIMPLE_UI_ACTIVE 0 // advanced UI by default + +// allow Aux Config and Strobe Modes in Simple UI +#define USE_EXTENDED_SIMPLE_UI + +// Allow 3C in Simple UI for switching between smooth and stepped ramping +#define USE_SIMPLE_UI_RAMPING_TOGGLE + +#define DEFAULT_2C_STYLE 1 // enable 2 click turbo + + +// AUX + +//#define USE_BUTTON_LED + +// this light has three aux LED channels: R, G, B +#define USE_AUX_RGB_LEDS + +// show each channel while it scroll by in the menu +#define USE_CONFIG_COLORS + +// blink numbers on the main LEDs by default +#define DEFAULT_BLINK_CHANNEL CM_MAIN + +// use aux red + aux blue for police strobe +#define USE_POLICE_COLOR_STROBE_MODE +#define POLICE_STROBE_USES_AUX +#define POLICE_COLOR_STROBE_CH1 CM_AUXRED +#define POLICE_COLOR_STROBE_CH2 CM_AUXBLU + +// the aux LEDs are front-facing, so turn them off while main LEDs are on +#ifdef USE_INDICATOR_LED_WHILE_RAMPING +#undef USE_INDICATOR_LED_WHILE_RAMPING +#endif + + +// Misc + +#define PARTY_STROBE_ONTIME 1 // slow down party strobe +#define STROBE_OFF_LEVEL 1 // keep the regulator chip on between pulses + +// smoother candle mode with bigger oscillations +#define CANDLE_AMPLITUDE 40 + +// enable 13H factory reset so it can be used on tail e-switch lights +#define USE_SOFT_FACTORY_RESET + diff --git a/hw/thefreeman/boost21-mp3431-hdr-dac-argb/cfg.h b/hw/thefreeman/boost21-mp3431-hdr-dac-argb/cfg.h deleted file mode 100644 index 2ed8fae..0000000 --- a/hw/thefreeman/boost21-mp3431-hdr-dac-argb/cfg.h +++ /dev/null @@ -1,119 +0,0 @@ -// thefreeman's BST21 BST20-FWxA (no button LED) -// Copyright (C) 2023 TBD (thefreeman), Selene ToyKeeper -// SPDX-License-Identifier: GPL-3.0-or-later -#pragma once - -#define MODEL_NUMBER "1631" -#include "thefreeman/boost21-mp3431-hdr-dac-argb/hwdef.h" -// ATTINY: 1616 - -// HPRsense : 1.7+0.3+5 = 7mR (DMN22M5UFG+trace resistance+5mR) -// Vsense=42.46mV, R1= 191k -// LPRsense : 1R -// transition DAC level 8, ramp level 45 -// fifth power ramp 0.1mA to 6066mA - -#define RAMP_SIZE 150 - -// 4 ramp segments: -// - low 0.55V -// - low 2.5V -// - high 0.55V -// - high 2.5V -// PWM1: DAC Data -#define PWM1_LEVELS 2, 3, 4, 5, 7, 9, 11, 13, 16, 19, 23, 28, 33, 39, 45, 53, 61, 71, 81, 93,106,121,137,155,175,196,220,246, \ - 60, 67, 74, 82, 91,100,110,121,133,146,159,174,190,207,224,244, \ - 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 23, 24, 26, 27, 29, 31, 33, 35, 37, 40, 42, 45, 47, 50, 53, 56, 59, 62, 66, 69, 73, 77, 81, 85, 90, 94, 99,104,109,114,120,126,132,138,144,151,158,165,173,180,188,196,205,214,223,232,242,252, \ - 57, 60, 62, 65, 67, 70, 73, 76, 78, 82, 85, 88, 91, 95, 98,102,105,109,113,117,121,126,130,135,139,144,149,154,159,164,170,175,181,187,193,199,206,212,219,225,232,240,247,255 -// PWM Tops: VREF selector (0.55V=16,1.1V=17, 2.5V=18, 4.3V=19, 1.5V=20) -#define PWM_TOPS 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \ - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, \ - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \ - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 - -#define MAX_1x7135 44 -#define DEFAULT_LEVEL 44 -#define HDR_ENABLE_LEVEL_MIN 45 // when HDR FET turns ON - -// no PWM, so MCU clock speed can be slow -#define HALFSPEED_LEVEL 41 -#define QUARTERSPEED_LEVEL 40 // seems to run fine at 10kHz/4, try reducing more - -#define RAMP_SMOOTH_FLOOR 1 -#define RAMP_SMOOTH_CEIL 130 // 50% / 3A / 1000 lm -// 1 22 [44] 65 87 108 130 -#define RAMP_DISCRETE_FLOOR 1 -#define RAMP_DISCRETE_CEIL 130 -#define RAMP_DISCRETE_STEPS 7 - -// 20 [45] 70 95 120 -#define SIMPLE_UI_FLOOR 20 -#define SIMPLE_UI_CEIL 120 // ~2.25A / ~750 lm -#define SIMPLE_UI_STEPS 5 - -// don't blink mid-ramp -#ifdef BLINK_AT_RAMP_MIDDLE -#undef BLINK_AT_RAMP_MIDDLE -#endif - -// thermal config - -// temperature limit -#define THERM_FASTER_LEVEL 130 // stop panicking at 50%/3A -#define MIN_THERM_STEPDOWN MAX_1x7135 - -//#define THERM_LOOKAHEAD 4 // 4 by default -> decrease for longer turbo -#define THERM_NEXT_WARNING_THRESHOLD 48 // 24 by default -> increase for fewer adjustments (more stable output on large time scale) -#define THERM_RESPONSE_MAGNITUDE 32 // 64 by default -> decrease for smaller adjustments (removes dip post turbo) -//#define THERM_WINDOW_SIZE 1 // 2 by default -> decrease for tighter temperature regulation - - -// UI - -//#define SIMPLE_UI_ACTIVE 0 // advanced UI by default - -// allow Aux Config and Strobe Modes in Simple UI -#define USE_EXTENDED_SIMPLE_UI - -// Allow 3C in Simple UI for switching between smooth and stepped ramping -#define USE_SIMPLE_UI_RAMPING_TOGGLE - -#define DEFAULT_2C_STYLE 1 // enable 2 click turbo - - -// AUX - -//#define USE_BUTTON_LED - -// this light has three aux LED channels: R, G, B -#define USE_AUX_RGB_LEDS - -// show each channel while it scroll by in the menu -#define USE_CONFIG_COLORS - -// blink numbers on the main LEDs by default -#define DEFAULT_BLINK_CHANNEL CM_MAIN - -// use aux red + aux blue for police strobe -#define USE_POLICE_COLOR_STROBE_MODE -#define POLICE_STROBE_USES_AUX -#define POLICE_COLOR_STROBE_CH1 CM_AUXRED -#define POLICE_COLOR_STROBE_CH2 CM_AUXBLU - -// the aux LEDs are front-facing, so turn them off while main LEDs are on -#ifdef USE_INDICATOR_LED_WHILE_RAMPING -#undef USE_INDICATOR_LED_WHILE_RAMPING -#endif - - -// Misc - -#define PARTY_STROBE_ONTIME 1 // slow down party strobe -#define STROBE_OFF_LEVEL 1 // keep the regulator chip on between pulses - -// smoother candle mode with bigger oscillations -#define CANDLE_AMPLITUDE 40 - -// enable 13H factory reset so it can be used on tail e-switch lights -#define USE_SOFT_FACTORY_RESET - diff --git a/hw/thefreeman/lin16dac/anduril.h b/hw/thefreeman/lin16dac/anduril.h new file mode 100644 index 0000000..62230e8 --- /dev/null +++ b/hw/thefreeman/lin16dac/anduril.h @@ -0,0 +1,61 @@ +// thefreeman's Linear 16 driver using DAC control +// Copyright (C) 2021-2023 (FIXME) +// SPDX-License-Identifier: GPL-3.0-or-later +#pragma once + +#define MODEL_NUMBER "1630" +#include "thefreeman/lin16dac/hwdef.h" +// ATTINY: 1616 + +// the button lights up +#define USE_INDICATOR_LED +// the button is visible while main LEDs are on +#define USE_INDICATOR_LED_WHILE_RAMPING +// off mode: low (1) +// lockout: blinking (3) +#define INDICATOR_LED_DEFAULT_MODE ((3<<2) + 1) + +// level_calc.py ninth 2 150 7135 1 0.03 6.4 7135 1 6.3 1600 +#define RAMP_SIZE 150 + +// 4 ramp segments: +// - low 0.55V +// - low 2.5V +// - high 0.55V +// - high 2.5V +// PWM1: DAC Data +// FIXME: ramp stalls with 8 duplicate levels in a row +// (maybe use 1.1V Vref during that part of the ramp?) +#define PWM1_LEVELS 25, 25, 33, 41, 41, 50, 58, 66, 75, 83, 92,108,117,133,150,167,192,209,234, \ + 58, 64, 71, 80, 90, 99,110,121,134,149,163,180,198,218,241, \ + 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 18, 19, 20, 22, 23, 25, 26, 28, 30, 32, 34, 36, 39, 41, 44, 47, 50, 53, 56, 59, 63, 67, 71, 75, 79, 84, 89, 94,100,105,112,118,124,131,139,146,154,163,172,181,191,201,212,223,234,246, \ + 57, 60, 63, 66, 69, 73, 76, 80, 84, 88, 93, 97,102,107,112,117,123,129,135,141,147,154,161,169,176,184,193,201,210,220,229,239,250,255 +// PWM Tops: VREF selector (0.55V=16,1.1V=17, 2.5V=18, 4.3V=19, 1.5V=20) +#define PWM_TOPS 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \ + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, \ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \ + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 + +#define MAX_1x7135 34 +#define HDR_ENABLE_LEVEL_MIN 35 // bottom level of top half of the ramp +#define HALFSPEED_LEVEL 255 // always run at 1/4th speed +#define QUARTERSPEED_LEVEL 255 // because DAC doesn't use PWM + +#define RAMP_SMOOTH_FLOOR 1 +#define RAMP_SMOOTH_CEIL 120 +// 10, 28, 46, [65], 83, 101, 120 +#define RAMP_DISCRETE_FLOOR 10 +#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL +#define RAMP_DISCRETE_STEPS 7 + +// stop panicking at ~30% power +#define THERM_FASTER_LEVEL 123 + +// enable 2 click turbo +#define DEFAULT_2C_STYLE 1 + +// don't blink mid-ramp +#ifdef BLINK_AT_RAMP_MIDDLE +#undef BLINK_AT_RAMP_MIDDLE +#endif + diff --git a/hw/thefreeman/lin16dac/cfg.h b/hw/thefreeman/lin16dac/cfg.h deleted file mode 100644 index 62230e8..0000000 --- a/hw/thefreeman/lin16dac/cfg.h +++ /dev/null @@ -1,61 +0,0 @@ -// thefreeman's Linear 16 driver using DAC control -// Copyright (C) 2021-2023 (FIXME) -// SPDX-License-Identifier: GPL-3.0-or-later -#pragma once - -#define MODEL_NUMBER "1630" -#include "thefreeman/lin16dac/hwdef.h" -// ATTINY: 1616 - -// the button lights up -#define USE_INDICATOR_LED -// the button is visible while main LEDs are on -#define USE_INDICATOR_LED_WHILE_RAMPING -// off mode: low (1) -// lockout: blinking (3) -#define INDICATOR_LED_DEFAULT_MODE ((3<<2) + 1) - -// level_calc.py ninth 2 150 7135 1 0.03 6.4 7135 1 6.3 1600 -#define RAMP_SIZE 150 - -// 4 ramp segments: -// - low 0.55V -// - low 2.5V -// - high 0.55V -// - high 2.5V -// PWM1: DAC Data -// FIXME: ramp stalls with 8 duplicate levels in a row -// (maybe use 1.1V Vref during that part of the ramp?) -#define PWM1_LEVELS 25, 25, 33, 41, 41, 50, 58, 66, 75, 83, 92,108,117,133,150,167,192,209,234, \ - 58, 64, 71, 80, 90, 99,110,121,134,149,163,180,198,218,241, \ - 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 18, 19, 20, 22, 23, 25, 26, 28, 30, 32, 34, 36, 39, 41, 44, 47, 50, 53, 56, 59, 63, 67, 71, 75, 79, 84, 89, 94,100,105,112,118,124,131,139,146,154,163,172,181,191,201,212,223,234,246, \ - 57, 60, 63, 66, 69, 73, 76, 80, 84, 88, 93, 97,102,107,112,117,123,129,135,141,147,154,161,169,176,184,193,201,210,220,229,239,250,255 -// PWM Tops: VREF selector (0.55V=16,1.1V=17, 2.5V=18, 4.3V=19, 1.5V=20) -#define PWM_TOPS 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \ - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, \ - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \ - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 - -#define MAX_1x7135 34 -#define HDR_ENABLE_LEVEL_MIN 35 // bottom level of top half of the ramp -#define HALFSPEED_LEVEL 255 // always run at 1/4th speed -#define QUARTERSPEED_LEVEL 255 // because DAC doesn't use PWM - -#define RAMP_SMOOTH_FLOOR 1 -#define RAMP_SMOOTH_CEIL 120 -// 10, 28, 46, [65], 83, 101, 120 -#define RAMP_DISCRETE_FLOOR 10 -#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL -#define RAMP_DISCRETE_STEPS 7 - -// stop panicking at ~30% power -#define THERM_FASTER_LEVEL 123 - -// enable 2 click turbo -#define DEFAULT_2C_STYLE 1 - -// don't blink mid-ramp -#ifdef BLINK_AT_RAMP_MIDDLE -#undef BLINK_AT_RAMP_MIDDLE -#endif - -- cgit v1.2.3