Skip to content

Commit

Permalink
Merge pull request #23 from seken/master
Browse files Browse the repository at this point in the history
Added Linux Support
  • Loading branch information
Makeblock-official committed Jun 17, 2015
2 parents 385da89 + 662a666 commit e0e5180
Show file tree
Hide file tree
Showing 5 changed files with 16,728 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pyc
*.swp
4 changes: 4 additions & 0 deletions mDrawGui/HexDownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def startDownloadUno(self, com, hexfile):
avrdudepath = robot_gui.getPkgPath("avrdude")
confpath = robot_gui.getPkgPath("avrdude.conf")
hexfile = robot_gui.getPkgPath(hexfile)
elif "Linux" in systemType:
avrdudepath = '/usr/bin/avrdude'
confpath = robot_gui.getPkgPath("avrdude.linux.conf")
hexfile = robot_gui.getPkgPath(hexfile)
cmd = u"%s -C%s -v -v -v -v -patmega328p -carduino -P%s -b115200 -D -Uflash:w:%s:i" %(avrdudepath,confpath,com,hexfile)
self.moveListThread = WorkInThread(self.downloadThread,cmd)
self.moveListThread.setDaemon(True)
Expand Down
10 changes: 9 additions & 1 deletion mDrawGui/SerialCom.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import serial
import platform
import threading
import time
import platform

try:
import _winreg
Expand Down Expand Up @@ -42,7 +44,6 @@ def __init__(self,ser,cb):
def run(self):
while self.running:
l = self.ser.readline()
print l
self.cb(l)

class serialCom():
Expand All @@ -52,6 +53,12 @@ def __init__(self,rxCallback):
return

def connect(self,port,baud=115200):
if "Linux" in platform.system():
connection = serial.serial_for_url(port, baud, timeout=2, rtscts=True)
time.sleep(0.1)
connection.close()
time.sleep(2)

self.ser = serial.Serial(port, baud)
self.rxth = serialRead(self.ser,self.rxcb)
self.rxth.setDaemon(True)
Expand All @@ -68,6 +75,7 @@ def send(self,msg):
if self.ser == None:
return
self.ser.write(msg)
self.ser.flush()



Expand Down
Loading

0 comments on commit e0e5180

Please sign in to comment.