/
piren.py
1251 lines (1129 loc) · 43.4 KB
/
piren.py
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
# piren.py
#
# by Ian Thompson on 12/2/16
# Part of the Piren Project
#
# (c) 2016 Ian Thompson
#
import pygame
import sirens
import RPi.GPIO as GPIO
from time import sleep
import setup
from collections import deque
import lcddriver
import horns
# Initialize
pygame.mixer.pre_init(44100, -16, 1, 512) # See READEME.md for more information, however, this shouldn't be a problem
pygame.init()
pygame.mixer.init()
display = lcddriver.lcd()
# 'dead.wav' is a wav file, obviously, that has no sound. This is used when some siren models do not
# have certain sounds. For example, some siren models do not have a horn. So, when the horn button is
# pushed, the seemingly empty wav file is played. With out this, an error would be thrown.
dead = 'dead.wav'
# Brand and model information are put in a deque. Then, in the 'set_...' functions, seen below, the
# appropriate sounds can be set for each type of siren. Why deques might you ask? Good question.
# If you look below at the 'prev_...' or 'next_...' towards the bottom, you can see the 1 can be
# moved 1 or -1 just by using the deque.rotate() function. This is extremely easier than using a
# simple list.
#
# The one in the deque represents the active brand or model. See the 'set_...' functions below for a
# little more information
brand = deque([1, 0, 0, 0, 0, 0, 0])
fed_sig_model = deque([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
code_3_model = deque([1, 0, 0, 0, 0])
galls_model = deque([1, 0])
whelen_model = deque([1, 0, 0, 0, 0, 0, 0, 0, 0, 0])
feniex_model = deque([1, 0])
other_model = deque([1, 0, 0, 0, 0, 0, 0, 0])
horns_model = deque([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
auxiliary = False
CODE_3 = 'CODE_3'
FED_SIG = 'FED_SIG'
GALLS = 'GALlS'
WHELEN = 'WHELEN'
OTHER = 'OTHER'
HORNS = 'HORNS'
FENIEX = 'FENIEX'
def set_brand(): # Sets the brand name for the selected siren. See above.
if brand[0] == 1:
return CODE_3
elif brand[1] == 1:
return FED_SIG
elif brand[2] == 1:
return GALLS
elif brand[3] == 1:
return WHELEN
elif brand[4] == 1:
return FENIEX
elif brand[5] == 1:
return OTHER
elif brand[6] == 1:
return HORNS
def set_wail(): # Sets what siren will be used for wail.
if brand_name == CODE_3:
if code_3_model[0] == 1:
return sirens.Code_3._3932_Scorpion.wail()
if code_3_model[1] == 1:
return sirens.Code_3.Mastercom.wail()
if code_3_model[2] == 1:
return sirens.Code_3.Mastercom_B.wail()
if code_3_model[3] == 1:
return sirens.Code_3.RLS.wail()
if code_3_model[4] == 1:
return sirens.Code_3.Vcon.wail()
if brand_name == FED_SIG:
if fed_sig_model[0] == 1:
return sirens.Federal_Signal.EQ2B.wail()
if fed_sig_model[1] == 1:
return sirens.Federal_Signal.MS4000.wail()
if fed_sig_model[2] == 1:
return sirens.Federal_Signal.PA20.wail()
if fed_sig_model[3] == 1:
return sirens.Federal_Signal.PA150.wail()
if fed_sig_model[4] == 1:
return sirens.Federal_Signal.PA300.wail()
if fed_sig_model[5] == 1:
return sirens.Federal_Signal.PA640.wail()
if fed_sig_model[6] == 1:
return sirens.Federal_Signal.PA4000.wail()
if fed_sig_model[7] == 1:
return sirens.Federal_Signal.SS200_Mini.wail()
if fed_sig_model[8] == 1:
return sirens.Federal_Signal.SS2000SM.wail()
if fed_sig_model[9] == 1:
return sirens.Federal_Signal.SSP3000b.wail()
if fed_sig_model[10] == 1:
return sirens.Federal_Signal.SSP3000b_w_Rumbler.wail()
if fed_sig_model[11] == 1:
return sirens.Federal_Signal.Touchmaster_Touchmaster_Delta.wail()
if fed_sig_model[12] == 1:
return sirens.Federal_Signal.Unitrol_80k.wail()
if fed_sig_model[13] == 1:
return sirens.Federal_Signal.Unitrol_8001.wail()
if fed_sig_model[14] == 1:
return sirens.Federal_Signal.Unitrol_Omega_90.wail()
if brand_name == GALLS:
if galls_model[0] == 1:
return sirens.Galls.ST160_Street_Thunder.wail()
if galls_model[1] == 1:
return sirens.Galls.ST300_Command_Center.wail()
if brand_name == WHELEN:
if whelen_model[0] == 1:
return sirens.Whelen._295HF100.wail()
if whelen_model[1] == 1:
return sirens.Whelen.Alpha.wail()
if whelen_model[2] == 1:
return sirens.Whelen.Alpha_22m.wail()
if whelen_model[3] == 1:
return sirens.Whelen.Beta.wail()
if whelen_model[4] == 1:
return sirens.Whelen.Cencom_Gold.wail()
if whelen_model[5] == 1:
return sirens.Whelen.Cencom_Sapphire.wail()
if whelen_model[6] == 1:
return sirens.Whelen.Cencom_Sapphire_Howler.wail()
if whelen_model[7] == 1:
return sirens.Whelen.Epsilon_EPSL_1.wail()
if whelen_model[8] == 1:
return sirens.Whelen.Gamma_2.wail()
if whelen_model[9] == 1:
return sirens.Whelen.WSSC30.wail()
if brand_name == FENIEX:
if feniex_model[0] == 1:
return sirens.Feniex.Storm_100w.wail()
elif feniex_model[1] == 1:
return sirens.Feniex.Storm_Pro.wail()
if brand_name == OTHER:
if other_model[0] == 1:
return sirens.Other.AS350_Heli.siren()
elif other_model[1] == 1:
return sirens.Other.Carson_SA441.wail()
elif other_model[2] == 1:
return sirens.Other.NA_SI100M.wail()
elif other_model[3] == 1:
return sirens.Other.Powercall_DX5.wail()
elif other_model[4] == 1:
return sirens.Other.Unitrol_480k.wail()
elif other_model[5] == 1:
return sirens.Other.CHP_Moto_Sirens.wail()
elif other_model[6] == 1:
return sirens.Other.Mototola_Spectra.wail()
elif other_model[7] == 1:
return sirens.Other.Tomar_940.wail()
else:
return dead
if brand_name == HORNS:
if horns_model[0] == 1:
return horns.dixie_horn()
if horns_model[1] == 1:
return horns.GTA4_Horn()
if horns_model[2] == 1:
return horns.ice_cream()
if horns_model[3]:
return horns.bad_boys()
if horns_model[4] == 1:
return horns.ecto1()
if horns_model[5] == 1:
return horns.move()
if horns_model[6] == 1:
return horns.pull_over()
if horns_model[7] == 1:
return horns.rap_horn()
if horns_model[8] == 1:
return horns.trombone()
if horns_model[9] == 1:
return horns.train_horn()
if horns_model[10] == 1:
return horns.horn()
if horns_model[11] == 1:
return horns.Reveille.full()
if horns_model[12] == 1:
return horns.Clemson.tigerrag()
def set_horn(): # Sets which sound will be used for the horn.
if brand_name == CODE_3:
if code_3_model[0] == 1:
return sirens.Code_3._3932_Scorpion.horn()
if code_3_model[1] == 1:
return sirens.Code_3.Mastercom.horn()
if code_3_model[2] == 1:
return sirens.Code_3.Mastercom_B.horn()
if code_3_model[3] == 1:
return sirens.Code_3.RLS.horn()
if code_3_model[4] == 1:
return sirens.Code_3.Vcon.horn()
if brand_name == FED_SIG:
if fed_sig_model[0] == 1:
return sirens.Federal_Signal.EQ2B.horn()
if fed_sig_model[1] == 1:
return sirens.Federal_Signal.MS4000.horn()
if fed_sig_model[2] == 1:
return sirens.Federal_Signal.PA20.horn()
if fed_sig_model[3] == 1:
return dead
if fed_sig_model[4] == 1:
return sirens.Federal_Signal.PA300.horn()
if fed_sig_model[5] == 1:
return sirens.Federal_Signal.PA640.horn()
if fed_sig_model[6] == 1:
return sirens.Federal_Signal.PA4000.horn()
if fed_sig_model[7] == 1:
return sirens.Federal_Signal.SS200_Mini.horn()
if fed_sig_model[8] == 1:
return sirens.Federal_Signal.SS2000SM.horn()
if fed_sig_model[9] == 1:
return sirens.Federal_Signal.SSP3000b.horn()
if fed_sig_model[10] == 1:
return sirens.Federal_Signal.SSP3000b_w_Rumbler.horn()
if fed_sig_model[11] == 1:
return sirens.Federal_Signal.Touchmaster_Touchmaster_Delta.horn()
if fed_sig_model[12] == 1:
return sirens.Federal_Signal.Unitrol_80k.horn()
if fed_sig_model[13] == 1:
return sirens.Federal_Signal.Unitrol_8001.horn()
if fed_sig_model[14] == 1:
return sirens.Federal_Signal.Unitrol_Omega_90.horn()
if brand_name == GALLS:
if galls_model[0] == 1:
return sirens.Galls.ST160_Street_Thunder.horn()
if galls_model[1] == 1:
return sirens.Galls.ST300_Command_Center.horn()
if brand_name == WHELEN:
if whelen_model[0] == 1:
return sirens.Whelen._295HF100.horn()
if whelen_model[1] == 1:
return sirens.Whelen.Alpha.horn()
if whelen_model[2] == 1:
return sirens.Whelen.Alpha_22m.horn()
if whelen_model[3] == 1:
return sirens.Whelen.Beta.horn()
if whelen_model[4] == 1:
return sirens.Whelen.Cencom_Gold.horn()
if whelen_model[5] == 1:
return sirens.Whelen.Cencom_Sapphire.horn()
if whelen_model[6] == 1:
return sirens.Whelen.Cencom_Sapphire_Howler.horn()
if whelen_model[7] == 1:
return sirens.Whelen.Epsilon_EPSL_1.horn()
if whelen_model[8] == 1:
return sirens.Whelen.Gamma_2.horn()
if whelen_model[9] == 1:
return sirens.Whelen.WSSC30.horn()
if brand_name == FENIEX:
if feniex_model[0] == 1:
return sirens.Feniex.Storm_100w.horn()
elif feniex_model[1] == 1:
return sirens.Feniex.Storm_Pro.horn()
if brand_name == OTHER:
if other_model[1] == 1:
return sirens.Other.Carson_SA441.horn()
elif other_model[2] == 1:
return sirens.Other.NA_SI100M.hilo()
elif other_model[3] == 1:
return sirens.Other.Powercall_DX5.horn()
elif other_model[4] == 1:
return sirens.Other.Unitrol_480k.horn()
elif other_model[6] == 1:
return sirens.Other.Mototola_Spectra.horn()
elif other_model[7] == 1:
return sirens.Other.Tomar_940.horn()
else:
return dead
if brand_name == HORNS:
if horns_model[0] == 1:
return horns.dixie_horn()
if horns_model[1] == 1:
return horns.GTA4_Horn()
if horns_model[2] == 1:
return horns.ice_cream()
if horns_model[3]:
return horns.bad_boys()
if horns_model[4] == 1:
return horns.ecto1()
if horns_model[5] == 1:
return horns.move()
if horns_model[6] == 1:
return horns.pull_over()
if horns_model[7] == 1:
return horns.rap_horn()
if horns_model[8] == 1:
return horns.trombone()
if horns_model[9] == 1:
return horns.train_horn()
if horns_model[10] == 1:
return horns.horn()
if horns_model[11] == 1:
return horns.Reveille.short()
if horns_model[12] == 1:
return horns.Clemson.almamater()
def set_yelp(): # Sets which sound will be used for yelp
if brand_name == CODE_3:
if code_3_model[0] == 1:
return sirens.Code_3._3932_Scorpion.yelp()
if code_3_model[1] == 1:
return sirens.Code_3.Mastercom.yelp()
if code_3_model[2] == 1:
return sirens.Code_3.Mastercom_B.yelp()
if code_3_model[3] == 1:
return sirens.Code_3.RLS.yelp()
if code_3_model[4] == 1:
return sirens.Code_3.Vcon.yelp()
if brand_name == FED_SIG:
if fed_sig_model[0] == 1:
return sirens.Federal_Signal.EQ2B.yelp()
if fed_sig_model[1] == 1:
return sirens.Federal_Signal.MS4000.yelp()
if fed_sig_model[2] == 1:
return sirens.Federal_Signal.PA20.yelp()
if fed_sig_model[3] == 1:
return sirens.Federal_Signal.PA150.yelp()
if fed_sig_model[4] == 1:
return sirens.Federal_Signal.PA300.yelp()
if fed_sig_model[5] == 1:
return sirens.Federal_Signal.PA640.yelp()
if fed_sig_model[6] == 1:
return sirens.Federal_Signal.PA4000.yelp()
if fed_sig_model[7] == 1:
return sirens.Federal_Signal.SS200_Mini.yelp()
if fed_sig_model[8] == 1:
return sirens.Federal_Signal.SS2000SM.yelp()
if fed_sig_model[9] == 1:
return sirens.Federal_Signal.SSP3000b.yelp()
if fed_sig_model[10] == 1:
return sirens.Federal_Signal.SSP3000b_w_Rumbler.yelp()
if fed_sig_model[11] == 1:
return sirens.Federal_Signal.Touchmaster_Touchmaster_Delta.yelp()
if fed_sig_model[12] == 1:
return sirens.Federal_Signal.Unitrol_80k.yelp()
if fed_sig_model[13] == 1:
return sirens.Federal_Signal.Unitrol_8001.yelp()
if fed_sig_model[14] == 1:
return sirens.Federal_Signal.Unitrol_Omega_90.yelp()
if brand_name == GALLS:
if galls_model[0] == 1:
return sirens.Galls.ST160_Street_Thunder.yelp()
if galls_model[1] == 1:
return sirens.Galls.ST300_Command_Center.yelp()
if brand_name == WHELEN:
if whelen_model[0] == 1:
return sirens.Whelen._295HF100.yelp()
if whelen_model[1] == 1:
return sirens.Whelen.Alpha.yelp()
if whelen_model[2] == 1:
return sirens.Whelen.Alpha_22m.power_call()
if whelen_model[3] == 1:
return sirens.Whelen.Beta.yelp()
if whelen_model[4] == 1:
return sirens.Whelen.Cencom_Gold.yelp()
if whelen_model[5] == 1:
return sirens.Whelen.Cencom_Sapphire.yelp()
if whelen_model[6] == 1:
return sirens.Whelen.Cencom_Sapphire_Howler.yelp()
if whelen_model[7] == 1:
return sirens.Whelen.Epsilon_EPSL_1.yelp()
if whelen_model[8] == 1:
return sirens.Whelen.Gamma_2.warble()
if whelen_model[9] == 1:
return sirens.Whelen.WSSC30.yelp()
if brand_name == FENIEX:
if feniex_model[0] == 1:
return sirens.Feniex.Storm_100w.yelp()
elif feniex_model[1] == 1:
return sirens.Feniex.Storm_Pro.yelp()
if brand_name == OTHER:
if other_model[1] == 1:
return sirens.Other.Carson_SA441.yelp()
elif other_model[2] == 1:
return sirens.Other.NA_SI100M.yelp()
elif other_model[3] == 1:
return sirens.Other.Powercall_DX5.yelp()
elif other_model[4] == 1:
return sirens.Other.Unitrol_480k.yelp()
elif other_model[5] == 1:
return sirens.Other.CHP_Moto_Sirens.yelp()
elif other_model[6] == 1:
return sirens.Other.Mototola_Spectra.yelp()
elif other_model[7] == 1:
return sirens.Other.Tomar_940.yelp()
else:
return dead
if brand_name == HORNS:
if horns_model[12] == 1:
return horns.Clemson.ragedefencecheer()
else:
return dead
def set_phaser(): # Sets which sound will be used for the phaser
if brand_name == CODE_3:
if code_3_model[0] == 1:
return sirens.Code_3._3932_Scorpion.phaser()
if code_3_model[1] == 1:
return sirens.Code_3.Mastercom.phaser()
if code_3_model[2] == 1:
return sirens.Code_3.Mastercom_B.phaser()
if code_3_model[3] == 1:
return sirens.Code_3.RLS.phaser()
if code_3_model[4] == 1:
return sirens.Code_3.Vcon.phaser()
if brand_name == FED_SIG:
if fed_sig_model[0] == 1:
return sirens.Federal_Signal.EQ2B.phaser()
if fed_sig_model[1] == 1:
return sirens.Federal_Signal.MS4000.phaser()
if fed_sig_model[2] == 1:
return sirens.Federal_Signal.PA20.hilo()
if fed_sig_model[3] == 1:
return sirens.Federal_Signal.PA150.hilo()
if fed_sig_model[4] == 1:
return sirens.Federal_Signal.PA300.phaser()
if fed_sig_model[5] == 1:
return sirens.Federal_Signal.PA640.phaser()
if fed_sig_model[6] == 1:
return sirens.Federal_Signal.PA4000.phaser()
if fed_sig_model[7] == 1:
return dead
if fed_sig_model[8] == 1:
return sirens.Federal_Signal.SS2000SM.phaser()
if fed_sig_model[9] == 1:
return sirens.Federal_Signal.SSP3000b.phaser()
if fed_sig_model[10] == 1:
return sirens.Federal_Signal.SSP3000b_w_Rumbler.phaser()
if fed_sig_model[11] == 1:
return sirens.Federal_Signal.Touchmaster_Touchmaster_Delta.phaser()
if fed_sig_model[12] == 1:
return sirens.Federal_Signal.Unitrol_80k.hetro()
if fed_sig_model[13] == 1:
return sirens.Federal_Signal.Unitrol_8001.phaser()
if fed_sig_model[14] == 1:
return sirens.Federal_Signal.Unitrol_Omega_90.hetro()
if brand_name == GALLS:
if galls_model[0] == 1:
return sirens.Galls.ST160_Street_Thunder.thunder()
if galls_model[1] == 1:
return sirens.Galls.ST300_Command_Center.phaser()
if brand_name == WHELEN:
if whelen_model[0] == 1:
return sirens.Whelen._295HF100.phaser()
if whelen_model[1] == 1:
return sirens.Whelen.Alpha.phaser()
if whelen_model[2] == 1:
return sirens.Whelen.Alpha_22m.wail2()
if whelen_model[3] == 1:
return sirens.Whelen.Beta.phaser()
if whelen_model[4] == 1:
return sirens.Whelen.Cencom_Gold.phaser()
if whelen_model[5] == 1:
return sirens.Whelen.Cencom_Sapphire.phaser()
if whelen_model[6] == 1:
return sirens.Whelen.Cencom_Sapphire_Howler.phaser()
if whelen_model[7] == 1:
return sirens.Whelen.Epsilon_EPSL_1.phaser()
if whelen_model[8] == 1:
return sirens.Whelen.Gamma_2.phaser()
if whelen_model[9] == 1:
return sirens.Whelen.WSSC30.phaser()
if brand_name == FENIEX:
if feniex_model[0] == 1:
return sirens.Feniex.Storm_100w.phaser()
elif feniex_model[1] == 1:
return sirens.Feniex.Storm_Pro.phaser()
if brand_name == OTHER:
if other_model[1] == 1:
return sirens.Other.Carson_SA441.phaser()
elif other_model[2] == 1:
return sirens.Other.NA_SI100M.riot()
elif other_model[3] == 1:
return sirens.Other.Powercall_DX5.phaser()
elif other_model[4] == 1:
return sirens.Other.Unitrol_480k.hilo()
elif other_model[6] == 1:
return sirens.Other.Mototola_Spectra.hilo()
elif other_model[7] == 1:
return sirens.Other.Tomar_940.phaser()
else:
return dead
if brand_name == HORNS:
if horns_model[12] == 1:
return horns.Clemson.sockittoem()
else:
return dead
def set_aux1(): # Sets what sound, if any, will be used as an auxillary sound. See below.
# Returns a list: [Str, Bool]
# The first element returned is the string to the auxillary sound,
# The second being a bool, which will indicate if the selected
# siren has an auxiliary siren.
if brand_name == CODE_3:
if code_3_model[2] == 1:
return [sirens.Code_3.Mastercom_B.hilo(), True]
else:
return [dead, False]
if brand_name == FED_SIG:
if fed_sig_model[2] == 1:
return [sirens.Federal_Signal.PA20.yelp2(), True]
if fed_sig_model[4] == 1:
return [sirens.Federal_Signal.PA300.hilo(), True]
if fed_sig_model[8] == 1:
return [sirens.Federal_Signal.SS2000SM.hilo(), False]
if fed_sig_model[9] == 1:
return [sirens.Federal_Signal.SSP3000b.hilo(), False]
if fed_sig_model[11] == 1:
return [sirens.Federal_Signal.Touchmaster_Touchmaster_Delta.sweep2(), True]
if fed_sig_model[13] == 1:
return [sirens.Federal_Signal.Unitrol_8001.hilo(), True]
if fed_sig_model[14] == 1:
return [sirens.Federal_Signal.Unitrol_8001.hilo(), True]
else:
return [dead, False]
if brand_name == GALLS:
if galls_model[0] == 1:
return [sirens.Galls.ST160_Street_Thunder.hilo(), True]
if galls_model[1] == 1:
return [sirens.Galls.ST300_Command_Center.hilo(), True]
else:
return [dead, False]
if brand_name == WHELEN:
if whelen_model[1] == 1:
return [sirens.Whelen.Alpha.hilo(), True]
elif whelen_model[2] == 1:
return [sirens.Whelen.Alpha_22m.power_call_2(), True]
elif whelen_model[4] == 1:
return [sirens.Whelen.Cencom_Gold.hilo(), True]
elif whelen_model[7] == 1:
return [sirens.Whelen.Epsilon_EPSL_1.hilo(), True]
elif whelen_model[8] == 1:
return [sirens.Whelen.Gamma_2.riot(), True]
elif whelen_model[9] == 1:
return [sirens.Whelen.WSSC30.martian(), True]
else:
return [dead, False]
if brand_name == FENIEX:
if feniex_model[0] == 1:
return [sirens.Feniex.Storm_100w.mech(), True]
elif feniex_model[1] == 1:
return [sirens.Feniex.Storm_Pro.hilo(), True]
else:
return [dead, False]
if brand_name == OTHER:
if other_model[1]:
return [sirens.Other.Carson_SA441.hilo(), True]
elif other_model[3] == 1:
return [sirens.Other.Powercall_DX5.hilo(), True]
elif other_model[7] == 1:
return [sirens.Other.Tomar_940.alert(), True]
else:
return [dead, False]
if brand_name == HORNS:
return [dead, False]
def set_aux2():
# Returns a list: [Str, Bool]
# The first element returned is the string to the auxillary sound,
# The second being a bool, which will indicate if the selected
# siren has an auxiliary siren.
if brand_name == CODE_3:
if code_3_model[2] == 1:
return [sirens.Code_3.Mastercom_B.hylo(), True]
else:
return [dead, False]
elif brand_name == FED_SIG:
if fed_sig_model[2] == 1:
return [sirens.Federal_Signal.PA20.yelp3(), True]
if fed_sig_model[11] == 1:
return [sirens.Federal_Signal.Touchmaster_Touchmaster_Delta.sweep1(), True]
if fed_sig_model[13] == 1:
return [sirens.Federal_Signal.Unitrol_8001.sweep(), True]
if fed_sig_model[14] == 1:
return [sirens.Federal_Signal.Unitrol_8001.sweep(), True]
else:
return [dead, False]
if brand_name == GALLS:
return [dead, False]
if brand_name == WHELEN:
if whelen_model[9] == 1:
return [sirens.Whelen.WSSC30.tritone(), True]
else:
return [dead, False]
if brand_name == FENIEX:
if feniex_model[1] == 1:
return [sirens.Feniex.Storm_Pro.mech(), True]
else:
return [dead, False]
if brand_name == OTHER:
if other_model[3] == 1:
return [sirens.Other.Powercall_DX5.inter(), True]
elif other_model[7] == 1:
return [sirens.Other.Tomar_940.hetro(), True]
else:
return [dead, False]
if brand_name == HORNS:
return [dead, False]
def set_aux3():
# Returns a list: [Str, Bool]
# The first element returned is the string to the auxillary sound,
# The second being a bool, which will indicate if the selected
# siren has an auxiliary siren.
if brand_name == CODE_3:
return [dead, False]
elif brand_name == FED_SIG:
if fed_sig_model[11] == 1:
return [sirens.Federal_Signal.Touchmaster_Touchmaster_Delta.hetro(), True]
else:
return [dead, False]
if brand_name == GALLS:
return [dead, False]
if brand_name == WHELEN:
if whelen_model[9] == 1:
return [sirens.Whelen.WSSC30.powercall(), True]
else:
return [dead, False]
if brand_name == FENIEX:
if feniex_model[1] == 1:
return [sirens.Feniex.Storm_Pro.pcall(), True]
else:
return [dead, False]
if brand_name == OTHER:
if other_model[3] == 1:
return [sirens.Other.Powercall_DX5.pcall(), True]
elif other_model[7] == 1:
return [sirens.Other.Tomar_940.hilo(), True]
else:
return [dead, False]
if brand_name == HORNS:
return [dead, False]
def set_aux4():
# Returns a list: [Str, Bool]
# The first element returned is the string to the auxillary sound,
# The second being a bool, which will indicate if the selected
# siren has an auxiliary siren.
if brand_name == CODE_3:
return [dead, False]
elif brand_name == FED_SIG:
if fed_sig_model[11] == 1:
return [sirens.Federal_Signal.Touchmaster_Touchmaster_Delta.Uhilo(), True]
else:
return [dead, False]
if brand_name == GALLS:
return [dead, False]
if brand_name == WHELEN:
if whelen_model[9] == 1:
return [sirens.Whelen.WSSC30.wail2(), True]
else:
return [dead, False]
if brand_name == FENIEX:
if feniex_model[1] == 1:
return [sirens.Feniex.Storm_Pro.yelp2(), True]
else:
return [dead, False]
if brand_name == OTHER:
if other_model[3] == 1:
return [sirens.Other.Powercall_DX5.pcall2(), True]
elif other_model[7] == 1:
return [sirens.Other.Tomar_940.yelp2(), True]
else:
return [dead, False]
if brand_name == HORNS:
return [dead, False]
brand_name = set_brand()
def set_lcd():
# This function is called every time the brand, or model, is changed.
# White space in the lcd_display_string() is so it will be centered on the lcd
# The simple python equation of "(16 - len(str)) / 2" gives the correct amount of white
# space so that the text can be centered.
display.lcd_clear()
set_brand()
if brand_name == CODE_3:
display.lcd_display_string(' Code 3', 1)
elif brand_name == FED_SIG:
display.lcd_display_string(' Federal Signal', 1)
elif brand_name == GALLS:
display.lcd_display_string(' Galls', 1)
elif brand_name == WHELEN:
display.lcd_display_string(' Whelen', 1)
elif brand_name == FENIEX:
display.lcd_display_string(' Feniex', 1)
elif brand_name == OTHER:
display.lcd_display_string(' Other', 1)
elif brand_name == HORNS:
display.lcd_display_string(' Horns', 1)
if brand_name == CODE_3:
if code_3_model[0] == 1:
display.lcd_display_string(" 3932 Scorpion", 2)
if code_3_model[1] == 1:
display.lcd_display_string(" Mastercom", 2)
if code_3_model[2] == 1:
display.lcd_display_string(" Mastercom B", 2)
if code_3_model[3] == 1:
display.lcd_display_string(" RLS", 2)
if code_3_model[4] == 1:
display.lcd_display_string(" Vcon", 2)
if brand_name == FED_SIG:
if fed_sig_model[0] == 1:
display.lcd_display_string(" EQ2B", 2)
if fed_sig_model[1] == 1:
display.lcd_display_string(" MS4000", 2)
if fed_sig_model[2] == 1:
display.lcd_display_string(" PA20", 2)
if fed_sig_model[3] == 1:
display.lcd_display_string(" PA150", 2)
if fed_sig_model[4] == 1:
display.lcd_display_string(" PA300", 2)
if fed_sig_model[5] == 1:
display.lcd_display_string(" PA640", 2)
if fed_sig_model[6] == 1:
display.lcd_display_string(" PA40000", 2)
if fed_sig_model[7] == 1:
display.lcd_display_string(" SS200 Mini", 2)
if fed_sig_model[8] == 1:
display.lcd_display_string(" SS2000SM", 2)
if fed_sig_model[9] == 1:
display.lcd_display_string(" SSP3000b", 2)
if fed_sig_model[10] == 1:
display.lcd_display_string("SSP3000b w Rumbler", 2)
if fed_sig_model[11] == 1:
display.lcd_display_string("Touchmaster Delta", 2)
if fed_sig_model[12] == 1:
display.lcd_display_string(" Unitrol 80k", 2)
if fed_sig_model[13] == 1:
display.lcd_display_string(" Unitrol 8001", 2)
if fed_sig_model[14] == 1:
display.lcd_display_string("Unitrol Omega 90", 2)
if brand_name == GALLS:
if galls_model[0] == 1:
display.lcd_display_string("ST160 Street Thunder", 2)
if galls_model[1] == 1:
display.lcd_display_string("ST300 Command Center", 2)
if brand_name == WHELEN:
if whelen_model[0] == 1:
display.lcd_display_string(' 295HF100', 2)
if whelen_model[1] == 1:
display.lcd_display_string(' Alpha', 2)
if whelen_model[2] == 1:
display.lcd_display_string(' Alpha 22m', 2)
if whelen_model[3] == 1:
display.lcd_display_string(' Beta', 2)
if whelen_model[4] == 1:
display.lcd_display_string(' Cencom Gold', 2)
if whelen_model[5] == 1:
display.lcd_display_string('Cencom Sapphire', 2)
if whelen_model[6] == 1:
display.lcd_display_string('Cencom Sapphire Howler', 2)
if whelen_model[7] == 1:
display.lcd_display_string(' Epsilon EPSL 1', 2)
if whelen_model[8] == 1:
display.lcd_display_string(' Gamma 2', 2)
if whelen_model[9] == 1:
display.lcd_display_string(' WSSC30', 2)
if brand_name == FENIEX:
if feniex_model[0] == 1:
display.lcd_display_string(' Storm 100w', 2)
if feniex_model[1] == 1:
display.lcd_display_string(' Storm Pro 200w', 2)
if brand_name == OTHER:
if other_model[0] == 1:
display.lcd_display_string('AS350 Helicopter', 2)
if other_model[1] == 1:
display.lcd_display_string(' Carson SA441', 2)
if other_model[2] == 1:
display.lcd_display_string(' N.A. SI100', 2)
if other_model[3] == 1:
display.lcd_display_string(' Powercall DX5', 2)
if other_model[4] == 1:
display.lcd_display_string(' Unitrol 480k', 2)
if other_model[5] == 1:
display.lcd_display_string(' CHP Motorcycle', 2)
if other_model[6] == 1:
display.lcd_display_string('Mototola Spectra', 2)
if other_model[7] == 1:
display.lcd_display_string(' Tomar 940', 2)
if brand_name == HORNS:
if horns_model[0] == 1:
display.lcd_display_string(' Dixie Horn', 2)
if horns_model[1] == 1:
display.lcd_display_string(' Liberty City', 2)
if horns_model[2] == 1:
display.lcd_display_string('Ice Cream Truck', 2)
if horns_model[3] == 1:
display.lcd_display_string(' Bad Boys', 2)
if horns_model[4] == 1:
display.lcd_display_string(' Etco1', 2)
if horns_model[5] == 1:
display.lcd_display_string(' Move Out', 2)
if horns_model[6] == 1:
display.lcd_display_string(' Pull Over', 2)
if horns_model[7] == 1:
display.lcd_display_string(' Rap Horn', 2)
if horns_model[8] == 1:
display.lcd_display_string(' Sad Trombone', 2)
if horns_model[9] == 1:
display.lcd_display_string(' Train Horn', 2)
if horns_model[10] == 1:
display.lcd_display_string(' Horn', 2)
if horns_model[11] == 1:
display.lcd_display_string(" Reveille ", 2)
if horns_model[12] == 1:
display.lcd_display_string("Clemson", 2)
horn = pygame.mixer.Sound(set_horn())
wail = pygame.mixer.Sound(set_wail())
m_wail = pygame.mixer.Sound(set_wail())
yelp = pygame.mixer.Sound(set_yelp())
phaser = pygame.mixer.Sound(set_phaser())
aux1 = pygame.mixer.Sound(set_aux1()[0])
aux1_is_usable = set_aux1()[1]
aux2 = pygame.mixer.Sound(set_aux2()[0])
aux2_is_usable = set_aux2()[1]
aux3 = pygame.mixer.Sound(set_aux3()[0])
aux3_is_usable = set_aux3()[1]
aux4 = pygame.mixer.Sound(set_aux4()[0])
aux4_is_usable = set_aux4()[1]
# GPIO Pin Numbers
class pin:
# Sets up the pin numbers for what each button will do.
wail = 25
horn = 24
phaser = 18
yelp = 5
manual_wail = 27
siren_led = 12
# Selection fed_sig_model
next = 17
previous = 9
# Selection Brand
next_brand = 11
prev_brand = 8
aux = 26
aux_led = 20
# Siren playing Booleans
wail_playing = False
horn_playing = False
yelp_playing = False
phaser_playing = False
manual_wail_playing = False
# GPIO Setup
GPIO.setmode(GPIO.BCM)
GPIO.setup(pin.wail, GPIO.IN)
GPIO.setup(pin.horn, GPIO.IN)
GPIO.setup(pin.phaser, GPIO.IN)
GPIO.setup(pin.yelp, GPIO.IN)
GPIO.setup(pin.manual_wail, GPIO.IN)
GPIO.setup(pin.siren_led, GPIO.OUT)
GPIO.setup(pin.next, GPIO.IN)
GPIO.setup(pin.previous, GPIO.IN)
GPIO.setup(pin.next_brand, GPIO.IN)
GPIO.setup(pin.prev_brand, GPIO.IN)
GPIO.setup(pin.aux, GPIO.IN)
GPIO.setup(pin.aux_led, GPIO.OUT)
def play_wail(channel):
global wail_playing
if GPIO.input(pin.wail) and not wail_playing:
wail.play(-1)
wail_playing = True
m_wail.set_volume(0)
else:
wail.stop()
wail_playing = False
m_wail.set_volume(1)
def play_horn(channel):
global horn_playing
if GPIO.input(pin.horn) and not horn_playing:
if auxiliary and aux1_is_usable:
aux1.play(-1)
else:
horn.play(-1)
wail.set_volume(0)
phaser.set_volume(0)
yelp.stop()
m_wail.stop()
horn_playing = True
else:
if auxiliary and aux1_is_usable:
aux1.stop()
else:
if yelp_playing:
yelp.play(-1)
if manual_wail_playing:
m_wail.play(-1)
horn.stop()
phaser.set_volume(1)
wail.set_volume(1)
horn_playing = False
def play_phaser(channel):
global phaser_playing
if GPIO.input(pin.phaser) and not phaser_playing:
if auxiliary and aux2_is_usable:
aux2.play(-1)
else:
phaser.play(-1)
wail.set_volume(0)
phaser_playing = True
else:
if auxiliary and aux2_is_usable:
aux2.stop()
else:
wail.set_volume(1)
phaser.stop()
phaser_playing = False
def play_yelp(channel):
global yelp_playing
if GPIO.input(pin.yelp) and not yelp_playing:
if auxiliary and aux3_is_usable:
aux3.play(-1)
else:
if wail_playing:
wail.stop()
yelp.play(-1)
wail.set_volume(0)
yelp_playing = True
else:
if auxiliary and aux3_is_usable:
aux3.stop()
if wail_playing:
wail.play(-1)
yelp.stop()
wail.set_volume(1)
yelp_playing = False
def play_manual_wail(channel):
global manual_wail_playing, wail_playing
if GPIO.input(pin.manual_wail):