mirror of
https://github.com/travisgoodspeed/goodwatch
synced 2024-11-21 23:58:31 +00:00
Setting the baud rate now works. There will be trouble above 38400 baud.
This commit is contained in:
parent
85d3575a89
commit
d79cc6cef6
@ -85,6 +85,9 @@ class BSL:
|
|||||||
if len(reply)!=1:
|
if len(reply)!=1:
|
||||||
print "Error, missing reply.";
|
print "Error, missing reply.";
|
||||||
sys.exit(1);
|
sys.exit(1);
|
||||||
|
elif msg[0]=='\x52':
|
||||||
|
#Change baud rate command has a briefer reply.
|
||||||
|
pass;
|
||||||
elif ord(reply[0])==0x00:
|
elif ord(reply[0])==0x00:
|
||||||
#Success
|
#Success
|
||||||
eighty=ord(self.serial.read(1));
|
eighty=ord(self.serial.read(1));
|
||||||
@ -200,10 +203,15 @@ class BSL:
|
|||||||
ratebyte='\x05';
|
ratebyte='\x05';
|
||||||
elif rate==115200:
|
elif rate==115200:
|
||||||
ratebyte='\x06';
|
ratebyte='\x06';
|
||||||
resp=self.transact("\x17"+ratebyte);
|
|
||||||
|
|
||||||
|
resp=self.transact("\x52"+ratebyte);
|
||||||
|
#self.serial.write("\x80\x52\x06");
|
||||||
|
#print self.serial.read().encode('hex');
|
||||||
|
|
||||||
#Then we jump the port to the new rate.
|
#Then we jump the port to the new rate.
|
||||||
self.serial.setBaudrate(rate);
|
#self.serial.setBaudrate(rate); #Old convention.
|
||||||
|
self.serial.baudrate=rate; #New convention.
|
||||||
|
|
||||||
MAXLEN=256; #Maximum bytes per read request.
|
MAXLEN=256; #Maximum bytes per read request.
|
||||||
def readbulk(self,adr,length):
|
def readbulk(self,adr,length):
|
||||||
|
Loading…
Reference in New Issue
Block a user