rotate display by 180 degrees

This commit is contained in:
Fisch 2018-01-06 19:50:59 +01:00
parent 6b277eba38
commit 3d7d4f99b4

View file

@ -50,6 +50,8 @@ class FlipdotSim():
self.udpHostSocket.close() self.udpHostSocket.close()
def sendToMatrix(self,imageArray,displayid=0): def sendToMatrix(self,imageArray,displayid=0):
imageArray=[x for x in reversed(imageArray)] #Rotated Image
data=np.zeros(int(WIDTH*HEIGHT/8),dtype=np.uint8) data=np.zeros(int(WIDTH*HEIGHT/8),dtype=np.uint8)
imageArray=np.hstack( (np.array(imageArray,dtype=np.uint8),np.zeros(len(data)*8-len(imageArray),dtype=np.uint8) )) imageArray=np.hstack( (np.array(imageArray,dtype=np.uint8),np.zeros(len(data)*8-len(imageArray),dtype=np.uint8) ))
print("imageArray size="+str(len(imageArray))) print("imageArray size="+str(len(imageArray)))
@ -150,9 +152,9 @@ def matrixSetup(ser,displayid=0):
ser.write(chr(2).encode()) ser.write(chr(2).encode())
ser.write(b'B') #command char ser.write(b'B') #command char
if displayid==0: if displayid==0:
ser.write(b'0') #display id 0 or 1 ser.write(b'1') #display id 0 or 1
elif displayid==1: elif displayid==1:
ser.write(b'1') ser.write(b'0')
#ser.write(b'00000000000') #ser.write(b'00000000000')
ser.write(b'00000000000') #alignment ser.write(b'00000000000') #alignment
ser.write(chr(27).encode()) #oneB ser.write(chr(27).encode()) #oneB