Different animation storage methods
This commit is contained in:
parent
d380f57e87
commit
ca549d8b5c
8 changed files with 50034 additions and 50016 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -23,3 +23,5 @@ fp-info-cache
|
||||||
# Exported BOM files
|
# Exported BOM files
|
||||||
*.xml
|
*.xml
|
||||||
*.csv
|
*.csv
|
||||||
|
|
||||||
|
Code/.idea/Code.iml
|
||||||
|
|
|
||||||
Binary file not shown.
25
Code/led.py
25
Code/led.py
|
|
@ -30,9 +30,9 @@ def getLedNumber(column, row):
|
||||||
pcbNum = int(column / 2)
|
pcbNum = int(column / 2)
|
||||||
colNum = column % 2
|
colNum = column % 2
|
||||||
if colNum == 0:
|
if colNum == 0:
|
||||||
return ((matrixHeight-row) + (pcbNum * ((matrixHeight+1)*2)))
|
return ((matrixHeight - row) + (pcbNum * ((matrixHeight + 1) * 2)))
|
||||||
else:
|
else:
|
||||||
return (((matrixHeight+1) + row) + (pcbNum * ((matrixHeight+1)*2)))
|
return (((matrixHeight + 1) + row) + (pcbNum * ((matrixHeight + 1) * 2)))
|
||||||
|
|
||||||
|
|
||||||
def compressFileToString(inputFile):
|
def compressFileToString(inputFile):
|
||||||
|
|
@ -49,20 +49,35 @@ def compressFileToString(inputFile):
|
||||||
compressor.write(chunk)
|
compressor.write(chunk)
|
||||||
|
|
||||||
|
|
||||||
|
def merrickData(animation):
|
||||||
|
merfile = open('merrick.dat', 'wb')
|
||||||
|
for l in range(0, len(animation.matrices)):
|
||||||
|
for i in range(0, len(animation.matrices[0].panels)):
|
||||||
|
for j in range(0, len(animation.matrices[0].panels[0].leds)):
|
||||||
|
merfile.write(animation.matrices[l].panels[i].leds[j].r.to_bytes(1, byteorder='big'))
|
||||||
|
merfile.write(animation.matrices[l].panels[i].leds[j].g.to_bytes(1, byteorder='big'))
|
||||||
|
merfile.write(animation.matrices[l].panels[i].leds[j].b.to_bytes(1, byteorder='big'))
|
||||||
|
merfile.close()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
askQuestion()
|
# askQuestion()
|
||||||
# mainMatrix = Matrix()
|
# mainMatrix = Matrix()
|
||||||
mainAnimation = Animation()
|
mainAnimation = Animation()
|
||||||
|
|
||||||
|
merrickData(mainAnimation)
|
||||||
|
|
||||||
file = open('matrix.json', 'w')
|
file = open('matrix.json', 'w')
|
||||||
|
|
||||||
matrixJSONData = mainAnimation.toJSON()
|
matrixJSONData = mainAnimation.toJSON()
|
||||||
file.write(matrixJSONData)
|
file.write(matrixJSONData)
|
||||||
file.close()
|
file.close()
|
||||||
with zipfile.ZipFile('matrix.zip', 'w', zipfile.ZIP_DEFLATED) as myzip:
|
with zipfile.ZipFile('matrix.zip', 'w', zipfile.ZIP_DEFLATED) as myzip:
|
||||||
|
# myzip.write('merrick.dat')
|
||||||
myzip.write('matrix.json')
|
myzip.write('matrix.json')
|
||||||
|
with zipfile.ZipFile('matrixMer.zip', 'w', zipfile.ZIP_DEFLATED) as myzip:
|
||||||
|
myzip.write('merrick.dat')
|
||||||
|
|
||||||
# arr = bytearray(mainAnimation)
|
# arr = bytearray(mainAnimation)
|
||||||
# print(arr)
|
# print(arr)
|
||||||
# file.write(arr)
|
# file.write(arr)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import json
|
import json
|
||||||
|
import random
|
||||||
|
|
||||||
class Animation:
|
class Animation:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
@ -44,9 +45,9 @@ class Panel:
|
||||||
|
|
||||||
class LED:
|
class LED:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.r = 0
|
self.r = random.randrange(0, 255)
|
||||||
self.g = 0
|
self.g = random.randrange(0, 255)
|
||||||
self.b = 0
|
self.b = random.randrange(0, 255)
|
||||||
|
|
||||||
# def value(self):
|
# def value(self):
|
||||||
# return self.r, self, g, self.b
|
# return self.r, self, g, self.b
|
||||||
|
|
|
||||||
100016
Code/matrix.json
100016
Code/matrix.json
File diff suppressed because it is too large
Load diff
BIN
Code/matrix.zip
BIN
Code/matrix.zip
Binary file not shown.
BIN
Code/matrixMer.zip
Normal file
BIN
Code/matrixMer.zip
Normal file
Binary file not shown.
BIN
Code/merrick.dat
Normal file
BIN
Code/merrick.dat
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue