~gabe/flashlight-firmware/anduril2

« back to all changes in this revision

Viewing changes to Tom_E/narsil/NarsilMulti/RampingTables.h

  • Committer: Selene Scriven
  • Date: 2017-06-14 00:44:14 UTC
  • Revision ID: ubuntu@toykeeper.net-20170614004414-0zqnblgisemcjk8g
Updated Narsil to NarsilM 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************************
 
2
 * RampingTables.h
 
3
 * ===============
 
4
 *
 
5
 ****************************************************************************************/
 
6
 
 
7
#ifndef RAMPINGTABLES_H_
 
8
#define RAMPINGTABLES_H_
 
9
 
 
10
 
 
11
#define RAMP_SIZE  150
 
12
 
 
13
//---------------------------------------------------------------------------------------
 
14
//---------------------------------------------------------------------------------------
 
15
#if   OUT_CHANNELS == 2                 // FET+1
 
16
//---------------------------------------------------------------------------------------
 
17
//---------------------------------------------------------------------------------------
 
18
 
 
19
        #define TIMED_STEPDOWN_MIN 115
 
 
b'\t// min level in ramping the timed stepdown will engage,'
 
20
        //    level 115 = 106 PWM, this is ~43%
 
21
        #define TIMED_STEPDOWN_SET 102
 
 
b'\t// the level timed stepdown will set,'
 
22
        //    level 102 = 71 PWM, this is ~32%
 
23
 
 
24
        //----------------------------------------------------
 
25
        // Ramping Mode Levels, 150 total entries (2.4 secs)
 
26
        //----------------------------------------------------
 
27
        #if USING_3807135_BANK
 
28
        //---------------------------------------------------------------------------------------
 
29
                #define FET_START_LVL 68
 
30
 
 
31
                // For MtnE 32x7135 380 driver (slight delay at transition point):
 
32
                //    level_calc.py 2 150 7135 5 0.3 180 7135 5 1 1500
 
33
                PROGMEM const byte ramp_7135[] = {
 
34
                        5,5,5,6,6,6,7,7,                                                 7,8,9,9,10,11,12,13,                                   // 1..16
 
35
                        14,15,16,17,19,20,22,24,                         26,28,30,32,34,37,40,42,
 
36
                        45,48,51,55,58,62,66,70,                         74,78,83,88,92,98,103,108,
 
37
                        114,120,126,132,139,145,152,159,         167,174,182,190,199,207,216,225,
 
38
                        235,244,255,255,255,255,255,255,         255,255,255,255,255,255,255,255,       // edited 254-->255 for entry #67 (1 based)
 
39
                        255,255,255,255,255,255,255,255,         255,255,255,255,255,255,255,255,
 
40
                        255,255,255,255,255,255,255,255,         255,255,255,255,255,255,255,255,
 
41
                        255,255,255,255,255,255,255,255,         255,255,255,255,255,255,255,255,
 
42
                        255,255,255,255,255,255,255,255,         255,255,255,255,255,255,255,255,       // 129..144
 
43
                        255,255,255,255,255,255                                                                                                                         // 145..150
 
44
                };
 
45
 
 
46
                PROGMEM const byte ramp_FET[]  = {
 
47
                        0,0,0,0,0,0,0,0,                                                 0,0,0,0,0,0,0,0,                                                       // 1..16
 
48
                        0,0,0,0,0,0,0,0,                                                 0,0,0,0,0,0,0,0,
 
49
                        0,0,0,0,0,0,0,0,                                                 0,0,0,0,0,0,0,0,
 
50
                        0,0,0,0,0,0,0,0,                                                 0,0,0,0,0,0,0,0,
 
51
                        0,0,0,6,7,8,10,11,                                       12,14,15,17,18,20,22,23,                               // starts at entry 68
 
52
                        25,27,28,30,32,34,36,38,                         40,42,44,46,48,50,52,55,
 
53
                        57,59,62,64,67,69,72,75,                         77,80,83,86,89,91,94,97,
 
54
                        101,104,107,110,113,117,120,124,         127,131,134,138,142,146,150,153,
 
55
                        157,161,166,170,174,178,182,187,         191,196,200,205,210,215,219,224,       // 129..144
 
56
                        229,234,239,244,250,255                                                                                                                         // 145..150
 
57
                };
 
