info@shuvit.org 2 years ago
parent
commit
b71bf094d9
5 changed files with 63 additions and 31 deletions
  1. 1
    1
      config.txt
  2. 2
    1
      lib/FSM.py
  3. 58
    11
      lib/StatesProg.py
  4. 2
    1
      main.py
  5. 0
    17
      new_wifi.txt

+ 1
- 1
config.txt View File

@@ -1,4 +1,4 @@
1
-default_song = snaps
1
+default_song = fire_eat
2 2
 theme = default
3 3
 title = default
4 4
 bpm = 90

+ 2
- 1
lib/FSM.py View File

@@ -90,7 +90,8 @@ class ProgFSM(Char):
90 90
         'Wifi',
91 91
         'Defender',
92 92
         'Update',
93
-        'Calculator'
93
+        'Calculator',
94
+        'About'
94 95
         ]
95 96
         
96 97
         for s in state_list:

+ 58
- 11
lib/StatesProg.py View File

@@ -742,6 +742,8 @@ def util_command(self, o, command):
742 742
 		self.FSM.ToTransition('toPing')	
743 743
 	elif command == "Wifi":
744 744
 		self.FSM.ToTransition('toWifi')	
745
+	elif command == "About":
746
+		self.FSM.ToTransition('toAbout')	
745 747
 
746 748
 def file_command(self, o, command):
747 749
 	if command == "Save":
@@ -964,7 +966,7 @@ class Main(State):
964 966
 
965 967
 						o.soundSlots[note].play(o.note_vol)
966 968
 						o.eSound = note
967
-						print('now editing sound ', o.eSound) 
969
+						#print('now editing sound ', o.eSound) 
968 970
 						draw_header(o)
969 971
 						#text_box1(o, "SVol", str(o.soundSlots[o.eSound].volume))
970 972
 						text_box1(o, "SVol", str(o.slots[o.eSound].volume))
@@ -992,7 +994,7 @@ class Main(State):
992 994
 		if self.record_queue != []:
993 995
 			cur_time = pygame.time.get_ticks()
994 996
 			note_pos = (cur_time - self.record_queue) - (o.half_bpm / 2)
995
-			print(note_pos)
997
+			#print(note_pos)
996 998
 			if o.odub == True:
997 999
 				if note_pos > (o.half_bpm):
998 1000
 					_note = 0
@@ -1322,13 +1324,13 @@ class SelectPattern(State):
1322 1324
 		self.active_patterns = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
1323 1325
 		pat_iter = o.pat_bank * 16
1324 1326
 		_iter = 0
1325
-		print('is this note on? ', o.soundSlots[0].notes[0][0][0])
1327
+		#print('is this note on? ', o.soundSlots[0].notes[0][0][0])
1326 1328
 
1327 1329
 
1328 1330
 		while pat_iter < ((o.pat_bank * 16) + 16):
1329 1331
 			
1330 1332
 			for s in o.soundSlots:
1331
-				print('checking soundSlot ', s.id)
1333
+				#print('checking soundSlot ', s.id)
1332 1334
 				pat_used = 0
1333 1335
 				for p in s.notes[pat_iter]:
1334 1336
 					if self.active_patterns[_iter] == 1:
@@ -1336,13 +1338,13 @@ class SelectPattern(State):
1336 1338
 					if p[0] == 1:
1337 1339
 						#pat_used = 1
1338 1340
 						self.active_patterns[_iter] = 1
1339
-						print('found ', pat_iter, ' -- ', p[0])
1341
+						#print('found ', pat_iter, ' -- ', p[0])
1340 1342
 						break
1341 1343
 				#self.active_patterns.append(pat_used)
1342 1344
 			pat_iter += 1
1343 1345
 			_iter += 1
1344 1346
 	
1345
-		print('active patterns ', self.active_patterns)
1347
+		#print('active patterns ', self.active_patterns)
1346 1348
 
1347 1349
 	def Exit(self):
1348 1350
 		self.FSM.owner.pub.unregister("beat", self)
@@ -1401,11 +1403,11 @@ class EditSoundSequence(State):
1401 1403
 			for k in self.FSM.owner.keyState:
1402 1404
 				if _id < 16 and k == 1:
1403 1405
 					if o.soundSlots[o.eSound].notes[self.curPattern][_id][0] == 1:
1404
-						print('turn note off')
1406
+						#print('turn note off')
1405 1407
 						o.soundSlots[o.eSound].notes[self.curPattern][_id][0] = 0
1406 1408
 						o.soundSlots[o.eSound].notes[self.curPattern][_id][1] = 0
1407 1409
 					else:
1408
-						print('turn note on')
1410
+						#print('turn note on')
1409 1411
 						o.soundSlots[o.eSound].notes[self.curPattern][_id][0] = 1
