~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/anduril/cfg-emisar-d4v2.h

  • Committer: Selene ToyKeeper
  • Date: 2023-11-04 15:09:10 UTC
  • mfrom: (483.1.175 anduril2)
  • Revision ID: bzr@toykeeper.net-20231104150910-ddd3afw4nhfvof2l
merged anduril2 branch -> fsm, with *years* of changes
(this also means this code is now Anduril 2 instead of Anduril 1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Emisar D4 config options for Anduril
2
 
#include "hwdef-Emisar_D4v2.h"
 
1
// Emisar D4v2 config options for Anduril
 
2
// Copyright (C) 2018-2023 Selene ToyKeeper
 
3
// SPDX-License-Identifier: GPL-3.0-or-later
 
4
#pragma once
 
5
 
 
6
#define MODEL_NUMBER "0113"
 
7
#include "hwdef-emisar-d4v2.h"
 
8
#include "hank-cfg.h"
3
9
// ATTINY: 1634
4
10
 
5
 
// this light has three aux LED channels: R, G, B
6
 
#define USE_AUX_RGB_LEDS
7
 
// it also has an independent LED in the button
8
 
#define USE_BUTTON_LED
9
 
// the aux LEDs are front-facing, so turn them off while main LEDs are on
10
 
// TODO: the whole "indicator LED" thing needs to be refactored into
11
 
//       "aux LED(s)" and "button LED(s)" since they work a bit differently
12
 
#ifdef USE_INDICATOR_LED_WHILE_RAMPING
13
 
#undef USE_INDICATOR_LED_WHILE_RAMPING
14
 
#endif
15
 
// enable blinking aux LEDs
16
 
#define TICK_DURING_STANDBY
17
 
#define STANDBY_TICK_SPEED 3  // every 0.128 s
18
 
//#define STANDBY_TICK_SPEED 4  // every 0.256 s
19
 
//#define STANDBY_TICK_SPEED 5  // every 0.512 s
20
 
 
21
 
 
22
 
// copied from original D4, since it's also a FET+1 and has the same host
23
 
// ../../bin/level_calc.py 1 65 7135 1 0.8 150
24
 
// ... mixed with this:
25
 
// ../../bin/level_calc.py 2 150 7135 4 0.33 150 FET 1 10 1500
26
 
#define RAMP_LENGTH 150
27
 
#define PWM1_LEVELS 1,1,2,2,3,3,4,4,5,6,7,8,9,10,12,13,14,15,17,19,20,22,24,26,29,31,34,36,39,42,45,48,51,55,59,62,66,70,75,79,84,89,93,99,104,110,115,121,127,134,140,147,154,161,168,176,184,192,200,209,217,226,236,245,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0
28
 
#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,4,5,7,8,9,11,12,14,15,17,19,20,22,24,25,27,29,31,33,35,37,39,41,43,45,48,50,52,55,57,59,62,64,67,70,72,75,78,81,84,87,90,93,96,99,102,105,109,112,115,119,122,126,129,133,137,141,144,148,152,156,160,165,169,173,177,182,186,191,195,200,205,209,214,219,224,229,234,239,244,250,255
29
 
#define MAX_1x7135 65
30
 
#define HALFSPEED_LEVEL 14
31
 
#define QUARTERSPEED_LEVEL 6
 
11
#define RAMP_SIZE 150
 
12
 
 
13
// 7135 at 75/150
 
14
// level_calc.py 5.7895 2 150 7135 1 0.1 130 FET 1 10 3000 --pwm dyn:74:4096:255:3
 
15
// (with some manual tweaks)
 
16
// non-zero part of FET channel calculated with:
 
17
//   level_calc.py 3 1 75 7135 2 500 3000
 
18
#define PWM1_LEVELS  1,1,2,3,3,4,5,6,7,8,9,11,12,13,15,16,18,19,21,23,26,27,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,71,74,76,78,80,82,85,87,90,93,96,100,103,107,112,116,122,127,133,140,147,154,163,171,182,192,203,215,228,241,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0
 
19
#define PWM2_LEVELS  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,5,7,9,11,13,15,17,19,21,23,25,27,29,32,34,36,39,41,43,46,49,51,54,57,59,62,65,68,71,74,77,80,83,86,90,93,96,100,103,107,110,114,117,121,125,129,133,137,141,145,149,153,157,162,166,170,175,179,184,189,193,198,203,208,213,218,223,228,233,239,244,249,255
 
20
#define PWM_TOPS     4095,2701,3200,3586,2518,2778,2834,2795,2705,2587,2455,2582,2412,2247,2256,2091,2062,1907,1860,1802,1737,1605,1542,1477,1412,1347,1284,1222,1162,1105,1050,997,946,898,853,810,768,730,693,658,625,594,564,536,503,485,462,439,418,398,384,366,353,340,327,319,307,298,292,284,280,273,269,266,263,260,258,256,256,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
 
21
 
 
22
#define MAX_1x7135 75
 
23
#define DEFAULT_LEVEL 50
 
24
#define MIN_THERM_STEPDOWN 70  // should be above highest dyn_pwm level
 
25
#define HALFSPEED_LEVEL 20
 
26
#define QUARTERSPEED_LEVEL 5
32
27
 
33
28
#define RAMP_SMOOTH_FLOOR 1
34
 
#define RAMP_SMOOTH_CEIL 120
35
 
// 10, 28, 46, [65], 83, 101, 120
36
 
#define RAMP_DISCRETE_FLOOR 10
37
 
#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
 
29
#define RAMP_SMOOTH_CEIL  130
 
30
// 20, 38, 56, [75], 93, 111, 130
 
31
#define RAMP_DISCRETE_FLOOR 20
 
32
#define RAMP_DISCRETE_CEIL  RAMP_SMOOTH_CEIL
38
33
#define RAMP_DISCRETE_STEPS 7
39
34
 
40
 
// stop panicking at ~30% power or ~1200 lm
41
 
#define THERM_FASTER_LEVEL 105
 
35
// 20, 40, 60, 80, 100
 
36
#define SIMPLE_UI_FLOOR 20
 
37
#define SIMPLE_UI_CEIL 100
 
38
#define SIMPLE_UI_STEPS 5
42
39
 
43
 
// easier access to thermal config mode, for Emisar
44
 
#define USE_TENCLICK_THERMAL_CONFIG
 
40
// stop panicking at ~25% power or ~1000 lm
 
41
#define THERM_FASTER_LEVEL 110
45
42
 
46
43
#define THERM_CAL_OFFSET 5
 
44
 
 
45
// show each channel while it scroll by in the menu
 
46
#define USE_CONFIG_COLORS
 
47
 
 
48
// blink numbers on the main LEDs by default (but allow user to change it)
 
49
#define DEFAULT_BLINK_CHANNEL  CM_MAIN
 
50
 
 
51
// use aux red + aux blue for police strobe
 
52
#define USE_POLICE_COLOR_STROBE_MODE
 
53
#define POLICE_STROBE_USES_AUX
 
54
#define POLICE_COLOR_STROBE_CH1        CM_AUXRED
 
55
#define POLICE_COLOR_STROBE_CH2        CM_AUXBLU
 
56
 
 
57
// the default of 26 looks a bit rough, so increase it to make it smoother
 
58
#define CANDLE_AMPLITUDE 33
 
59
 
 
60
// don't blink while ramping
 
61
#ifdef BLINK_AT_RAMP_MIDDLE
 
62
#undef BLINK_AT_RAMP_MIDDLE
 
63
#endif
 
64