~gabe/flashlight-firmware/anduril2

« back to all changes in this revision

Viewing changes to Tom_E/narsil/Narsil/Release/Narsil.lss

  • Committer: Selene Scriven
  • Date: 2016-07-10 01:15:02 UTC
  • Revision ID: ubuntu@toykeeper.net-20160710011502-1lput1t8445t0ufr
Updated Narsil from 2016-03-21 to 2016-06-08 version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
Narsil.elf:     file format elf32-avr
3
 
 
4
 
Sections:
5
 
Idx Name          Size      VMA       LMA       File off  Algn
6
 
  0 .text         000010c0  00000000  00000000  00000094  2**1
7
 
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
8
 
  1 .data         0000003e  00800060  000010c0  00001154  2**0
9
 
                  CONTENTS, ALLOC, LOAD, DATA
10
 
  2 .bss          00000039  0080009e  0080009e  00001192  2**0
11
 
                  ALLOC
12
 
  3 .noinit       00000001  008000d7  008000d7  00001192  2**0
13
 
                  ALLOC
14
 
  4 .comment      00000030  00000000  00000000  00001192  2**0
15
 
                  CONTENTS, READONLY
16
 
  5 .note.gnu.avr.deviceinfo 0000003c  00000000  00000000  000011c4  2**2
17
 
                  CONTENTS, READONLY
18
 
  6 .debug_aranges 000000a8  00000000  00000000  00001200  2**0
19
 
                  CONTENTS, READONLY, DEBUGGING
20
 
  7 .debug_info   00001906  00000000  00000000  000012a8  2**0
21
 
                  CONTENTS, READONLY, DEBUGGING
22
 
  8 .debug_abbrev 0000039e  00000000  00000000  00002bae  2**0
23
 
                  CONTENTS, READONLY, DEBUGGING
24
 
  9 .debug_line   00000666  00000000  00000000  00002f4c  2**0
25
 
                  CONTENTS, READONLY, DEBUGGING
26
 
 10 .debug_frame  000001c0  00000000  00000000  000035b4  2**2
27
 
                  CONTENTS, READONLY, DEBUGGING
28
 
 11 .debug_str    000006a4  00000000  00000000  00003774  2**0
29
 
                  CONTENTS, READONLY, DEBUGGING
30
 
 12 .debug_loc    00000d71  00000000  00000000  00003e18  2**0
31
 
                  CONTENTS, READONLY, DEBUGGING
32
 
 13 .debug_ranges 00000128  00000000  00000000  00004b89  2**0
33
 
                  CONTENTS, READONLY, DEBUGGING
34
 
 
35
 
Disassembly of section .text:
36
 
 
37
 
00000000 <__vectors>:
38
 
       0:       76 c0           rjmp    .+236           ; 0xee <__ctors_end>
39
 
       2:       90 c0           rjmp    .+288           ; 0x124 <__bad_interrupt>
40
 
       4:       53 c1           rjmp    .+678           ; 0x2ac <__vector_2>
41
 
       6:       8e c0           rjmp    .+284           ; 0x124 <__bad_interrupt>
42
 
       8:       8d c0           rjmp    .+282           ; 0x124 <__bad_interrupt>
43
 
       a:       8c c0           rjmp    .+280           ; 0x124 <__bad_interrupt>
44
 
       c:       8b c0           rjmp    .+278           ; 0x124 <__bad_interrupt>
45
 
       e:       8a c0           rjmp    .+276           ; 0x124 <__bad_interrupt>
46
 
      10:       89 c0           rjmp    .+274           ; 0x124 <__bad_interrupt>
47
 
      12:       88 c0           rjmp    .+272           ; 0x124 <__bad_interrupt>
48
 
      14:       87 c0           rjmp    .+270           ; 0x124 <__bad_interrupt>
49
 
      16:       86 c0           rjmp    .+268           ; 0x124 <__bad_interrupt>
50
 
      18:       e6 c1           rjmp    .+972           ; 0x3e6 <__vector_12>
51
 
      1a:       84 c0           rjmp    .+264           ; 0x124 <__bad_interrupt>
52
 
      1c:       83 c0           rjmp    .+262           ; 0x124 <__bad_interrupt>
53
 
      1e:       9c c7           rjmp    .+3896          ; 0xf58 <main+0x75a>
54
 
      20:       32 c8           rjmp    .-3996          ; 0xfffff086 <__eeprom_end+0xff7ef086>
55
 
      22:       a1 c6           rjmp    .+3394          ; 0xd66 <main+0x568>
56
 
      24:       00 c7           rjmp    .+3584          ; 0xe26 <main+0x628>
57
 
      26:       58 c7           rjmp    .+3760          ; 0xed8 <main+0x6da>
58
 
      28:       64 c7           rjmp    .+3784          ; 0xef2 <main+0x6f4>
59
 
      2a:       70 c7           rjmp    .+3808          ; 0xf0c <main+0x70e>
60
 
      2c:       8c c7           rjmp    .+3864          ; 0xf46 <main+0x748>
61
 
      2e:       2b c8           rjmp    .-4010          ; 0xfffff086 <__eeprom_end+0xff7ef086>
62
 
      30:       2a c8           rjmp    .-4012          ; 0xfffff086 <__eeprom_end+0xff7ef086>
63
 
      32:       29 c8           rjmp    .-4014          ; 0xfffff086 <__eeprom_end+0xff7ef086>
64
 
      34:       28 c8           rjmp    .-4016          ; 0xfffff086 <__eeprom_end+0xff7ef086>
65
 
      36:       27 c8           rjmp    .-4018          ; 0xfffff086 <__eeprom_end+0xff7ef086>
66
 
      38:       26 c8           rjmp    .-4020          ; 0xfffff086 <__eeprom_end+0xff7ef086>
67
 
      3a:       25 c8           rjmp    .-4022          ; 0xfffff086 <__eeprom_end+0xff7ef086>
68
 
      3c:       24 c8           rjmp    .-4024          ; 0xfffff086 <__eeprom_end+0xff7ef086>
69
 
      3e:       23 c8           rjmp    .-4026          ; 0xfffff086 <__eeprom_end+0xff7ef086>
70
 
      40:       22 c8           rjmp    .-4028          ; 0xfffff086 <__eeprom_end+0xff7ef086>
71
 
      42:       21 c8           rjmp    .-4030          ; 0xfffff086 <__eeprom_end+0xff7ef086>
72
 
      44:       20 c8           rjmp    .-4032          ; 0xfffff086 <__eeprom_end+0xff7ef086>
73
 
      46:       88 c7           rjmp    .+3856          ; 0xf58 <main+0x75a>
74
 
      48:       1e c8           rjmp    .-4036          ; 0xfffff086 <__eeprom_end+0xff7ef086>
75
 
      4a:       93 c7           rjmp    .+3878          ; 0xf72 <main+0x774>
76
 
      4c:       a0 c7           rjmp    .+3904          ; 0xf8e <main+0x790>
77
 
      4e:       f6 c7           rjmp    .+4076          ; 0x103c <main+0x83e>
78
 
      50:       01 c8           rjmp    .-4094          ; 0xfffff054 <__eeprom_end+0xff7ef054>
79
 
      52:       0c c8           rjmp    .-4072          ; 0xfffff06c <__eeprom_end+0xff7ef06c>
80
 
 
81
 
00000054 <__trampolines_end>:
82
 
      54:       68 45           sbci    r22, 0x58       ; 88
83
 
      56:       6c 46           sbci    r22, 0x6C       ; 108
84
 
      58:       70 47           sbci    r23, 0x70       ; 112
85
 
      5a:       75 48           sbci    r23, 0x85       ; 133
86
 
      5c:       78 49           sbci    r23, 0x98       ; 152
87
 
      5e:       7c 60           ori     r23, 0x0C       ; 12
88
 
      60:       80 61           ori     r24, 0x10       ; 16
89
 
      62:       84 62           ori     r24, 0x24       ; 36
90
 
      64:       88 63           ori     r24, 0x38       ; 56
91
 
      66:       8d 64           ori     r24, 0x4D       ; 77
92
 
      68:       92 65           ori     r25, 0x52       ; 82
93
 
      6a:       96 66           ori     r25, 0x66       ; 102
94
 
      6c:       9a 67           ori     r25, 0x7A       ; 122
95
 
      6e:       9f 68           ori     r25, 0x8F       ; 143
96
 
      70:       a3 69           ori     r26, 0x93       ; 147
97
 
      72:       a7 80           ldd     r10, Z+7        ; 0x07
98
 
      74:       ab 81           ldd     r26, Y+3        ; 0x03
99
 
      76:       af 82           std     Y+7, r10        ; 0x07
100
 
      78:       b4 83           std     Z+4, r27        ; 0x04
101
 
      7a:       b8 84           ldd     r11, Y+8        ; 0x08
102
 
      7c:       ff 21           and     r31, r15
103
 
 
104
 
0000007e <turboTimeOutVals>:
105
 
      7e:       00 00 53 07 a6 0e f9 15 4c 1d f2 2b 3e 49 7c 92     ..S.....L..+>I|.
106
 
 
107
 
0000008e <modeSetCnts>:
108
 
      8e:       01 02 03 04 05 06 07 03                             ........
109
 
 
110
 
00000096 <mode7135Set12>:
111
 
      96:       14 e6 ff 00                                         ....
112
 
 
113
 
0000009a <modeFetSet12>:
114
 
      9a:       00 00 5a ff                                         ..Z.
115
 
 
116
 
0000009e <mode7135Set11>:
117
 
      9e:       ff ff 00                                            ...
118
 
 
119
 
000000a1 <modeFetSet11>:
120
 
      a1:       00 6e ff                                            .n.
121
 
 
122
 
000000a4 <mode7135Set10>:
123
 
      a4:       ff ff 00                                            ...
124
 
 
125
 
000000a7 <modeFetSet10>:
126
 
      a7:       00 46 ff                                            .F.
127
 
 
128
 
000000aa <mode7135Set9>:
129
 
      aa:       1e ff 00                                            ...
130
 
 
131
 
000000ad <modeFetSet9>:
132
 
      ad:       00 50 ff                                            .P.
133
 
 
134
 
000000b0 <mode7135Set8>:
135
 
      b0:       1e ff 00                                            ...
136
 
 
137
 
000000b3 <modeFetSet8>:
138
 
      b3:       00 19 ff                                            ...
139
 
 
140
 
000000b6 <mode7135Set7>:
141
 
      b6:       18 3f 96 ff ff ff 00                                .?.....
142
 
 
143
 
000000bd <modeFetSet7>:
144
 
      bd:       00 00 00 00 46 8c ff                                ....F..
145
 
 
146
 
000000c4 <mode7135Set6>:
147
 
      c4:       14 6e ff ff ff 00                                   .n....
148
 
 
149
 
000000ca <modeFetSet6>:
150
 
      ca:       00 00 07 38 89 ff                                   ...8..
151
 
 
152
 
000000d0 <mode7135Set5>:
153
 
      d0:       1e 78 ff ff 00                                      .x...
154
 
 
155
 
000000d5 <modeFetSet5>:
156
 
      d5:       00 00 00 50 ff                                      ...P.
157
 
 
158
 
000000da <mode7135Set4>:
159
 
      da:       1e ff ff 00                                         ....
160
 
 
161
 
000000de <modeFetSet4>:
162
 
      de:       00 00 50 ff                                         ..P.
163
 
 
164
 
000000e2 <mode7135Set3>:
165
 
      e2:       78 ff 00                                            x..
166
 
 
167
 
000000e5 <modeFetSet3>:
168
 
      e5:       00 46 ff                                            .F.
169
 
 
170
 
000000e8 <mode7135Set2>:
171
 
      e8:       ff 00                                               ..
172
 
 
173
 
000000ea <modeFetSet2>:
174
 
      ea:       00 ff                                               ..
175
 
 
176
 
000000ec <mode7135Set1>:
177
 
        ...
178
 
 
179
 
000000ed <modeFetSet1>:
180
 
      ed:       ff                                                  .
181
 
 
182
 
000000ee <__ctors_end>:
183
 
      ee:       11 24           eor     r1, r1
184
 
      f0:       1f be           out     0x3f, r1        ; 63
185
 
      f2:       cf e5           ldi     r28, 0x5F       ; 95
186
 
      f4:       d2 e0           ldi     r29, 0x02       ; 2
187
 
      f6:       de bf           out     0x3e, r29       ; 62
188
 
      f8:       cd bf           out     0x3d, r28       ; 61
189
 
 
190
 
000000fa <__do_copy_data>:
191
 
      fa:       10 e0           ldi     r17, 0x00       ; 0
192
 
      fc:       a0 e6           ldi     r26, 0x60       ; 96
193
 
      fe:       b0 e0           ldi     r27, 0x00       ; 0
194
 
     100:       e0 ec           ldi     r30, 0xC0       ; 192
195
 
     102:       f0 e1           ldi     r31, 0x10       ; 16
196
 
     104:       02 c0           rjmp    .+4             ; 0x10a <__do_copy_data+0x10>
197
 
     106:       05 90           lpm     r0, Z+
198
 
     108:       0d 92           st      X+, r0
199
 
     10a:       ae 39           cpi     r26, 0x9E       ; 158
200
 
     10c:       b1 07           cpc     r27, r17
201
 
     10e:       d9 f7           brne    .-10            ; 0x106 <__do_copy_data+0xc>
202
 
 
203
 
00000110 <__do_clear_bss>:
204
 
     110:       20 e0           ldi     r18, 0x00       ; 0
205
 
     112:       ae e9           ldi     r26, 0x9E       ; 158
206
 
     114:       b0 e0           ldi     r27, 0x00       ; 0
207
 
     116:       01 c0           rjmp    .+2             ; 0x11a <.do_clear_bss_start>
208
 
 
209
 
00000118 <.do_clear_bss_loop>:
210
 
     118:       1d 92           st      X+, r1
211
 
 
212
 
0000011a <.do_clear_bss_start>:
213
 
     11a:       a7 3d           cpi     r26, 0xD7       ; 215
214
 
     11c:       b2 07           cpc     r27, r18
215
 
     11e:       e1 f7           brne    .-8             ; 0x118 <.do_clear_bss_loop>
216
 
     120:       6e d3           rcall   .+1756          ; 0x7fe <main>
217
 
     122:       cc c7           rjmp    .+3992          ; 0x10bc <_exit>
218
 
 
219
 
00000124 <__bad_interrupt>:
220
 
     124:       6d cf           rjmp    .-294           ; 0x0 <__vectors>
221
 
 
222
 
00000126 <_delay_ms>:
223
 
    milliseconds can be achieved.
224
 
 */
225
 
void
226
 
_delay_loop_2(uint16_t __count)
227
 