58
        //---------------------------------------------------------------------------------------
 
59
 
 
60
        #else // regular FET+1 support
 
61
        //---------------------------------------------------------------------------------------
 
62
 
 
63
                #define FET_START_LVL 66
 
64
 
 
65
                // For FET+1: FET and one 350 mA 7135 (tested/verified to be smooth):
 
66
                //    level_calc.py 2 150 7135 3 0.3 150 FET 1 1 1500
 
67
                PROGMEM const byte ramp_7135[] = {
 
68
                        3,3,3,4,4,4,5,5,  6,6,7,8,9,10,11,12,
 
69
                        13,14,15,17,18,20,22,24,  26,28,30,33,35,38,41,44,
 
70
                        47,51,54,58,62,66,70,74,  79,83,88,93,99,104,110,116,
 
71
                        122,128,135,142,149,156,164,172,  180,188,196,205,214,223,233,243,      // 49-64
 
72
                        253,255,255,255,255,255,255,255,  255,255,255,255,255,255,255,255,
 
73
                        255,255,255,255,255,255,255,255,  255,255,255,255,255,255,255,255,
 
74
                        255,255,255,255,255,255,255,255,  255,255,255,255,255,255,255,255,
 
75
                        255,255,255,255,255,255,255,255,  255,255,255,255,255,255,255,255,
 
76
                        255,255,255,255,255,255,255,255,  255,255,255,255,255,255,255,255,
 
77
                        255,255,255,255,255,0                                                                                                                           // 145-150
 
78
                };
 
79
 
 
80
                PROGMEM const byte ramp_FET[]  = {
 
81
                        0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,
 
82
                        0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,
 
83
                        0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,
 
84
                        0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,                                                                                              // 49-64
 
85
                        0,2,3,4,5,7,8,9,  11,12,14,15,17,18,20,22,
 
86
                        23,25,27,29,30,32,34,36,  38,40,42,44,47,49,51,53,
 
87
                        56,58,60,63,66,68,71,73,  76,79,82,85,87,90,93,96,                                                      // 96-112
 
88
                        100,103,106,109,113,116,119,123,  126,130,134,137,141,145,149,153,      // 113-128
 
89
                        157,161,165,169,173,178,182,186,  191,196,200,205,210,214,219,224,      // 129-144
 
90
                        229,234,239,244,250,255                                                                                                                         // 145-150
 
91
                };
 
92
        #endif
 
93
                
 
94
//---------------------------------------------------------------------------------------
 
95
//---------------------------------------------------------------------------------------
 
96
#elif OUT_CHANNELS == 3         // Triple Channel
 
97
//---------------------------------------------------------------------------------------
 
98
//---------------------------------------------------------------------------------------
 
99
        #ifdef TRIPLE_3_7135                    // 3 7135's
 
100
                #define RAMP_SIZE  150
 
101
                #define TIMED_STEPDOWN_MIN 115
 
 
b'\t\t// min level in ramping the timed stepdown will engage,'
 
102
                //    level 115 = 106 PWM, this is ~43%
 
103
                #define TIMED_STEPDOWN_SET 102
 
 
b'\t\t// the level timed stepdown will set,'
 
104
                //    level 102 = 71 PWM, this is ~32%
 
105
 
 
106
                #define BANK_START_LVL 71
 
107
                #define FET_START_LVL 121
 
108
 
 
109
                // Ramping Modes, 150 total entries (2.4 secs)
 
110
                //  level_calc.py 3 150 7135 3 0.3 150 7135 3 1.0 500 FET 1 1 1200
 
111
                //  Manual changes: edited to add 255 max entries without an overlap,
 
112
                //         v1.4: changed 1st level of 7135 bank from 4 to 5 (71st value)
 
113
                //
 
