This repository has been archived by the owner on Oct 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathmain.lss
executable file
·2749 lines (2591 loc) · 92.2 KB
/
main.lss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
main.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000dae 00000000 00000000 00000094 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000002 00800060 00000dae 00000e42 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000036 00800062 00800062 00000e44 2**0
ALLOC
3 .debug_aranges 00000060 00000000 00000000 00000e44 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_pubnames 0000011f 00000000 00000000 00000ea4 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_info 00000b3d 00000000 00000000 00000fc3 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_abbrev 000003ab 00000000 00000000 00001b00 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_line 00000f6a 00000000 00000000 00001eab 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_frame 000000e0 00000000 00000000 00002e18 2**2
CONTENTS, READONLY, DEBUGGING
9 .debug_str 000001ab 00000000 00000000 00002ef8 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_loc 000006fa 00000000 00000000 000030a3 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_ranges 00000120 00000000 00000000 0000379d 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 12 c0 rjmp .+36 ; 0x26 <__ctors_end>
2: 2c c0 rjmp .+88 ; 0x5c <__bad_interrupt>
4: 2b c0 rjmp .+86 ; 0x5c <__bad_interrupt>
6: 2a c0 rjmp .+84 ; 0x5c <__bad_interrupt>
8: b9 c2 rjmp .+1394 ; 0x57c <__vector_4>
a: 28 c0 rjmp .+80 ; 0x5c <__bad_interrupt>
c: 27 c0 rjmp .+78 ; 0x5c <__bad_interrupt>
e: 26 c0 rjmp .+76 ; 0x5c <__bad_interrupt>
10: 25 c0 rjmp .+74 ; 0x5c <__bad_interrupt>
12: 24 c0 rjmp .+72 ; 0x5c <__bad_interrupt>
14: 23 c0 rjmp .+70 ; 0x5c <__bad_interrupt>
16: 22 c0 rjmp .+68 ; 0x5c <__bad_interrupt>
18: 21 c0 rjmp .+66 ; 0x5c <__bad_interrupt>
1a: 20 c0 rjmp .+64 ; 0x5c <__bad_interrupt>
1c: 20 c0 rjmp .+64 ; 0x5e <__vector_14>
1e: 1e c0 rjmp .+60 ; 0x5c <__bad_interrupt>
20: 1d c0 rjmp .+58 ; 0x5c <__bad_interrupt>
22: 1c c0 rjmp .+56 ; 0x5c <__bad_interrupt>
24: 1b c0 rjmp .+54 ; 0x5c <__bad_interrupt>
00000026 <__ctors_end>:
26: 11 24 eor r1, r1
28: 1f be out 0x3f, r1 ; 63
2a: cf e5 ldi r28, 0x5F ; 95
2c: d4 e0 ldi r29, 0x04 ; 4
2e: de bf out 0x3e, r29 ; 62
30: cd bf out 0x3d, r28 ; 61
00000032 <__do_copy_data>:
32: 10 e0 ldi r17, 0x00 ; 0
34: a0 e6 ldi r26, 0x60 ; 96
36: b0 e0 ldi r27, 0x00 ; 0
38: ee ea ldi r30, 0xAE ; 174
3a: fd e0 ldi r31, 0x0D ; 13
3c: 02 c0 rjmp .+4 ; 0x42 <.do_copy_data_start>
0000003e <.do_copy_data_loop>:
3e: 05 90 lpm r0, Z+
40: 0d 92 st X+, r0
00000042 <.do_copy_data_start>:
42: a2 36 cpi r26, 0x62 ; 98
44: b1 07 cpc r27, r17
46: d9 f7 brne .-10 ; 0x3e <.do_copy_data_loop>
00000048 <__do_clear_bss>:
48: 10 e0 ldi r17, 0x00 ; 0
4a: a2 e6 ldi r26, 0x62 ; 98
4c: b0 e0 ldi r27, 0x00 ; 0
4e: 01 c0 rjmp .+2 ; 0x52 <.do_clear_bss_start>
00000050 <.do_clear_bss_loop>:
50: 1d 92 st X+, r1
00000052 <.do_clear_bss_start>:
52: a8 39 cpi r26, 0x98 ; 152
54: b1 07 cpc r27, r17
56: e1 f7 brne .-8 ; 0x50 <.do_clear_bss_loop>
58: 64 d0 rcall .+200 ; 0x122 <main>
5a: a7 c6 rjmp .+3406 ; 0xdaa <_exit>
0000005c <__bad_interrupt>:
5c: d1 cf rjmp .-94 ; 0x0 <__vectors>
0000005e <__vector_14>:
#define HU1 34
#define AD2 565
#define HU2 70
ISR(ADC_vect) // New ADC result.
{
5e: 1f 92 push r1
60: 0f 92 push r0
62: 0f b6 in r0, 0x3f ; 63
64: 0f 92 push r0
66: 11 24 eor r1, r1
68: 2f 93 push r18
6a: 3f 93 push r19
6c: 4f 93 push r20
6e: 5f 93 push r21
70: 6f 93 push r22
72: 7f 93 push r23
74: 8f 93 push r24
76: 9f 93 push r25
78: af 93 push r26
7a: bf 93 push r27
7c: cf 93 push r28
7e: df 93 push r29
80: ef 93 push r30
82: ff 93 push r31
// Two-stage ADC -> Humidity math.
/*float voltage = 2.56 * ADC * 2 / 1024.0;
buffer[indux] = (uint8_t)(((voltage/5.0)-0.1515)/0.00636);*/
buffer[indux] = (((((float)HU2-(float)HU1)/((float)AD2-(float)AD1)) * (ADC - (float)AD1)) + ((float)HU1));
84: 80 91 62 00 lds r24, 0x0062
88: c8 2f mov r28, r24
8a: d0 e0 ldi r29, 0x00 ; 0
8c: 64 b1 in r22, 0x04 ; 4
8e: 75 b1 in r23, 0x05 ; 5
90: 80 e0 ldi r24, 0x00 ; 0
92: 90 e0 ldi r25, 0x00 ; 0
94: 64 d5 rcall .+2760 ; 0xb5e <__floatunsisf>
96: 20 e0 ldi r18, 0x00 ; 0
98: 30 e0 ldi r19, 0x00 ; 0
9a: 44 e8 ldi r20, 0x84 ; 132
9c: 53 e4 ldi r21, 0x43 ; 67
9e: ce d4 rcall .+2460 ; 0xa3c <__subsf3>
a0: 2b e8 ldi r18, 0x8B ; 139
a2: 31 ef ldi r19, 0xF1 ; 241
a4: 44 ef ldi r20, 0xF4 ; 244
a6: 5d e3 ldi r21, 0x3D ; 61
a8: e8 d5 rcall .+3024 ; 0xc7a <__mulsf3>
aa: 20 e0 ldi r18, 0x00 ; 0
ac: 30 e0 ldi r19, 0x00 ; 0
ae: 48 e0 ldi r20, 0x08 ; 8
b0: 52 e4 ldi r21, 0x42 ; 66
b2: c5 d4 rcall .+2442 ; 0xa3e <__addsf3>
b4: 28 d5 rcall .+2640 ; 0xb06 <__fixunssfsi>
b6: ca 59 subi r28, 0x9A ; 154
b8: df 4f sbci r29, 0xFF ; 255
ba: 68 83 st Y, r22
indux++;
bc: 80 91 62 00 lds r24, 0x0062
c0: 8f 5f subi r24, 0xFF ; 255
c2: 80 93 62 00 sts 0x0062, r24
if(indux >= BUFFSIZE) indux = 0;
c6: 80 91 62 00 lds r24, 0x0062
ca: 82 33 cpi r24, 0x32 ; 50
cc: 10 f0 brcs .+4 ; 0xd2 <__vector_14+0x74>
ce: 10 92 62 00 sts 0x0062, r1
d2: 40 e0 ldi r20, 0x00 ; 0
d4: 50 e0 ldi r21, 0x00 ; 0
d6: 20 e0 ldi r18, 0x00 ; 0
d8: 30 e0 ldi r19, 0x00 ; 0
uint16_t avg = 0;
for(uint8_t i=0;i<BUFFSIZE;i++)
{
avg += buffer[i];
da: f9 01 movw r30, r18
dc: ea 59 subi r30, 0x9A ; 154
de: ff 4f sbci r31, 0xFF ; 255
e0: 80 81 ld r24, Z
e2: 48 0f add r20, r24
e4: 51 1d adc r21, r1
e6: 2f 5f subi r18, 0xFF ; 255
e8: 3f 4f sbci r19, 0xFF ; 255
buffer[indux] = (((((float)HU2-(float)HU1)/((float)AD2-(float)AD1)) * (ADC - (float)AD1)) + ((float)HU1));
indux++;
if(indux >= BUFFSIZE) indux = 0;
uint16_t avg = 0;
for(uint8_t i=0;i<BUFFSIZE;i++)
ea: 22 33 cpi r18, 0x32 ; 50
ec: 31 05 cpc r19, r1
ee: a9 f7 brne .-22 ; 0xda <__vector_14+0x7c>
{
avg += buffer[i];
}
avg /= BUFFSIZE;
humidity = avg;
f0: ca 01 movw r24, r20
f2: 62 e3 ldi r22, 0x32 ; 50
f4: 70 e0 ldi r23, 0x00 ; 0
f6: 30 d6 rcall .+3168 ; 0xd58 <__udivmodhi4>
f8: 60 93 63 00 sts 0x0063, r22
}
fc: ff 91 pop r31
fe: ef 91 pop r30
100: df 91 pop r29
102: cf 91 pop r28
104: bf 91 pop r27
106: af 91 pop r26
108: 9f 91 pop r25
10a: 8f 91 pop r24
10c: 7f 91 pop r23
10e: 6f 91 pop r22
110: 5f 91 pop r21
112: 4f 91 pop r20
114: 3f 91 pop r19
116: 2f 91 pop r18
118: 0f 90 pop r0
11a: 0f be out 0x3f, r0 ; 63
11c: 0f 90 pop r0
11e: 1f 90 pop r1
120: 18 95 reti
00000122 <main>:
int main(void)
{
122: 2f 92 push r2
124: 3f 92 push r3
126: 4f 92 push r4
128: 5f 92 push r5
12a: 6f 92 push r6
12c: 7f 92 push r7
12e: 8f 92 push r8
130: 9f 92 push r9
132: af 92 push r10
134: bf 92 push r11
136: cf 92 push r12
138: df 92 push r13
13a: ef 92 push r14
13c: ff 92 push r15
13e: 0f 93 push r16
140: 1f 93 push r17
delay_ms(70); // Required delay to let the humidity sensor stabilize.
142: 86 e4 ldi r24, 0x46 ; 70
144: 90 e0 ldi r25, 0x00 ; 0
146: fe d3 rcall .+2044 ; 0x944 <delay_ms>
DDRC |= (1<<RELAY1)|(1<<RELAY2); // Enable output on relay pins.
148: 84 b3 in r24, 0x14 ; 20
14a: 80 63 ori r24, 0x30 ; 48
14c: 84 bb out 0x14, r24 ; 20
PORTB = (1<<PB1)|(1<<PB0); // Enable button pull-up.
14e: 83 e0 ldi r24, 0x03 ; 3
150: 88 bb out 0x18, r24 ; 24
sevsegTest(); // Start-up sequence.
152: 52 d3 rcall .+1700 ; 0x7f8 <sevsegTest>
PORTB |= 3; // Enable pull-ups.
154: 88 b3 in r24, 0x18 ; 24
156: 83 60 ori r24, 0x03 ; 3
158: 88 bb out 0x18, r24 ; 24
sevsegDuality(1); // Enable display mulitplexing.
15a: 81 e0 ldi r24, 0x01 ; 1
15c: 01 d2 rcall .+1026 ; 0x560 <sevsegDuality>
// Run relay tests.
segl = 0b10000000;
15e: 10 e8 ldi r17, 0x80 ; 128
160: 10 93 64 00 sts 0x0064, r17
segr = 0b00000000;
164: 10 92 60 00 sts 0x0060, r1
delay_ms(5);
168: 85 e0 ldi r24, 0x05 ; 5
16a: 90 e0 ldi r25, 0x00 ; 0
16c: eb d3 rcall .+2006 ; 0x944 <delay_ms>
PORTC |= (1<<RELAY1);
16e: ad 9a sbi 0x15, 5 ; 21
delay_ms(500);
170: 84 ef ldi r24, 0xF4 ; 244
172: 91 e0 ldi r25, 0x01 ; 1
174: e7 d3 rcall .+1998 ; 0x944 <delay_ms>
PORTC &= ~(1<<RELAY1);
176: ad 98 cbi 0x15, 5 ; 21
PORTC |= (1<<RELAY2);
178: ac 9a sbi 0x15, 4 ; 21
segl = 0b00000000;
17a: 10 92 64 00 sts 0x0064, r1
segr = 0b10000000;
17e: 10 93 60 00 sts 0x0060, r17
delay_ms(500);
182: 84 ef ldi r24, 0xF4 ; 244
184: 91 e0 ldi r25, 0x01 ; 1
186: de d3 rcall .+1980 ; 0x944 <delay_ms>
PORTC &= ~(1<<RELAY2);
188: ac 98 cbi 0x15, 4 ; 21
// Get stored values from EEPROM.
uint8_t humidLo = eeprom_read_byte((uint8_t*)0x00);
18a: 80 e0 ldi r24, 0x00 ; 0
18c: 90 e0 ldi r25, 0x00 ; 0
18e: f8 d5 rcall .+3056 ; 0xd80 <__eerd_byte_m8>
190: d8 2e mov r13, r24
uint8_t humidHi = eeprom_read_byte((uint8_t*)0x01);
192: 81 e0 ldi r24, 0x01 ; 1
194: 90 e0 ldi r25, 0x00 ; 0
196: f4 d5 rcall .+3048 ; 0xd80 <__eerd_byte_m8>
198: e8 2e mov r14, r24
if(humidLo > 90 || humidLo < 10 || humidLo > humidHi) humidLo = 25;
19a: 8d 2d mov r24, r13
19c: 8a 50 subi r24, 0x0A ; 10
19e: 81 35 cpi r24, 0x51 ; 81
1a0: 10 f4 brcc .+4 ; 0x1a6 <main+0x84>
1a2: ed 14 cp r14, r13
1a4: 10 f4 brcc .+4 ; 0x1aa <main+0x88>
1a6: 89 e1 ldi r24, 0x19 ; 25
1a8: d8 2e mov r13, r24
if(humidHi > 90 || humidHi < 10 || humidLo > humidHi) humidHi = 50;
1aa: 8e 2d mov r24, r14
1ac: 8a 50 subi r24, 0x0A ; 10
1ae: 81 35 cpi r24, 0x51 ; 81
1b0: 10 f4 brcc .+4 ; 0x1b6 <main+0x94>
1b2: ed 14 cp r14, r13
1b4: 10 f4 brcc .+4 ; 0x1ba <main+0x98>
1b6: 02 e3 ldi r16, 0x32 ; 50
1b8: e0 2e mov r14, r16
// Set up analog/digital converter.
ADMUX = (1<<REFS1)|(1<<REFS0); // Set ref to internal 2.56 and channel to 0 (indirectly).
1ba: 80 ec ldi r24, 0xC0 ; 192
1bc: 87 b9 out 0x07, r24 ; 7
ADCSRA = (1<<ADEN)|(1<<ADIE)|(1<<ADPS2); // Enable adc, enable interrupt, prescale by 16x.
1be: 8c e8 ldi r24, 0x8C ; 140
1c0: 86 b9 out 0x06, r24 ; 6
sei();
1c2: 78 94 sei
}
sevsegHex(0xff);
delay_ms(600);*/
// Two dashes.
segl = 0b01000000;
1c4: 80 e4 ldi r24, 0x40 ; 64
1c6: 80 93 64 00 sts 0x0064, r24
segr = 0b01000000;
1ca: 80 93 60 00 sts 0x0060, r24
else if(selec == 4) // ADC readout.
{
// "Ad"
segl = 0b11110111;
segr = 0b01011110;
1ce: 1e e5 ldi r17, 0x5E ; 94
1d0: a1 2e mov r10, r17
if(humidHi > 90) humidHi = 10;
}
}
if(humidHi <= humidLo) // Error!
{
segl = 0b11111001;
1d2: b9 ef ldi r27, 0xF9 ; 249
1d4: cb 2e mov r12, r27
segr = 0b01010000;
1d6: a0 e5 ldi r26, 0x50 ; 80
1d8: ba 2e mov r11, r26
{
/*// Two dashes.
segl = 0b01000000;
segr = 0b01000000;*/
if(bit_is_clear(PINB,PB1)) // If upper button is pressed...
1da: b1 99 sbic 0x16, 1 ; 22
1dc: 99 c1 rjmp .+818 ; 0x510 <__stack+0xb1>
{
delay_ms(20); //
1de: 84 e1 ldi r24, 0x14 ; 20
1e0: 90 e0 ldi r25, 0x00 ; 0
1e2: b0 d3 rcall .+1888 ; 0x944 <delay_ms>
1e4: 10 e0 ldi r17, 0x00 ; 0
1e6: 06 c0 rjmp .+12 ; 0x1f4 <main+0xd2>
uint8_t counter = 0;
while(bit_is_clear(PINB,PB1))
{
delay_ms(5);
1e8: 85 e0 ldi r24, 0x05 ; 5
1ea: 90 e0 ldi r25, 0x00 ; 0
1ec: ab d3 rcall .+1878 ; 0x944 <delay_ms>
counter++;
1ee: 1f 5f subi r17, 0xFF ; 255
if((counter*5) > 500) break; // Leave the loop once long time press is detected.
1f0: 15 36 cpi r17, 0x65 ; 101
1f2: 11 f0 breq .+4 ; 0x1f8 <main+0xd6>
if(bit_is_clear(PINB,PB1)) // If upper button is pressed...
{
delay_ms(20); //
uint8_t counter = 0;
while(bit_is_clear(PINB,PB1))
1f4: b1 9b sbis 0x16, 1 ; 22
1f6: f8 cf rjmp .-16 ; 0x1e8 <main+0xc6>
delay_ms(5);
counter++;
if((counter*5) > 500) break; // Leave the loop once long time press is detected.
}
if((counter*5) > 500)
1f8: 85 e0 ldi r24, 0x05 ; 5
1fa: 18 9f mul r17, r24
1fc: c0 01 movw r24, r0
1fe: 11 24 eor r1, r1
200: 85 5f subi r24, 0xF5 ; 245
202: 91 40 sbci r25, 0x01 ; 1
204: 0c f4 brge .+2 ; 0x208 <main+0xe6>
206: 80 c1 rjmp .+768 ; 0x508 <__stack+0xa9>
{
// Long press, go to options.
// Scroll "OPT".
// "O"
segl = 0;
208: 10 92 64 00 sts 0x0064, r1
segr = 0b00111111;
20c: 1f e3 ldi r17, 0x3F ; 63
20e: 10 93 60 00 sts 0x0060, r17
delay_ms(SCROLLWAIT);
212: 88 e5 ldi r24, 0x58 ; 88
214: 92 e0 ldi r25, 0x02 ; 2
216: 96 d3 rcall .+1836 ; 0x944 <delay_ms>
// "OP"
segl = 0b00111111;
218: 10 93 64 00 sts 0x0064, r17
segr = 0b01110011;
21c: 13 e7 ldi r17, 0x73 ; 115
21e: 10 93 60 00 sts 0x0060, r17
delay_ms(SCROLLWAIT);
222: 88 e5 ldi r24, 0x58 ; 88
224: 92 e0 ldi r25, 0x02 ; 2
226: 8e d3 rcall .+1820 ; 0x944 <delay_ms>
// "PT"
segl = 0b01110011;
228: 10 93 64 00 sts 0x0064, r17
segr = 0b01111000;
22c: 18 e7 ldi r17, 0x78 ; 120
22e: 10 93 60 00 sts 0x0060, r17
delay_ms(SCROLLWAIT);
232: 88 e5 ldi r24, 0x58 ; 88
234: 92 e0 ldi r25, 0x02 ; 2
236: 86 d3 rcall .+1804 ; 0x944 <delay_ms>
// "T"
segl = 0b01111000;
238: 10 93 64 00 sts 0x0064, r17
segr = 0b10000000;
23c: 80 e8 ldi r24, 0x80 ; 128
23e: 80 93 60 00 sts 0x0060, r24
242: 03 c0 rjmp .+6 ; 0x24a <main+0x128>
while(bit_is_clear(PINB,PB1)) delay_ms(5);
244: 85 e0 ldi r24, 0x05 ; 5
246: 90 e0 ldi r25, 0x00 ; 0
248: 7d d3 rcall .+1786 ; 0x944 <delay_ms>
24a: b1 9b sbis 0x16, 1 ; 22
24c: fb cf rjmp .-10 ; 0x244 <main+0x122>
segl = 0b10000000;
24e: 80 e8 ldi r24, 0x80 ; 128
250: 80 93 64 00 sts 0x0064, r24
segr = 0;
254: 10 92 60 00 sts 0x0060, r1
delay_ms(200);
258: 88 ec ldi r24, 0xC8 ; 200
25a: 90 e0 ldi r25, 0x00 ; 0
25c: 73 d3 rcall .+1766 ; 0x944 <delay_ms>
// Turn off the relays.
RELAYPORT &= ~((1<<RELAY1)|(1<<RELAY2));
25e: 85 b3 in r24, 0x15 ; 21
260: 8f 7c andi r24, 0xCF ; 207
262: 85 bb out 0x15, r24 ; 21
264: ff 24 eor r15, r15
266: f3 94 inc r15
268: 18 e7 ldi r17, 0x78 ; 120
}
delay = 255;
// "dc"
segl = 0b11011110;
segr = 0b01011000;
for(;delay>0;delay-=1)
26a: f8 e7 ldi r31, 0x78 ; 120
26c: 5f 2e mov r5, r31
}
else if(selec == 2) // Lo (low setting)
{
// "Lo"
segl = 0b10111000;
26e: e8 eb ldi r30, 0xB8 ; 184
270: 4e 2e mov r4, r30
segr = 0b01011100;
272: 7c e5 ldi r23, 0x5C ; 92
274: 37 2e mov r3, r23
}
else if(selec == 1) // Test...
{
// "TE"
segl = 0b11111000;
276: 68 ef ldi r22, 0xF8 ; 248
278: 26 2e mov r2, r22
delay_ms(5);
}
delay = 120;
// "ES"
segl = 0b11111001;
segr = 0b01101101;
27a: 5d e6 ldi r21, 0x6D ; 109
27c: 95 2e mov r9, r21
}
delay_ms(5);
}
delay = 255;
// "ST"
segl = 0b11101101;
27e: 4d ee ldi r20, 0xED ; 237
280: 84 2e mov r8, r20
{
if(selec == 0) // End (exit menu)
{
// "En"
segl = 0b11111001;
segr = 0b01010100;
282: 34 e5 ldi r19, 0x54 ; 84
284: 73 2e mov r7, r19
}
delay_ms(5);
}
delay = 255;
// "nd"
segl = 0b11010100;
286: 24 ed ldi r18, 0xD4 ; 212
288: 62 2e mov r6, r18
uint8_t menu = 1;
uint8_t selec = 1;
uint8_t delay = 120;
while(menu)
{
if(selec == 0) // End (exit menu)
28a: ff 20 and r15, r15
28c: 09 f5 brne .+66 ; 0x2d0 <main+0x1ae>
{
// "En"
segl = 0b11111001;
28e: c0 92 64 00 sts 0x0064, r12
segr = 0b01010100;
292: 70 92 60 00 sts 0x0060, r7
for(;delay>0;delay-=1)
{
if(bit_is_clear(PINB,PB1)) break;
296: b1 9b sbis 0x16, 1 ; 22
298: 09 c0 rjmp .+18 ; 0x2ac <main+0x18a>
if(bit_is_clear(PINB,PB0))
29a: b0 99 sbic 0x16, 0 ; 22
29c: 02 c0 rjmp .+4 ; 0x2a2 <main+0x180>
29e: 00 e0 ldi r16, 0x00 ; 0
2a0: 06 c0 rjmp .+12 ; 0x2ae <main+0x18c>
{
// Quit menu.
menu = 0;
break;
}
delay_ms(5);
2a2: 85 e0 ldi r24, 0x05 ; 5
2a4: 90 e0 ldi r25, 0x00 ; 0
2a6: 4e d3 rcall .+1692 ; 0x944 <delay_ms>
if(selec == 0) // End (exit menu)
{
// "En"
segl = 0b11111001;
segr = 0b01010100;
for(;delay>0;delay-=1)
2a8: 11 50 subi r17, 0x01 ; 1
2aa: a9 f7 brne .-22 ; 0x296 <main+0x174>
2ac: 01 e0 ldi r16, 0x01 ; 1
}
delay_ms(5);
}
delay = 255;
// "nd"
segl = 0b11010100;
2ae: 60 92 64 00 sts 0x0064, r6
segr = 0b01011110;
2b2: a0 92 60 00 sts 0x0060, r10
2b6: 1f ef ldi r17, 0xFF ; 255
for(;delay>0;delay-=1)
{
if(bit_is_clear(PINB,PB1)) break;
2b8: b1 9b sbis 0x16, 1 ; 22
2ba: 09 c1 rjmp .+530 ; 0x4ce <__stack+0x6f>
if(bit_is_clear(PINB,PB0))
2bc: b0 99 sbic 0x16, 0 ; 22
2be: 02 c0 rjmp .+4 ; 0x2c4 <main+0x1a2>
2c0: 00 e0 ldi r16, 0x00 ; 0
2c2: 05 c1 rjmp .+522 ; 0x4ce <__stack+0x6f>
{
// Quit menu.
menu = 0;
break;
}
delay_ms(5);
2c4: 85 e0 ldi r24, 0x05 ; 5
2c6: 90 e0 ldi r25, 0x00 ; 0
2c8: 3d d3 rcall .+1658 ; 0x944 <delay_ms>
}
delay = 255;
// "nd"
segl = 0b11010100;
segr = 0b01011110;
for(;delay>0;delay-=1)
2ca: 11 50 subi r17, 0x01 ; 1
2cc: a9 f7 brne .-22 ; 0x2b8 <main+0x196>
2ce: ff c0 rjmp .+510 ; 0x4ce <__stack+0x6f>
delay_ms(5);
}
delay = 120;
}
else if(selec == 1) // Test...
2d0: 81 e0 ldi r24, 0x01 ; 1
2d2: f8 16 cp r15, r24
2d4: 59 f5 brne .+86 ; 0x32c <main+0x20a>
{
// "TE"
segl = 0b11111000;
2d6: 20 92 64 00 sts 0x0064, r2
segr = 0b01111001;
2da: 29 e7 ldi r18, 0x79 ; 121
2dc: 20 93 60 00 sts 0x0060, r18
for(;delay>0;delay-=1)
{
if(bit_is_clear(PINB,PB1)) break;
2e0: b1 9b sbis 0x16, 1 ; 22
2e2: 07 c0 rjmp .+14 ; 0x2f2 <main+0x1d0>
if(bit_is_clear(PINB,PB0))
2e4: b0 9b sbis 0x16, 0 ; 22
{
// Test relays.
testRelays();
2e6: 38 d3 rcall .+1648 ; 0x958 <testRelays>
}
delay_ms(5);
2e8: 85 e0 ldi r24, 0x05 ; 5
2ea: 90 e0 ldi r25, 0x00 ; 0
2ec: 2b d3 rcall .+1622 ; 0x944 <delay_ms>
else if(selec == 1) // Test...
{
// "TE"
segl = 0b11111000;
segr = 0b01111001;
for(;delay>0;delay-=1)
2ee: 11 50 subi r17, 0x01 ; 1
2f0: b9 f7 brne .-18 ; 0x2e0 <main+0x1be>
}
delay_ms(5);
}
delay = 120;
// "ES"
segl = 0b11111001;
2f2: c0 92 64 00 sts 0x0064, r12
segr = 0b01101101;
2f6: 90 92 60 00 sts 0x0060, r9
2fa: 18 e7 ldi r17, 0x78 ; 120
for(;delay>0;delay-=1)
{
if(bit_is_clear(PINB,PB1)) break;
2fc: b1 9b sbis 0x16, 1 ; 22
2fe: 07 c0 rjmp .+14 ; 0x30e <main+0x1ec>
if(bit_is_clear(PINB,PB0))
300: b0 9b sbis 0x16, 0 ; 22
{
// Test relays.
testRelays();
302: 2a d3 rcall .+1620 ; 0x958 <testRelays>
}
delay_ms(5);
304: 85 e0 ldi r24, 0x05 ; 5
306: 90 e0 ldi r25, 0x00 ; 0
308: 1d d3 rcall .+1594 ; 0x944 <delay_ms>
}
delay = 120;
// "ES"
segl = 0b11111001;
segr = 0b01101101;
for(;delay>0;delay-=1)
30a: 11 50 subi r17, 0x01 ; 1
30c: b9 f7 brne .-18 ; 0x2fc <main+0x1da>
}
delay_ms(5);
}
delay = 255;
// "ST"
segl = 0b11101101;
30e: 80 92 64 00 sts 0x0064, r8
segr = 0b01111000;
312: 50 92 60 00 sts 0x0060, r5
316: 1f ef ldi r17, 0xFF ; 255
for(;delay>0;delay-=1)
{
if(bit_is_clear(PINB,PB1)) break;
318: b1 9b sbis 0x16, 1 ; 22
31a: d8 c0 rjmp .+432 ; 0x4cc <__stack+0x6d>
if(bit_is_clear(PINB,PB0))
31c: b0 9b sbis 0x16, 0 ; 22
{
// Test relays.
testRelays();
31e: 1c d3 rcall .+1592 ; 0x958 <testRelays>
}
delay_ms(5);
320: 85 e0 ldi r24, 0x05 ; 5
322: 90 e0 ldi r25, 0x00 ; 0
324: 0f d3 rcall .+1566 ; 0x944 <delay_ms>
}
delay = 255;
// "ST"
segl = 0b11101101;
segr = 0b01111000;
for(;delay>0;delay-=1)
326: 11 50 subi r17, 0x01 ; 1
328: b9 f7 brne .-18 ; 0x318 <main+0x1f6>
32a: d0 c0 rjmp .+416 ; 0x4cc <__stack+0x6d>
delay_ms(5);
}
delay = 120;
}
else if(selec == 2) // Lo (low setting)
32c: 82 e0 ldi r24, 0x02 ; 2
32e: f8 16 cp r15, r24
330: 09 f0 breq .+2 ; 0x334 <main+0x212>
332: 51 c0 rjmp .+162 ; 0x3d6 <main+0x2b4>
{
// "Lo"
segl = 0b10111000;
334: 40 92 64 00 sts 0x0064, r4
segr = 0b01011100;
338: 30 92 60 00 sts 0x0060, r3
33c: 1f ef ldi r17, 0xFF ; 255
delay = 255;
uint8_t skip = 0;
for(;delay>0;delay-=1)
{
if(bit_is_clear(PINB,PB1)) {while(bit_is_clear(PINB,PB1)) delay_ms(5);skip = 1;break;}
33e: b1 99 sbic 0x16, 1 ; 22
340: 08 c0 rjmp .+16 ; 0x352 <main+0x230>
342: 03 c0 rjmp .+6 ; 0x34a <main+0x228>
344: 85 e0 ldi r24, 0x05 ; 5
346: 90 e0 ldi r25, 0x00 ; 0
348: fd d2 rcall .+1530 ; 0x944 <delay_ms>
34a: b1 9b sbis 0x16, 1 ; 22
34c: fb cf rjmp .-10 ; 0x344 <main+0x222>
34e: 01 e0 ldi r16, 0x01 ; 1
350: 0f c0 rjmp .+30 ; 0x370 <main+0x24e>
if(bit_is_clear(PINB,PB0))
352: b0 99 sbic 0x16, 0 ; 22
354: 07 c0 rjmp .+14 ; 0x364 <main+0x242>
356: 03 c0 rjmp .+6 ; 0x35e <main+0x23c>
{
while(bit_is_clear(PINB,PB0)) delay_ms(5);
358: 85 e0 ldi r24, 0x05 ; 5
35a: 90 e0 ldi r25, 0x00 ; 0
35c: f3 d2 rcall .+1510 ; 0x944 <delay_ms>
35e: b0 9b sbis 0x16, 0 ; 22
360: fb cf rjmp .-10 ; 0x358 <main+0x236>
362: 05 c0 rjmp .+10 ; 0x36e <main+0x24c>
break;
}
delay_ms(10);
364: 8a e0 ldi r24, 0x0A ; 10
366: 90 e0 ldi r25, 0x00 ; 0
368: ed d2 rcall .+1498 ; 0x944 <delay_ms>
// "Lo"
segl = 0b10111000;
segr = 0b01011100;
delay = 255;
uint8_t skip = 0;
for(;delay>0;delay-=1)
36a: 11 50 subi r17, 0x01 ; 1
36c: 41 f7 brne .-48 ; 0x33e <main+0x21c>
36e: 00 e0 ldi r16, 0x00 ; 0
370: 1d 2d mov r17, r13
372: 13 c0 rjmp .+38 ; 0x39a <main+0x278>
uint8_t hold = humidLo; // Store unmodified value.
while(bit_is_set(PINB,PB0) && skip == 0) // While the lower button remains unpressed...
{
sevsegNumber(humidLo);
374: 81 2f mov r24, r17
376: 52 d1 rcall .+676 ; 0x61c <sevsegNumber>
segl |= 0b10000000; // Add in the decimal.
378: 80 91 64 00 lds r24, 0x0064
37c: 80 68 ori r24, 0x80 ; 128
37e: 80 93 64 00 sts 0x0064, r24
if(bit_is_clear(PINB, PB1)) // If upper button (increment) is pressed.
382: b1 99 sbic 0x16, 1 ; 22
384: 0a c0 rjmp .+20 ; 0x39a <main+0x278>
386: 03 c0 rjmp .+6 ; 0x38e <main+0x26c>
{
while(bit_is_clear(PINB,PB1)) delay_ms(5);
388: 85 e0 ldi r24, 0x05 ; 5
38a: 90 e0 ldi r25, 0x00 ; 0
38c: db d2 rcall .+1462 ; 0x944 <delay_ms>
38e: b1 9b sbis 0x16, 1 ; 22
390: fb cf rjmp .-10 ; 0x388 <main+0x266>
humidLo += 5;
392: 1b 5f subi r17, 0xFB ; 251
if(humidLo > 90) humidLo = 10;
394: 1b 35 cpi r17, 0x5B ; 91
396: 08 f0 brcs .+2 ; 0x39a <main+0x278>
398: 1a e0 ldi r17, 0x0A ; 10
}
delay = 255;
uint8_t hold = humidLo; // Store unmodified value.
while(bit_is_set(PINB,PB0) && skip == 0) // While the lower button remains unpressed...
39a: b0 9b sbis 0x16, 0 ; 22
39c: 02 c0 rjmp .+4 ; 0x3a2 <main+0x280>
39e: 00 23 and r16, r16
3a0: 49 f3 breq .-46 ; 0x374 <main+0x252>
humidLo += 5;
if(humidLo > 90) humidLo = 10;
}
}
if(humidHi <= humidLo) // Error!
3a2: 1e 15 cp r17, r14
3a4: 38 f0 brcs .+14 ; 0x3b4 <main+0x292>
{
segl = 0b11111001;
3a6: c0 92 64 00 sts 0x0064, r12
segr = 0b01010000;
3aa: b0 92 60 00 sts 0x0060, r11
delay_ms(1000);
3ae: 88 ee ldi r24, 0xE8 ; 232
3b0: 93 e0 ldi r25, 0x03 ; 3
3b2: 0a c0 rjmp .+20 ; 0x3c8 <main+0x2a6>
humidLo = hold;
}
else
{
if(humidLo != hold) eeprom_write_byte((uint8_t*)0x00, humidLo);
3b4: 1d 15 cp r17, r13
3b6: 49 f0 breq .+18 ; 0x3ca <main+0x2a8>
3b8: 80 e0 ldi r24, 0x00 ; 0
3ba: 90 e0 ldi r25, 0x00 ; 0
3bc: 61 2f mov r22, r17
3be: e8 d4 rcall .+2512 ; 0xd90 <__eewr_byte_m8>
3c0: d1 2e mov r13, r17
3c2: 03 c0 rjmp .+6 ; 0x3ca <main+0x2a8>
}
while(bit_is_clear(PINB,PB0)) delay_ms(5);
3c4: 85 e0 ldi r24, 0x05 ; 5
3c6: 90 e0 ldi r25, 0x00 ; 0
3c8: bd d2 rcall .+1402 ; 0x944 <delay_ms>
3ca: b0 9b sbis 0x16, 0 ; 22
3cc: fb cf rjmp .-10 ; 0x3c4 <main+0x2a2>
3ce: 01 e0 ldi r16, 0x01 ; 1
3d0: 93 e0 ldi r25, 0x03 ; 3
3d2: f9 2e mov r15, r25
3d4: 56 c0 rjmp .+172 ; 0x482 <__stack+0x23>
selec++;
}
else if(selec == 3) // Hi (high setting)
3d6: 23 e0 ldi r18, 0x03 ; 3
3d8: f2 16 cp r15, r18
3da: 09 f0 breq .+2 ; 0x3de <main+0x2bc>
3dc: 54 c0 rjmp .+168 ; 0x486 <__stack+0x27>
{
// "Hi"
segl = 0b11110110;
3de: 86 ef ldi r24, 0xF6 ; 246
3e0: 80 93 64 00 sts 0x0064, r24
segr = 0b00010000;
3e4: 20 e1 ldi r18, 0x10 ; 16
3e6: 20 93 60 00 sts 0x0060, r18
3ea: 1f ef ldi r17, 0xFF ; 255
delay = 255;
uint8_t skip = 0;
for(;delay>0;delay-=1)
{
if(bit_is_clear(PINB,PB1)) {while(bit_is_clear(PINB,PB1)) delay_ms(5); skip = 1;break;} // TODO: fix this if new menu option added.
3ec: b1 99 sbic 0x16, 1 ; 22
3ee: 08 c0 rjmp .+16 ; 0x400 <main+0x2de>
3f0: 03 c0 rjmp .+6 ; 0x3f8 <main+0x2d6>
3f2: 85 e0 ldi r24, 0x05 ; 5
3f4: 90 e0 ldi r25, 0x00 ; 0
3f6: a6 d2 rcall .+1356 ; 0x944 <delay_ms>
3f8: b1 9b sbis 0x16, 1 ; 22
3fa: fb cf rjmp .-10 ; 0x3f2 <main+0x2d0>
3fc: 01 e0 ldi r16, 0x01 ; 1
3fe: 0f c0 rjmp .+30 ; 0x41e <main+0x2fc>
if(bit_is_clear(PINB,PB0))
400: b0 99 sbic 0x16, 0 ; 22
402: 07 c0 rjmp .+14 ; 0x412 <main+0x2f0>
404: 03 c0 rjmp .+6 ; 0x40c <main+0x2ea>
{
while(bit_is_clear(PINB,PB0)) delay_ms(5);
406: 85 e0 ldi r24, 0x05 ; 5
408: 90 e0 ldi r25, 0x00 ; 0
40a: 9c d2 rcall .+1336 ; 0x944 <delay_ms>
40c: b0 9b sbis 0x16, 0 ; 22
40e: fb cf rjmp .-10 ; 0x406 <main+0x2e4>
410: 05 c0 rjmp .+10 ; 0x41c <main+0x2fa>
break;
}
delay_ms(10);
412: 8a e0 ldi r24, 0x0A ; 10
414: 90 e0 ldi r25, 0x00 ; 0
416: 96 d2 rcall .+1324 ; 0x944 <delay_ms>
// "Hi"
segl = 0b11110110;
segr = 0b00010000;
delay = 255;
uint8_t skip = 0;
for(;delay>0;delay-=1)
418: 11 50 subi r17, 0x01 ; 1
41a: 41 f7 brne .-48 ; 0x3ec <main+0x2ca>
41c: 00 e0 ldi r16, 0x00 ; 0
41e: 1e 2d mov r17, r14
420: 13 c0 rjmp .+38 ; 0x448 <main+0x326>
uint8_t hold = humidHi; // Store unmodified value.
while(bit_is_set(PINB,PB0) && skip == 0) // While the lower button remains unpressed...
{
sevsegNumber(humidHi);
422: 81 2f mov r24, r17
424: fb d0 rcall .+502 ; 0x61c <sevsegNumber>
segl |= 0b10000000; // Add in the decimal.
426: 80 91 64 00 lds r24, 0x0064
42a: 80 68 ori r24, 0x80 ; 128
42c: 80 93 64 00 sts 0x0064, r24
if(bit_is_clear(PINB, PB1)) // If upper button (increment) is pressed.
430: b1 99 sbic 0x16, 1 ; 22
432: 0a c0 rjmp .+20 ; 0x448 <main+0x326>
434: 03 c0 rjmp .+6 ; 0x43c <main+0x31a>
{
while(bit_is_clear(PINB,PB1)) delay_ms(5);
436: 85 e0 ldi r24, 0x05 ; 5
438: 90 e0 ldi r25, 0x00 ; 0
43a: 84 d2 rcall .+1288 ; 0x944 <delay_ms>
43c: b1 9b sbis 0x16, 1 ; 22
43e: fb cf rjmp .-10 ; 0x436 <main+0x314>
humidHi += 5;
440: 1b 5f subi r17, 0xFB ; 251
if(humidHi > 90) humidHi = 10;
442: 1b 35 cpi r17, 0x5B ; 91
444: 08 f0 brcs .+2 ; 0x448 <main+0x326>
446: 1a e0 ldi r17, 0x0A ; 10
}
delay = 255;
uint8_t hold = humidHi; // Store unmodified value.
while(bit_is_set(PINB,PB0) && skip == 0) // While the lower button remains unpressed...
448: b0 9b sbis 0x16, 0 ; 22
44a: 02 c0 rjmp .+4 ; 0x450 <main+0x32e>
44c: 00 23 and r16, r16
44e: 49 f3 breq .-46 ; 0x422 <main+0x300>
while(bit_is_clear(PINB,PB1)) delay_ms(5);
humidHi += 5;
if(humidHi > 90) humidHi = 10;
}
}
if(humidHi <= humidLo) // Error!
450: d1 16 cp r13, r17
452: 38 f0 brcs .+14 ; 0x462 <__stack+0x3>
{
segl = 0b11111001;
454: c0 92 64 00 sts 0x0064, r12
segr = 0b01010000;
458: b0 92 60 00 sts 0x0060, r11
delay_ms(1000);
45c: 88 ee ldi r24, 0xE8 ; 232
45e: 93 e0 ldi r25, 0x03 ; 3
460: 0a c0 rjmp .+20 ; 0x476 <__stack+0x17>
humidHi = hold;
}
else
{
if(humidHi != hold) eeprom_write_byte((uint8_t*)0x01, humidHi);
462: 1e 15 cp r17, r14
464: 49 f0 breq .+18 ; 0x478 <__stack+0x19>
466: 81 e0 ldi r24, 0x01 ; 1
468: 90 e0 ldi r25, 0x00 ; 0
46a: 61 2f mov r22, r17
46c: 91 d4 rcall .+2338 ; 0xd90 <__eewr_byte_m8>
46e: e1 2e mov r14, r17
470: 03 c0 rjmp .+6 ; 0x478 <__stack+0x19>
}