Different animation storage methods

This commit is contained in:
maxunm 2020-08-07 16:47:08 -04:00
parent d380f57e87
commit ca549d8b5c
8 changed files with 50034 additions and 50016 deletions

2
.gitignore vendored
View file

@ -23,3 +23,5 @@ fp-info-cache
# Exported BOM files
*.xml
*.csv
Code/.idea/Code.iml

View file

@ -30,9 +30,9 @@ def getLedNumber(column, row):
pcbNum = int(column / 2)
colNum = column % 2
if colNum == 0:
return ((matrixHeight-row) + (pcbNum * ((matrixHeight+1)*2)))
return ((matrixHeight - row) + (pcbNum * ((matrixHeight + 1) * 2)))
else:
return (((matrixHeight+1) + row) + (pcbNum * ((matrixHeight+1)*2)))
return (((matrixHeight + 1) + row) + (pcbNum * ((matrixHeight + 1) * 2)))
def compressFileToString(inputFile):
@ -49,20 +49,35 @@ def compressFileToString(inputFile):
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__":
askQuestion()
# askQuestion()
# mainMatrix = Matrix()
mainAnimation = Animation()
merrickData(mainAnimation)
file = open('matrix.json', 'w')
matrixJSONData = mainAnimation.toJSON()
file.write(matrixJSONData)
file.close()
with zipfile.ZipFile('matrix.zip', 'w', zipfile.ZIP_DEFLATED) as myzip:
# myzip.write('merrick.dat')
myzip.write('matrix.json')
with zipfile.ZipFile('matrixMer.zip', 'w', zipfile.ZIP_DEFLATED) as myzip:
myzip.write('merrick.dat')
# arr = bytearray(mainAnimation)
# print(arr)
# file.write(arr)

View file

@ -1,4 +1,5 @@
import json
import random
class Animation:
def __init__(self):
@ -44,9 +45,9 @@ class Panel:
class LED:
def __init__(self):
self.r = 0
self.g = 0
self.b = 0
self.r = random.randrange(0, 255)
self.g = random.randrange(0, 255)
self.b = random.randrange(0, 255)
# def value(self):
# return self.r, self, g, self.b

File diff suppressed because it is too large Load diff

Binary file not shown.

BIN
Code/matrixMer.zip Normal file

Binary file not shown.

BIN
Code/merrick.dat Normal file

Binary file not shown.