114
                PROGMEM const byte ramp_7135[] = {
 
115
                        3,3,3,4,4,4,5,5,                                                5,6,7,7,8,9,9,10,
 
116
                        11,12,14,15,16,17,19,21,                        22,24,26,28,30,32,35,37,
 
117
                        40,42,45,48,51,55,58,62,                        65,69,73,77,82,86,91,96,
 
118
                        101,106,111,117,122,128,134,141,        147,154,161,168,175,182,190,198,
 
119
                        206,215,223,232,243,255,255,255,        255,255,255,255,255,255,255,255,
 
120
                        255,255,255,255,255,255,255,255,        255,255,255,255,255,255,255,255,
 
121
                        255,255,255,255,255,255,255,255,        255,255,255,255,255,255,255,255,
 
122
                        255,255,255,255,255,255,255,255,        255,255,255,255,255,255,255,255,
 
123
                        255,255,255,255,255,255,255,255,        255,255,255,255,255,255,255,255,        // 70 entries, 0-69
 
124
                        255,255,255,255,255,0
 
125
                };
 
126
                PROGMEM const byte ramp_7135s[] = {
 
127
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
128
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
129
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
130
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
131
                        0,0,0,0,0,0,5,7,                                                10,13,16,19,23,26,30,33,
 
132
                        37,40,44,48,52,56,60,64,                        69,73,78,82,87,92,96,101,
 
133
                        106,111,117,122,127,133,139,144,        150,156,162,168,174,181,187,194,
 
134
                        201,207,214,221,228,236,245,255,        255,255,255,255,255,255,255,255,
 
135
                        255,255,255,255,255,255,255,255,        255,255,255,255,255,255,255,255,        // 50 entries, 70-119
 
136
                        255,255,255,255,255,0
 
137
                };
 
138
                PROGMEM const byte ramp_FET[]  = {
 
139
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
140
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
141
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
142
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
143
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
144
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
145
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
146
                        0,0,0,0,0,0,0,0,                                                3,10,17,25,32,40,47,55,
 
147
                        63,71,79,87,95,104,112,121,             130,139,148,157,166,175,185,194,        // 30 entries, 120-149
 
148
                        204,214,224,234,245,255
 
149
                };
 
150
        #endif
 
151
 
 
152
        //---------------------------------------------------------------------------------------
 
153
        #ifdef TRIPLE_8_7135
 
154
                #define RAMP_SIZE  150
 
155
                #define TIMED_STEPDOWN_MIN 115
 
 
b'\t\t// min level in ramping the timed stepdown will engage,'
 
156
                //    level 115 = 106 PWM, this is ~43%
 
157
                #define TIMED_STEPDOWN_SET 102
 
 
b'\t\t// the level timed stepdown will set,'
 
158
                //    level 102 = 71 PWM, this is ~32%
 
159
 
 
160
                #define BANK_START_LVL 71
 
161
                #define FET_START_LVL 139
 
162
 
 
163
                // Ramping Modes, 150 total entries (2.4 secs)
 
164
                //  level_calc.py 3 150 7135 3 0.3 150 7135 3 2.0 800 FET 1 1 1200
 
165
                //  (manually edited to add 255 max entries without an overlap)
 
166
                PROGMEM const byte ramp_7135[] = {
 
167
                        3,3,3,4,4,4,5,5,                                                5,6,7,7,8,9,9,10,
 
168
                        11,12,14,15,16,17,19,21,                        22,24,26,28,30,32,35,37,
 
169
                        40,42,45,48,51,55,58,62,                        65,69,73,77,82,86,91,96,
 
170
                        101,106,111,117,122,128,134,141,        147,154,161,168,175,182,190,198,
 
171
                        206,215,223,232,243,255,255,255,        255,255,255,255,255,255,255,255,        // 70 entries, 0-69
 
172
                        255,255,255,255,255,255,255,255,        255,255,255,255,255,255,255,255,
 
173
                        255,255,255,255,255,255,255,255,        255,255,255,255,255,255,255,255,
 
174
                        255,255,255,255,255,255,255,255,        255,255,255,255,255,255,255,255,
 
175
                        255,255,255,255,255,255,255,255,        255,255,255,255,255,255,255,255,
 
176
                        255,255,255,255,255,0
 
177
                };
 
