--- a/etherlab/runtime_etherlab.py Thu Apr 04 17:50:43 2013 +0900
+++ b/etherlab/runtime_etherlab.py Fri Apr 05 11:55:09 2013 +0900
@@ -1,6 +1,7 @@
import subprocess,sys,ctypes
from threading import Thread
import ctypes,time,re
+from targets.typemapping import LogLevelsDict
SDOAnswered = PLCBinary.SDOAnswered
SDOAnswered.restype = None
@@ -12,11 +13,12 @@
def SDOThreadProc(*params):
global Result
if params[0] == "upload":
- command = "ethercat upload -p %d -t %s 0x%.4x 0x%.2x"
+ cmdfmt = "ethercat upload -p %d -t %s 0x%.4x 0x%.2x"
else:
- command = "ethercat download -p %d -t %s 0x%.4x 0x%.2x %s"
+ cmdfmt = "ethercat download -p %d -t %s 0x%.4x 0x%.2x %s"
- proc = subprocess.Popen(command % params[1:], stdout=subprocess.PIPE, shell=True)
+ command = cmdfmt % params[1:]
+ proc = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
res = proc.wait()
output = proc.communicate()[0]
@@ -35,6 +37,10 @@
Result = res == 0
SDOAnswered()
+ if res != 0 :
+ PLCObject.LogMessage(
+ LogLevelsDict["WARNING"],
+ "%s : %s"%(command,output))
def EthercatSDOUpload(pos, index, subindex, var_type):
global SDOThread
@@ -89,4 +95,3 @@
StopKMSGThread = True
KMSGPollThread = None
-