Welcome! Log In Create A New Profile

Advanced

patches for send.py and RepRapArduinoSerialSender.py

Posted by Triffid_Hunter 
patches for send.py and RepRapArduinoSerialSender.py
February 08, 2010 12:59AM
This patch makes send.py case-insensitive, allows specifying baud rate on the command line, adds newlines to the end of gcodes so my arduino knows to send a response, and makes the output more readable.

I've never touched python before, so let me know how this looks smiling smiley


-----------------------------------------------
Wooden Mendel
Teacup Firmware
Attachments:
open | download - send.patch (4.7 KB)
Re: patches for send.py and RepRapArduinoSerialSender.py
February 09, 2010 07:10PM
Here are the updated files, for peer review smiling smiley


-----------------------------------------------
Wooden Mendel
Teacup Firmware
Attachments:
open | download - send.py (5 KB)
open | download - RepRapArduinoSerialSender.py (4.5 KB)
Re: patches for send.py and RepRapArduinoSerialSender.py
February 10, 2010 04:11AM
Thanks Triffid_Hunter for posting the files.

I suggest people try these files out and report the results here. If there are no problems, I'll add them to the next skeinforge update.

Enrique
With this modifications I'm able to print on my mendel with FiveD firmware:
- I needed a \n after setdtr(1) to get a start response
- stripping all spaces from gcode results in quite strange behaviour
- printing what gets really sent


--- 13/miscellaneous/fabricate/RepRapArduinoSerialSender.py 2010-02-13 06:41:01.000000000 +0100
+++ 14/miscellaneous/fabricate/RepRapArduinoSerialSender.py 2010-03-16 01:09:32.000000000 +0100
@@ -76,6 +76,7 @@
# There is presumably some latency required.
time.sleep(1)
self.ser.setDTR(1)
+ self.ser.write("\n")
self.read("Start")

def write(self, block):
@@ -87,18 +88,17 @@
This routine also removes all whitespace before sending it to the arduino,
which is handy for gcode, but will screw up if you try to do binary communications.
"""
- if self._verbose:
- print "> " + block
-
# The arduino GCode interperter firmware doesn't like whitespace
# and if there's anything other than space and tab, we have other problems.
block=block.strip()
- block=block.replace(' ','')
block=block.replace("\t",'')
#Skip blank blocks.
if len(block) == 0:
return

+ if self._verbose:
+ print "> " + block
+
self.ser.write(block + "\n")
self.read("OK")
Sorry, only registered users may post in this forum.

Click here to login