178
                PROGMEM const byte ramp_7135s[] = {
 
179
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
180
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
181
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
182
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
183
                        0,0,0,0,0,0,5,7,                                                9,11,13,15,17,19,21,23,         //      changed from: "0,0,0,0,0,0,3,5,  7,9,11,13,15,17,19,21"
 
184
                        25,27,29,31,33,36,38,41,                        44,46,49,52,55,58,61,64,        // changed from: "24,26,28 ..."
 
185
                        67,71,74,77,80,84,87,91,                        95,98,102,106,110,114,118,122,
 
186
                        126,130,135,139,144,148,153,157,        162,167,172,177,182,187,192,197,
 
187
                        203,208,214,219,225,231,237,242,        248,255,255,255,255,255,255,255,        // 68 entries, 70-137
 
188
                        255,255,255,255,255,0
 
189
                };
 
190
                PROGMEM const byte ramp_FET[]  = {
 
191
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
192
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
193
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
194
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
195
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
196
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
197
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
198
                        0,0,0,0,0,0,0,0,                                                0,0,0,0,0,0,0,0,
 
199
                        0,0,0,0,0,0,0,0,                                                0,0,18,38,59,79,100,122,                        // 12 entries, 138-149
 
200
                        143,165,187,209,232,255
 
201
                };
 
202
        #endif
 
203
 
 
204
//---------------------------------------------------------------------------------------
 
205
//---------------------------------------------------------------------------------------
 
206
#elif OUT_CHANNELS == 1         // single FET or single bank of 7135's
 
207
//---------------------------------------------------------------------------------------
 
208
//---------------------------------------------------------------------------------------
 
209
        #define TIMED_STEPDOWN_MIN 137
 
 
b'\t// min level in ramping the timed step down will engage,'
 
210
        //    level 137 = 200 PWM, this is ~80%
 
211
        #define TIMED_STEPDOWN_SET 105
 
 
b'\t// the level timed stepdown will set,'
 
212
        //    level 105 = 100 PWM, this is ~40%
 
213
        
 
214
        #define FET_START_LVL 50        // use about 20% for 1 channel
 
215
 
 
216
 
 
217
                // For single channel, 7135 bank or FET
 
218
                //    level_calc.py 1 150 7135 5 1.0 1500
 
219
                //    defines: 1 channel, 150 steps, 7135 type, 5=start PWM value, approx. min 1.0 lumen, max of 1500 lumen
 
220
                PROGMEM const byte ramp_1Chan[] = {
 
221
                        5,5,5,5,5,5,5,5,                                                5,6,6,6,6,6,6,6,
 
222
                        6,7,7,7,7,7,8,8,                                                8,8,9,9,9,9,10,10,
 
223
                        11,11,11,12,12,13,13,14,                        14,15,15,16,16,17,17,18,
 
224
                        19,19,20,21,22,22,23,24,                        25,26,27,27,28,29,30,31,                                // 49-64
 
225
                        32,33,35,36,37,38,39,40,                        42,43,44,46,47,49,50,51,
 
226
                        53,55,56,58,59,61,63,65,                        66,68,70,72,74,76,78,80,
 
227
                        82,84,86,88,91,93,95,98,                        100,102,105,107,110,112,115,118,                //  97-112
 
228
                        121,123,126,129,132,135,138,141,        144,147,150,154,157,160,163,167,                // 113-128
 
229
                        170,174,177,181,185,188,192,196,        200,204,208,212,216,220,224,228,                // 129-144
 
230
                        233,237,241,246,250,255                                                                                                                         // 145-150
 
231
                };
 
232
 
 
233
 
 
234
#endif
 
235
 
 
236
#endif /* RAMPINGTABLES_H_ */
 
 
b'\\ No newline at end of file'