{
228
 
        __asm__ volatile (
229
 
     126:       20 ed           ldi     r18, 0xD0       ; 208
230
 
     128:       37 e0           ldi     r19, 0x07       ; 7
231
 
    //if (n==0) { _delay_loop_2(BOGOMIPS/3); }
232
 
    //else {
233
 
    //    while(n-- > 0) _delay_loop_2(BOGOMIPS);
234
 
    //}
235
 
    //#else
236
 
    while(n-- > 0) _delay_loop_2(BOGOMIPS);
237
 
     12a:       01 97           sbiw    r24, 0x01       ; 1
238
 
     12c:       20 f0           brcs    .+8             ; 0x136 <_delay_ms+0x10>
239
 
     12e:       f9 01           movw    r30, r18
240
 
     130:       31 97           sbiw    r30, 0x01       ; 1
241
 
     132:       f1 f7           brne    .-4             ; 0x130 <_delay_ms+0xa>
242
 
     134:       fa cf           rjmp    .-12            ; 0x12a <_delay_ms+0x4>
243
 
    //#endif
244
 
}
245
 
     136:       08 95           ret
246
 
 
247
 
00000138 <TurnOnBoardLed>:
248
 
* TurnOnBoardLed
249
 
* ==============
250
 
**************************************************************************************/
251
 
void TurnOnBoardLed(byte on)
252
 
{
253
 
        if (onboardLedEnable)
254
 
     138:       90 91 62 00     lds     r25, 0x0062
255
 
     13c:       99 23           and     r25, r25
256
 
     13e:       49 f0           breq    .+18            ; 0x152 <TurnOnBoardLed+0x1a>
257
 
        {
258
 
                if (on)
259
 
     140:       88 23           and     r24, r24
260
 
     142:       21 f0           breq    .+8             ; 0x14c <TurnOnBoardLed+0x14>
261
 
                {
262
 
                        DDRB = (1 << PWM_PIN) | (1 << ALT_PWM_PIN) | (1 << ONBOARD_LED_PIN);
263
 
     144:       83 e1           ldi     r24, 0x13       ; 19
264
 
     146:       87 bb           out     0x17, r24       ; 23
265
 
                        PORTB |= (1 << ONBOARD_LED_PIN);
266
 
     148:       c4 9a           sbi     0x18, 4 ; 24
267
 
     14a:       08 95           ret
268
 
                }
269
 
                else
270
 
                {
271
 
                        DDRB = (1 << PWM_PIN) | (1 << ALT_PWM_PIN);
272
 
     14c:       83 e0           ldi     r24, 0x03       ; 3
273
 
     14e:       87 bb           out     0x17, r24       ; 23
274
 
                        PORTB &= 0xff ^ (1 << ONBOARD_LED_PIN);
275
 
     150:       c4 98           cbi     0x18, 4 ; 24
276
 
     152:       08 95           ret
277
 
 
278
 
00000154 <strobe>:
279
 
/**************************************************************************************
280
 
* strobe
281
 
* ======
282
 
**************************************************************************************/
283
 
void strobe(byte ontime, byte offtime)
284
 
{
285
 
     154:       cf 93           push    r28
286
 
     156:       df 93           push    r29
287
 
     158:       1f 92           push    r1
288
 
     15a:       cd b7           in      r28, 0x3d       ; 61
289
 
     15c:       de b7           in      r29, 0x3e       ; 62
290
 
        PWM_LVL = 255;
291
 
     15e:       9f ef           ldi     r25, 0xFF       ; 255
292
 
     160:       98 bd           out     0x28, r25       ; 40
293
 
        _delay_ms(ontime);
294
 
     162:       90 e0           ldi     r25, 0x00       ; 0
295
 
     164:       69 83           std     Y+1, r22        ; 0x01
296
 
     166:       df df           rcall   .-66            ; 0x126 <_delay_ms>
297
 
        PWM_LVL = 0;
298
 
     168:       18 bc           out     0x28, r1        ; 40
299
 
        _delay_ms(offtime);
300
 
     16a:       69 81           ldd     r22, Y+1        ; 0x01
301
 
     16c:       86 2f           mov     r24, r22
302
 
     16e:       90 e0           ldi     r25, 0x00       ; 0
303
 
}
304
 
     170:       0f 90           pop     r0
305
 
     172:       df 91           pop     r29
306
 
     174:       cf 91           pop     r28
307
 
void strobe(byte ontime, byte offtime)
308
 
{
309
 
        PWM_LVL = 255;
310
 
        _delay_ms(ontime);
311
 
        PWM_LVL = 0;
312
 
        _delay_ms(offtime);
313
 
     176:       d7 cf           rjmp    .-82            ; 0x126 <_delay_ms>
314
 
 
315
 
00000178 <get_voltage>:
316
 
* get_voltage
317
 
* ===========
318
 
**************************************************************************************/
319
 
uint8_t get_voltage()
320
 
{
321
 
        ADCSRA |= (1 << ADSC);                          // Start conversion
322
 
     178:       36 9a           sbi     0x06, 6 ; 6
323
 
        
324
 
        while (ADCSRA & (1 << ADSC))  ; // Wait for completion
325
 
     17a:       36 99           sbic    0x06, 6 ; 6
326
 
     17c:       fe cf           rjmp    .-4             ; 0x17a <get_voltage+0x2>
327
 
        
328
 
        return ADCH;    // Send back the result
329
 
     17e:       85 b1           in      r24, 0x05       ; 5
330
 
}
331
 
     180:       08 95           ret
332
 
 
333
 
00000182 <blink>:
334
 
/**************************************************************************************
335
 
* blink - do a # of blinks with a speed in msecs
336
 
* =====
337
 
**************************************************************************************/
338
 
void blink(byte val, word speed)
339
 
{
340
 
     182:       ef 92           push    r14
341
 
     184:       ff 92           push    r15
342
 
     186:       0f 93           push    r16
343
 
     188:       1f 93           push    r17
344
 
     18a:       cf 93           push    r28
345
 
     18c:       df 93           push    r29
346
 
     18e:       c8 2f           mov     r28, r24
347
 
     190:       8b 01           movw    r16, r22
348
 
                set_output(BLINK_BRIGHTNESS);
349
 
                _delay_ms(speed);
350
 
                
351
 
                TurnOnBoardLed(0);
352
 
                set_output(0,0);
353
 
                _delay_ms(speed<<2);    // 4X delay OFF
354
 
     192:       7b 01           movw    r14, r22
355
 
     194:       ee 0c           add     r14, r14
356
 
     196:       ff 1c           adc     r15, r15
357
 
     198:       ee 0c           add     r14, r14
358
 
     19a:       ff 1c           adc     r15, r15
359
 
 {
360
 
        // Need PHASE to properly turn off the light
361
 
//      if ((pwm1==0) && (pwm2==0))
362
 
//              TCCR0A = PHASE;
363
 
        PWM_LVL = pwm1;
364
 
        ALT_PWM_LVL = pwm2;
365
 
     19c:       d8 e2           ldi     r29, 0x28       ; 40
366
 
* =====
367
 
**************************************************************************************/
368
 
void blink(byte val, word speed)
369
 
{
370
 
//      TCCR0A = PHASE;
371
 
        for (; val>0; val--)
372
 
     19e:       cc 23           and     r28, r28
373
 
     1a0:       71 f0           breq    .+28            ; 0x1be <blink+0x3c>
374
 
        {
375
 
                TurnOnBoardLed(1);
376
 
     1a2:       81 e0           ldi     r24, 0x01       ; 1
377
 
     1a4:       c9 df           rcall   .-110           ; 0x138 <TurnOnBoardLed>
378
 
void set_output(byte pwm1, byte pwm2)
379
 
 {
380
 
        // Need PHASE to properly turn off the light
381
 
//      if ((pwm1==0) && (pwm2==0))
382
 
//              TCCR0A = PHASE;
383
 
        PWM_LVL = pwm1;
384
 
     1a6:       18 bc           out     0x28, r1        ; 40
385
 
        ALT_PWM_LVL = pwm2;
386
 
     1a8:       d9 bd           out     0x29, r29       ; 41
387
 
//      TCCR0A = PHASE;
388
 
        for (; val>0; val--)
389
 
        {
390
 
                TurnOnBoardLed(1);
391
 
                set_output(BLINK_BRIGHTNESS);
392
 
                _delay_ms(speed);
393
 
     1aa:       c8 01           movw    r24, r16
394
 
     1ac:       bc df           rcall   .-136           ; 0x126 <_delay_ms>
395
 
                
396
 
                TurnOnBoardLed(0);
397
 
     1ae:       80 e0           ldi     r24, 0x00       ; 0
398
 
     1b0:       c3 df           rcall   .-122           ; 0x138 <TurnOnBoardLed>
399
 
void set_output(byte pwm1, byte pwm2)
400
 
 {
401
 
        // Need PHASE to properly turn off the light
402
 
//      if ((pwm1==0) && (pwm2==0))
403
 
//              TCCR0A = PHASE;
404
 
        PWM_LVL = pwm1;
405
 
     1b2:       18 bc           out     0x28, r1        ; 40
406
 
        ALT_PWM_LVL = pwm2;
407
 
     1b4:       19 bc           out     0x29, r1        ; 41
408
 
                set_output(BLINK_BRIGHTNESS);
409
 
                _delay_ms(speed);
410
 
                
411
 
                TurnOnBoardLed(0);
412
 
                set_output(0,0);
413
 
                _delay_ms(speed<<2);    // 4X delay OFF
414
 
     1b6:       c7 01           movw    r24, r14
415
 
     1b8:       b6 df           rcall   .-148           ; 0x126 <_delay_ms>
416
 
* =====
417
 
**************************************************************************************/
418
 
void blink(byte val, word speed)
419
 
{
420
 
//      TCCR0A = PHASE;
421
 
        for (; val>0; val--)
422
 
     1ba:       c1 50           subi    r28, 0x01       ; 1
423
 
     1bc:       f0 cf           rjmp    .-32            ; 0x19e <blink+0x1c>
424
 
                
425
 
                TurnOnBoardLed(0);
426
 
                set_output(0,0);
427
 
                _delay_ms(speed<<2);    // 4X delay OFF
428
 
        }
429
 
}
430
 
     1be:       df 91           pop     r29
431
 
     1c0:       cf 91           pop     r28
432
 
     1c2:       1f 91           pop     r17
433
 
     1c4:       0f 91           pop     r16
434
 
     1c6:       ff 90           pop     r15
435
 
     1c8:       ef 90           pop     r14
436
 
     1ca:       08 95           ret
437
 
 
438
 
000001cc <battBlink>:
439
 
/**************************************************************************************
440
 
* battBlink - do a # of blinks with a speed in msecs
441
 
* =========
442
 
**************************************************************************************/
443
 
void battBlink(byte val)
444
 
{
445
 
     1cc:       cf 93           push    r28
446
 
     1ce:       df 93           push    r29
447
 
     1d0:       c8 2f           mov     r28, r24
448
 
 {
449
 
        // Need PHASE to properly turn off the light
450
 
//      if ((pwm1==0) && (pwm2==0))
451
 
//              TCCR0A = PHASE;
452
 
        PWM_LVL = pwm1;
453
 
        ALT_PWM_LVL = pwm2;
454
 
     1d2:       d8 e2           ldi     r29, 0x28       ; 40
455
 
* =========
456
 
**************************************************************************************/
457
 
void battBlink(byte val)
458
 
{
459
 
//      TCCR0A = PHASE;
460
 
        for (; val>0; val--)
461
 
     1d4:       cc 23           and     r28, r28
462
 
     1d6:       c1 f0           breq    .+48            ; 0x208 <battBlink+0x3c>
463
 
        {
464
 
                TurnOnBoardLed(1);
465
 
     1d8:       81 e0           ldi     r24, 0x01       ; 1
466
 
     1da:       ae df           rcall   .-164           ; 0x138 <TurnOnBoardLed>
467
 
                
468
 
                if (bvldLedOnly == 0)
469
 
     1dc:       80 91 ba 00     lds     r24, 0x00BA
470
 
     1e0:       81 11           cpse    r24, r1
471
 
     1e2:       02 c0           rjmp    .+4             ; 0x1e8 <battBlink+0x1c>
472
 
void set_output(byte pwm1, byte pwm2)
473
 
 {
474
 
        // Need PHASE to properly turn off the light
475
 
//      if ((pwm1==0) && (pwm2==0))
476
 
//              TCCR0A = PHASE;
477
 
        PWM_LVL = pwm1;
478
 
     1e4:       18 bc           out     0x28, r1        ; 40
479
 
        ALT_PWM_LVL = pwm2;
480
 
     1e6:       d9 bd           out     0x29, r29       ; 41
481
 
                TurnOnBoardLed(1);
482
 
                
483
 
                if (bvldLedOnly == 0)
484
 
                        set_output(BLINK_BRIGHTNESS);
485
 
                        
486
 
                _delay_ms(250);
487
 
     1e8:       8a ef           ldi     r24, 0xFA       ; 250
488
 
     1ea:       90 e0           ldi     r25, 0x00       ; 0
489
 
     1ec:       9c df           rcall   .-200           ; 0x126 <_delay_ms>
490
 
                
491
 
                TurnOnBoardLed(0);
492
 
     1ee:       80 e0           ldi     r24, 0x00       ; 0
493
 
     1f0:       a3 df           rcall   .-186           ; 0x138 <TurnOnBoardLed>
494
 
void set_output(byte pwm1, byte pwm2)
495
 
 {
496
 
        // Need PHASE to properly turn off the light
497
 
//      if ((pwm1==0) && (pwm2==0))
498
 
//              TCCR0A = PHASE;
499
 
        PWM_LVL = pwm1;
500
 
     1f2:       18 bc           out     0x28, r1        ; 40
501
 
        ALT_PWM_LVL = pwm2;
502
 
     1f4:       19 bc           out     0x29, r1        ; 41
503
 
                        
504
 
                _delay_ms(250);
505
 
                
506
 
                TurnOnBoardLed(0);
507
 
                set_output(0,0);
508
 
                _delay_ms(375);
509
 
     1f6:       87 e7           ldi     r24, 0x77       ; 119
510
 
     1f8:       91 e0           ldi     r25, 0x01       ; 1
511
 
     1fa:       95 df           rcall   .-214           ; 0x126 <_delay_ms>
512
 
                
513
 
                if (modeIdx != BATT_CHECK_MODE)
514
 
     1fc:       80 91 b3 00     lds     r24, 0x00B3
515
 
     200:       80 35           cpi     r24, 0x50       ; 80
516
 
     202:       11 f4           brne    .+4             ; 0x208 <battBlink+0x3c>
517
 
* =========
518
 
**************************************************************************************/
519
 
void battBlink(byte val)
520
 
{
521
 
//      TCCR0A = PHASE;
522
 
        for (; val>0; val--)
523
 
     204:       c1 50           subi    r28, 0x01       ; 1
524
 
     206:       e6 cf           rjmp    .-52            ; 0x1d4 <battBlink+0x8>
525
 
                _delay_ms(375);
526
 
                
527
 
                if (modeIdx != BATT_CHECK_MODE)
528
 
                        break;
529
 
        }
530
 
}
531
 
     208:       df 91           pop     r29
532
 
     20a:       cf 91           pop     r28
533
 
     20c:       08 95           ret
534
 
 
535
 
0000020e <configBlink>:
536
 
/**************************************************************************************
537
 
* configBlink - do 2 quick blinks, followed by num count of long blinks
538
 
* ===========
539
 
**************************************************************************************/
540
 
void configBlink(byte num)
541
 
{
542
 
     20e:       cf 93           push    r28
543
 
     210:       c8 2f           mov     r28, r24
544
 
        blink(2, 40);
545
 
     212:       68 e2           ldi     r22, 0x28       ; 40
546
 
     214:       70 e0           ldi     r23, 0x00       ; 0
547
 
     216:       82 e0           ldi     r24, 0x02       ; 2
548
 
     218:       b4 df           rcall   .-152           ; 0x182 <blink>
549
 
        _delay_ms(240);
550
 
     21a:       80 ef           ldi     r24, 0xF0       ; 240
551
 
     21c:       90 e0           ldi     r25, 0x00       ; 0
552
 
     21e:       83 df           rcall   .-250           ; 0x126 <_delay_ms>
553
 
        blink(num, 100);
554
 
     220:       64 e6           ldi     r22, 0x64       ; 100
555
 
     222:       70 e0           ldi     r23, 0x00       ; 0
556
 
     224:       8c 2f           mov     r24, r28
557
 
     226:       ad df           rcall   .-166           ; 0x182 <blink>
558
 
 
559
 
        configIdleTime = 0;             // reset the timeout after the blinks complete
560
 
     228:       10 92 b4 00     sts     0x00B4, r1
561
 
}
562
 
     22c:       cf 91           pop     r28
563
 
     22e:       08 95           ret
564
 
 
565
 
00000230 <is_pressed>:
566
 
{
567
 
        static byte pressed = 0;
568
 
        // Keep track of last switch values polled
569
 
        static byte buffer = 0x00;
570
 
        // Shift over and tack on the latest value, 0 being low for pressed, 1 for pulled-up for released
571
 
        buffer = (buffer << 1) | ((PINB & (1 << SWITCH_PIN)) == 0);
572
 
     230:       86 b3           in      r24, 0x16       ; 22
573
 
     232:       83 fb           bst     r24, 3
574
 
     234:       88 27           eor     r24, r24
575
 
     236:       80 f9           bld     r24, 0
576
 
     238:       91 e0           ldi     r25, 0x01       ; 1
577
 
     23a:       98 27           eor     r25, r24
578
 
     23c:       80 91 a4 00     lds     r24, 0x00A4
579
 
     240:       88 0f           add     r24, r24
580
 
     242:       89 2b           or      r24, r25
581
 
     244:       80 93 a4 00     sts     0x00A4, r24
582
 
        
583
 
        if (pressed) {
584
 
     248:       90 91 a3 00     lds     r25, 0x00A3
585
 
     24c:       99 23           and     r25, r25
586
 
     24e:       11 f0           breq    .+4             ; 0x254 <is_pressed+0x24>
587
 
                // Need to look for a release indicator by seeing if the last switch status has been 0 for n number of polls
588
 
                pressed = (buffer & DB_REL_DUR);
589
 
     250:       8f 70           andi    r24, 0x0F       ; 15
590
 
     252:       01 c0           rjmp    .+2             ; 0x256 <is_pressed+0x26>
591
 
        } else {
592
 
                // Need to look for pressed indicator by seeing if the last switch status was 1 for n number of polls
593
 
                pressed = ((buffer & DB_PRES_DUR) == DB_PRES_DUR);
594
 
     254:       81 70           andi    r24, 0x01       ; 1
595
 
     256:       80 93 a3 00     sts     0x00A3, r24
596
 
        }
597
 
 
598
 
        return pressed;
599
 
     25a:       80 91 a3 00     lds     r24, 0x00A3
600
 
}
601
 
     25e:       90 e0           ldi     r25, 0x00       ; 0
602
 
     260:       08 95           ret
603
 
 
604
 
00000262 <next_mode>:
605
 
* next_mode - switch's to next mode, higher output mode
606
 
* =========
607
 
**************************************************************************************/
608
 
void next_mode()
609
 
{
610
 
        if (modeIdx < 16)       // 11/16/14 TE: bug fix to exit strobe mode when doing a long press in strobe mode
611
 
     262:       80 91 b3 00     lds     r24, 0x00B3
612
 
     266:       80 31           cpi     r24, 0x10       ; 16
613
 
     268:       20 f4           brcc    .+8             ; 0x272 <next_mode+0x10>
614
 
                prevModeIdx      = modeIdx;
615
 
     26a:       80 91 b3 00     lds     r24, 0x00B3
616
 
     26e:       80 93 b2 00     sts     0x00B2, r24
617
 
 
618
 
        if (++modeIdx >= modesCnt)
619
 
     272:       80 91 b3 00     lds     r24, 0x00B3
620
 
     276:       8f 5f           subi    r24, 0xFF       ; 255
621
 
     278:       80 93 b3 00     sts     0x00B3, r24
622
 
     27c:       90 91 c9 00     lds     r25, 0x00C9
623
 
     280:       89 17           cp      r24, r25
624
 
     282:       10 f0           brcs    .+4             ; 0x288 <next_mode+0x26>
625
 
        {
626
 
                // Wrap around
627
 
                modeIdx = 0;
628
 
     284:       10 92 b3 00     sts     0x00B3, r1
629
 
     288:       08 95           ret
630
 
 
631
 
0000028a <prev_mode>:
632
 
* prev_mode - switch's to previous mode, lower output mode
633
 
* =========
634
 
**************************************************************************************/
635
 
void prev_mode()
636
 
{
637
 
        prevModeIdx      = modeIdx;
638
 
     28a:       80 91 b3 00     lds     r24, 0x00B3
639
 
     28e:       80 93 b2 00     sts     0x00B2, r24
640
 
 
641
 
        if (modeIdx == 0)
642
 
     292:       80 91 b3 00     lds     r24, 0x00B3
643
 
     296:       81 11           cpse    r24, r1
644
 
     298:       03 c0           rjmp    .+6             ; 0x2a0 <prev_mode+0x16>
645
 
                modeIdx = modesCnt - 1; // Wrap around
646
 
     29a:       80 91 c9 00     lds     r24, 0x00C9
647
 
     29e:       02 c0           rjmp    .+4             ; 0x2a4 <prev_mode+0x1a>
648
 
        else
649
 
                --modeIdx;
650
 
     2a0:       80 91 b3 00     lds     r24, 0x00B3
651
 
     2a4:       81 50           subi    r24, 0x01       ; 1
652
 
     2a6:       80 93 b3 00     sts     0x00B3, r24
653
 
     2aa:       08 95           ret
654
 
 
655
 
000002ac <__vector_2>:
656
 
        GIMSK &= ~(1 << PCIE);
657
 
}
658
 
 
659
 
// Need an interrupt for when pin change is enabled to ONLY wake us from sleep.
660
 
// All logic of what to do when we wake up will be handled in the main loop.
661
 
EMPTY_INTERRUPT(PCINT0_vect);
662
 
     2ac:       18 95           reti
663
 
 
664
 
000002ae <sleep_until_switch_press>:
665
 
* WDT_off - turn off the WatchDog timer
666
 
* =======
667
 
**************************************************************************************/
668
 
inline void WDT_off()
669
 
{
670
 
        cli();                                                  // Disable interrupts
671
 
     2ae:       f8 94           cli
672
 
        wdt_reset();                                    // Reset the WDT
673
 
     2b0:       a8 95           wdr
674
 
        MCUSR &= ~(1<<WDRF);                    // Clear Watchdog reset flag
675
 
     2b2:       84 b7           in      r24, 0x34       ; 52
676
 
     2b4:       87 7f           andi    r24, 0xF7       ; 247
677
 
     2b6:       84 bf           out     0x34, r24       ; 52
678
 
        WDTCR |= (1<<WDCE) | (1<<WDE);  // Start timed sequence
679
 
     2b8:       81 b5           in      r24, 0x21       ; 33
680
 
     2ba:       88 61           ori     r24, 0x18       ; 24
681
 
     2bc:       81 bd           out     0x21, r24       ; 33
682
 
        WDTCR = 0x00;                                   // Disable WDT
683
 
     2be:       11 bc           out     0x21, r1        ; 33
684
 
        sei();                                                  // Enable interrupts
685
 
     2c0:       78 94           sei
686
 
        // This routine takes up a lot of program memory :(
687
 
        // Turn the WDT off so it doesn't wake us from sleep
688
 
        // Will also ensure interrupts are on or we will never wake up
689
 
        WDT_off();
690
 
        // Need to reset press duration since a button release wasn't recorded
691
 
        pressDuration = 0;
692
 
     2c2:       10 92 b1 00     sts     0x00B1, r1
693
 
        // Enable a pin change interrupt to wake us up
694
 
        // However, we have to make sure the switch is released otherwise we will wake when the user releases the switch
695
 
        while (is_pressed()) {
696
 
     2c6:       b4 df           rcall   .-152           ; 0x230 <is_pressed>
697
 
     2c8:       89 2b           or      r24, r25
698
 
     2ca:       21 f0           breq    .+8             ; 0x2d4 <sleep_until_switch_press+0x26>
699
 
                _delay_ms(16);
700
 
     2cc:       80 e1           ldi     r24, 0x10       ; 16
701
 
     2ce:       90 e0           ldi     r25, 0x00       ; 0
702
 
     2d0:       2a df           rcall   .-428           ; 0x126 <_delay_ms>
703
 
     2d2:       f9 cf           rjmp    .-14            ; 0x2c6 <sleep_until_switch_press+0x18>
704
 
* PCINT_on - Enable pin change interrupts
705
 
* ========
706
 
**************************************************************************************/
707
 
inline void PCINT_on() {
708
 
        // Enable pin change interrupts
709
 
        GIMSK |= (1 << PCIE);
710
 
     2d4:       8b b7           in      r24, 0x3b       ; 59
711
 
     2d6:       80 62           ori     r24, 0x20       ; 32
712
 
     2d8:       8b bf           out     0x3b, r24       ; 59
713
 
        }
714
 
        PCINT_on();
715
 
        // Enable sleep mode set to Power Down that will be triggered by the sleep_mode() command.
716
 
        //set_sleep_mode(SLEEP_MODE_PWR_DOWN);
717
 
        // Now go to sleep
718
 
        sleep_mode();
719
 
     2da:       85 b7           in      r24, 0x35       ; 53
720
 
     2dc:       80 62           ori     r24, 0x20       ; 32
721
 
     2de:       85 bf           out     0x35, r24       ; 53
722
 
     2e0:       88 95           sleep
723
 
     2e2:       85 b7           in      r24, 0x35       ; 53
724
 
     2e4:       8f 7d           andi    r24, 0xDF       ; 223
725
 
     2e6:       85 bf           out     0x35, r24       ; 53
726
 
* PCINT_off - Disable pin change interrupts
727
 
* =========
728
 
**************************************************************************************/
729
 
inline void PCINT_off() {
730
 
        // Disable pin change interrupts
731
 
        GIMSK &= ~(1 << PCIE);
732
 
     2e8:       8b b7           in      r24, 0x3b       ; 59
733
 
     2ea:       8f 7d           andi    r24, 0xDF       ; 223
734
 
     2ec:       8b bf           out     0x3b, r24       ; 59
735
 
* WDT_on - Setup watchdog timer to only interrupt, not reset, every 16ms
736
 
* ======
737
 
**************************************************************************************/
738
 
inline void WDT_on() {
739
 
        // Setup watchdog timer to only interrupt, not reset, every 16ms.
740
 
        cli();                                                  // Disable interrupts
741
 
     2ee:       f8 94           cli
742
 
        wdt_reset();                                    // Reset the WDT
743
 
     2f0:       a8 95           wdr
744
 
        WDTCR |= (1<<WDCE) | (1<<WDE);  // Start timed sequence
745
 
     2f2:       81 b5           in      r24, 0x21       ; 33
746
 
     2f4:       88 61           ori     r24, 0x18       ; 24
747
 
     2f6:       81 bd           out     0x21, r24       ; 33
748
 
        WDTCR = (1<<WDIE);                              // Enable interrupt every 16ms (was 1<<WDTIE)
749
 
     2f8:       80 e4           ldi     r24, 0x40       ; 64
750
 
     2fa:       81 bd           out     0x21, r24       ; 33
751
 
        sei();                                                  // Enable interrupts
752
 
     2fc:       78 94           sei
753
 
     2fe:       08 95           ret
754
 
 
755
 
00000300 <SaveConfig>:
756
 
*
757
 
**************************************************************************************/
758
 
void SaveConfig()
759
 
{  
760
 
        // Pack all settings into one byte
761
 
        byte config1 = (byte)(word)(modeIdx | (modeSetIdx << 3));
762
 
     300:       80 91 b3 00     lds     r24, 0x00B3
763
 
     304:       e0 91 66 00     lds     r30, 0x0066
764
 
     308:       ee 0f           add     r30, r30
765
 
     30a:       ee 0f           add     r30, r30
766
 
     30c:       ee 0f           add     r30, r30
767
 
     30e:       e8 2b           or      r30, r24
768
 
        byte config2 = (byte)(word)(highToLow | (modeMemoryEnabled << 1) | (moonlightLevel << 2) | (turboTimeoutMode << 5));
769
 
     310:       90 91 bd 00     lds     r25, 0x00BD
770
 
     314:       20 91 bc 00     lds     r18, 0x00BC
771
 
     318:       80 91 63 00     lds     r24, 0x0063
772
 
     31c:       40 91 bb 00     lds     r20, 0x00BB
773
 
     320:       22 0f           add     r18, r18
774
 
     322:       88 0f           add     r24, r24
775
 
     324:       88 0f           add     r24, r24
776
 
     326:       82 2b           or      r24, r18
777
 
     328:       89 2b           or      r24, r25
778
 
     32a:       42 95           swap    r20
779
 
     32c:       44 0f           add     r20, r20
780
 
     32e:       40 7e           andi    r20, 0xE0       ; 224
781
 
     330:       48 2b           or      r20, r24
782
 
        byte config3 = (byte)(word)(OffTimeEnable | (onboardLedEnable << 1) | (locatorLedOn << 2) | (bvldLedOnly << 3) | (moonLightEnable << 4));
783
 
     332:       30 91 b9 00     lds     r19, 0x00B9
784
 
     336:       50 91 62 00     lds     r21, 0x0062
785
 
     33a:       20 91 64 00     lds     r18, 0x0064
786
 
     33e:       90 91 ba 00     lds     r25, 0x00BA
787
 
     342:       80 91 65 00     lds     r24, 0x0065
788
 
     346:       55 0f           add     r21, r21
789
 
     348:       22 0f           add     r18, r18
790
 
     34a:       22 0f           add     r18, r18
791
 
     34c:       25 2b           or      r18, r21
792
 
     34e:       23 2b           or      r18, r19
793
 
     350:       99 0f           add     r25, r25
794
 
     352:       99 0f           add     r25, r25
795
 
     354:       99 0f           add     r25, r25
796
 
     356:       92 2b           or      r25, r18
797
 
     358:       82 95           swap    r24
798
 
     35a:       80 7f           andi    r24, 0xF0       ; 240
799
 
     35c:       89 2b           or      r24, r25
800
 
        
801
 
        byte oldpos = eepos;
802
 
     35e:       20 91 a5 00     lds     r18, 0x00A5
803
 
     362:       30 91 a6 00     lds     r19, 0x00A6
804
 
        
805
 
        eepos = (eepos+3) & 127;  // wear leveling, use next cell
806
 
     366:       b9 01           movw    r22, r18
807
 
     368:       6d 5f           subi    r22, 0xFD       ; 253
808
 
     36a:       7f 4f           sbci    r23, 0xFF       ; 255
809
 
     36c:       6f 77           andi    r22, 0x7F       ; 127
810
 
     36e:       77 27           eor     r23, r23
811
 
     370:       70 93 a6 00     sts     0x00A6, r23
812
 
     374:       60 93 a5 00     sts     0x00A5, r22
813
 
        
814
 
        // Write the current settings (3 bytes)
815
 
        EEARL=eepos;   EEDR=config1; EECR=32+4; EECR=32+4+2;  //WRITE  //32:write only (no erase)  4:enable  2:go
816
 
     378:       6e bb           out     0x1e, r22       ; 30
817
 
     37a:       ed bb           out     0x1d, r30       ; 29
818
 
     37c:       94 e2           ldi     r25, 0x24       ; 36
819
 
     37e:       9c bb           out     0x1c, r25       ; 28
820
 
     380:       96 e2           ldi     r25, 0x26       ; 38
821
 
     382:       9c bb           out     0x1c, r25       ; 28
822
 
        while(EECR & 2)  ; // wait for completion
823
 
     384:       e1 99           sbic    0x1c, 1 ; 28
824
 
     386:       fe cf           rjmp    .-4             ; 0x384 <SaveConfig+0x84>
825
 
        EEARL=eepos+1; EEDR=config2; EECR=32+4; EECR=32+4+2;  //WRITE  //32:write only (no erase)  4:enable  2:go
826
 
     388:       90 91 a5 00     lds     r25, 0x00A5
827
 
     38c:       9f 5f           subi    r25, 0xFF       ; 255
828
 
     38e:       9e bb           out     0x1e, r25       ; 30
829
 
     390:       4d bb           out     0x1d, r20       ; 29
830
 
     392:       94 e2           ldi     r25, 0x24       ; 36
831
 
     394:       9c bb           out     0x1c, r25       ; 28
832
 
     396:       96 e2           ldi     r25, 0x26       ; 38
833
 
     398:       9c bb           out     0x1c, r25       ; 28
834
 
        while(EECR & 2)  ; // wait for completion
835
 
     39a:       e1 99           sbic    0x1c, 1 ; 28
836
 
     39c:       fe cf           rjmp    .-4             ; 0x39a <SaveConfig+0x9a>
837
 
        EEARL=eepos+2; EEDR=config3; EECR=32+4; EECR=32+4+2;  //WRITE  //32:write only (no erase)  4:enable  2:go
838
 
     39e:       90 91 a5 00     lds     r25, 0x00A5
839
 
     3a2:       9e 5f           subi    r25, 0xFE       ; 254
840
 
     3a4:       9e bb           out     0x1e, r25       ; 30
841
 
     3a6:       8d bb           out     0x1d, r24       ; 29
842
 
     3a8:       84 e2           ldi     r24, 0x24       ; 36
843
 
     3aa:       8c bb           out     0x1c, r24       ; 28
844
 
     3ac:       86 e2           ldi     r24, 0x26       ; 38
845
 
     3ae:       8c bb           out     0x1c, r24       ; 28
846
 
        while(EECR & 2)  ; // wait for completion
847
 
     3b0:       e1 99           sbic    0x1c, 1 ; 28
848
 
     3b2:       fe cf           rjmp    .-4             ; 0x3b0 <SaveConfig+0xb0>
849
 
 
850
 
        // Erase the last settings (3 bytes)
851
 
        EEARL=oldpos;   EECR=16+4; EECR=16+4+2;  //ERASE  //16:erase only (no write)  4:enable  2:go
852
 
     3b4:       2e bb           out     0x1e, r18       ; 30
853
 
     3b6:       84 e1           ldi     r24, 0x14       ; 20
854
 
     3b8:       8c bb           out     0x1c, r24       ; 28
855
 
     3ba:       86 e1           ldi     r24, 0x16       ; 22
856
 
     3bc:       8c bb           out     0x1c, r24       ; 28
857
 
        while(EECR & 2)  ; // wait for completion
858
 
     3be:       e1 99           sbic    0x1c, 1 ; 28
859
 
     3c0:       fe cf           rjmp    .-4             ; 0x3be <SaveConfig+0xbe>
860
 
        EEARL=oldpos+1; EECR=16+4; EECR=16+4+2;  //ERASE  //16:erase only (no write)  4:enable  2:go
861
 
     3c2:       81 e0           ldi     r24, 0x01       ; 1
862
 
     3c4:       82 0f           add     r24, r18
863
 
     3c6:       8e bb           out     0x1e, r24       ; 30
864
 
     3c8:       84 e1           ldi     r24, 0x14       ; 20
865
 
     3ca:       8c bb           out     0x1c, r24       ; 28
866
 
     3cc:       86 e1           ldi     r24, 0x16       ; 22
867
 
     3ce:       8c bb           out     0x1c, r24       ; 28
868
 
        while(EECR & 2)  ; // wait for completion
869
 
     3d0:       e1 99           sbic    0x1c, 1 ; 28
870
 
     3d2:       fe cf           rjmp    .-4             ; 0x3d0 <SaveConfig+0xd0>
871
 
        EEARL=oldpos+2; EECR=16+4; EECR=16+4+2;  //ERASE  //16:erase only (no write)  4:enable  2:go
872
 
     3d4:       2e 5f           subi    r18, 0xFE       ; 254
873
 
     3d6:       2e bb           out     0x1e, r18       ; 30
874
 
     3d8:       84 e1           ldi     r24, 0x14       ; 20
875
 
     3da:       8c bb           out     0x1c, r24       ; 28
876
 
     3dc:       86 e1           ldi     r24, 0x16       ; 22
877
 
     3de:       8c bb           out     0x1c, r24       ; 28
878
 
        while(EECR & 2)  ; // wait for completion
879
 
     3e0:       e1 99           sbic    0x1c, 1 ; 28
880
 
     3e2:       fe cf           rjmp    .-4             ; 0x3e0 <SaveConfig+0xe0>
881
 
}
882
 
     3e4:       08 95           ret
883
 
 
884
 
000003e6 <__vector_12>:
885
 
/**************************************************************************************
886
 
* WDT_vect - The watchdog timer - this is invoked every 16ms
887
 
* ========
888
 
**************************************************************************************/
889
 
ISR(WDT_vect)
890
 
{
891
 
     3e6:       1f 92           push    r1
892
 
     3e8:       0f 92           push    r0
893
 
     3ea:       0f b6           in      r0, 0x3f        ; 63
894
 
     3ec:       0f 92           push    r0
895
 
     3ee:       11 24           eor     r1, r1
896
 
     3f0:       2f 93           push    r18
897
 
     3f2:       3f 93           push    r19
898
 
     3f4:       4f 93           push    r20
899
 
     3f6:       5f 93           push    r21
900
 
     3f8:       6f 93           push    r22
901
 
     3fa:       7f 93           push    r23
902
 
     3fc:       8f 93           push    r24
903
 
     3fe:       9f 93           push    r25
904
 
     400:       af 93           push    r26
905
 
     402:       bf 93           push    r27
906
 
     404:       ef 93           push    r30
907
 
     406:       ff 93           push    r31
908
 
  #endif
909
 
 
910
 
        //---------------------------------------------------------------------------------------
911
 
   // Button is pressed
912
 
        //---------------------------------------------------------------------------------------
913
 
        if (is_pressed())
914
 
     408:       13 df           rcall   .-474           ; 0x230 <is_pressed>
915
 
     40a:       89 2b           or      r24, r25
916
 
     40c:       09 f4           brne    .+2             ; 0x410 <__vector_12+0x2a>
917
 
     40e:       c6 c0           rjmp    .+396           ; 0x59c <__vector_12+0x1b6>
918
 
        {
919
 
                if (pressDuration < 255)
920
 
     410:       80 91 b1 00     lds     r24, 0x00B1
921
 
     414:       8f 3f           cpi     r24, 0xFF       ; 255
922
 
     416:       29 f0           breq    .+10            ; 0x422 <__vector_12+0x3c>
923
 
                        pressDuration++;
924
 
     418:       80 91 b1 00     lds     r24, 0x00B1
925
 
     41c:       8f 5f           subi    r24, 0xFF       ; 255
926
 
     41e:       80 93 b1 00     sts     0x00B1, r24
927
 
                
928
 
                //---------------------------------------------------------------------------------------
929
 
                // Handle config mode specially right here:
930
 
                //---------------------------------------------------------------------------------------
931
 
                if (ConfigMode > 0)
932
 
     422:       80 91 b7 00     lds     r24, 0x00B7
933
 
     426:       88 23           and     r24, r24
934
 
     428:       d1 f0           breq    .+52            ; 0x45e <__vector_12+0x78>
935
 
                {
936
 
                        configIdleTime = 0;
937
 
     42a:       10 92 b4 00     sts     0x00B4, r1
938
 
                        
939
 
                        if (!holdHandled)
940
 
     42e:       80 91 aa 00     lds     r24, 0x00AA
941
 
     432:       81 11           cpse    r24, r1
942
 
     434:       d3 c1           rjmp    .+934           ; 0x7dc <__vector_12+0x3f6>
943
 
                        {
944
 
                                if (pressDuration == 35)                // hold time for skipping: 35*16 = 560 msecs
945
 
     436:       80 91 b1 00     lds     r24, 0x00B1
946
 
     43a:       83 32           cpi     r24, 0x23       ; 35
947
 
     43c:       21 f4           brne    .+8             ; 0x446 <__vector_12+0x60>
948
 
                                        ++ConfigMode;
949
 
     43e:       80 91 b7 00     lds     r24, 0x00B7
950
 
     442:       8f 5f           subi    r24, 0xFF       ; 255
951
 
     444:       09 c0           rjmp    .+18            ; 0x458 <__vector_12+0x72>
952
 
                                else if (pressDuration == 70)   // hold time for bailing out: 70*16 = 1.1 secs
953
 
     446:       80 91 b1 00     lds     r24, 0x00B1
954
 
     44a:       86 34           cpi     r24, 0x46       ; 70
955
 
     44c:       09 f0           breq    .+2             ; 0x450 <__vector_12+0x6a>
956
 
     44e:       c6 c1           rjmp    .+908           ; 0x7dc <__vector_12+0x3f6>
957
 
                                {
958
 
                                        holdHandled = 1;                // suppress more hold events on this hold
959
 
     450:       81 e0           ldi     r24, 0x01       ; 1
960
 
     452:       80 93 aa 00     sts     0x00AA, r24
961
 
                                        ConfigMode = 8;         // Exit Config mode
962
 
     456:       88 e0           ldi     r24, 0x08       ; 8
963
 
     458:       80 93 b7 00     sts     0x00B7, r24
964
 
     45c:       bf c1           rjmp    .+894           ; 0x7dc <__vector_12+0x3f6>
965
 
                                }
966
 
                        }
967
 
                        return;
968
 
                }
969
 
 
970
 
                if (!holdHandled)
971
 
     45e:       80 91 aa 00     lds     r24, 0x00AA
972
 
     462:       81 11           cpse    r24, r1
973
 
     464:       93 c0           rjmp    .+294           ; 0x58c <__vector_12+0x1a6>
974
 
                {
975
 
                        //---------------------------------------------------------------------------------------
976
 
                        // LONG hold - for previous mode
977
 
                        //---------------------------------------------------------------------------------------
978
 
                        if ((pressDuration == LONG_PRESS_DUR) && (byLockOutSet == 0))
979
 
     466:       80 91 b1 00     lds     r24, 0x00B1
980
 
     46a:       88 31           cpi     r24, 0x18       ; 24
981
 
     46c:       41 f5           brne    .+80            ; 0x4be <__vector_12+0xd8>
982
 
     46e:       80 91 b8 00     lds     r24, 0x00B8
983
 
     472:       81 11           cpse    r24, r1
984
 
     474:       24 c0           rjmp    .+72            ; 0x4be <__vector_12+0xd8>
985
 
                        {
986
 
                                if (modeIdx < 16)
987
 
     476:       80 91 b3 00     lds     r24, 0x00B3
988
 
     47a:       80 31           cpi     r24, 0x10       ; 16
989
 
     47c:       40 f4           brcc    .+16            ; 0x48e <__vector_12+0xa8>
990
 
                                {
991
 
                                        // Long press
992
 
                                        if (highToLow)
993
 
     47e:       80 91 bd 00     lds     r24, 0x00BD
994
 
     482:       88 23           and     r24, r24
995
 
     484:       11 f0           breq    .+4             ; 0x48a <__vector_12+0xa4>
996
 
                                                next_mode();
997
 
     486:       ed de           rcall   .-550           ; 0x262 <next_mode>
998
 
     488:       1a c0           rjmp    .+52            ; 0x4be <__vector_12+0xd8>
999
 
                                        else
1000
 
                                                prev_mode();
1001
 
     48a:       ff de           rcall   .-514           ; 0x28a <prev_mode>
1002
 
     48c:       18 c0           rjmp    .+48            ; 0x4be <__vector_12+0xd8>
1003
 
                                }
1004
 
                                else if (modeIdx > SPECIAL_MODES)
1005
 
     48e:       80 91 b3 00     lds     r24, 0x00B3
1006
 
     492:       8b 35           cpi     r24, 0x5B       ; 91
1007
 
     494:       a0 f0           brcs    .+40            ; 0x4be <__vector_12+0xd8>
1008
 
                                {
1009
 
                                        if (specModeIdx > 0)
1010
 
     496:       80 91 d6 00     lds     r24, 0x00D6
1011
 
     49a:       88 23           and     r24, r24
1012
 
     49c:       61 f0           breq    .+24            ; 0x4b6 <__vector_12+0xd0>
1013
 
                                        {
1014
 
                                                --specModeIdx;
1015
 
     49e:       80 91 d6 00     lds     r24, 0x00D6
1016
 
     4a2:       81 50           subi    r24, 0x01       ; 1
1017
 
     4a4:       80 93 d6 00     sts     0x00D6, r24
1018
 
                                                modeIdx = specialModes[specModeIdx];
1019
 
     4a8:       e0 91 d6 00     lds     r30, 0x00D6
1020
 
     4ac:       f0 e0           ldi     r31, 0x00       ; 0
1021
 
     4ae:       e8 56           subi    r30, 0x68       ; 104
1022
 
     4b0:       ff 4f           sbci    r31, 0xFF       ; 255
1023
 
     4b2:       80 81           ld      r24, Z
1024
 
     4b4:       02 c0           rjmp    .+4             ; 0x4ba <__vector_12+0xd4>
1025
 
                                        }
1026
 
                                        else
1027
 
                                                modeIdx = prevModeIdx;  // bail out of special modes
1028
 
     4b6:       80 91 b2 00     lds     r24, 0x00B2
1029
 
     4ba:       80 93 b3 00     sts     0x00B3, r24
1030
 
                        }
1031
 
 
1032
 
                        //---------------------------------------------------------------------------------------
1033
 
                        // XLONG hold - for strobes, battery check, or lock-out (depending on preceding quick clicks)
1034
 
                        //---------------------------------------------------------------------------------------
1035
 
                        if (pressDuration == XLONG_PRESS_DUR)
1036
 
     4be:       80 91 b1 00     lds     r24, 0x00B1
1037
 
     4c2:       84 34           cpi     r24, 0x44       ; 68
1038
 
     4c4:       09 f0           breq    .+2             ; 0x4c8 <__vector_12+0xe2>
1039
 
     4c6:       4d c0           rjmp    .+154           ; 0x562 <__vector_12+0x17c>
1040
 
                        {
1041
 
                                if ((byLockOutEnable == 1) && (quickClicks == 2) && (wIdleTicks < LOCK_OUT_TICKS))
1042
 
     4c8:       80 91 61 00     lds     r24, 0x0061
1043
 
     4cc:       81 30           cpi     r24, 0x01       ; 1
1044
 
     4ce:       99 f4           brne    .+38            ; 0x4f6 <__vector_12+0x110>
1045
 
     4d0:       90 91 b0 00     lds     r25, 0x00B0
1046
 
     4d4:       92 30           cpi     r25, 0x02       ; 2
1047
 
     4d6:       79 f4           brne    .+30            ; 0x4f6 <__vector_12+0x110>
1048
 
     4d8:       20 91 ad 00     lds     r18, 0x00AD
1049
 
     4dc:       30 91 ae 00     lds     r19, 0x00AE
1050
 
     4e0:       20 31           cpi     r18, 0x10       ; 16
1051
 
     4e2:       31 05           cpc     r19, r1
1052
 
     4e4:       40 f4           brcc    .+16            ; 0x4f6 <__vector_12+0x110>
1053
 
                                {
1054
 
                                        modeIdx = 0;
1055
 
     4e6:       10 92 b3 00     sts     0x00B3, r1
1056
 
                                        byLockOutSet = 1 - byLockOutSet;                // invert "LOCK OUT"
1057
 
     4ea:       90 91 b8 00     lds     r25, 0x00B8
1058
 
     4ee:       89 1b           sub     r24, r25
1059
 
     4f0:       80 93 b8 00     sts     0x00B8, r24
1060
 
     4f4:       36 c0           rjmp    .+108           ; 0x562 <__vector_12+0x17c>
1061
 
                                }
1062
 
                                else if (byLockOutSet == 0)
1063
 
     4f6:       80 91 b8 00     lds     r24, 0x00B8
1064
 
     4fa:       81 11           cpse    r24, r1
1065
 
     4fc:       32 c0           rjmp    .+100           ; 0x562 <__vector_12+0x17c>
1066
 
                                {
1067
 
                                        if ((quickClicks == 1) && (wIdleTicks < LOCK_OUT_TICKS))
1068
 
     4fe:       80 91 b0 00     lds     r24, 0x00B0
1069
 
     502:       81 30           cpi     r24, 0x01       ; 1
1070
 
     504:       41 f4           brne    .+16            ; 0x516 <__vector_12+0x130>
1071
 
     506:       80 91 ad 00     lds     r24, 0x00AD
1072
 
     50a:       90 91 ae 00     lds     r25, 0x00AE
1073
 
     50e:       40 97           sbiw    r24, 0x10       ; 16
1074
 
     510:       10 f4           brcc    .+4             ; 0x516 <__vector_12+0x130>
1075
 
                                        {
1076
 
                                                modeIdx = BATT_CHECK_MODE;
1077
 
     512:       80 e5           ldi     r24, 0x50       ; 80
1078
 
     514:       06 c0           rjmp    .+12            ; 0x522 <__vector_12+0x13c>
1079
 
                                        }
1080
 
                                        else if (modeIdx > SPECIAL_MODES)
1081
 
     516:       80 91 b3 00     lds     r24, 0x00B3
1082
 
     51a:       8b 35           cpi     r24, 0x5B       ; 91
1083
 
     51c:       28 f0           brcs    .+10            ; 0x528 <__vector_12+0x142>
1084
 
                                        {
1085
 
                                                modeIdx = prevModeIdx;  // restore last normal mode
1086
 
     51e:       80 91 b2 00     lds     r24, 0x00B2
1087
 
     522:       80 93 b3 00     sts     0x00B3, r24
1088
 
     526:       1d c0           rjmp    .+58            ; 0x562 <__vector_12+0x17c>
1089
 
                                        }
1090
 
                                        else if (modeIdx == BATT_CHECK_MODE)
1091
 
     528:       80 91 b3 00     lds     r24, 0x00B3
1092
 
     52c:       80 35           cpi     r24, 0x50       ; 80
1093
 
     52e:       69 f4           brne    .+26            ; 0x54a <__vector_12+0x164>
1094
 
                                        {
1095
 
                                                modeIdx = 0;            // clear main mode
1096
 
     530:       10 92 b3 00     sts     0x00B3, r1
1097
 
                                                PWM_LVL = 0;            // suppress main LED output
1098
 
     534:       18 bc           out     0x28, r1        ; 40
1099
 
                                                ALT_PWM_LVL = 0;
1100
 
     536:       19 bc           out     0x29, r1        ; 41
1101
 
                                
1102
 
                                                ConfigMode = 21;                // Initialize Advanced Config mode
1103
 
     538:       85 e1           ldi     r24, 0x15       ; 21
1104
 
     53a:       80 93 b7 00     sts     0x00B7, r24
1105
 
                                                configClicks = 0;
1106
 
     53e:       10 92 b5 00     sts     0x00B5, r1
1107
 
                                                holdHandled = 1;                // suppress more hold events on this hold
1108
 
     542:       81 e0           ldi     r24, 0x01       ; 1
1109
 
     544:       80 93 aa 00     sts     0x00AA, r24
1110
 
     548:       0c c0           rjmp    .+24            ; 0x562 <__vector_12+0x17c>
1111
 
                                        }
1112
 
                                        else
1113
 
                                        {
1114
 
                                                // Engage first special mode!
1115
 
                                                specModeIdx = 0;
1116
 
     54a:       10 92 d6 00     sts     0x00D6, r1
1117
 
                                                modeIdx = specialModes[specModeIdx];
1118
 
     54e:       e0 91 d6 00     lds     r30, 0x00D6
1119
 
     552:       f0 e0           ldi     r31, 0x00       ; 0
1120
 
     554:       e8 56           subi    r30, 0x68       ; 104
1121
 
     556:       ff 4f           sbci    r31, 0xFF       ; 255
1122
 
     558:       80 81           ld      r24, Z
1123
 
     55a:       80 93 b3 00     sts     0x00B3, r24
1124
 
                                                        
1125
 
                                                TurnOnBoardLed(0);      // be sure the on board LED is OFF here
1126
 
     55e:       80 e0           ldi     r24, 0x00       ; 0
1127
 
     560:       eb dd           rcall   .-1066          ; 0x138 <TurnOnBoardLed>
1128
 
                        }
1129
 
                        
1130
 
                        //---------------------------------------------------------------------------------------
1131
 
                        // CONFIG hold - if it is not locked out or lock-out was just exited on this hold
1132
 
                        //---------------------------------------------------------------------------------------
1133
 
                        if ((pressDuration == CONFIG_ENTER_DUR) && (byLockOutSet == 0) && (quickClicks != 2))
1134
 
     562:       80 91 b1 00     lds     r24, 0x00B1
1135
 
     566:       80 3a           cpi     r24, 0xA0       ; 160
1136
 
     568:       89 f4           brne    .+34            ; 0x58c <__vector_12+0x1a6>
1137
 
     56a:       80 91 b8 00     lds     r24, 0x00B8
1138
 
     56e:       81 11           cpse    r24, r1
1139
 
     570:       0d c0           rjmp    .+26            ; 0x58c <__vector_12+0x1a6>
1140
 
     572:       80 91 b0 00     lds     r24, 0x00B0
1141
 
     576:       82 30           cpi     r24, 0x02       ; 2
1142
 
     578:       49 f0           breq    .+18            ; 0x58c <__vector_12+0x1a6>
1143
 
                        {
1144
 
                                modeIdx = 0;
1145
 
     57a:       10 92 b3 00     sts     0x00B3, r1
1146
 
                                // turn the light off initially
1147
 
//                              TCCR0A = PHASE;
1148
 
                                PWM_LVL = 0;
1149
 
     57e:       18 bc           out     0x28, r1        ; 40
1150
 
                                ALT_PWM_LVL = 0;
1151
 
     580:       19 bc           out     0x29, r1        ; 41
1152
 
                                        
1153
 
                                ConfigMode = 1;
1154
 
     582:       81 e0           ldi     r24, 0x01       ; 1
1155
 
     584:       80 93 b7 00     sts     0x00B7, r24
1156
 
                                configClicks = 0;
1157
 
     588:       10 92 b5 00     sts     0x00B5, r1
1158
 
                        }
1159
 
                }
1160
 
 
1161
 
                wTurboTicks = 0;                // Just always reset turbo timer whenever the button is pressed
1162
 
     58c:       10 92 a2 00     sts     0x00A2, r1
1163
 
     590:       10 92 a1 00     sts     0x00A1, r1
1164
 
 
1165
 
                //LowBattState = 0;             // reset the Low Battery State upon a button press (NO - keep it active!)
1166
 
 
1167
 
          #ifdef VOLTAGE_MON
1168
 
                adc_ticks = ADC_DELAY;  // Same with the ramp down delay
1169
 
     594:       8c eb           ldi     r24, 0xBC       ; 188
1170
 
     596:       80 93 60 00     sts     0x0060, r24
1171
 
     59a:       20 c1           rjmp    .+576           ; 0x7dc <__vector_12+0x3f6>
1172
 
        //---------------------------------------------------------------------------------------
1173
 
   // Not pressed (debounced qualified)
1174
 
        //---------------------------------------------------------------------------------------
1175
 
        else
1176
 
        {
1177
 
                holdHandled = 0;                // free up any hold suppressed state
1178
 
     59c:       10 92 aa 00     sts     0x00AA, r1
1179
 
 
1180
 
                if (ConfigMode > 0)
1181
 
     5a0:       80 91 b7 00     lds     r24, 0x00B7
1182
 
     5a4:       88 23           and     r24, r24
1183
 
     5a6:       c1 f0           breq    .+48            ; 0x5d8 <__vector_12+0x1f2>
1184
 
                {
1185
 
                        if (pressDuration > 0)
1186
 
     5a8:       80 91 b1 00     lds     r24, 0x00B1
1187
 
     5ac:       88 23           and     r24, r24
1188
 
     5ae:       61 f0           breq    .+24            ; 0x5c8 <__vector_12+0x1e2>
1189
 
                        {
1190
 
                                if (pressDuration < LONG_PRESS_DUR)
1191
 
     5b0:       80 91 b1 00     lds     r24, 0x00B1
1192
 
     5b4:       88 31           cpi     r24, 0x18       ; 24
1193
 
     5b6:       28 f4           brcc    .+10            ; 0x5c2 <__vector_12+0x1dc>
1194
 
                                        ++configClicks;
1195
 
     5b8:       80 91 b5 00     lds     r24, 0x00B5
1196
 
     5bc:       8f 5f           subi    r24, 0xFF       ; 255
1197
 
     5be:       80 93 b5 00     sts     0x00B5, r24
1198
 
                                configIdleTime = 0;
1199
 
     5c2:       10 92 b4 00     sts     0x00B4, r1
1200
 
     5c6:       05 c0           rjmp    .+10            ; 0x5d2 <__vector_12+0x1ec>
1201
 
                        }
1202
 
                        else
1203
 
                        {
1204
 
                                ++configIdleTime;
1205
 
     5c8:       80 91 b4 00     lds     r24, 0x00B4
1206
 
     5cc:       8f 5f           subi    r24, 0xFF       ; 255
1207
 
     5ce:       80 93 b4 00     sts     0x00B4, r24
1208
 
                        }
1209
 
                        pressDuration = 0;
1210
 
     5d2:       10 92 b1 00     sts     0x00B1, r1
1211
 
     5d6:       00 c1           rjmp    .+512           ; 0x7d8 <__vector_12+0x3f2>
1212
 
                } // config mode
1213
 
                
1214
 
                else if (pressDuration > 0)
1215
 
     5d8:       80 91 b1 00     lds     r24, 0x00B1
1216
 
     5dc:       88 23           and     r24, r24
1217
 
     5de:       09 f4           brne    .+2             ; 0x5e2 <__vector_12+0x1fc>
1218
 
     5e0:       78 c0           rjmp    .+240           ; 0x6d2 <__vector_12+0x2ec>
1219
 
                {
1220
 
                // Was previously pressed
1221
 
                        if (pressDuration < LONG_PRESS_DUR)
1222
 
     5e2:       80 91 b1 00     lds     r24, 0x00B1
1223
 
     5e6:       88 31           cpi     r24, 0x18       ; 24
1224
 
     5e8:       08 f0           brcs    .+2             ; 0x5ec <__vector_12+0x206>
1225
 
     5ea:       6e c0           rjmp    .+220           ; 0x6c8 <__vector_12+0x2e2>
1226
 
                        {
1227
 
                                // normal short click
1228
 
                                if (modeIdx == BATT_CHECK_MODE)         // battery check - reset to OFF
1229
 
     5ec:       80 91 b3 00     lds     r24, 0x00B3
1230
 
     5f0:       80 35           cpi     r24, 0x50       ; 80
1231
 
     5f2:       09 f4           brne    .+2             ; 0x5f6 <__vector_12+0x210>
1232
 
     5f4:       41 c0           rjmp    .+130           ; 0x678 <__vector_12+0x292>
1233
 
                                        modeIdx = 0;
1234
 
                                else
1235
 
                                {
1236
 
                                        // track quick clicks in a row from OFF
1237
 
                                        if ((modeIdx == 0) && !quickClicks)
1238
 
     5f6:       80 91 b3 00     lds     r24, 0x00B3
1239
 
     5fa:       81 11           cpse    r24, r1
1240
 
     5fc:       06 c0           rjmp    .+12            ; 0x60a <__vector_12+0x224>
1241
 
     5fe:       80 91 b0 00     lds     r24, 0x00B0
1242
 
     602:       81 11           cpse    r24, r1
1243
 
     604:       02 c0           rjmp    .+4             ; 0x60a <__vector_12+0x224>
1244
 
                                                quickClicks = 1;
1245
 
     606:       81 e0           ldi     r24, 0x01       ; 1
1246
 
     608:       07 c0           rjmp    .+14            ; 0x618 <__vector_12+0x232>
1247
 
                                        else if (quickClicks)
1248
 
     60a:       80 91 b0 00     lds     r24, 0x00B0
1249
 
     60e:       88 23           and     r24, r24
1250
 
     610:       29 f0           breq    .+10            ; 0x61c <__vector_12+0x236>
1251
 
                                                ++quickClicks;
1252
 
     612:       80 91 b0 00     lds     r24, 0x00B0
1253
 
     616:       8f 5f           subi    r24, 0xFF       ; 255
1254
 
     618:       80 93 b0 00     sts     0x00B0, r24
1255
 
 
1256
 
                                        if (byLockOutSet == 0)
1257
 
     61c:       80 91 b8 00     lds     r24, 0x00B8
1258
 
     620:       81 11           cpse    r24, r1
1259
 
     622:       50 c0           rjmp    .+160           ; 0x6c4 <__vector_12+0x2de>
1260
 
                                        {
1261
 
                                                if (modeMemoryEnabled && (modeMemoryLastModeIdx > 0) && (modeIdx == 0))
1262
 
     624:       80 91 bc 00     lds     r24, 0x00BC
1263
 
     628:       88 23           and     r24, r24
1264
 
     62a:       79 f0           breq    .+30            ; 0x64a <__vector_12+0x264>
1265
 
     62c:       80 91 af 00     lds     r24, 0x00AF
1266
 
     630:       88 23           and     r24, r24
1267
 
     632:       59 f0           breq    .+22            ; 0x64a <__vector_12+0x264>
1268
 
     634:       80 91 b3 00     lds     r24, 0x00B3
1269
 
     638:       81 11           cpse    r24, r1
1270
 
     63a:       07 c0           rjmp    .+14            ; 0x64a <__vector_12+0x264>
1271
 
                                                {
1272
 
                                                        modeIdx = modeMemoryLastModeIdx;
1273
 
     63c:       80 91 af 00     lds     r24, 0x00AF
1274
 
     640:       80 93 b3 00     sts     0x00B3, r24
1275
 
                                                        modeMemoryLastModeIdx = 0;
1276
 
     644:       10 92 af 00     sts     0x00AF, r1
1277
 
     648:       3d c0           rjmp    .+122           ; 0x6c4 <__vector_12+0x2de>
1278
 
                                                }
1279
 
                                                else if (modeIdx < 16)
1280
 
     64a:       80 91 b3 00     lds     r24, 0x00B3
1281
 
     64e:       80 31           cpi     r24, 0x10       ; 16
1282
 
     650:       f0 f4           brcc    .+60            ; 0x68e <__vector_12+0x2a8>
1283
 
                                                {
1284
 
                                                        if ((modeIdx > 0) && (wIdleTicks >= IDLE_TIME))
1285
 
     652:       80 91 b3 00     lds     r24, 0x00B3
1286
 
     656:       88 23           and     r24, r24
1287
 
     658:       91 f0           breq    .+36            ; 0x67e <__vector_12+0x298>
1288
 
     65a:       80 91 ad 00     lds     r24, 0x00AD
1289
 
     65e:       90 91 ae 00     lds     r25, 0x00AE
1290
 
     662:       8b 34           cpi     r24, 0x4B       ; 75
1291
 
     664:       91 05           cpc     r25, r1
1292
 
     666:       58 f0           brcs    .+22            ; 0x67e <__vector_12+0x298>
1293
 
                                                        {
1294
 
                                                                modeMemoryLastModeIdx = modeIdx;
1295
 
     668:       80 91 b3 00     lds     r24, 0x00B3
1296
 
     66c:       80 93 af 00     sts     0x00AF, r24
1297
 
                                                                prevModeIdx = modeIdx;
1298
 
     670:       80 91 b3 00     lds     r24, 0x00B3
1299
 
     674:       80 93 b2 00     sts     0x00B2, r24
1300
 
                                                                modeIdx = 0;    // Turn OFF the light
1301
 
     678:       10 92 b3 00     sts     0x00B3, r1
1302
 
     67c:       23 c0           rjmp    .+70            ; 0x6c4 <__vector_12+0x2de>
1303
 
                                                        }
1304
 
                                                        else
1305
 
                                                        {
1306
 
                                                                // Short press - normal modes
1307
 
                                                                if (highToLow)
1308
 
     67e:       80 91 bd 00     lds     r24, 0x00BD
1309
 
     682:       88 23           and     r24, r24
1310
 
     684:       11 f0           breq    .+4             ; 0x68a <__vector_12+0x2a4>
1311
 
                                                                        prev_mode();
1312
 
     686:       01 de           rcall   .-1022          ; 0x28a <prev_mode>
1313
 
     688:       1d c0           rjmp    .+58            ; 0x6c4 <__vector_12+0x2de>
1314
 
                                                                else
1315
 
                                                                        next_mode();
1316
 
     68a:       eb dd           rcall   .-1066          ; 0x262 <next_mode>
1317
 
     68c:       1b c0           rjmp    .+54            ; 0x6c4 <__vector_12+0x2de>
1318
 
                                                        }
1319
 
                                                }
1320
 
                                                else  // special modes
1321
 
                                                {
1322
 
                                                        if (wIdleTicks >= IDLE_TIME)
1323
 
     68e:       80 91 ad 00     lds     r24, 0x00AD
1324
 
     692:       90 91 ae 00     lds     r25, 0x00AE
1325
 
     696:       8b 34           cpi     r24, 0x4B       ; 75
1326
 
     698:       91 05           cpc     r25, r1
1327
 
     69a:       48 f4           brcc    .+18            ; 0x6ae <__vector_12+0x2c8>
1328
 
                                                                modeIdx = prevModeIdx;
1329
 
                                                        else if (++specModeIdx > specialModesCnt)
1330
 
     69c:       80 91 d6 00     lds     r24, 0x00D6
1331
 
     6a0:       8f 5f           subi    r24, 0xFF       ; 255
1332
 
     6a2:       80 93 d6 00     sts     0x00D6, r24
1333
 
     6a6:       90 91 67 00     lds     r25, 0x0067
1334
 
     6aa:       98 17           cp      r25, r24
1335
 
     6ac:       18 f4           brcc    .+6             ; 0x6b4 <__vector_12+0x2ce>
1336
 
                                                                modeIdx = prevModeIdx;  // bail out of special modes
1337
 
     6ae:       80 91 b2 00     lds     r24, 0x00B2
1338
 
     6b2:       06 c0           rjmp    .+12            ; 0x6c0 <__vector_12+0x2da>
1339
 
                                                        else
1340
 
                                                                modeIdx = specialModes[specModeIdx];
1341
 
     6b4:       e0 91 d6 00     lds     r30, 0x00D6
1342
 
     6b8:       f0 e0           ldi     r31, 0x00       ; 0
1343
 
     6ba:       e8 56           subi    r30, 0x68       ; 104
1344
 
     6bc:       ff 4f           sbci    r31, 0xFF       ; 255
1345
 
     6be:       80 81           ld      r24, Z
1346
 
     6c0:       80 93 b3 00     sts     0x00B3, r24
1347
 
                                                }
1348
 
                                        }
1349
 
                                } // ...
1350
 
 
1351
 
                                pressDuration = 0;
1352
 
     6c4:       10 92 b1 00     sts     0x00B1, r1
1353
 
                        } // short click
1354
 
                        
1355
 
                        wIdleTicks = 0; // reset idle time
1356
 
     6c8:       10 92 ae 00     sts     0x00AE, r1
1357
 
     6cc:       10 92 ad 00     sts     0x00AD, r1
1358
 
     6d0:       83 c0           rjmp    .+262           ; 0x7d8 <__vector_12+0x3f2>
1359
 
                else
1360
 
                {
1361
 
                        //------------------------------------
1362
 
                        // Not previously pressed
1363
 
                        //------------------------------------
1364
 
                        if (++wIdleTicks == 0)
1365
 
     6d2:       80 91 ad 00     lds     r24, 0x00AD
1366
 
     6d6:       90 91 ae 00     lds     r25, 0x00AE
1367
 
     6da:       01 96           adiw    r24, 0x01       ; 1
1368
 
     6dc:       90 93 ae 00     sts     0x00AE, r25
1369
 
     6e0:       80 93 ad 00     sts     0x00AD, r24
1370
 
     6e4:       89 2b           or      r24, r25
1371
 
     6e6:       31 f4           brne    .+12            ; 0x6f4 <__vector_12+0x30e>
1372
 
                                wIdleTicks = 30000;             // max it out at 30,000 (8 minutes)
1373
 
     6e8:       80 e3           ldi     r24, 0x30       ; 48
1374
 
     6ea:       95 e7           ldi     r25, 0x75       ; 117
1375
 
     6ec:       90 93 ae 00     sts     0x00AE, r25
1376
 
     6f0:       80 93 ad 00     sts     0x00AD, r24
1377
 
 
1378
 
                        if (wIdleTicks > LOCK_OUT_TICKS)
1379
 
     6f4:       80 91 ad 00     lds     r24, 0x00AD
1380
 
     6f8:       90 91 ae 00     lds     r25, 0x00AE
1381
 
     6fc:       41 97           sbiw    r24, 0x11       ; 17
1382
 
     6fe:       10 f0           brcs    .+4             ; 0x704 <__vector_12+0x31e>
1383
 
                                quickClicks = 0;
1384
 
     700:       10 92 b0 00     sts     0x00B0, r1
1385
 
 
1386
 
                        // Only do turbo check when switch isn't pressed
1387
 
                        if ((turboTimeoutMode > 0) && (modeIdx < 16))
1388
 
     704:       80 91 bb 00     lds     r24, 0x00BB
1389
 
     708:       88 23           and     r24, r24
1390
 
     70a:       e9 f0           breq    .+58            ; 0x746 <__vector_12+0x360>
1391
 
     70c:       80 91 b3 00     lds     r24, 0x00B3
1392
 
     710:       80 31           cpi     r24, 0x10       ; 16
1393
 
     712:       c8 f4           brcc    .+50            ; 0x746 <__vector_12+0x360>
1394
 
                                if (byPrimModes[modeIdx] == 255)
1395
 
     714:       e0 91 b3 00     lds     r30, 0x00B3
1396
 
     718:       f0 e0           ldi     r31, 0x00       ; 0
1397
 
     71a:       e5 53           subi    r30, 0x35       ; 53
1398
 
     71c:       ff 4f           sbci    r31, 0xFF       ; 255
1399
 
     71e:       80 81           ld      r24, Z
1400
 
     720:       8f 3f           cpi     r24, 0xFF       ; 255
1401
 
     722:       89 f4           brne    .+34            ; 0x746 <__vector_12+0x360>
1402
 
                                {
1403
 
                                        if (++wTurboTicks > wTurboTickLimit)
1404
 
     724:       80 91 a1 00     lds     r24, 0x00A1
1405
 
     728:       90 91 a2 00     lds     r25, 0x00A2
1406
 
     72c:       01 96           adiw    r24, 0x01       ; 1
1407
 
     72e:       90 93 a2 00     sts     0x00A2, r25
1408
 
     732:       80 93 a1 00     sts     0x00A1, r24
1409
 
     736:       20 91 ab 00     lds     r18, 0x00AB
1410
 
     73a:       30 91 ac 00     lds     r19, 0x00AC
1411
 
     73e:       28 17           cp      r18, r24
1412
 
     740:       39 07           cpc     r19, r25
1413
 
     742:       08 f4           brcc    .+2             ; 0x746 <__vector_12+0x360>
1414
 
                                                prev_mode();            // Go to the previous mode
1415
 
     744:       a2 dd           rcall   .-1212          ; 0x28a <prev_mode>
1416
 
                                }
1417
 
 
1418
 
                        // Only do voltage monitoring when the switch isn't pressed
1419
 
                  #ifdef VOLTAGE_MON
1420
 
                        if (adc_ticks > 0)
1421
 
     746:       80 91 60 00     lds     r24, 0x0060
1422
 
     74a:       88 23           and     r24, r24
1423
 
     74c:       19 f0           breq    .+6             ; 0x754 <__vector_12+0x36e>
1424
 
                                --adc_ticks;
1425
 
     74e:       81 50           subi    r24, 0x01       ; 1
1426
 
     750:       80 93 60 00     sts     0x0060, r24
1427
 
                        if (adc_ticks == 0)
1428
 
     754:       80 91 60 00     lds     r24, 0x0060
1429
 
     758:       81 11           cpse    r24, r1
1430
 
     75a:       27 c0           rjmp    .+78            ; 0x7aa <__vector_12+0x3c4>
1431
 
                        {
1432
 
                                // See if conversion is done
1433
 
                                if (ADCSRA & (1 << ADIF))
1434
 
     75c:       34 9b           sbis    0x06, 4 ; 6
1435
 
     75e:       16 c0           rjmp    .+44            ; 0x78c <__vector_12+0x3a6>
1436
 
                                {
1437
 
                                        // See if voltage is lower than what we were looking for
1438
 
                                        if (ADCH < ((modeIdx == 1) ? ADC_CRIT : ADC_LOW))
1439
 
     760:       85 b1           in      r24, 0x05       ; 5
1440
 
     762:       90 e0           ldi     r25, 0x00       ; 0
1441
 
     764:       20 91 b3 00     lds     r18, 0x00B3
1442
 
     768:       21 30           cpi     r18, 0x01       ; 1
1443
 
     76a:       19 f0           breq    .+6             ; 0x772 <__vector_12+0x38c>
1444
 
     76c:       2d e7           ldi     r18, 0x7D       ; 125
1445
 
     76e:       30 e0           ldi     r19, 0x00       ; 0
1446
 
     770:       02 c0           rjmp    .+4             ; 0x776 <__vector_12+0x390>
1447
 
     772:       20 e7           ldi     r18, 0x70       ; 112
1448
 
     774:       30 e0           ldi     r19, 0x00       ; 0
1449
 
     776:       82 17           cp      r24, r18
1450
 
     778:       93 07           cpc     r25, r19
1451
 
     77a:       34 f4           brge    .+12            ; 0x788 <__vector_12+0x3a2>
1452
 
                                                ++lowbatt_cnt;
1453
 
     77c:       80 91 a0 00     lds     r24, 0x00A0
1454
 
     780:       8f 5f           subi    r24, 0xFF       ; 255
1455
 
     782:       80 93 a0 00     sts     0x00A0, r24
1456
 
     786:       02 c0           rjmp    .+4             ; 0x78c <__vector_12+0x3a6>
1457
 
                                        else
1458
 
                                                lowbatt_cnt = 0;
1459
 
     788:       10 92 a0 00     sts     0x00A0, r1
1460
 
                                }
1461
 
                                
1462
 
                                // See if it's been low for a while
1463
 
                                if (lowbatt_cnt >= 4)
1464
 
     78c:       80 91 a0 00     lds     r24, 0x00A0
1465
 
     790:       84 30           cpi     r24, 0x04       ; 4
1466
 
     792:       50 f0           brcs    .+20            ; 0x7a8 <__vector_12+0x3c2>
1467
 
                                {
1468
 
                                        LowBattSignal = 1;
1469
 
     794:       81 e0           ldi     r24, 0x01       ; 1
1470
 
     796:       80 93 a9 00     sts     0x00A9, r24
1471
 
                                        
1472
 
                                        LowBattState = 1;
1473
 
     79a:       80 93 a8 00     sts     0x00A8, r24
1474
 
                                        
1475
 
                                        lowbatt_cnt = 0;
1476
 
     79e:       10 92 a0 00     sts     0x00A0, r1
1477
 
                                        // If we reach 0 here, main loop will go into sleep mode
1478
 
                                        // Restart the counter to when we step down again
1479
 
                                        adc_ticks = ADC_DELAY;
1480
 
     7a2:       8c eb           ldi     r24, 0xBC       ; 188
1481
 
     7a4:       80 93 60 00     sts     0x0060, r24
1482
 
                                }
1483
 
                                
1484
 
                                // Make sure conversion is running for next time through
1485
 
                                ADCSRA |= (1 << ADSC);
1486
 
     7a8:       36 9a           sbi     0x06, 6 ; 6
1487
 
                        }
1488
 
                        
1489
 
                        if (LowBattState)
1490
 
     7aa:       80 91 a8 00     lds     r24, 0x00A8
1491
 
     7ae:       88 23           and     r24, r24
1492
 
     7b0:       99 f0           breq    .+38            ; 0x7d8 <__vector_12+0x3f2>
1493
 
                        {
1494
 
                                if (++wLowBattBlinkTicks == 500)                // Blink every 8 secs
1495
 
     7b2:       80 91 9e 00     lds     r24, 0x009E
1496
 
     7b6:       90 91 9f 00     lds     r25, 0x009F
1497
 
     7ba:       01 96           adiw    r24, 0x01       ; 1
1498
 
     7bc:       90 93 9f 00     sts     0x009F, r25
1499
 
     7c0:       80 93 9e 00     sts     0x009E, r24
1500
 
     7c4:       84 3f           cpi     r24, 0xF4       ; 244
1501
 
     7c6:       91 40           sbci    r25, 0x01       ; 1
1502
 
     7c8:       39 f4           brne    .+14            ; 0x7d8 <__vector_12+0x3f2>
1503
 
                                {
1504
 
                                        LowBattBlinkSignal = 1;
1505
 
     7ca:       81 e0           ldi     r24, 0x01       ; 1
1506
 
     7cc:       80 93 a7 00     sts     0x00A7, r24
1507
 
                                        wLowBattBlinkTicks = 0;
1508
 
     7d0:       10 92 9f 00     sts     0x009F, r1
1509
 
     7d4:       10 92 9e 00     sts     0x009E, r1
1510
 
                        }
1511
 
                        
1512
 
                  #endif
1513
 
                } // not previously pressed
1514
 
                
1515
 
                pressDuration = 0;
1516
 
     7d8:       10 92 b1 00     sts     0x00B1, r1
1517
 
        } // Not pressed
1518
 
}
1519
 
     7dc:       ff 91           pop     r31
1520
 
     7de:       ef 91           pop     r30
1521
 
     7e0:       bf 91           pop     r27
1522
 
     7e2:       af 91           pop     r26
1523
 
     7e4:       9f 91           pop     r25
1524
 
     7e6:       8f 91           pop     r24
1525
 
     7e8:       7f 91           pop     r23
1526
 
     7ea:       6f 91           pop     r22
1527
 
     7ec:       5f 91           pop     r21
1528
 
     7ee:       4f 91           pop     r20
1529
 
     7f0:       3f 91           pop     r19
1530
 
     7f2:       2f 91           pop     r18
1531
 
     7f4:       0f 90           pop     r0
1532
 
     7f6:       0f be           out     0x3f, r0        ; 63
1533
 
     7f8:       0f 90           pop     r0
1534
 
     7fa:       1f 90           pop     r1
1535
 
     7fc:       18 95           reti
1536
 
 
1537
 
000007fe <main>:
1538
 
int main(void)
1539
 
{       
1540
 
        byte i;
1541
 
 
1542
 
        // Set all ports to input, and turn pull-up resistors on for the inputs we are using
1543
 
        DDRB = 0x00;
1544
 
     7fe:       17 ba           out     0x17, r1        ; 23
1545
 
        //PORTB = (1 << SWITCH_PIN) | (1 << STAR3_PIN);
1546
 
 
1547
 
        PORTB = (1 << SWITCH_PIN);              // Only the switch is an input
1548
 
     800:       88 e0           ldi     r24, 0x08       ; 8
1549
 
     802:       88 bb           out     0x18, r24       ; 24
1550
 
 
1551
 
        // Set the switch as an interrupt for when we turn pin change interrupts on
1552
 
        PCMSK = (1 << SWITCH_PIN);
1553
 
     804:       85 bb           out     0x15, r24       ; 21
1554
 
        
1555
 
        // Set primary and alternate PWN pins for output
1556
 
        DDRB = (1 << PWM_PIN) | (1 << ALT_PWM_PIN);
1557
 
     806:       83 e0           ldi     r24, 0x03       ; 3
1558
 
     808:       87 bb           out     0x17, r24       ; 23
1559
 
 
1560
 
        // Set timer to do PWM for correct output pin and set prescaler timing
1561
 
        TCCR0B = 0x01; // pre-scaler for timer (1 => 1, 2 => 8, 3 => 64...)
1562
 
     80a:       81 e0           ldi     r24, 0x01       ; 1
1563
 
     80c:       83 bf           out     0x33, r24       ; 51
1564
 
* ADC_on - Turn the AtoD Converter ON
1565
 
* ======
1566
 
**************************************************************************************/
1567
 
inline void ADC_on() {
1568
 
// For 13A:     ADMUX  = (1 << REFS0) | (1 << ADLAR) | ADC_CHANNEL; // 1.1v reference, left-adjust, ADC1/PB2
1569
 
        ADMUX  = (1 << REFS1) | (1 << ADLAR) | ADC_CHANNEL; // 1.1v reference, left-adjust, ADC1/PB2
1570
 
     80e:       81 ea           ldi     r24, 0xA1       ; 161
1571
 
     810:       87 b9           out     0x07, r24       ; 7
1572
 
   DIDR0 |= (1 << ADC_DIDR);                                                    // disable digital input on ADC pin to reduce power consumption
1573
 
     812:       a2 9a           sbi     0x14, 2 ; 20
1574
 
        ADCSRA = (1 << ADEN ) | (1 << ADSC ) | ADC_PRSCL;   // enable, start, pre-scale
1575
 
     814:       86 ec           ldi     r24, 0xC6       ; 198
1576
 
     816:       86 b9           out     0x06, r24       ; 6
1577
 
        #ifdef VOLTAGE_MON
1578
 
        ADC_on();
1579
 
        #else
1580
 
        ADC_off();
1581
 
        #endif
1582
 
        ACSR   |=  (1<<7); //AC off
1583
 
     818:       47 9a           sbi     0x08, 7 ; 8
1584
 
 
1585
 
        // Enable sleep mode set to Power Down that will be triggered by the sleep_mode() command.
1586
 
        set_sleep_mode(SLEEP_MODE_PWR_DOWN);
1587
 
     81a:       85 b7           in      r24, 0x35       ; 53
1588
 
     81c:       87 7e           andi    r24, 0xE7       ; 231
1589
 
     81e:       80 61           ori     r24, 0x10       ; 16
1590
 
     820:       85 bf           out     0x35, r24       ; 53
1591
 
inline void LoadConfig()
1592
 
{
1593
 
   byte config1, config2, config3;
1594
 
 
1595
 
   // find the config data
1596
 
   for (eepos=0; eepos < 128; eepos+=3)
1597
 
     822:       10 92 a6 00     sts     0x00A6, r1
1598
 
     826:       10 92 a5 00     sts     0x00A5, r1
1599
 
     82a:       00 91 a5 00     lds     r16, 0x00A5
1600
 
     82e:       10 91 a6 00     lds     r17, 0x00A6
1601
 
     832:       00 38           cpi     r16, 0x80       ; 128
1602
 
     834:       11 05           cpc     r17, r1
1603
 
     836:       08 f0           brcs    .+2             ; 0x83a <main+0x3c>
1604
 
     838:       34 c4           rjmp    .+2152          ; 0x10a2 <main+0x8a4>
1605
 
        {
1606
 
           config1 = eeprom_read_byte((const byte *)eepos);
1607
 
     83a:       c8 01           movw    r24, r16
1608
 
     83c:       37 d4           rcall   .+2158          ; 0x10ac <eeprom_read_byte>
1609
 
     83e:       c8 2f           mov     r28, r24
1610
 
                config2 = eeprom_read_byte((const byte *)eepos+1);
1611
 
     840:       c8 01           movw    r24, r16
1612
 
     842:       01 96           adiw    r24, 0x01       ; 1
1613
 
     844:       33 d4           rcall   .+2150          ; 0x10ac <eeprom_read_byte>
1614
 
     846:       d8 2f           mov     r29, r24
1615
 
                config3 = eeprom_read_byte((const byte *)eepos+2);
1616
 
     848:       c8 01           movw    r24, r16
1617
 
     84a:       02 96           adiw    r24, 0x02       ; 2
1618
 
     84c:       2f d4           rcall   .+2142          ; 0x10ac <eeprom_read_byte>
1619
 
     84e:       98 2f           mov     r25, r24
1620
 
                
1621
 
                // A valid 'config1' can never be 0xff (0xff is an erased location)
1622
 
           if (config1 != 0xff)
1623
 
     850:       cf 3f           cpi     r28, 0xFF       ; 255
1624
 
     852:       39 f4           brne    .+14            ; 0x862 <main+0x64>
1625
 
inline void LoadConfig()
1626
 
{
1627
 
   byte config1, config2, config3;
1628
 
 
1629
 
   // find the config data
1630
 
   for (eepos=0; eepos < 128; eepos+=3)
1631
 
     854:       0d 5f           subi    r16, 0xFD       ; 253
1632
 
     856:       1f 4f           sbci    r17, 0xFF       ; 255
1633
 
     858:       10 93 a6 00     sts     0x00A6, r17
1634
 
     85c:       00 93 a5 00     sts     0x00A5, r16
1635
 
     860:       e4 cf           rjmp    .-56            ; 0x82a <main+0x2c>
1636
 
   }
1637
 
 
1638
 
   // unpack the config data
1639
 
   if (eepos < 128)
1640
 
        {
1641
 
           modeIdx = config1 & 0x7;
1642
 
     862:       8c 2f           mov     r24, r28
1643
 
     864:       87 70           andi    r24, 0x07       ; 7
1644
 
     866:       80 93 b3 00     sts     0x00B3, r24
1645
 
                modeSetIdx = (config1 >> 3) & 0x0f;
1646
 
     86a:       c6 95           lsr     r28
1647
 
     86c:       c6 95           lsr     r28
1648
 
     86e:       c6 95           lsr     r28
1649
 
     870:       cf 70           andi    r28, 0x0F       ; 15
1650
 
     872:       c0 93 66 00     sts     0x0066, r28
1651
 
                
1652
 
           highToLow = config2 & 1;
1653
 
     876:       8d 2f           mov     r24, r29
1654
 
     878:       81 70           andi    r24, 0x01       ; 1
1655
 
     87a:       80 93 bd 00     sts     0x00BD, r24
1656
 
           modeMemoryEnabled = (config2 >> 1) & 1;
1657
 
     87e:       d1 fb           bst     r29, 1
1658
 
     880:       88 27           eor     r24, r24
1659
 
     882:       80 f9           bld     r24, 0
1660
 
     884:       80 93 bc 00     sts     0x00BC, r24
1661
 
                moonlightLevel = (config2 >> 2) & 0x07;
1662
 
     888:       8d 2f           mov     r24, r29
1663
 
     88a:       86 95           lsr     r24
1664
 
     88c:       86 95           lsr     r24
1665
 
     88e:       87 70           andi    r24, 0x07       ; 7
1666
 
     890:       80 93 63 00     sts     0x0063, r24
1667
 
                turboTimeoutMode = (config2 >> 5) & 0x07;
1668
 
     894:       d2 95           swap    r29
1669
 
     896:       d6 95           lsr     r29
1670
 
     898:       d7 70           andi    r29, 0x07       ; 7
1671
 
     89a:       d0 93 bb 00     sts     0x00BB, r29
1672
 
        
1673
 
                OffTimeEnable = config3 & 1;
1674
 
     89e:       89 2f           mov     r24, r25
1675
 
     8a0:       81 70           andi    r24, 0x01       ; 1
1676
 
     8a2:       80 93 b9 00     sts     0x00B9, r24
1677
 
                onboardLedEnable = (config3 >> 1) & 1;
1678
 
     8a6:       91 fb           bst     r25, 1
1679
 
     8a8:       88 27           eor     r24, r24
1680
 
     8aa:       80 f9           bld     r24, 0
1681
 
     8ac:       80 93 62 00     sts     0x0062, r24
1682
 
                locatorLedOn = (config3 >> 2) & 1;
1683
 
     8b0:       92 fb           bst     r25, 2
1684
 
     8b2:       88 27           eor     r24, r24
1685
 
     8b4:       80 f9           bld     r24, 0
1686
 
     8b6:       80 93 64 00     sts     0x0064, r24
1687
 
                bvldLedOnly = (config3 >> 3) & 1;
1688
 
     8ba:       93 fb           bst     r25, 3
1689
 
     8bc:       88 27           eor     r24, r24
1690
 
     8be:       80 f9           bld     r24, 0
1691
 
     8c0:       80 93 ba 00     sts     0x00BA, r24
1692
 
                moonLightEnable = (config3 >> 4) & 1;
1693
 
     8c4:       92 95           swap    r25
1694
 
     8c6:       91 70           andi    r25, 0x01       ; 1
1695
 
     8c8:       90 93 65 00     sts     0x0065, r25
1696
 
**************************************************************************************/
1697
 
inline void DefineModeSet()
1698
 
{
1699
 
        byte offset = 1;
1700
 
 
1701
 
        modesCnt = pgm_read_byte(modeSetCnts+modeSetIdx);
1702
 
     8cc:       e0 91 66 00     lds     r30, 0x0066
1703
 
     8d0:       f0 e0           ldi     r31, 0x00       ; 0
1704
 
     8d2:       e2 57           subi    r30, 0x72       ; 114
1705
 
     8d4:       ff 4f           sbci    r31, 0xFF       ; 255
1706
 
     8d6:       84 91           lpm     r24, Z
1707
 
     8d8:       80 93 c9 00     sts     0x00C9, r24
1708
 
 
1709
 
        // Set OFF mode states (index 0)
1710
 
        byPrimModes[0] = bySecModes[0] = 0;
1711
 
     8dc:       10 92 be 00     sts     0x00BE, r1
1712
 
     8e0:       10 92 cb 00     sts     0x00CB, r1
1713
 
//      mode_pwm[0] = PHASE;
1714
 
 
1715
 
        if (moonLightEnable)
1716
 
     8e4:       90 91 65 00     lds     r25, 0x0065
1717
 
     8e8:       99 23           and     r25, r25
1718
 
     8ea:       41 f0           breq    .+16            ; 0x8fc <main+0xfe>
1719
 
        {
1720
 
                offset = 2;
1721
 
                byPrimModes[1] = 0;
1722
 
     8ec:       10 92 cc 00     sts     0x00CC, r1
1723
 
                bySecModes[1] = moonlightLevel; // PWM value to use for moonlight mode
1724
 
     8f0:       90 91 63 00     lds     r25, 0x0063
1725
 
     8f4:       90 93 bf 00     sts     0x00BF, r25
1726
 
        byPrimModes[0] = bySecModes[0] = 0;
1727
 
//      mode_pwm[0] = PHASE;
1728
 
 
1729
 
        if (moonLightEnable)
1730
 
        {
1731
 
                offset = 2;
1732
 
     8f8:       92 e0           ldi     r25, 0x02       ; 2
1733
 
     8fa:       01 c0           rjmp    .+2             ; 0x8fe <main+0x100>
1734
 
* DefineModeSet
1735
 
* =============
1736
 
**************************************************************************************/
1737
 
inline void DefineModeSet()
1738
 
{
1739
 
        byte offset = 1;
1740
 
     8fc:       91 e0           ldi     r25, 0x01       ; 1
1741
 
                bySecModes[1] = moonlightLevel; // PWM value to use for moonlight mode
1742
 
//              mode_pwm[1] = PHASE;
1743
 
        }
1744
 
 
1745
 
        // Populate the RAM based current mode set
1746
 
        for (int i = 0; i < modesCnt; i++) 
1747
 
     8fe:       20 e0           ldi     r18, 0x00       ; 0
1748
 
     900:       30 e0           ldi     r19, 0x00       ; 0
1749
 
     902:       48 2f           mov     r20, r24
1750
 
     904:       50 e0           ldi     r21, 0x00       ; 0
1751
 
     906:       69 2f           mov     r22, r25
1752
 
     908:       70 e0           ldi     r23, 0x00       ; 0
1753
 
     90a:       24 17           cp      r18, r20
1754
 
     90c:       35 07           cpc     r19, r21
1755
 
     90e:       2c f5           brge    .+74            ; 0x95a <main+0x15c>
1756
 
        {
1757
 
                byPrimModes[offset+i] = pgm_read_byte(modeTableFet[modeSetIdx]+i);
1758
 
     910:       a0 91 66 00     lds     r26, 0x0066
1759
 
     914:       b0 e0           ldi     r27, 0x00       ; 0
1760
 
     916:       aa 0f           add     r26, r26
1761
 
     918:       bb 1f           adc     r27, r27
1762
 
     91a:       a0 58           subi    r26, 0x80       ; 128
1763
 
     91c:       bf 4f           sbci    r27, 0xFF       ; 255
1764
 
     91e:       ed 91           ld      r30, X+
1765
 
     920:       fc 91           ld      r31, X
1766
 
     922:       e2 0f           add     r30, r18
1767
 
     924:       f3 1f           adc     r31, r19
1768
 
     926:       e4 91           lpm     r30, Z
1769
 
     928:       e9 01           movw    r28, r18
1770
 
     92a:       c6 0f           add     r28, r22
1771
 
     92c:       d7 1f           adc     r29, r23
1772
 
     92e:       de 01           movw    r26, r28
1773
 
     930:       a5 53           subi    r26, 0x35       ; 53
1774
 
     932:       bf 4f           sbci    r27, 0xFF       ; 255
1775
 
     934:       ec 93           st      X, r30
1776
 
                bySecModes[offset+i] = pgm_read_byte(modeTable7135[modeSetIdx]+i);
1777
 
     936:       a0 91 66 00     lds     r26, 0x0066
1778
 
     93a:       b0 e0           ldi     r27, 0x00       ; 0
1779
 
     93c:       aa 0f           add     r26, r26
1780
 
     93e:       bb 1f           adc     r27, r27
1781
 
     940:       a8 59           subi    r26, 0x98       ; 152
1782
 
     942:       bf 4f           sbci    r27, 0xFF       ; 255
1783
 
     944:       ed 91           ld      r30, X+
1784
 
     946:       fc 91           ld      r31, X
1785
 
     948:       e2 0f           add     r30, r18
1786
 
     94a:       f3 1f           adc     r31, r19
1787
 
     94c:       e4 91           lpm     r30, Z
1788
 
     94e:       c2 54           subi    r28, 0x42       ; 66
1789
 
     950:       df 4f           sbci    r29, 0xFF       ; 255
1790
 
     952:       e8 83           st      Y, r30
1791
 
                bySecModes[1] = moonlightLevel; // PWM value to use for moonlight mode
1792
 
//              mode_pwm[1] = PHASE;
1793
 
        }
1794
 
 
1795
 
        // Populate the RAM based current mode set
1796
 
        for (int i = 0; i < modesCnt; i++) 
1797
 
     954:       2f 5f           subi    r18, 0xFF       ; 255
1798
 
     956:       3f 4f           sbci    r19, 0xFF       ; 255
1799
 
     958:       d8 cf           rjmp    .-80            ; 0x90a <main+0x10c>
1800
 
                byPrimModes[offset+i] = pgm_read_byte(modeTableFet[modeSetIdx]+i);
1801
 
                bySecModes[offset+i] = pgm_read_byte(modeTable7135[modeSetIdx]+i);
1802
 
//              mode_pwm[offset+i] = pgm_read_byte(modeTablePwm[modeSetIdx]+i);
1803
 
        }
1804
 
 
1805
 
        modesCnt += offset;             // adjust to total mode count
1806
 
     95a:       89 0f           add     r24, r25
1807
 
     95c:       80 93 c9 00     sts     0x00C9, r24
1808
 
        // Load config settings: mode, mode set, lo-hi, mode memory
1809
 
        LoadConfig();
1810
 
 
1811
 
        DefineModeSet();
1812
 
 
1813
 
        wTurboTickLimit = pgm_read_word(turboTimeOutVals+turboTimeoutMode);
1814
 
     960:       e0 91 bb 00     lds     r30, 0x00BB
1815
 
     964:       f0 e0           ldi     r31, 0x00       ; 0
1816
 
     966:       ee 0f           add     r30, r30
1817
 
     968:       ff 1f           adc     r31, r31
1818
 
     96a:       e2 58           subi    r30, 0x82       ; 130
1819
 
     96c:       ff 4f           sbci    r31, 0xFF       ; 255
1820
 
     96e:       85 91           lpm     r24, Z+
1821
 
     970:       94 91           lpm     r25, Z
1822
 
     972:       90 93 ac 00     sts     0x00AC, r25
1823
 
     976:       80 93 ab 00     sts     0x00AB, r24
1824
 
        
1825
 
        if (OffTimeEnable)
1826
 
     97a:       80 91 b9 00     lds     r24, 0x00B9
1827
 
     97e:       88 23           and     r24, r24
1828
 
     980:       39 f0           breq    .+14            ; 0x990 <main+0x192>
1829
 
        {
1830
 
                if (!noinit_decay)
1831
 
     982:       80 91 d7 00     lds     r24, 0x00D7
1832
 
     986:       81 11           cpse    r24, r1
1833
 
     988:       05 c0           rjmp    .+10            ; 0x994 <main+0x196>
1834
 
                {
1835
 
                        // Indicates they did a short press, go to the next mode
1836
 
                        next_mode(); // Will handle wrap arounds
1837
 
     98a:       6b dc           rcall   .-1834          ; 0x262 <next_mode>
1838
 
                        SaveConfig();
1839
 
     98c:       b9 dc           rcall   .-1678          ; 0x300 <SaveConfig>
1840
 
     98e:       02 c0           rjmp    .+4             ; 0x994 <main+0x196>
1841
 
                }
1842
 
        }
1843
 
        else
1844
 
                modeIdx = 0;
1845
 
     990:       10 92 b3 00     sts     0x00B3, r1
1846
 
 
1847
 
   TCCR0A = PHASE;              // set this once here - don't use FAST anymore
1848
 
     994:       81 ea           ldi     r24, 0xA1       ; 161
1849
 
     996:       8a bd           out     0x2a, r24       ; 42
1850
 
                
1851
 
        if (modeIdx == 0)
1852
 
     998:       80 91 b3 00     lds     r24, 0x00B3
1853
 
     99c:       81 11           cpse    r24, r1
1854
 
     99e:       04 c0           rjmp    .+8             ; 0x9a8 <main+0x1aa>
1855
 
        {
1856
 
//         TCCR0A = PHASE;
1857
 
                blink(2, 80);
1858
 
     9a0:       60 e5           ldi     r22, 0x50       ; 80
1859
 
     9a2:       70 e0           ldi     r23, 0x00       ; 0
1860
 
     9a4:       82 e0           ldi     r24, 0x02       ; 2
1861
 
     9a6:       ed db           rcall   .-2086          ; 0x182 <blink>
1862
 
        }
1863
 
 
1864
 
        // set noinit data for next boot
1865
 
        noinit_decay = 0;  // will decay to non-zero after being off for a while
1866
 
     9a8:       10 92 d7 00     sts     0x00D7, r1
1867
 
 
1868
 
        last_modeIdx = 250;     // make it invalid for first time
1869
 
     9ac:       8a ef           ldi     r24, 0xFA       ; 250
1870
 
     9ae:       80 93 d5 00     sts     0x00D5, r24
1871
 
* WDT_on - Setup watchdog timer to only interrupt, not reset, every 16ms
1872
 
* ======
1873
 
**************************************************************************************/
1874
 
inline void WDT_on() {
1875
 
        // Setup watchdog timer to only interrupt, not reset, every 16ms.
1876
 
        cli();                                                  // Disable interrupts
1877
 
     9b2:       f8 94           cli
1878
 
        wdt_reset();                                    // Reset the WDT
1879
 
     9b4:       a8 95           wdr
1880
 
        WDTCR |= (1<<WDCE) | (1<<WDE);  // Start timed sequence
1881
 
     9b6:       81 b5           in      r24, 0x21       ; 33
1882
 
     9b8:       88 61           ori     r24, 0x18       ; 24
1883
 
     9ba:       81 bd           out     0x21, r24       ; 33
1884
 
        WDTCR = (1<<WDIE);                              // Enable interrupt every 16ms (was 1<<WDTIE)
1885
 
     9bc:       80 e4           ldi     r24, 0x40       ; 64
1886
 
     9be:       81 bd           out     0x21, r24       ; 33
1887
 
        sei();                                                  // Enable interrupts
1888
 
     9c0:       78 94           sei
1889
 
 
1890
 
        last_modeIdx = 250;     // make it invalid for first time
1891
 
        
1892
 
   byte byPrevLockOutSet = 0;
1893
 
 
1894
 
   byte prevConfigClicks = 0;
1895
 
     9c2:       d0 e0           ldi     r29, 0x00       ; 0
1896
 
        // set noinit data for next boot
1897
 
        noinit_decay = 0;  // will decay to non-zero after being off for a while
1898
 
 
1899
 
        last_modeIdx = 250;     // make it invalid for first time
1900
 
        
1901
 
   byte byPrevLockOutSet = 0;
1902
 
     9c4:       c0 e0           ldi     r28, 0x00       ; 0
1903
 
                                                if (configClicks)
1904
 
                                                {
1905
 
                                                        OffTimeEnable = 1 - (configClicks & 1);
1906
 
                                                        SaveConfig();
1907
 
                                                }
1908
 
                                                ConfigMode = 8;                 // all done, go to exit
1909
 
     9c6:       18 e0           ldi     r17, 0x08       ; 8
1910
 
void set_output(byte pwm1, byte pwm2)
1911
 
 {
1912
 
        // Need PHASE to properly turn off the light
1913
 
//      if ((pwm1==0) && (pwm2==0))
1914
 
//              TCCR0A = PHASE;
1915
 
        PWM_LVL = pwm1;
1916
 
     9c8:       0f ef           ldi     r16, 0xFF       ; 255
1917
 
    // and will change the mode if needed. If this loop detects that the mode has changed,
1918
 
    // run the logic for that mode while continuing to check for a mode change.
1919
 
        while(1)                // run forever
1920
 
        {
1921
 
      //---------------------------------------------------------------------------------------
1922
 
                if (ConfigMode == 0)                                    // Normal mode
1923
 
     9ca:       80 91 b7 00     lds     r24, 0x00B7
1924
 
     9ce:       81 11           cpse    r24, r1
1925
 
     9d0:       9e c1           rjmp    .+828           ; 0xd0e <main+0x510>
1926
 
      //---------------------------------------------------------------------------------------
1927
 
                {
1928
 
                        if (byPrevLockOutSet != byLockOutSet)
1929
 
     9d2:       80 91 b8 00     lds     r24, 0x00B8
1930
 
     9d6:       c8 17           cp      r28, r24
1931
 
     9d8:       59 f0           breq    .+22            ; 0x9f0 <main+0x1f2>
1932
 
                        {
1933
 
                                byPrevLockOutSet = byLockOutSet;
1934
 
     9da:       c0 91 b8 00     lds     r28, 0x00B8
1935
 
void set_output(byte pwm1, byte pwm2)
1936
 
 {
1937
 
        // Need PHASE to properly turn off the light
1938
 
//      if ((pwm1==0) && (pwm2==0))
1939
 
//              TCCR0A = PHASE;
1940
 
        PWM_LVL = pwm1;
1941
 
     9de:       18 bc           out     0x28, r1        ; 40
1942
 
        ALT_PWM_LVL = pwm2;
1943
 
     9e0:       19 bc           out     0x29, r1        ; 41
1944
 
                        if (byPrevLockOutSet != byLockOutSet)
1945
 
                        {
1946
 
                                byPrevLockOutSet = byLockOutSet;
1947
 
 
1948
 
                                set_output(0,0);
1949
 
                                _delay_ms(250);
1950
 
     9e2:       8a ef           ldi     r24, 0xFA       ; 250
1951
 
     9e4:       90 e0           ldi     r25, 0x00       ; 0
1952
 
     9e6:       9f db           rcall   .-2242          ; 0x126 <_delay_ms>
1953
 
                                blink(4, 60);
1954
 
     9e8:       6c e3           ldi     r22, 0x3C       ; 60
1955
 
     9ea:       70 e0           ldi     r23, 0x00       ; 0
1956
 
     9ec:       84 e0           ldi     r24, 0x04       ; 4
1957
 
     9ee:       c9 db           rcall   .-2158          ; 0x182 <blink>
1958
 
                        }
1959
 
 
1960
 
                        if (modeIdx != last_modeIdx)
1961
 
     9f0:       90 91 b3 00     lds     r25, 0x00B3
1962
 
     9f4:       80 91 d5 00     lds     r24, 0x00D5
1963
 
     9f8:       98 17           cp      r25, r24
1964
 
     9fa:       09 f4           brne    .+2             ; 0x9fe <main+0x200>
1965
 
     9fc:       fd c0           rjmp    .+506           ; 0xbf8 <main+0x3fa>
1966
 
                        {
1967
 
                                //---------------------------------------------------
1968
 
                                // Mode Handling - The WDT changed the mode
1969
 
                                //---------------------------------------------------
1970
 
                                if (modeIdx < 16)
1971
 
     9fe:       80 91 b3 00     lds     r24, 0x00B3
1972
 
     a02:       80 31           cpi     r24, 0x10       ; 16
1973
 
     a04:       40 f5           brcc    .+80            ; 0xa56 <main+0x258>
1974
 
                                {
1975
 
                                        set_mode(modeIdx);      // Set a solid mode here!!
1976
 
     a06:       20 91 b3 00     lds     r18, 0x00B3
1977
 
**************************************************************************************/
1978
 
void inline set_mode(byte mode)
1979
 
{
1980
 
//   TCCR0A = mode_pwm[mode];
1981
 
 
1982
 
        currOutLvl1 = byPrimModes[mode];
1983
 
     a0a:       82 2f           mov     r24, r18
1984
 
     a0c:       90 e0           ldi     r25, 0x00       ; 0
1985
 
     a0e:       fc 01           movw    r30, r24
1986
 
     a10:       e5 53           subi    r30, 0x35       ; 53
1987
 
     a12:       ff 4f           sbci    r31, 0xFF       ; 255
1988
 
     a14:       30 81           ld      r19, Z
1989
 
     a16:       30 93 ca 00     sts     0x00CA, r19
1990
 
        currOutLvl2 = bySecModes[mode];
1991
 
     a1a:       fc 01           movw    r30, r24
1992
 
     a1c:       e2 54           subi    r30, 0x42       ; 66
1993
 
     a1e:       ff 4f           sbci    r31, 0xFF       ; 255
1994
 
     a20:       80 81           ld      r24, Z
1995
 
     a22:       80 93 c8 00     sts     0x00C8, r24
1996
 
        
1997
 
        PWM_LVL = currOutLvl1;
1998
 
     a26:       80 91 ca 00     lds     r24, 0x00CA
1999
 
     a2a:       88 bd           out     0x28, r24       ; 40
2000
 
        ALT_PWM_LVL = currOutLvl2;
2001
 
     a2c:       80 91 c8 00     lds     r24, 0x00C8
2002
 
     a30:       89 bd           out     0x29, r24       ; 41
2003
 
        
2004
 
        if ((mode == 0) && locatorLedOn)
2005
 
     a32:       21 11           cpse    r18, r1
2006
 
     a34:       06 c0           rjmp    .+12            ; 0xa42 <main+0x244>
2007
 
     a36:       80 91 64 00     lds     r24, 0x0064
2008
 
     a3a:       88 23           and     r24, r24
2009
 
     a3c:       11 f0           breq    .+4             ; 0xa42 <main+0x244>
2010
 
                TurnOnBoardLed(1);
2011
 
     a3e:       81 e0           ldi     r24, 0x01       ; 1
2012
 
     a40:       04 c0           rjmp    .+8             ; 0xa4a <main+0x24c>
2013
 
        else if (last_modeIdx == 0)
2014
 
     a42:       80 91 d5 00     lds     r24, 0x00D5
2015
 
     a46:       81 11           cpse    r24, r1
2016
 
     a48:       01 c0           rjmp    .+2             ; 0xa4c <main+0x24e>
2017
 
                TurnOnBoardLed(0);
2018
 
     a4a:       76 db           rcall   .-2324          ; 0x138 <TurnOnBoardLed>
2019
 
                                // Mode Handling - The WDT changed the mode
2020
 
                                //---------------------------------------------------
2021
 
                                if (modeIdx < 16)
2022
 
                                {
2023
 
                                        set_mode(modeIdx);      // Set a solid mode here!!
2024
 
                                        last_modeIdx = modeIdx;
2025
 
     a4c:       80 91 b3 00     lds     r24, 0x00B3
2026
 
     a50:       80 93 d5 00     sts     0x00D5, r24
2027
 
     a54:       d1 c0           rjmp    .+418           ; 0xbf8 <main+0x3fa>
2028
 
                                }
2029
 
                                else
2030
 
                                {
2031
 
                                        last_modeIdx = modeIdx;
2032
 
     a56:       80 91 b3 00     lds     r24, 0x00B3
2033
 
     a5a:       80 93 d5 00     sts     0x00D5, r24
2034
 
 
2035
 
                                        // If coming from a standard mode, suppress alternate PWM output
2036
 
                                        ALT_PWM_LVL = 0;
2037
 
     a5e:       19 bc           out     0x29, r1        ; 41
2038
 
 
2039
 
                                        if (modeIdx == BATT_CHECK_MODE)
2040
 
     a60:       80 91 b3 00     lds     r24, 0x00B3
2041
 
     a64:       80 35           cpi     r24, 0x50       ; 80
2042
 
     a66:       71 f5           brne    .+92            ; 0xac4 <main+0x2c6>
2043
 
                                        {
2044
 
//                                              TCCR0A = PHASE;   // set all output for PHASE mode
2045
 
                                                while (modeIdx == BATT_CHECK_MODE)      // Battery Check
2046
 
     a68:       80 91 b3 00     lds     r24, 0x00B3
2047
 
     a6c:       80 35           cpi     r24, 0x50       ; 80
2048
 
     a6e:       09 f0           breq    .+2             ; 0xa72 <main+0x274>
2049
 
     a70:       c3 c0           rjmp    .+390           ; 0xbf8 <main+0x3fa>
2050
 
   // Return an composite int, number of "blinks", for approximate battery charge
2051
 
   // Uses the table above for return values
2052
 
   // Return value is 3 bits of whole volts and 5 bits of tenths-of-a-volt
2053
 
   uint8_t i, voltage;
2054
 
 
2055
 
   voltage = get_voltage();
2056
 
     a72:       82 db           rcall   .-2300          ; 0x178 <get_voltage>
2057
 
 
2058
 
   // figure out how many times to blink
2059
 
   for (i=0; voltage > pgm_read_byte(voltage_blinks + i); i += 2)  ;
2060
 
     a74:       90 e0           ldi     r25, 0x00       ; 0
2061
 
     a76:       29 2f           mov     r18, r25
2062
 
     a78:       30 e0           ldi     r19, 0x00       ; 0
2063
 
     a7a:       f9 01           movw    r30, r18
2064
 
     a7c:       ec 5a           subi    r30, 0xAC       ; 172
2065
 
     a7e:       ff 4f           sbci    r31, 0xFF       ; 255
2066
 
     a80:       e4 91           lpm     r30, Z
2067
 
     a82:       e8 17           cp      r30, r24
2068
 
     a84:       10 f4           brcc    .+4             ; 0xa8a <main+0x28c>
2069
 
     a86:       9e 5f           subi    r25, 0xFE       ; 254
2070
 
     a88:       f6 cf           rjmp    .-20            ; 0xa76 <main+0x278>
2071
 
   return pgm_read_byte(voltage_blinks + i + 1);
2072
 
     a8a:       f9 01           movw    r30, r18
2073
 
     a8c:       eb 5a           subi    r30, 0xAB       ; 171
2074
 
     a8e:       ff 4f           sbci    r31, 0xFF       ; 255
2075
 
     a90:       f4 90           lpm     r15, Z
2076
 
//                                              TCCR0A = PHASE;   // set all output for PHASE mode
2077
 
                                                while (modeIdx == BATT_CHECK_MODE)      // Battery Check
2078
 
                                                {
2079
 
                                                        // blink out volts and tenths
2080
 
                                                        uint8_t result = battcheck();
2081
 
                                                        battBlink(result >> 5);
2082
 
     a92:       8f 2d           mov     r24, r15
2083
 
     a94:       82 95           swap    r24
2084
 
     a96:       86 95           lsr     r24
2085
 
     a98:       87 70           andi    r24, 0x07       ; 7
2086
 
     a9a:       98 db           rcall   .-2256          ; 0x1cc <battBlink>
2087
 
                                                        if (modeIdx != BATT_CHECK_MODE)         break;
2088
 
     a9c:       80 91 b3 00     lds     r24, 0x00B3
2089
 
     aa0:       80 35           cpi     r24, 0x50       ; 80
2090
 
     aa2:       09 f0           breq    .+2             ; 0xaa6 <main+0x2a8>
2091
 
     aa4:       a9 c0           rjmp    .+338           ; 0xbf8 <main+0x3fa>
2092
 
                                                        _delay_ms(800);
2093
 
     aa6:       80 e2           ldi     r24, 0x20       ; 32
2094
 
     aa8:       93 e0           ldi     r25, 0x03       ; 3
2095
 
     aaa:       3d db           rcall   .-2438          ; 0x126 <_delay_ms>
2096
 
                                                        battBlink(result & 0b00011111);
2097
 
     aac:       8f 2d           mov     r24, r15
2098
 
     aae:       8f 71           andi    r24, 0x1F       ; 31
2099
 
     ab0:       8d db           rcall   .-2278          ; 0x1cc <battBlink>
2100
 
                                                        if (modeIdx != BATT_CHECK_MODE)         break;
2101
 
     ab2:       80 91 b3 00     lds     r24, 0x00B3
2102
 
     ab6:       80 35           cpi     r24, 0x50       ; 80
2103
 
     ab8:       09 f0           breq    .+2             ; 0xabc <main+0x2be>
2104
 
     aba:       9e c0           rjmp    .+316           ; 0xbf8 <main+0x3fa>
2105
 
                                                        _delay_ms(2000);
2106
 
     abc:       80 ed           ldi     r24, 0xD0       ; 208
2107
 
     abe:       97 e0           ldi     r25, 0x07       ; 7
2108
 
     ac0:       32 db           rcall   .-2460          ; 0x126 <_delay_ms>
2109
 
     ac2:       d2 cf           rjmp    .-92            ; 0xa68 <main+0x26a>
2110
 
                                                }
2111
 
                                        }
2112
 
 
2113
 
                                        else if (modeIdx == STROBE_MODE)
2114
 
     ac4:       80 91 b3 00     lds     r24, 0x00B3
2115
 
     ac8:       8b 35           cpi     r24, 0x5B       ; 91
2116
 
     aca:       49 f4           brne    .+18            ; 0xade <main+0x2e0>
2117
 
                                        {
2118
 
//                                              TCCR0A = PHASE;   // set all output for PHASE mode
2119
 
                                                while (modeIdx == STROBE_MODE)      // strobe at 16 Hz
2120
 
     acc:       80 91 b3 00     lds     r24, 0x00B3
2121
 
     ad0:       8b 35           cpi     r24, 0x5B       ; 91
2122
 
     ad2:       09 f0           breq    .+2             ; 0xad6 <main+0x2d8>
2123
 
     ad4:       91 c0           rjmp    .+290           ; 0xbf8 <main+0x3fa>
2124
 
                                                {
2125
 
                                                        strobe(16,47);          // 20,60 is 12.5 Hz
2126
 
     ad6:       6f e2           ldi     r22, 0x2F       ; 47
2127
 
     ad8:       80 e1           ldi     r24, 0x10       ; 16
2128
 
     ada:       3c db           rcall   .-2440          ; 0x154 <strobe>
2129
 
     adc:       f7 cf           rjmp    .-18            ; 0xacc <main+0x2ce>
2130
 
                                                        strobe(ms, ms);
2131
 
                                                }
2132
 
                                        }
2133
 
#endif
2134
 
 
2135
 
                                        else if (modeIdx == POLICE_STROBE)
2136
 
     ade:       80 91 b3 00     lds     r24, 0x00B3
2137
 
     ae2:       8c 35           cpi     r24, 0x5C       ; 92
2138
 
     ae4:       01 f5           brne    .+64            ; 0xb26 <main+0x328>
2139
 
                                        {
2140
 
//                                              TCCR0A = PHASE;   // set all output for PHASE mode
2141
 
                                                while (modeIdx == POLICE_STROBE)                // police strobe
2142
 
     ae6:       80 91 b3 00     lds     r24, 0x00B3
2143
 
     aea:       8c 35           cpi     r24, 0x5C       ; 92
2144
 
     aec:       09 f0           breq    .+2             ; 0xaf0 <main+0x2f2>
2145
 
     aee:       84 c0           rjmp    .+264           ; 0xbf8 <main+0x3fa>
2146
 
     af0:       58 e0           ldi     r21, 0x08       ; 8
2147
 
     af2:       f5 2e           mov     r15, r21
2148
 
                                                {
2149
 
                                                        for(i=0;i<8;i++)
2150
 
                                                        {
2151
 
                                                                if (modeIdx != POLICE_STROBE)           break;
2152
 
     af4:       80 91 b3 00     lds     r24, 0x00B3
2153
 
     af8:       8c 35           cpi     r24, 0x5C       ; 92
2154
 
     afa:       19 f0           breq    .+6             ; 0xb02 <main+0x304>
2155
 
     afc:       48 e0           ldi     r20, 0x08       ; 8
2156
 
     afe:       f4 2e           mov     r15, r20
2157
 
     b00:       0d c0           rjmp    .+26            ; 0xb1c <main+0x31e>
2158
 
                                                                strobe(20,40);
2159
 
     b02:       68 e2           ldi     r22, 0x28       ; 40
2160
 
     b04:       84 e1           ldi     r24, 0x14       ; 20
2161
 
     b06:       26 db           rcall   .-2484          ; 0x154 <strobe>
2162
 
     b08:       fa 94           dec     r15
2163
 
                                        else if (modeIdx == POLICE_STROBE)
2164
 
                                        {
2165
 
//                                              TCCR0A = PHASE;   // set all output for PHASE mode
2166
 
                                                while (modeIdx == POLICE_STROBE)                // police strobe
2167
 
                                                {
2168
 
                                                        for(i=0;i<8;i++)
2169
 
     b0a:       f1 10           cpse    r15, r1
2170
 
     b0c:       f3 cf           rjmp    .-26            ; 0xaf4 <main+0x2f6>
2171
 
     b0e:       f6 cf           rjmp    .-20            ; 0xafc <main+0x2fe>
2172
 
                                                                strobe(20,40);
2173
 
                                                        }
2174
 
                                                        for(i=0;i<8;i++)
2175
 
                                                        {
2176
 
                                                                if (modeIdx != POLICE_STROBE)           break;
2177
 
                                                                strobe(40,80);
2178
 
     b10:       60 e5           ldi     r22, 0x50       ; 80
2179
 
     b12:       88 e2           ldi     r24, 0x28       ; 40
2180
 
     b14:       1f db           rcall   .-2498          ; 0x154 <strobe>
2181
 
     b16:       fa 94           dec     r15
2182
 
                                                        for(i=0;i<8;i++)
2183
 
                                                        {
2184
 
                                                                if (modeIdx != POLICE_STROBE)           break;
2185
 
                                                                strobe(20,40);
2186
 
                                                        }
2187
 
                                                        for(i=0;i<8;i++)
2188
 
     b18:       ff 20           and     r15, r15
2189
 
     b1a:       29 f3           breq    .-54            ; 0xae6 <main+0x2e8>
2190
 
                                                        {
2191
 
                                                                if (modeIdx != POLICE_STROBE)           break;
2192
 
     b1c:       80 91 b3 00     lds     r24, 0x00B3
2193
 
     b20:       8c 35           cpi     r24, 0x5C       ; 92
2194
 
     b22:       b1 f3           breq    .-20            ; 0xb10 <main+0x312>
2195
 
     b24:       e0 cf           rjmp    .-64            ; 0xae6 <main+0x2e8>
2196
 
                                                                strobe(40,80);
2197
 
                                                        }
2198
 
                                                }
2199
 
                                        }
2200
 
 
2201
 
                                        else if (modeIdx == BIKING_STROBE)
2202
 
     b26:       80 91 b3 00     lds     r24, 0x00B3
2203
 
     b2a:       8d 35           cpi     r24, 0x5D       ; 93
2204
 
     b2c:       49 f5           brne    .+82            ; 0xb80 <main+0x382>
2205
 
                                        {
2206
 
//                                              TCCR0A = PHASE;   // set all output for PHASE mode
2207
 
                                                while (modeIdx == BIKING_STROBE)                // police strobe
2208
 
     b2e:       80 91 b3 00     lds     r24, 0x00B3
2209
 
     b32:       8d 35           cpi     r24, 0x5D       ; 93
2210
 
     b34:       11 f5           brne    .+68            ; 0xb7a <main+0x37c>
2211
 
     b36:       34 e0           ldi     r19, 0x04       ; 4
2212
 
     b38:       f3 2e           mov     r15, r19
2213
 
                                                {
2214
 
                                                        // normal version
2215
 
                                                        for(i=0;i<4;i++)
2216
 
                                                        {
2217
 
                                                                if (modeIdx != BIKING_STROBE)           break;
2218
 
     b3a:       80 91 b3 00     lds     r24, 0x00B3
2219
 
     b3e:       8d 35           cpi     r24, 0x5D       ; 93
2220
 
     b40:       19 f0           breq    .+6             ; 0xb48 <main+0x34a>
2221
 
     b42:       2a e0           ldi     r18, 0x0A       ; 10
2222
 
     b44:       f2 2e           mov     r15, r18
2223
 
     b46:       14 c0           rjmp    .+40            ; 0xb70 <main+0x372>
2224
 
void set_output(byte pwm1, byte pwm2)
2225
 
 {
2226
 
        // Need PHASE to properly turn off the light
2227
 
//      if ((pwm1==0) && (pwm2==0))
2228
 
//              TCCR0A = PHASE;
2229
 
        PWM_LVL = pwm1;
2230
 
     b48:       08 bd           out     0x28, r16       ; 40
2231
 
        ALT_PWM_LVL = pwm2;
2232
 
     b4a:       19 bc           out     0x29, r1        ; 41
2233
 
                                                        // normal version
2234
 
                                                        for(i=0;i<4;i++)
2235
 
                                                        {
2236
 
                                                                if (modeIdx != BIKING_STROBE)           break;
2237
 
                                                                set_output(255,0);
2238
 
                                                                _delay_ms(5);
2239
 
     b4c:       85 e0           ldi     r24, 0x05       ; 5
2240
 
     b4e:       90 e0           ldi     r25, 0x00       ; 0
2241
 
     b50:       ea da           rcall   .-2604          ; 0x126 <_delay_ms>
2242
 
void set_output(byte pwm1, byte pwm2)
2243
 
 {
2244
 
        // Need PHASE to properly turn off the light
2245
 
//      if ((pwm1==0) && (pwm2==0))
2246
 
//              TCCR0A = PHASE;
2247
 
        PWM_LVL = pwm1;
2248
 
     b52:       18 bc           out     0x28, r1        ; 40
2249
 
        ALT_PWM_LVL = pwm2;
2250
 
     b54:       09 bd           out     0x29, r16       ; 41
2251
 
                                                        {
2252
 
                                                                if (modeIdx != BIKING_STROBE)           break;
2253
 
                                                                set_output(255,0);
2254
 
                                                                _delay_ms(5);
2255
 
                                                                set_output(0,255);
2256
 
                                                                _delay_ms(65);
2257
 
     b56:       81 e4           ldi     r24, 0x41       ; 65
2258
 
     b58:       90 e0           ldi     r25, 0x00       ; 0
2259
 
     b5a:       e5 da           rcall   .-2614          ; 0x126 <_delay_ms>
2260
 
     b5c:       fa 94           dec     r15
2261
 
                                        {
2262
 
//                                              TCCR0A = PHASE;   // set all output for PHASE mode
2263
 
                                                while (modeIdx == BIKING_STROBE)                // police strobe
2264
 
                                                {
2265
 
                                                        // normal version
2266
 
                                                        for(i=0;i<4;i++)
2267
 
     b5e:       f1 10           cpse    r15, r1
2268
 
     b60:       ec cf           rjmp    .-40            ; 0xb3a <main+0x33c>
2269
 
     b62:       ef cf           rjmp    .-34            ; 0xb42 <main+0x344>
2270
 
                                                                _delay_ms(65);
2271
 
                                                        }
2272
 
                                                        for(i=0;i<10;i++)
2273
 
                                                        {
2274
 
                                                                if (modeIdx != BIKING_STROBE)           break;
2275
 
                                                                _delay_ms(72);
2276
 
     b64:       88 e4           ldi     r24, 0x48       ; 72
2277
 
     b66:       90 e0           ldi     r25, 0x00       ; 0
2278
 
     b68:       de da           rcall   .-2628          ; 0x126 <_delay_ms>
2279
 
     b6a:       fa 94           dec     r15
2280
 
                                                                set_output(255,0);
2281
 
                                                                _delay_ms(5);
2282
 
                                                                set_output(0,255);
2283
 
                                                                _delay_ms(65);
2284
 
                                                        }
2285
 
                                                        for(i=0;i<10;i++)
2286
 
     b6c:       ff 20           and     r15, r15
2287
 
     b6e:       f9 f2           breq    .-66            ; 0xb2e <main+0x330>
2288
 
                                                        {
2289
 
                                                                if (modeIdx != BIKING_STROBE)           break;
2290
 
     b70:       80 91 b3 00     lds     r24, 0x00B3
2291
 
     b74:       8d 35           cpi     r24, 0x5D       ; 93
2292
 
     b76:       b1 f3           breq    .-20            ; 0xb64 <main+0x366>
2293
 
     b78:       da cf           rjmp    .-76            ; 0xb2e <main+0x330>
2294
 
void set_output(byte pwm1, byte pwm2)
2295
 
 {
2296
 
        // Need PHASE to properly turn off the light
2297
 
//      if ((pwm1==0) && (pwm2==0))
2298
 
//              TCCR0A = PHASE;
2299
 
        PWM_LVL = pwm1;
2300
 
     b7a:       18 bc           out     0x28, r1        ; 40
2301
 
        ALT_PWM_LVL = pwm2;
2302
 
     b7c:       19 bc           out     0x29, r1        ; 41
2303
 
     b7e:       3c c0           rjmp    .+120           ; 0xbf8 <main+0x3fa>
2304
 
                                                        }
2305
 
                                                }
2306
 
                                                set_output(0,0);
2307
 
                                        }
2308
 
 
2309
 
                                        else if (modeIdx == BEACON_2S_MODE)
2310
 
     b80:       80 91 b3 00     lds     r24, 0x00B3
2311
 
     b84:       8e 35           cpi     r24, 0x5E       ; 94
2312
 
     b86:       d1 f4           brne    .+52            ; 0xbbc <main+0x3be>
2313
 
                                        {
2314
 
//                                              TCCR0A = PHASE;   // set all output for PHASE mode
2315
 
                                                while (modeIdx == BEACON_2S_MODE)               // Beacon 2 sec mode
2316
 
     b88:       80 91 b3 00     lds     r24, 0x00B3
2317
 
     b8c:       8e 35           cpi     r24, 0x5E       ; 94
2318
 
     b8e:       a1 f5           brne    .+104           ; 0xbf8 <main+0x3fa>
2319
 
                                                {
2320
 
                                                        _delay_ms(300); // pause a little initially
2321
 
     b90:       8c e2           ldi     r24, 0x2C       ; 44
2322
 
     b92:       91 e0           ldi     r25, 0x01       ; 1
2323
 
     b94:       c8 da           rcall   .-2672          ; 0x126 <_delay_ms>
2324
 
                                                
2325
 
                                                        strobe(125,125);                // two flash's
2326
 
     b96:       6d e7           ldi     r22, 0x7D       ; 125
2327
 
     b98:       8d e7           ldi     r24, 0x7D       ; 125
2328
 
     b9a:       dc da           rcall   .-2632          ; 0x154 <strobe>
2329
 
                                                        strobe(125,125);
2330
 
     b9c:       6d e7           ldi     r22, 0x7D       ; 125
2331
 
     b9e:       8d e7           ldi     r24, 0x7D       ; 125
2332
 
     ba0:       d9 da           rcall   .-2638          ; 0x154 <strobe>
2333
 
     ba2:       9f e0           ldi     r25, 0x0F       ; 15
2334
 
     ba4:       f9 2e           mov     r15, r25
2335
 
                                                
2336
 
                                                        for (i=0; i < 15; i++)  // 1.5 secs delay
2337
 
                                                        {
2338
 
                                                                if (modeIdx != BEACON_2S_MODE)          break;
2339
 
     ba6:       80 91 b3 00     lds     r24, 0x00B3
2340
 
     baa:       8e 35           cpi     r24, 0x5E       ; 94
2341
 
     bac:       69 f7           brne    .-38            ; 0xb88 <main+0x38a>
2342
 
                                                                _delay_ms(100);
2343
 
     bae:       84 e6           ldi     r24, 0x64       ; 100
2344
 
     bb0:       90 e0           ldi     r25, 0x00       ; 0
2345
 
     bb2:       b9 da           rcall   .-2702          ; 0x126 <_delay_ms>
2346
 
     bb4:       fa 94           dec     r15
2347
 
                                                        _delay_ms(300); // pause a little initially
2348
 
                                                
2349
 
                                                        strobe(125,125);                // two flash's
2350
 
                                                        strobe(125,125);
2351
 
                                                
2352
 
                                                        for (i=0; i < 15; i++)  // 1.5 secs delay
2353
 
     bb6:       f1 10           cpse    r15, r1
2354
 
     bb8:       f6 cf           rjmp    .-20            ; 0xba6 <main+0x3a8>
2355
 
     bba:       e6 cf           rjmp    .-52            ; 0xb88 <main+0x38a>
2356
 
                                                                _delay_ms(100);
2357
 
                                                        }
2358
 
                                                }
2359
 
                                        }
2360
 
 
2361
 
                                        else if (modeIdx == BEACON_10S_MODE)
2362
 
     bbc:       80 91 b3 00     lds     r24, 0x00B3
2363
 
     bc0:       8f 35           cpi     r24, 0x5F       ; 95
2364
 
     bc2:       d1 f4           brne    .+52            ; 0xbf8 <main+0x3fa>
2365
 
                                                while (modeIdx == BEACON_10S_MODE)              // Beacon 10 sec mode
2366
 
     bc4:       80 91 b3 00     lds     r24, 0x00B3
2367
 
     bc8:       8f 35           cpi     r24, 0x5F       ; 95
2368
 
     bca:       b1 f4           brne    .+44            ; 0xbf8 <main+0x3fa>
2369
 
                                                {
2370
 
//                                                      TCCR0A = PHASE;   // set all output for PHASE mode
2371
 
 
2372
 
                                                        _delay_ms(300); // pause a little initially
2373
 
     bcc:       8c e2           ldi     r24, 0x2C       ; 44
2374
 
     bce:       91 e0           ldi     r25, 0x01       ; 1
2375
 
     bd0:       aa da           rcall   .-2732          ; 0x126 <_delay_ms>
2376
 
 
2377
 
                                                        strobe(240,240);                // two slow flash's
2378
 
     bd2:       60 ef           ldi     r22, 0xF0       ; 240
2379
 
     bd4:       80 ef           ldi     r24, 0xF0       ; 240
2380
 
     bd6:       be da           rcall   .-2692          ; 0x154 <strobe>
2381
 
                                                        strobe(240,240);
2382
 
     bd8:       60 ef           ldi     r22, 0xF0       ; 240
2383
 
     bda:       80 ef           ldi     r24, 0xF0       ; 240
2384
 
     bdc:       bb da           rcall   .-2698          ; 0x154 <strobe>
2385
 
     bde:       84 e6           ldi     r24, 0x64       ; 100
2386
 
     be0:       f8 2e           mov     r15, r24
2387
 
 
2388
 
                                                        for (i=0; i < 100; i++) // 10 secs delay
2389
 
                                                        {
2390
 
                                                                if (modeIdx != BEACON_10S_MODE)         break;
2391
 
     be2:       80 91 b3 00     lds     r24, 0x00B3
2392
 
     be6:       8f 35           cpi     r24, 0x5F       ; 95
2393
 
     be8:       69 f7           brne    .-38            ; 0xbc4 <main+0x3c6>
2394
 
                                                                _delay_ms(100);
2395
 
     bea:       84 e6           ldi     r24, 0x64       ; 100
2396
 
     bec:       90 e0           ldi     r25, 0x00       ; 0
2397
 
     bee:       9b da           rcall   .-2762          ; 0x126 <_delay_ms>
2398
 
     bf0:       fa 94           dec     r15
2399
 
                                                        _delay_ms(300); // pause a little initially
2400
 
 
2401
 
                                                        strobe(240,240);                // two slow flash's
2402
 
                                                        strobe(240,240);
2403
 
 
2404
 
                                                        for (i=0; i < 100; i++) // 10 secs delay
2405
 
     bf2:       f1 10           cpse    r15, r1
2406
 
     bf4:       f6 cf           rjmp    .-20            ; 0xbe2 <main+0x3e4>
2407
 
     bf6:       e6 cf           rjmp    .-52            ; 0xbc4 <main+0x3c6>
2408
 
                                }
2409
 
                        } // mode change detected
2410
 
                        
2411
 
 
2412
 
                        // Perform low battery indicator tests
2413
 
                        if (LowBattSignal)
2414
 
     bf8:       80 91 a9 00     lds     r24, 0x00A9
2415
 
     bfc:       88 23           and     r24, r24
2416
 
     bfe:       21 f1           breq    .+72            ; 0xc48 <main+0x44a>
2417
 
                        {
2418
 
                                if (modeIdx > 0)
2419
 
     c00:       80 91 b3 00     lds     r24, 0x00B3
2420
 
     c04:       88 23           and     r24, r24
2421
 
     c06:       e9 f0           breq    .+58            ; 0xc42 <main+0x444>
2422
 
     c08:       b4 e0           ldi     r27, 0x04       ; 4
2423
 
     c0a:       fb 2e           mov     r15, r27
2424
 
     c0c:       fa 94           dec     r15
2425
 
                                {
2426
 
                                        // Flash 3 times before lowering
2427
 
                                        byte i = 0;
2428
 
                                        while (i++<3)
2429
 
     c0e:       ff 20           and     r15, r15
2430
 
     c10:       99 f0           breq    .+38            ; 0xc38 <main+0x43a>
2431
 
void set_output(byte pwm1, byte pwm2)
2432
 
 {
2433
 
        // Need PHASE to properly turn off the light
2434
 
//      if ((pwm1==0) && (pwm2==0))
2435
 
//              TCCR0A = PHASE;
2436
 
        PWM_LVL = pwm1;
2437
 
     c12:       18 bc           out     0x28, r1        ; 40
2438
 
        ALT_PWM_LVL = pwm2;
2439
 
     c14:       19 bc           out     0x29, r1        ; 41
2440
 
                                        // Flash 3 times before lowering
2441
 
                                        byte i = 0;
2442
 
                                        while (i++<3)
2443
 
                                        {
2444
 
                                                set_output(0,0);
2445
 
                                                _delay_ms(250);
2446
 
     c16:       8a ef           ldi     r24, 0xFA       ; 250
2447
 
     c18:       90 e0           ldi     r25, 0x00       ; 0
2448
 
     c1a:       85 da           rcall   .-2806          ; 0x126 <_delay_ms>
2449
 
                                                TurnOnBoardLed(1);
2450
 
     c1c:       81 e0           ldi     r24, 0x01       ; 1
2451
 
     c1e:       8c da           rcall   .-2792          ; 0x138 <TurnOnBoardLed>
2452
 
                                                set_output(currOutLvl1, currOutLvl2);
2453
 
     c20:       80 91 c8 00     lds     r24, 0x00C8
2454
 
     c24:       90 91 ca 00     lds     r25, 0x00CA
2455
 
void set_output(byte pwm1, byte pwm2)
2456
 
 {
2457
 
        // Need PHASE to properly turn off the light
2458
 
//      if ((pwm1==0) && (pwm2==0))
2459
 
//              TCCR0A = PHASE;
2460
 
        PWM_LVL = pwm1;
2461
 
     c28:       98 bd           out     0x28, r25       ; 40
2462
 
        ALT_PWM_LVL = pwm2;
2463
 
     c2a:       89 bd           out     0x29, r24       ; 41
2464
 
                                        {
2465
 
                                                set_output(0,0);
2466
 
                                                _delay_ms(250);
2467
 
                                                TurnOnBoardLed(1);
2468
 
                                                set_output(currOutLvl1, currOutLvl2);
2469
 
                                                _delay_ms(500);
2470
 
     c2c:       84 ef           ldi     r24, 0xF4       ; 244
2471
 
     c2e:       91 e0           ldi     r25, 0x01       ; 1
2472
 
     c30:       7a da           rcall   .-2828          ; 0x126 <_delay_ms>
2473
 
                                                TurnOnBoardLed(0);
2474
 
     c32:       80 e0           ldi     r24, 0x00       ; 0
2475
 
     c34:       81 da           rcall   .-2814          ; 0x138 <TurnOnBoardLed>
2476
 
     c36:       ea cf           rjmp    .-44            ; 0xc0c <main+0x40e>
2477
 
                                        }
2478
 
                                        
2479
 
                                        if (modeIdx < 16)
2480
 
     c38:       80 91 b3 00     lds     r24, 0x00B3
2481
 
     c3c:       80 31           cpi     r24, 0x10       ; 16
2482
 
     c3e:       08 f4           brcc    .+2             ; 0xc42 <main+0x444>
2483
 
                                                prev_mode();
2484
 
     c40:       24 db           rcall   .-2488          ; 0x28a <prev_mode>
2485
 
                                }
2486
 
                                LowBattSignal = 0;
2487
 
     c42:       10 92 a9 00     sts     0x00A9, r1
2488
 
     c46:       34 c0           rjmp    .+104           ; 0xcb0 <main+0x4b2>
2489
 
                        }
2490
 
                        else if (LowBattBlinkSignal)
2491
 
     c48:       80 91 a7 00     lds     r24, 0x00A7
2492
 
     c4c:       88 23           and     r24, r24
2493
 
     c4e:       81 f1           breq    .+96            ; 0xcb0 <main+0x4b2>
2494
 
                        {
2495
 
                                // Blink the Indicator LED twice
2496
 
                                if (onboardLedEnable)
2497
 
     c50:       80 91 62 00     lds     r24, 0x0062
2498
 
     c54:       88 23           and     r24, r24
2499
 
     c56:       51 f1           breq    .+84            ; 0xcac <main+0x4ae>
2500
 
                                {
2501
 
                                        if ((modeIdx > 0) || (locatorLedOn == 0))
2502
 
     c58:       80 91 b3 00     lds     r24, 0x00B3
2503
 
     c5c:       81 11           cpse    r24, r1
2504
 
     c5e:       04 c0           rjmp    .+8             ; 0xc68 <main+0x46a>
2505
 
     c60:       80 91 64 00     lds     r24, 0x0064
2506
 
     c64:       81 11           cpse    r24, r1
2507
 
     c66:       11 c0           rjmp    .+34            ; 0xc8a <main+0x48c>
2508
 
                                        {
2509
 
                                                TurnOnBoardLed(1);
2510
 
     c68:       81 e0           ldi     r24, 0x01       ; 1
2511
 
     c6a:       66 da           rcall   .-2868          ; 0x138 <TurnOnBoardLed>
2512
 
                                                _delay_ms(500);
2513
 
     c6c:       84 ef           ldi     r24, 0xF4       ; 244
2514
 
     c6e:       91 e0           ldi     r25, 0x01       ; 1
2515
 
     c70:       5a da           rcall   .-2892          ; 0x126 <_delay_ms>
2516
 
                                                TurnOnBoardLed(0);
2517
 
     c72:       80 e0           ldi     r24, 0x00       ; 0
2518
 
     c74:       61 da           rcall   .-2878          ; 0x138 <TurnOnBoardLed>
2519
 
                                                _delay_ms(500);
2520
 
     c76:       84 ef           ldi     r24, 0xF4       ; 244
2521
 
     c78:       91 e0           ldi     r25, 0x01       ; 1
2522
 
     c7a:       55 da           rcall   .-2902          ; 0x126 <_delay_ms>
2523
 
                                                TurnOnBoardLed(1);
2524
 
     c7c:       81 e0           ldi     r24, 0x01       ; 1
2525
 
     c7e:       5c da           rcall   .-2888          ; 0x138 <TurnOnBoardLed>
2526
 
                                                _delay_ms(500);
2527
 
     c80:       84 ef           ldi     r24, 0xF4       ; 244
2528
 
     c82:       91 e0           ldi     r25, 0x01       ; 1
2529
 
     c84:       50 da           rcall   .-2912          ; 0x126 <_delay_ms>
2530
 
                                                TurnOnBoardLed(0);
2531
 
     c86:       80 e0           ldi     r24, 0x00       ; 0
2532
 
     c88:       10 c0           rjmp    .+32            ; 0xcaa <main+0x4ac>
2533
 
                                        }
2534
 
                                        else
2535
 
                                        {
2536
 
                                                TurnOnBoardLed(0);
2537
 
     c8a:       80 e0           ldi     r24, 0x00       ; 0
2538
 
     c8c:       55 da           rcall   .-2902          ; 0x138 <TurnOnBoardLed>
2539
 
                                                _delay_ms(500);
2540
 
     c8e:       84 ef           ldi     r24, 0xF4       ; 244
2541
 
     c90:       91 e0           ldi     r25, 0x01       ; 1
2542
 
     c92:       49 da           rcall   .-2926          ; 0x126 <_delay_ms>
2543
 
                                                TurnOnBoardLed(1);
2544
 
     c94:       81 e0           ldi     r24, 0x01       ; 1
2545
 
     c96:       50 da           rcall   .-2912          ; 0x138 <TurnOnBoardLed>
2546
 
                                                _delay_ms(500);
2547
 
     c98:       84 ef           ldi     r24, 0xF4       ; 244
2548
 
     c9a:       91 e0           ldi     r25, 0x01       ; 1
2549
 
     c9c:       44 da           rcall   .-2936          ; 0x126 <_delay_ms>
2550
 
                                                TurnOnBoardLed(0);
2551
 
     c9e:       80 e0           ldi     r24, 0x00       ; 0
2552
 
     ca0:       4b da           rcall   .-2922          ; 0x138 <TurnOnBoardLed>
2553
 
                                                _delay_ms(500);
2554
 
     ca2:       84 ef           ldi     r24, 0xF4       ; 244
2555
 
     ca4:       91 e0           ldi     r25, 0x01       ; 1
2556
 
     ca6:       3f da           rcall   .-2946          ; 0x126 <_delay_ms>
2557
 
                                                TurnOnBoardLed(1);
2558
 
     ca8:       81 e0           ldi     r24, 0x01       ; 1
2559
 
     caa:       46 da           rcall   .-2932          ; 0x138 <TurnOnBoardLed>
2560
 
                                        }
2561
 
                                }
2562
 
 
2563
 
                                LowBattBlinkSignal = 0;
2564
 
     cac:       10 92 a7 00     sts     0x00A7, r1
2565
 
                        }
2566
 
 
2567
 
                        // Be sure switch is not pressed and light is OFF for at least 10 secs
2568
 
                        word wWaitTicks = 625;  // 10 secs
2569
 
                        if (LowBattState)
2570
 
     cb0:       80 91 a8 00     lds     r24, 0x00A8
2571
 
     cb4:       88 23           and     r24, r24
2572
 
     cb6:       29 f0           breq    .+10            ; 0xcc2 <main+0x4c4>
2573
 
                                wWaitTicks = 22500;     // 6 minutes
2574
 
     cb8:       a4 ee           ldi     r26, 0xE4       ; 228
2575
 
     cba:       ea 2e           mov     r14, r26
2576
 
     cbc:       a7 e5           ldi     r26, 0x57       ; 87
2577
 
     cbe:       fa 2e           mov     r15, r26
2578
 
     cc0:       04 c0           rjmp    .+8             ; 0xcca <main+0x4cc>
2579
 
 
2580
 
                                LowBattBlinkSignal = 0;
2581
 
                        }
2582
 
 
2583
 
                        // Be sure switch is not pressed and light is OFF for at least 10 secs
2584
 
                        word wWaitTicks = 625;  // 10 secs
2585
 
     cc2:       f1 e7           ldi     r31, 0x71       ; 113
2586
 
     cc4:       ef 2e           mov     r14, r31
2587
 
     cc6:       f2 e0           ldi     r31, 0x02       ; 2
2588
 
     cc8:       ff 2e           mov     r15, r31
2589
 
                        if (LowBattState)
2590
 
                                wWaitTicks = 22500;     // 6 minutes
2591
 
                        
2592
 
                        if ((modeIdx == 0) && !is_pressed() && (wIdleTicks > wWaitTicks))
2593
 
     cca:       80 91 b3 00     lds     r24, 0x00B3
2594
 
     cce:       81 11           cpse    r24, r1
2595
 
     cd0:       7c ce           rjmp    .-776           ; 0x9ca <main+0x1cc>
2596
 
     cd2:       ae da           rcall   .-2724          ; 0x230 <is_pressed>
2597
 
     cd4:       89 2b           or      r24, r25
2598
 
     cd6:       09 f0           breq    .+2             ; 0xcda <main+0x4dc>
2599
 
     cd8:       78 ce           rjmp    .-784           ; 0x9ca <main+0x1cc>
2600
 
     cda:       80 91 ad 00     lds     r24, 0x00AD
2601
 
     cde:       90 91 ae 00     lds     r25, 0x00AE
2602
 
     ce2:       e8 16           cp      r14, r24
2603
 
     ce4:       f9 06           cpc     r15, r25
2604
 
     ce6:       08 f0           brcs    .+2             ; 0xcea <main+0x4ec>
2605
 
     ce8:       70 ce           rjmp    .-800           ; 0x9ca <main+0x1cc>
2606
 
                        {
2607
 
                                // If the battery is currently low, then turn OFF the indicator LED before going to sleep
2608
 
                                //  to help in saving the battery
2609
 
                                if (get_voltage() < ADC_LOW)
2610
 
     cea:       46 da           rcall   .-2932          ; 0x178 <get_voltage>
2611
 
     cec:       8d 37           cpi     r24, 0x7D       ; 125
2612
 
     cee:       30 f4           brcc    .+12            ; 0xcfc <main+0x4fe>
2613
 
                                        if (locatorLedOn)
2614
 
     cf0:       80 91 64 00     lds     r24, 0x0064
2615
 
     cf4:       88 23           and     r24, r24
2616
 
     cf6:       11 f0           breq    .+4             ; 0xcfc <main+0x4fe>
2617
 
                                                TurnOnBoardLed(0);
2618
 
     cf8:       80 e0           ldi     r24, 0x00       ; 0
2619
 
     cfa:       1e da           rcall   .-3012          ; 0x138 <TurnOnBoardLed>
2620
 
                                
2621
 
                                wIdleTicks = 0;
2622
 
     cfc:       10 92 ae 00     sts     0x00AE, r1
2623
 
     d00:       10 92 ad 00     sts     0x00AD, r1
2624
 
                                _delay_ms(1); // Need this here, maybe instructions for PWM output not getting executed before shutdown?
2625
 
     d04:       81 e0           ldi     r24, 0x01       ; 1
2626
 
     d06:       90 e0           ldi     r25, 0x00       ; 0
2627
 
     d08:       0e da           rcall   .-3044          ; 0x126 <_delay_ms>
2628
 
                                sleep_until_switch_press();     // Go to sleep
2629
 
     d0a:       d1 da           rcall   .-2654          ; 0x2ae <sleep_until_switch_press>
2630
 
     d0c:       5e ce           rjmp    .-836           ; 0x9ca <main+0x1cc>
2631
 
                
2632
 
      //---------------------------------------------------------------------------------------
2633
 
                else                             // Configuration mode in effect
2634
 
      //---------------------------------------------------------------------------------------
2635
 
                {
2636
 
                        if (configClicks != prevConfigClicks)
2637
 
     d0e:       80 91 b5 00     lds     r24, 0x00B5
2638
 
     d12:       8d 17           cp      r24, r29
2639
 
     d14:       71 f0           breq    .+28            ; 0xd32 <main+0x534>
2640
 
                        {
2641
 
                                prevConfigClicks = configClicks;
2642
 
     d16:       d0 91 b5 00     lds     r29, 0x00B5
2643
 
                                if (configClicks > 0)
2644
 
     d1a:       80 91 b5 00     lds     r24, 0x00B5
2645
 
     d1e:       88 23           and     r24, r24
2646
 
     d20:       41 f0           breq    .+16            ; 0xd32 <main+0x534>
2647
 
void set_output(byte pwm1, byte pwm2)
2648
 
 {
2649
 
        // Need PHASE to properly turn off the light
2650
 
//      if ((pwm1==0) && (pwm2==0))
2651
 
//              TCCR0A = PHASE;
2652
 
        PWM_LVL = pwm1;
2653
 
     d22:       18 bc           out     0x28, r1        ; 40
2654
 
        ALT_PWM_LVL = pwm2;
2655
 
     d24:       84 e1           ldi     r24, 0x14       ; 20
2656
 
     d26:       89 bd           out     0x29, r24       ; 41
2657
 
**************************************************************************************/
2658
 
inline static void clickBlink()
2659
 
{
2660
 
//      TCCR0A = PHASE;
2661
 
        set_output(0,20);
2662
 
        _delay_ms(100);
2663
 
     d28:       84 e6           ldi     r24, 0x64       ; 100
2664
 
     d2a:       90 e0           ldi     r25, 0x00       ; 0
2665
 
     d2c:       fc d9           rcall   .-3080          ; 0x126 <_delay_ms>
2666
 
void set_output(byte pwm1, byte pwm2)
2667
 
 {
2668
 
        // Need PHASE to properly turn off the light
2669
 
//      if ((pwm1==0) && (pwm2==0))
2670
 
//              TCCR0A = PHASE;
2671
 
        PWM_LVL = pwm1;
2672
 
     d2e:       18 bc           out     0x28, r1        ; 40
2673
 
        ALT_PWM_LVL = pwm2;
2674
 
     d30:       19 bc           out     0x29, r1        ; 41
2675
 
                                prevConfigClicks = configClicks;
2676
 
                                if (configClicks > 0)
2677
 
                                        clickBlink();
2678
 
                        }
2679
 
                        
2680
 
                        if (ConfigMode != prevConfigMode)
2681
 
     d32:       90 91 b7 00     lds     r25, 0x00B7
2682
 
     d36:       80 91 b6 00     lds     r24, 0x00B6
2683
 
     d3a:       98 17           cp      r25, r24
2684
 
     d3c:       09 f4           brne    .+2             ; 0xd40 <main+0x542>
2685
 
     d3e:       a6 c1           rjmp    .+844           ; 0x108c <main+0x88e>
2686
 
                        {
2687
 
                                prevConfigMode = ConfigMode;
2688
 
     d40:       80 91 b7 00     lds     r24, 0x00B7
2689
 
     d44:       80 93 b6 00     sts     0x00B6, r24
2690
 
                                configIdleTime = 0;
2691
 
     d48:       10 92 b4 00     sts     0x00B4, r1
2692
 
 
2693
 
                                switch (ConfigMode)
2694
 
     d4c:       e0 91 b7 00     lds     r30, 0x00B7
2695
 
     d50:       8e 2f           mov     r24, r30
2696
 
     d52:       90 e0           ldi     r25, 0x00       ; 0
2697
 
     d54:       fc 01           movw    r30, r24
2698
 
     d56:       31 97           sbiw    r30, 0x01       ; 1
2699
 
     d58:       eb 31           cpi     r30, 0x1B       ; 27
2700
 
     d5a:       f1 05           cpc     r31, r1
2701
 
     d5c:       08 f0           brcs    .+2             ; 0xd60 <main+0x562>
2702
 
     d5e:       93 c1           rjmp    .+806           ; 0x1086 <main+0x888>
2703
 
     d60:       e1 5f           subi    r30, 0xF1       ; 241
2704
 
     d62:       ff 4f           sbci    r31, 0xFF       ; 255
2705
 
     d64:       09 94           ijmp
2706
 
                                                ++ConfigMode;
2707
 
                                                configClicks = 0;
2708
 
                                                break;
2709
 
                                                
2710
 
                                        case 3: // 1 - exiting mode set selection
2711
 
                                                if ((configClicks > 0) && (configClicks <= 8))
2712
 
     d66:       80 91 b5 00     lds     r24, 0x00B5
2713
 
     d6a:       88 23           and     r24, r24
2714
 
     d6c:       09 f4           brne    .+2             ; 0xd70 <main+0x572>
2715
 
     d6e:       56 c0           rjmp    .+172           ; 0xe1c <main+0x61e>
2716
 
     d70:       80 91 b5 00     lds     r24, 0x00B5
2717
 
     d74:       89 30           cpi     r24, 0x09       ; 9
2718
 
     d76:       08 f0           brcs    .+2             ; 0xd7a <main+0x57c>
2719
 
     d78:       51 c0           rjmp    .+162           ; 0xe1c <main+0x61e>
2720
 
                                                {
2721
 
                                                        modeSetIdx = configClicks - 1;
2722
 
     d7a:       80 91 b5 00     lds     r24, 0x00B5
2723
 
     d7e:       81 50           subi    r24, 0x01       ; 1
2724
 
     d80:       80 93 66 00     sts     0x0066, r24
2725
 
**************************************************************************************/
2726
 
inline void DefineModeSet()
2727
 
{
2728
 
        byte offset = 1;
2729
 
 
2730
 
        modesCnt = pgm_read_byte(modeSetCnts+modeSetIdx);
2731
 
     d84:       e0 91 66 00     lds     r30, 0x0066
2732
 
     d88:       f0 e0           ldi     r31, 0x00       ; 0
2733
 
     d8a:       e2 57           subi    r30, 0x72       ; 114
2734
 
     d8c:       ff 4f           sbci    r31, 0xFF       ; 255
2735
 
     d8e:       84 91           lpm     r24, Z
2736
 
     d90:       80 93 c9 00     sts     0x00C9, r24
2737
 
 
2738
 
        // Set OFF mode states (index 0)
2739
 
        byPrimModes[0] = bySecModes[0] = 0;
2740
 
     d94:       10 92 be 00     sts     0x00BE, r1
2741
 
     d98:       10 92 cb 00     sts     0x00CB, r1
2742
 
//      mode_pwm[0] = PHASE;
2743
 
 
2744
 
        if (moonLightEnable)
2745
 
     d9c:       90 91 65 00     lds     r25, 0x0065
2746
 
     da0:       99 23           and     r25, r25
2747
 
     da2:       41 f0           breq    .+16            ; 0xdb4 <main+0x5b6>
2748
 
        {
2749
 
                offset = 2;
2750
 
                byPrimModes[1] = 0;
2751
 
     da4:       10 92 cc 00     sts     0x00CC, r1
2752
 
                bySecModes[1] = moonlightLevel; // PWM value to use for moonlight mode
2753
 
     da8:       90 91 63 00     lds     r25, 0x0063
2754
 
     dac:       90 93 bf 00     sts     0x00BF, r25
2755
 
        byPrimModes[0] = bySecModes[0] = 0;
2756
 
//      mode_pwm[0] = PHASE;
2757
 
 
2758
 
        if (moonLightEnable)
2759
 
        {
2760
 
                offset = 2;
2761
 
     db0:       92 e0           ldi     r25, 0x02       ; 2
2762
 
     db2:       01 c0           rjmp    .+2             ; 0xdb6 <main+0x5b8>
2763
 
* DefineModeSet
2764
 
* =============
2765
 
**************************************************************************************/
2766
 
inline void DefineModeSet()
2767
 
{
2768
 
        byte offset = 1;
2769
 
     db4:       91 e0           ldi     r25, 0x01       ; 1
2770
 
                bySecModes[1] = moonlightLevel; // PWM value to use for moonlight mode
2771
 
//              mode_pwm[1] = PHASE;
2772
 
        }
2773
 
 
2774
 
        // Populate the RAM based current mode set
2775
 
        for (int i = 0; i < modesCnt; i++) 
2776
 
     db6:       20 e0           ldi     r18, 0x00       ; 0
2777
 
     db8:       30 e0           ldi     r19, 0x00       ; 0
2778
 
     dba:       68 2f           mov     r22, r24
2779
 
     dbc:       70 e0           ldi     r23, 0x00       ; 0
2780
 
     dbe:       e9 2e           mov     r14, r25
2781
 
     dc0:       f1 2c           mov     r15, r1
2782
 
     dc2:       26 17           cp      r18, r22
2783
 
     dc4:       37 07           cpc     r19, r23
2784
 
     dc6:       34 f5           brge    .+76            ; 0xe14 <main+0x616>
2785
 
        {
2786
 
                byPrimModes[offset+i] = pgm_read_byte(modeTableFet[modeSetIdx]+i);
2787
 
     dc8:       a0 91 66 00     lds     r26, 0x0066
2788
 
     dcc:       b0 e0           ldi     r27, 0x00       ; 0
2789
 
     dce:       aa 0f           add     r26, r26
2790
 
     dd0:       bb 1f           adc     r27, r27
2791
 
     dd2:       a0 58           subi    r26, 0x80       ; 128
2792
 
     dd4:       bf 4f           sbci    r27, 0xFF       ; 255
2793
 
     dd6:       ed 91           ld      r30, X+
2794
 
     dd8:       fc 91           ld      r31, X
2795
 
     dda:       e2 0f           add     r30, r18
2796
 
     ddc:       f3 1f           adc     r31, r19
2797
 
     dde:       e4 91           lpm     r30, Z
2798
 
     de0:       a9 01           movw    r20, r18
2799
 
     de2:       4e 0d           add     r20, r14
2800
 
     de4:       5f 1d           adc     r21, r15
2801
 
     de6:       da 01           movw    r26, r20
2802
 
     de8:       a5 53           subi    r26, 0x35       ; 53
2803
 
     dea:       bf 4f           sbci    r27, 0xFF       ; 255
2804
 
     dec:       ec 93           st      X, r30
2805
 
                bySecModes[offset+i] = pgm_read_byte(modeTable7135[modeSetIdx]+i);
2806
 
     dee:       a0 91 66 00     lds     r26, 0x0066
2807
 
     df2:       b0 e0           ldi     r27, 0x00       ; 0
2808
 
     df4:       aa 0f           add     r26, r26
2809
 
     df6:       bb 1f           adc     r27, r27
2810
 
     df8:       a8 59           subi    r26, 0x98       ; 152
2811
 
     dfa:       bf 4f           sbci    r27, 0xFF       ; 255
2812
 
     dfc:       ed 91           ld      r30, X+
2813
 
     dfe:       fc 91           ld      r31, X
2814
 
     e00:       e2 0f           add     r30, r18
2815
 
     e02:       f3 1f           adc     r31, r19
2816
 
     e04:       e4 91           lpm     r30, Z
2817
 
     e06:       da 01           movw    r26, r20
2818
 
     e08:       a2 54           subi    r26, 0x42       ; 66
2819
 
     e0a:       bf 4f           sbci    r27, 0xFF       ; 255
2820
 
     e0c:       ec 93           st      X, r30
2821
 
                bySecModes[1] = moonlightLevel; // PWM value to use for moonlight mode
2822
 
//              mode_pwm[1] = PHASE;
2823
 
        }
2824
 
 
2825
 
        // Populate the RAM based current mode set
2826
 
        for (int i = 0; i < modesCnt; i++) 
2827
 
     e0e:       2f 5f           subi    r18, 0xFF       ; 255
2828
 
     e10:       3f 4f           sbci    r19, 0xFF       ; 255
2829
 
     e12:       d7 cf           rjmp    .-82            ; 0xdc2 <main+0x5c4>
2830
 
                byPrimModes[offset+i] = pgm_read_byte(modeTableFet[modeSetIdx]+i);
2831
 
                bySecModes[offset+i] = pgm_read_byte(modeTable7135[modeSetIdx]+i);
2832
 
//              mode_pwm[offset+i] = pgm_read_byte(modeTablePwm[modeSetIdx]+i);
2833
 
        }
2834
 
 
2835
 
        modesCnt += offset;             // adjust to total mode count
2836
 
     e14:       89 0f           add     r24, r25
2837
 
     e16:       80 93 c9 00     sts     0x00C9, r24
2838
 
                                        case 3: // 1 - exiting mode set selection
2839
 
                                                if ((configClicks > 0) && (configClicks <= 8))
2840
 
                                                {
2841
 
                                                        modeSetIdx = configClicks - 1;
2842
 
                                                        DefineModeSet();
2843
 
                                                        SaveConfig();
2844
 
     e1a:       72 da           rcall   .-2844          ; 0x300 <SaveConfig>
2845
 
                                                }
2846
 
                                                configBlink(2);
2847
 
     e1c:       82 e0           ldi     r24, 0x02       ; 2
2848
 
     e1e:       f7 d9           rcall   .-3090          ; 0x20e <configBlink>
2849
 
                                                configIdleTime = 0;
2850
 
     e20:       10 92 b4 00     sts     0x00B4, r1
2851
 
                                                break;
2852
 
     e24:       30 c1           rjmp    .+608           ; 0x1086 <main+0x888>
2853
 
 
2854
 
                                        case 4: // 2 - exiting moonlight enabling
2855
 
                                                if (configClicks)
2856
 
     e26:       80 91 b5 00     lds     r24, 0x00B5
2857
 
     e2a:       88 23           and     r24, r24
2858
 
     e2c:       09 f4           brne    .+2             ; 0xe30 <main+0x632>
2859
 
     e2e:       52 c0           rjmp    .+164           ; 0xed4 <main+0x6d6>
2860
 
                                                {
2861
 
                                                        moonLightEnable = 1 - (configClicks & 1);
2862
 
     e30:       80 91 b5 00     lds     r24, 0x00B5
2863
 
     e34:       80 95           com     r24
2864
 
     e36:       81 70           andi    r24, 0x01       ; 1
2865
 
     e38:       80 93 65 00     sts     0x0065, r24
2866
 
**************************************************************************************/
2867
 
inline void DefineModeSet()
2868
 
{
2869
 
        byte offset = 1;
2870
 
 
2871
 
        modesCnt = pgm_read_byte(modeSetCnts+modeSetIdx);
2872
 
     e3c:       e0 91 66 00     lds     r30, 0x0066
2873
 
     e40:       f0 e0           ldi     r31, 0x00       ; 0
2874
 
     e42:       e2 57           subi    r30, 0x72       ; 114
2875
 
     e44:       ff 4f           sbci    r31, 0xFF       ; 255
2876
 
     e46:       84 91           lpm     r24, Z
2877
 
     e48:       80 93 c9 00     sts     0x00C9, r24
2878
 
 
2879
 
        // Set OFF mode states (index 0)
2880
 
        byPrimModes[0] = bySecModes[0] = 0;
2881
 
     e4c:       10 92 be 00     sts     0x00BE, r1
2882
 
     e50:       10 92 cb 00     sts     0x00CB, r1
2883
 
//      mode_pwm[0] = PHASE;
2884
 
 
2885
 
        if (moonLightEnable)
2886
 
     e54:       90 91 65 00     lds     r25, 0x0065
2887
 
     e58:       99 23           and     r25, r25
2888
 
     e5a:       41 f0           breq    .+16            ; 0xe6c <main+0x66e>
2889
 
        {
2890
 
                offset = 2;
2891
 
                byPrimModes[1] = 0;
2892
 
     e5c:       10 92 cc 00     sts     0x00CC, r1
2893
 
                bySecModes[1] = moonlightLevel; // PWM value to use for moonlight mode
2894
 
     e60:       90 91 63 00     lds     r25, 0x0063
2895
 
     e64:       90 93 bf 00     sts     0x00BF, r25
2896
 
        byPrimModes[0] = bySecModes[0] = 0;
2897
 
//      mode_pwm[0] = PHASE;
2898
 
 
2899
 
        if (moonLightEnable)
2900
 
        {
2901
 
                offset = 2;
2902
 
     e68:       92 e0           ldi     r25, 0x02       ; 2
2903
 
     e6a:       01 c0           rjmp    .+2             ; 0xe6e <main+0x670>
2904
 
* DefineModeSet
2905
 
* =============
2906
 
**************************************************************************************/
2907
 
inline void DefineModeSet()
2908
 
{
2909
 
        byte offset = 1;
2910
 
     e6c:       91 e0           ldi     r25, 0x01       ; 1
2911
 
                bySecModes[1] = moonlightLevel; // PWM value to use for moonlight mode
2912
 
//              mode_pwm[1] = PHASE;
2913
 
        }
2914
 
 
2915
 
        // Populate the RAM based current mode set
2916
 
        for (int i = 0; i < modesCnt; i++) 
2917
 
     e6e:       20 e0           ldi     r18, 0x00       ; 0
2918
 
     e70:       30 e0           ldi     r19, 0x00       ; 0
2919
 
     e72:       68 2f           mov     r22, r24
2920
 
     e74:       70 e0           ldi     r23, 0x00       ; 0
2921
 
     e76:       e9 2e           mov     r14, r25
2922
 
     e78:       f1 2c           mov     r15, r1
2923
 
     e7a:       26 17           cp      r18, r22
2924
 
     e7c:       37 07           cpc     r19, r23
2925
 
     e7e:       34 f5           brge    .+76            ; 0xecc <main+0x6ce>
2926
 
        {
2927
 
                byPrimModes[offset+i] = pgm_read_byte(modeTableFet[modeSetIdx]+i);
2928
 
     e80:       a0 91 66 00     lds     r26, 0x0066
2929
 
     e84:       b0 e0           ldi     r27, 0x00       ; 0
2930
 
     e86:       aa 0f           add     r26, r26
2931
 
     e88:       bb 1f           adc     r27, r27
2932
 
     e8a:       a0 58           subi    r26, 0x80       ; 128
2933
 
     e8c:       bf 4f           sbci    r27, 0xFF       ; 255
2934
 
     e8e:       ed 91           ld      r30, X+
2935
 
     e90:       fc 91           ld      r31, X
2936
 
     e92:       e2 0f           add     r30, r18
2937
 
     e94:       f3 1f           adc     r31, r19
2938
 
     e96:       e4 91           lpm     r30, Z
2939
 
     e98:       a9 01           movw    r20, r18
2940
 
     e9a:       4e 0d           add     r20, r14
2941
 
     e9c:       5f 1d           adc     r21, r15
2942
 
     e9e:       da 01           movw    r26, r20
2943
 
     ea0:       a5 53           subi    r26, 0x35       ; 53
2944
 
     ea2:       bf 4f           sbci    r27, 0xFF       ; 255
2945
 
     ea4:       ec 93           st      X, r30
2946
 
                bySecModes[offset+i] = pgm_read_byte(modeTable7135[modeSetIdx]+i);
2947
 
     ea6:       a0 91 66 00     lds     r26, 0x0066
2948
 
     eaa:       b0 e0           ldi     r27, 0x00       ; 0
2949
 
     eac:       aa 0f           add     r26, r26
2950
 
     eae:       bb 1f           adc     r27, r27
2951
 
     eb0:       a8 59           subi    r26, 0x98       ; 152
2952
 
     eb2:       bf 4f           sbci    r27, 0xFF       ; 255
2953
 
     eb4:       ed 91           ld      r30, X+
2954
 
     eb6:       fc 91           ld      r31, X
2955
 
     eb8:       e2 0f           add     r30, r18
2956
 
     eba:       f3 1f           adc     r31, r19
2957
 
     ebc:       e4 91           lpm     r30, Z
2958
 
     ebe:       da 01           movw    r26, r20
2959
 
     ec0:       a2 54           subi    r26, 0x42       ; 66
2960
 
     ec2:       bf 4f           sbci    r27, 0xFF       ; 255
2961
 
     ec4:       ec 93           st      X, r30
2962
 
                bySecModes[1] = moonlightLevel; // PWM value to use for moonlight mode
2963
 
//              mode_pwm[1] = PHASE;
2964
 
        }
2965
 
 
2966
 
        // Populate the RAM based current mode set
2967
 
        for (int i = 0; i < modesCnt; i++) 
2968
 
     ec6:       2f 5f           subi    r18, 0xFF       ; 255
2969
 
     ec8:       3f 4f           sbci    r19, 0xFF       ; 255
2970
 
     eca:       d7 cf           rjmp    .-82            ; 0xe7a <main+0x67c>
2971
 
                byPrimModes[offset+i] = pgm_read_byte(modeTableFet[modeSetIdx]+i);
2972
 
                bySecModes[offset+i] = pgm_read_byte(modeTable7135[modeSetIdx]+i);
2973
 
//              mode_pwm[offset+i] = pgm_read_byte(modeTablePwm[modeSetIdx]+i);
2974
 
        }
2975
 
 
2976
 
        modesCnt += offset;             // adjust to total mode count
2977
 
     ecc:       89 0f           add     r24, r25
2978
 
     ece:       80 93 c9 00     sts     0x00C9, r24
2979
 
                                        case 4: // 2 - exiting moonlight enabling
2980
 
                                                if (configClicks)
2981
 
                                                {
2982
 
                                                        moonLightEnable = 1 - (configClicks & 1);
2983
 
                                                        DefineModeSet();
2984
 
                                                        SaveConfig();
2985
 
     ed2:       16 da           rcall   .-3028          ; 0x300 <SaveConfig>
2986
 
                                                }
2987
 
                                                configBlink(3);
2988
 
     ed4:       83 e0           ldi     r24, 0x03       ; 3
2989
 
     ed6:       59 c0           rjmp    .+178           ; 0xf8a <main+0x78c>
2990
 
                                                break;
2991
 
 
2992
 
                                        case 5: // 3 - exiting mode order setting
2993
 
                                                if (configClicks)
2994
 
     ed8:       80 91 b5 00     lds     r24, 0x00B5
2995
 
     edc:       88 23           and     r24, r24
2996
 
     ede:       39 f0           breq    .+14            ; 0xeee <main+0x6f0>
2997
 
                                                {
2998
 
                                                        highToLow = 1 - (configClicks & 1);
2999
 
     ee0:       80 91 b5 00     lds     r24, 0x00B5
3000
 
     ee4:       80 95           com     r24
3001
 
     ee6:       81 70           andi    r24, 0x01       ; 1
3002
 
     ee8:       80 93 bd 00     sts     0x00BD, r24
3003
 
                                                        SaveConfig();
3004
 
     eec:       09 da           rcall   .-3054          ; 0x300 <SaveConfig>
3005
 
                                                }
3006
 
                                                configBlink(4);
3007
 
     eee:       84 e0           ldi     r24, 0x04       ; 4
3008
 
     ef0:       4c c0           rjmp    .+152           ; 0xf8a <main+0x78c>
3009
 
                                                break;
3010
 
 
3011
 
                                        case 6: // 4 - exiting mode memory setting
3012
 
                                                if (configClicks)
3013
 
     ef2:       80 91 b5 00     lds     r24, 0x00B5
3014
 
     ef6:       88 23           and     r24, r24
3015
 
     ef8:       39 f0           breq    .+14            ; 0xf08 <main+0x70a>
3016
 
                                                {
3017
 
                                                        modeMemoryEnabled = 1 - (configClicks & 1);
3018
 
     efa:       80 91 b5 00     lds     r24, 0x00B5
3019
 
     efe:       80 95           com     r24
3020
 
     f00:       81 70           andi    r24, 0x01       ; 1
3021
 
     f02:       80 93 bc 00     sts     0x00BC, r24
3022
 
                                                        SaveConfig();
3023
 
     f06:       fc d9           rcall   .-3080          ; 0x300 <SaveConfig>
3024
 
                                                }
3025
 
                                                configBlink(5);
3026
 
     f08:       85 e0           ldi     r24, 0x05       ; 5
3027
 
     f0a:       3f c0           rjmp    .+126           ; 0xf8a <main+0x78c>
3028
 
                                                break;
3029
 
                                                
3030
 
                                        case 7: // 5 - exiting turbo timeout setting
3031
 
                                                if ((configClicks > 0) && (configClicks <= 8))
3032
 
     f0c:       80 91 b5 00     lds     r24, 0x00B5
3033
 
     f10:       88 23           and     r24, r24
3034
 
     f12:       09 f4           brne    .+2             ; 0xf16 <main+0x718>
3035
 
     f14:       b6 c0           rjmp    .+364           ; 0x1082 <main+0x884>
3036
 
     f16:       80 91 b5 00     lds     r24, 0x00B5
3037
 
     f1a:       89 30           cpi     r24, 0x09       ; 9
3038
 
     f1c:       08 f0           brcs    .+2             ; 0xf20 <main+0x722>
3039
 
     f1e:       b1 c0           rjmp    .+354           ; 0x1082 <main+0x884>
3040
 
                                                {
3041
 
                                                        turboTimeoutMode = configClicks - 1;
3042
 
     f20:       80 91 b5 00     lds     r24, 0x00B5
3043
 
     f24:       81 50           subi    r24, 0x01       ; 1
3044
 
     f26:       80 93 bb 00     sts     0x00BB, r24
3045
 
                                                        
3046
 
                                                        // Set the updated Turbo Tick count limit
3047
 
                                                        wTurboTickLimit = pgm_read_word(turboTimeOutVals+turboTimeoutMode);
3048
 
     f2a:       e0 91 bb 00     lds     r30, 0x00BB
3049
 
     f2e:       f0 e0           ldi     r31, 0x00       ; 0
3050
 
     f30:       ee 0f           add     r30, r30
3051
 
     f32:       ff 1f           adc     r31, r31
3052
 
     f34:       e2 58           subi    r30, 0x82       ; 130
3053
 
     f36:       ff 4f           sbci    r31, 0xFF       ; 255
3054
 
     f38:       85 91           lpm     r24, Z+
3055
 
     f3a:       94 91           lpm     r25, Z
3056
 
     f3c:       90 93 ac 00     sts     0x00AC, r25
3057
 
     f40:       80 93 ab 00     sts     0x00AB, r24
3058
 
     f44:       9d c0           rjmp    .+314           ; 0x1080 <main+0x882>
3059
 
                                                }
3060
 
                                                ConfigMode = 8;                 // all done, go to exit
3061
 
                                                break;
3062
 
 
3063
 
                                        case 8: // exiting config mode
3064
 
                                                ConfigMode = 0;         // Exit Config mode
3065
 
     f46:       10 92 b7 00     sts     0x00B7, r1
3066
 
                                                blink(5, 40);
3067
 
     f4a:       68 e2           ldi     r22, 0x28       ; 40
3068
 
     f4c:       70 e0           ldi     r23, 0x00       ; 0
3069
 
     f4e:       85 e0           ldi     r24, 0x05       ; 5
3070
 
     f50:       18 d9           rcall   .-3536          ; 0x182 <blink>
3071
 
                                                modeIdx = 0;
3072
 
     f52:       10 92 b3 00     sts     0x00B3, r1
3073
 
                                                break;
3074
 
     f56:       97 c0           rjmp    .+302           ; 0x1086 <main+0x888>
3075
 
                                        //-------------------------------------------------------------------------
3076
 
                                        //                      Advanced Config Modes (from Battery Voltage Level display)
3077
 
                                        //-------------------------------------------------------------------------
3078
 
                                        
3079
 
                                        case 21:        // Start Adv Config mode
3080
 
                                                _delay_ms(400);
3081
 
     f58:       80 e9           ldi     r24, 0x90       ; 144
3082
 
     f5a:       91 e0           ldi     r25, 0x01       ; 1
3083
 
     f5c:       e4 d8           rcall   .-3640          ; 0x126 <_delay_ms>
3084
 
 
3085
 
                                                configBlink(1);
3086
 
     f5e:       81 e0           ldi     r24, 0x01       ; 1
3087
 
     f60:       56 d9           rcall   .-3412          ; 0x20e <configBlink>
3088
 
                                                ++ConfigMode;
3089
 
     f62:       80 91 b7 00     lds     r24, 0x00B7
3090
 
     f66:       8f 5f           subi    r24, 0xFF       ; 255
3091
 
     f68:       80 93 b7 00     sts     0x00B7, r24
3092
 
                                                configClicks = 0;
3093
 
     f6c:       10 92 b5 00     sts     0x00B5, r1
3094
 
                                                break;
3095
 
     f70:       8a c0           rjmp    .+276           ; 0x1086 <main+0x888>
3096
 
                                        
3097
 
                                        case 23:        // 1 - exiting locator LED ON selection
3098
 
                                                if (configClicks)
3099
 
     f72:       80 91 b5 00     lds     r24, 0x00B5
3100
 
     f76:       88 23           and     r24, r24
3101
 
     f78:       39 f0           breq    .+14            ; 0xf88 <main+0x78a>
3102
 
                                                {
3103
 
                                                        locatorLedOn = 1 - (configClicks & 1);
3104
 
     f7a:       80 91 b5 00     lds     r24, 0x00B5
3105
 
     f7e:       80 95           com     r24
3106
 
     f80:       81 70           andi    r24, 0x01       ; 1
3107
 
     f82:       80 93 64 00     sts     0x0064, r24
3108
 
                                                        SaveConfig();
3109
 
     f86:       bc d9           rcall   .-3208          ; 0x300 <SaveConfig>
3110
 
                                                }
3111
 
                                                configBlink(2);
3112
 
     f88:       82 e0           ldi     r24, 0x02       ; 2
3113
 
     f8a:       41 d9           rcall   .-3454          ; 0x20e <configBlink>
3114
 
                                                break;
3115
 
     f8c:       7c c0           rjmp    .+248           ; 0x1086 <main+0x888>
3116
 
                                                
3117
 
                                        case 24:        // 2 - exiting moonlight level selection
3118
 
                                                if ((configClicks > 0) && (configClicks <= 7))
3119
 
     f8e:       80 91 b5 00     lds     r24, 0x00B5
3120
 
     f92:       88 23           and     r24, r24
3121
 
     f94:       09 f4           brne    .+2             ; 0xf98 <main+0x79a>
3122
 
     f96:       9e cf           rjmp    .-196           ; 0xed4 <main+0x6d6>
3123
 
     f98:       80 91 b5 00     lds     r24, 0x00B5
3124
 
     f9c:       88 30           cpi     r24, 0x08       ; 8
3125
 
     f9e:       08 f0           brcs    .+2             ; 0xfa2 <main+0x7a4>
3126
 
     fa0:       99 cf           rjmp    .-206           ; 0xed4 <main+0x6d6>
3127
 
                                                {
3128
 
                                                        moonlightLevel = configClicks;
3129
 
     fa2:       80 91 b5 00     lds     r24, 0x00B5
3130
 
     fa6:       80 93 63 00     sts     0x0063, r24
3131
 
**************************************************************************************/
3132
 
inline void DefineModeSet()
3133
 
{
3134
 
        byte offset = 1;
3135
 
 
3136
 
        modesCnt = pgm_read_byte(modeSetCnts+modeSetIdx);
3137
 
     faa:       e0 91 66 00     lds     r30, 0x0066
3138
 
     fae:       f0 e0           ldi     r31, 0x00       ; 0
3139
 
     fb0:       e2 57           subi    r30, 0x72       ; 114
3140
 
     fb2:       ff 4f           sbci    r31, 0xFF       ; 255
3141
 
     fb4:       84 91           lpm     r24, Z
3142
 
     fb6:       80 93 c9 00     sts     0x00C9, r24
3143
 
 
3144
 
        // Set OFF mode states (index 0)
3145
 
        byPrimModes[0] = bySecModes[0] = 0;
3146
 
     fba:       10 92 be 00     sts     0x00BE, r1
3147
 
     fbe:       10 92 cb 00     sts     0x00CB, r1
3148
 
//      mode_pwm[0] = PHASE;
3149
 
 
3150
 
        if (moonLightEnable)
3151
 
     fc2:       90 91 65 00     lds     r25, 0x0065
3152
 
     fc6:       99 23           and     r25, r25
3153
 
     fc8:       41 f0           breq    .+16            ; 0xfda <main+0x7dc>
3154
 
        {
3155
 
                offset = 2;
3156
 
                byPrimModes[1] = 0;
3157
 
     fca:       10 92 cc 00     sts     0x00CC, r1
3158
 
                bySecModes[1] = moonlightLevel; // PWM value to use for moonlight mode
3159
 
     fce:       90 91 63 00     lds     r25, 0x0063
3160
 
     fd2:       90 93 bf 00     sts     0x00BF, r25
3161
 
        byPrimModes[0] = bySecModes[0] = 0;
3162
 
//      mode_pwm[0] = PHASE;
3163
 
 
3164
 
        if (moonLightEnable)
3165
 
        {
3166
 
                offset = 2;
3167
 
     fd6:       92 e0           ldi     r25, 0x02       ; 2
3168
 
     fd8:       01 c0           rjmp    .+2             ; 0xfdc <main+0x7de>
3169
 
* DefineModeSet
3170
 
* =============
3171
 
**************************************************************************************/
3172
 
inline void DefineModeSet()
3173
 
{
3174
 
        byte offset = 1;
3175
 
     fda:       91 e0           ldi     r25, 0x01       ; 1
3176
 
                bySecModes[1] = moonlightLevel; // PWM value to use for moonlight mode
3177
 
//              mode_pwm[1] = PHASE;
3178
 
        }
3179
 
 
3180
 
        // Populate the RAM based current mode set
3181
 
        for (int i = 0; i < modesCnt; i++) 
3182
 
     fdc:       20 e0           ldi     r18, 0x00       ; 0
3183
 
     fde:       30 e0           ldi     r19, 0x00       ; 0
3184
 
     fe0:       68 2f           mov     r22, r24
3185
 
     fe2:       70 e0           ldi     r23, 0x00       ; 0
3186
 
     fe4:       e9 2e           mov     r14, r25
3187
 
     fe6:       f1 2c           mov     r15, r1
3188
 
     fe8:       26 17           cp      r18, r22
3189
 
     fea:       37 07           cpc     r19, r23
3190
 
     fec:       0c f0           brlt    .+2             ; 0xff0 <main+0x7f2>
3191
 
     fee:       6e cf           rjmp    .-292           ; 0xecc <main+0x6ce>
3192
 
        {
3193
 
                byPrimModes[offset+i] = pgm_read_byte(modeTableFet[modeSetIdx]+i);
3194
 
     ff0:       a0 91 66 00     lds     r26, 0x0066
3195
 
     ff4:       b0 e0           ldi     r27, 0x00       ; 0
3196
 
     ff6:       aa 0f           add     r26, r26
3197
 
     ff8:       bb 1f           adc     r27, r27
3198
 
     ffa:       a0 58           subi    r26, 0x80       ; 128
3199
 
     ffc:       bf 4f           sbci    r27, 0xFF       ; 255
3200
 
     ffe:       ed 91           ld      r30, X+
3201
 
    1000:       fc 91           ld      r31, X
3202
 
    1002:       e2 0f           add     r30, r18
3203
 
    1004:       f3 1f           adc     r31, r19
3204
 
    1006:       e4 91           lpm     r30, Z
3205
 
    1008:       a9 01           movw    r20, r18
3206
 
    100a:       4e 0d           add     r20, r14
3207
 
    100c:       5f 1d           adc     r21, r15
3208
 
    100e:       da 01           movw    r26, r20
3209
 
    1010:       a5 53           subi    r26, 0x35       ; 53
3210
 
    1012:       bf 4f           sbci    r27, 0xFF       ; 255
3211
 
    1014:       ec 93           st      X, r30
3212
 
                bySecModes[offset+i] = pgm_read_byte(modeTable7135[modeSetIdx]+i);
3213
 
    1016:       a0 91 66 00     lds     r26, 0x0066
3214
 
    101a:       b0 e0           ldi     r27, 0x00       ; 0
3215
 
    101c:       aa 0f           add     r26, r26
3216
 
    101e:       bb 1f           adc     r27, r27
3217
 
    1020:       a8 59           subi    r26, 0x98       ; 152
3218
 
    1022:       bf 4f           sbci    r27, 0xFF       ; 255
3219
 
    1024:       ed 91           ld      r30, X+
3220
 
    1026:       fc 91           ld      r31, X
3221
 
    1028:       e2 0f           add     r30, r18
3222
 
    102a:       f3 1f           adc     r31, r19
3223
 
    102c:       e4 91           lpm     r30, Z
3224
 
    102e:       da 01           movw    r26, r20
3225
 
    1030:       a2 54           subi    r26, 0x42       ; 66
3226
 
    1032:       bf 4f           sbci    r27, 0xFF       ; 255
3227
 
    1034:       ec 93           st      X, r30
3228
 
                bySecModes[1] = moonlightLevel; // PWM value to use for moonlight mode
3229
 
//              mode_pwm[1] = PHASE;
3230
 
        }
3231
 
 
3232
 
        // Populate the RAM based current mode set
3233
 
        for (int i = 0; i < modesCnt; i++) 
3234
 
    1036:       2f 5f           subi    r18, 0xFF       ; 255
3235
 
    1038:       3f 4f           sbci    r19, 0xFF       ; 255
3236
 
    103a:       d6 cf           rjmp    .-84            ; 0xfe8 <main+0x7ea>
3237
 
                                                }
3238
 
                                                configBlink(3);
3239
 
                                                break;
3240
 
 
3241
 
                                        case 25:        // 3 - exiting BVLD LED config selection
3242
 
                                                if (configClicks)
3243
 
    103c:       80 91 b5 00     lds     r24, 0x00B5
3244
 
    1040:       88 23           and     r24, r24
3245
 
    1042:       09 f4           brne    .+2             ; 0x1046 <main+0x848>
3246
 
    1044:       54 cf           rjmp    .-344           ; 0xeee <main+0x6f0>
3247
 
                                                {
3248
 
                                                        bvldLedOnly = 1 - (configClicks & 1);
3249
 
    1046:       80 91 b5 00     lds     r24, 0x00B5
3250
 
    104a:       80 95           com     r24
3251
 
    104c:       81 70           andi    r24, 0x01       ; 1
3252
 
    104e:       80 93 ba 00     sts     0x00BA, r24
3253
 
    1052:       4c cf           rjmp    .-360           ; 0xeec <main+0x6ee>
3254
 
                                                }
3255
 
                                                configBlink(4);
3256
 
                                                break;
3257
 
                                        
3258
 
                                        case 26:        // 4 - exiting Indicator LED enable selection
3259
 
                                                if (configClicks)
3260
 
    1054:       80 91 b5 00     lds     r24, 0x00B5
3261
 
    1058:       88 23           and     r24, r24
3262
 
    105a:       09 f4           brne    .+2             ; 0x105e <main+0x860>
3263
 
    105c:       55 cf           rjmp    .-342           ; 0xf08 <main+0x70a>
3264
 
                                                {
3265
 
                                                        onboardLedEnable = 1 - (configClicks & 1);
3266
 
    105e:       80 91 b5 00     lds     r24, 0x00B5
3267
 
    1062:       80 95           com     r24
3268
 
    1064:       81 70           andi    r24, 0x01       ; 1
3269
 
    1066:       80 93 62 00     sts     0x0062, r24
3270
 
    106a:       4d cf           rjmp    .-358           ; 0xf06 <main+0x708>
3271
 
                                                }
3272
 
                                                configBlink(5);
3273
 
                                                break;
3274
 
                                        
3275
 
                                        case 27:        // 5 - power tail switch modes w/mem selection
3276
 
                                                if (configClicks)
3277
 
    106c:       80 91 b5 00     lds     r24, 0x00B5
3278
 
    1070:       88 23           and     r24, r24
3279
 
    1072:       39 f0           breq    .+14            ; 0x1082 <main+0x884>
3280
 
                                                {
3281
 
                                                        OffTimeEnable = 1 - (configClicks & 1);
3282
 
    1074:       80 91 b5 00     lds     r24, 0x00B5
3283
 
    1078:       80 95           com     r24
3284
 
    107a:       81 70           andi    r24, 0x01       ; 1
3285
 
    107c:       80 93 b9 00     sts     0x00B9, r24
3286
 
                                                        SaveConfig();
3287
 
    1080:       3f d9           rcall   .-3458          ; 0x300 <SaveConfig>
3288
 
                                                }
3289
 
                                                ConfigMode = 8;                 // all done, go to exit
3290
 
    1082:       10 93 b7 00     sts     0x00B7, r17
3291
 
                                                break;
3292
 
                                        
3293
 
                                } // switch on new config mode
3294
 
                                
3295
 
                                configClicks = 0;
3296
 
    1086:       10 92 b5 00     sts     0x00B5, r1
3297
 
    108a:       9f cc           rjmp    .-1730          ; 0x9ca <main+0x1cc>
3298
 
 
3299
 
                        } // ConfigMode changed
3300
 
 
3301
 
                        else if (configIdleTime > 250)          // 4 secs
3302
 
    108c:       80 91 b4 00     lds     r24, 0x00B4
3303
 
    1090:       8b 3f           cpi     r24, 0xFB       ; 251
3304
 
    1092:       08 f4           brcc    .+2             ; 0x1096 <main+0x898>
3305
 
    1094:       9a cc           rjmp    .-1740          ; 0x9ca <main+0x1cc>
3306
 
                        {
3307
 
                                ++ConfigMode;
3308
 
    1096:       80 91 b7 00     lds     r24, 0x00B7
3309
 
    109a:       8f 5f           subi    r24, 0xFF       ; 255
3310
 
    109c:       80 93 b7 00     sts     0x00B7, r24
3311
 
    10a0:       94 cc           rjmp    .-1752          ; 0x9ca <main+0x1cc>
3312
 
                locatorLedOn = (config3 >> 2) & 1;
3313
 
                bvldLedOnly = (config3 >> 3) & 1;
3314
 
                moonLightEnable = (config3 >> 4) & 1;
3315
 
        }
3316
 
        else
3317
 
                eepos = 0;
3318
 
    10a2:       10 92 a6 00     sts     0x00A6, r1
3319
 
    10a6:       10 92 a5 00     sts     0x00A5, r1
3320
 
    10aa:       10 cc           rjmp    .-2016          ; 0x8cc <main+0xce>
3321
 
 
3322
 
000010ac <eeprom_read_byte>:
3323
 
    10ac:       e1 99           sbic    0x1c, 1 ; 28
3324
 
    10ae:       fe cf           rjmp    .-4             ; 0x10ac <eeprom_read_byte>
3325
 
    10b0:       9f bb           out     0x1f, r25       ; 31
3326
 
    10b2:       8e bb           out     0x1e, r24       ; 30
3327
 
    10b4:       e0 9a           sbi     0x1c, 0 ; 28
3328
 
    10b6:       99 27           eor     r25, r25
3329
 
    10b8:       8d b3           in      r24, 0x1d       ; 29
3330
 
    10ba:       08 95           ret
3331
 
 
3332
 
000010bc <_exit>:
3333
 
    10bc:       f8 94           cli
3334
 
 
3335
 
000010be <__stop_program>:
3336
 
    10be:       ff cf           rjmp    .-2             ; 0x10be <__stop_program>