nikitto
Members
-
Joined
-
Last visited
Reputation Activity
-
nikitto got a reaction from Gabriel_2018 in Raspberry PiIt looks very nice. Congrats! Are you thinking to implement any kind of control ? Perhaps using Telegram to get some information about system or connect a relay.
-
nikitto got a reaction from Chris Hobson in Axpert USBHi all, this is my first post in this forum.
Thanks Gnome for your effort. I got your code (Python) and I begun to work with it.
I installed crcmod library for python (https://pypi.python.org/pypi/crcmod) and now, I can send every command with its CRC.
import os, sys
import crcmod
import time
comando = 'QPI'
xmodem_crc_func = crcmod.mkCrcFun(0x11021, rev=False, initCrc=0x0000, xorOut=0x0000)
def crc(comando):
global crc
crc = hex(xmodem_crc_func(comando))
return crc
# calcular crc
crc(comando)
print ('CRC='),crc
crc1=crc[0:4]
crc2=crc[0:2]+crc[4:6]
crc1=int(crc1, base=16)
crc2=int(crc2, base=16)
fd = os.open('/dev/hidraw0', os.O_RDWR | os.O_NONBLOCK)
os.write(fd, comando+chr(crc1)+chr(crc2)+'\r')
time.sleep(1)
res = os.read(fd, 5)
print res
os.close(fd)
In this momment, I'm working with os.read() (almost finished). I'll publish the code soon.