1410 1412
 						o.soundSlots[o.eSound].notes[self.curPattern][_id][1] = o.note_vol
1411 1413
 					draw_header(o)
@@ -1455,7 +1457,7 @@ class EditSoundSequence(State):
1455 1457
 			self.curPattern = message[0]
1456 1458
 		else:
1457 1459
 			self.curPattern = o.ePattern
1458
-		print('message ', message)
1460
+		#print('message ', message)
1459 1461
 		o.update_display(0)
1460 1462
 		
1461 1463
 	def Exit(self):
@@ -1697,7 +1699,7 @@ class Util(State):
1697 1699
 		o = self.FSM.owner 
1698 1700
 		o.header_text = "Utilities"
1699 1701
 		o.pub.register("beat", self)
1700
-		self.menu = ["Clock", "Balls", "Defender", "Calculator", "Exit", "Shutdown", "Reboot", "Theme", "Ping", "Wifi", "Update"]
1702
+		self.menu = ["Clock", "Balls", "Defender", "Calculator", "Exit", "Shutdown", "Reboot", "Theme", "Ping", "Wifi", "Update", "About"]
1701 1703
 		self.cur_el = 0
1702 1704
 
1703 1705
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
@@ -3182,4 +3184,49 @@ class Calculator(State):
3182 3184
 	def Exit(self):
3183 3185
 		self.FSM.owner.pub.unregister("beat", self)
3184 3186
 
3185
-#==================================== 
3187
+#==================================== 
3188
+
3189
+class About(State):
3190
+	def __init__(self,FSM):
3191
+		super(About, self).__init__(FSM)    
3192
+		
3193
+	def Enter(self):
3194
+		
3195
+		o = self.FSM.owner 
3196
+		o.header_text = "About"
3197
+		o.pub.register("beat", self)
3198
+		
3199
+		if o.keyState[16] > 0 or o.keyState[17] > 0:
3200
+			pass
3201
+		else:
3202
+			draw_header(o)
3203
+			o.update_display(0)
3204
+			self.draw_main(o)
3205
+		super(About, self).Enter()        
3206
+		
3207
+	def Execute(self):
3208
+		o = self.FSM.owner 
3209
+		menu1_actions(self, o)
3210
+		if o.keyState[16] == 1:
3211
+			draw_menu1(o)
3212
+			o.update_display(0)
3213
+		elif o.keyState[16] == 4:
3214
+			draw_header(o)
3215
+			self.draw_main(o)
3216
+			o.update_display(0)
3217
+
3218
+		if o.keyState[0] == 1 or o.keyState[0] == 3 or o.keyState[1] == 1 or o.keyState[1] == 3 or o.keyState[2] == 1 or o.keyState[2] == 3 or o.keyState[3] == 1 or o.keyState[3] == 3:
3219
+			draw_header(o)
3220
+			self.draw_main(o)
3221
+			o.update_display(0)	
3222
+	
3223
+	def draw_main(self, o):
3224
+		#o.center_text(self.msg, o.h1, o.width, 25, o.light_grey)
3225
+		o.center_block("rob@robzilla-beats.com", o.h2, [0, 0, o.width, o.height], o.light_grey)
3226
+
3227
+	def ReceiveMessage(self, message):
3228
+		o = self.FSM.owner 
3229
+		play_seq(o, message)
3230
+		
3231
+	def Exit(self):
3232
+		self.FSM.owner.pub.unregister("beat", self)        

+ 2
- 1
main.py View File

@@ -285,6 +285,7 @@ class Prog:
285 285
 
286 286
 	def update_keys(self):
287 287
 		_id = 0 
288
+		#print('key 1 ', self.keyState[1])
288 289
 		for k in self.keyState:
289 290
 			if k == 0:
290 291
 				if _id in self.keys:
@@ -543,7 +544,7 @@ while not done:
543 544
 			p.curPattern = next(p.songCycle)
544 545
 
545 546
 		#blink internal led
546
-		if p.playhead  % 8 == 0:
547
+		if p.playhead  % 4 == 0:
547 548
 			GPIO.setup(29, GPIO.OUT)
548 549
 			GPIO.output(29, GPIO.LOW)
549 550
 		else:

+ 0
- 17
new_wifi.txt View File

@@ -1,17 +0,0 @@
1
-this
2
-that
3
-the other
4
-
5
-network={
6
-    psk="this_ssid"
7
-    psk="this_pass"
8
-
9
-network={
10
-    psk="this_ssid"
11
-    psk="this_pass"
12
-}
13
-
14
-    psk="this_ssid"
15
-    psk="this_pass"
16
-}
17
-

Loading…
Cancel
Save