Updated dsp.py and led.py to be Python 3.5 compatible

This commit is contained in:
Scott Lawson 2016-12-27 02:13:02 -07:00
parent f4a3a39b58
commit e09578da1d
2 changed files with 3 additions and 2 deletions

View File

@ -15,7 +15,7 @@ class ExpFilter:
self.value = val self.value = val
def update(self, value): def update(self, value):
if not isinstance(self.value, (int, long, float)): if isinstance(self.value, (list, np.ndarray, tuple)):
alpha = value - self.value alpha = value - self.value
alpha[alpha > 0.0] = self.alpha_rise alpha[alpha > 0.0] = self.alpha_rise
alpha[alpha <= 0.0] = self.alpha_decay alpha[alpha <= 0.0] = self.alpha_decay

View File

@ -1,5 +1,6 @@
from __future__ import print_function from __future__ import print_function
from __future__ import division from __future__ import division
from __future__ import unicode_literals
import socket import socket
import numpy as np import numpy as np
import config import config
@ -23,7 +24,7 @@ def update():
continue continue
m += chr(i) + chr(p[0][i]) + chr(p[1][i]) + chr(p[2][i]) m += chr(i) + chr(p[0][i]) + chr(p[1][i]) + chr(p[2][i])
_prev_pixels = np.copy(p) _prev_pixels = np.copy(p)
_sock.sendto(m, (config.UDP_IP, config.UDP_PORT)) _sock.sendto(m.encode(), (config.UDP_IP, config.UDP_PORT))
if __name__ == '__main__': if __name__ == '__main__':