author | laurent |
Fri, 04 Jun 2010 15:39:14 +0200 | |
changeset 561 | 4cc6eef4778f |
parent 558 | e7ce2b3f1d5d |
child 562 | 2c8f08f4f874 |
child 563 | c74a37d156df |
permissions | -rw-r--r-- |
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
1 |
#!/usr/bin/env python |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
3 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
4 |
#This file is part of Beremiz, a Integrated Development Environment for |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
5 |
#programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
6 |
# |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
7 |
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
8 |
# |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
9 |
#See COPYING file for copyrights details. |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
10 |
# |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
11 |
#This library is free software; you can redistribute it and/or |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
12 |
#modify it under the terms of the GNU General Public |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
13 |
#License as published by the Free Software Foundation; either |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
14 |
#version 2.1 of the License, or (at your option) any later version. |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
15 |
# |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
16 |
#This library is distributed in the hope that it will be useful, |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
17 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
18 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
19 |
#General Public License for more details. |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
20 |
# |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
21 |
#You should have received a copy of the GNU General Public |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
22 |
#License along with this library; if not, write to the Free Software |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
23 |
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
24 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
25 |
import ctypes |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
26 |
from LPCAppProto import * |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
27 |
from LPCObject import * |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
28 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
29 |
class LPCAppObject(LPCObject): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
30 |
def connect(self,comport): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
31 |
self.SerialConnection = LPCAppProto(comport,#number |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
32 |
115200, #speed |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
33 |
2) #timeout |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
34 |
self.HandleSerialTransaction(IDLETransaction()) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
35 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
36 |
def HandleSerialTransaction(self, transaction): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
37 |
if self.SerialConnection is not None: |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
38 |
try: |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
39 |
self.PLCStatus, res = self.SerialConnection.HandleTransaction(transaction) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
40 |
return res |
548 | 41 |
except LPCProtoError,e: |
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
42 |
self.pluginsroot.logger.write_error(str(e)+"\n") |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
43 |
self.SerialConnection = None |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
44 |
self.PLCStatus = "Disconnected" |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
45 |
return None |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
46 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
47 |
def StartPLC(self, debug=False): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
48 |
self.HandleSerialTransaction(STARTTransaction()) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
49 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
50 |
def StopPLC(self): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
51 |
self.HandleSerialTransaction(STOPTransaction()) |
558 | 52 |
return True |
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
53 |
|
548 | 54 |
def ResetPLC(self): |
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
55 |
self.HandleSerialTransaction(RESETTransaction()) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
56 |
return self.PLCStatus |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
57 |
|
548 | 58 |
def GetPLCstatus(self): |
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
59 |
self.HandleSerialTransaction(IDLETransaction()) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
60 |
return self.PLCStatus |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
61 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
62 |
def MatchMD5(self, MD5): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
63 |
data = self.HandleSerialTransaction(GET_PLCIDTransaction()) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
64 |
return data[:32] == MD5 |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
65 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
66 |
class IEC_STRING(ctypes.Structure): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
67 |
""" |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
68 |
Must be changed according to changes in iec_types.h |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
69 |
""" |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
70 |
_fields_ = [("len", ctypes.c_uint8), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
71 |
("body", ctypes.c_char * 126)] |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
72 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
73 |
TypeTranslator = {"BOOL" : (ctypes.c_uint8, lambda x:x.value!=0, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
74 |
"STEP" : (ctypes.c_uint8, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
75 |
"TRANSITION" : (ctypes.c_uint8, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
76 |
"ACTION" : (ctypes.c_uint8, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
77 |
"SINT" : (ctypes.c_int8, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
78 |
"USINT" : (ctypes.c_uint8, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
79 |
"BYTE" : (ctypes.c_uint8, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
80 |
"STRING" : (IEC_STRING, lambda x:x.body[:x.len], lambda t,x:t(len(x),x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
81 |
"INT" : (ctypes.c_int16, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
82 |
"UINT" : (ctypes.c_uint16, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
83 |
"WORD" : (ctypes.c_uint16, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
84 |
"WSTRING" : (None, None, None),#TODO |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
85 |
"DINT" : (ctypes.c_int32, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
86 |
"UDINT" : (ctypes.c_uint32, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
87 |
"DWORD" : (ctypes.c_uint32, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
88 |
"LINT" : (ctypes.c_int64, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
89 |
"ULINT" : (ctypes.c_uint64, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
90 |
"LWORD" : (ctypes.c_uint64, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
91 |
"REAL" : (ctypes.c_float, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
92 |
"LREAL" : (ctypes.c_double, lambda x:x.value, lambda t,x:t(x)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
93 |
} |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
94 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
95 |
def SetTraceVariablesList(self, idxs): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
96 |
""" |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
97 |
Call ctype imported function to append |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
98 |
these indexes to registred variables in PLC debugger |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
99 |
""" |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
100 |
if idxs: |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
101 |
buff = "" |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
102 |
# keep a copy of requested idx |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
103 |
self._Idxs = idxs[:] |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
104 |
for idx,iectype,force in idxs: |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
105 |
idxstr = ctypes.string_at( |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
106 |
ctypes.pointer( |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
107 |
ctypes.c_uint32(length)),4) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
108 |
if force !=None: |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
109 |
c_type,unpack_func, pack_func = self.TypeTranslator.get(iectype, (None,None,None)) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
110 |
forcedsizestr = chr(ctypes.sizeof(c_type)) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
111 |
forcestr = ctypes.string_at( |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
112 |
ctypes.pointer( |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
113 |
pack_func(c_type,force)), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
114 |
forced_type_size) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
115 |
buff += idxstr + forced_type_size_str + forcestr |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
116 |
else: |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
117 |
buff += idxstr + chr(0) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
118 |
data = self.HandleSerialTransaction( |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
119 |
SET_TRACE_VARIABLETransaction(buff)) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
120 |
else: |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
121 |
self._Idxs = [] |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
122 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
123 |
def GetTraceVariables(self): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
124 |
""" |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
125 |
Return a list of variables, corresponding to the list of required idx |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
126 |
""" |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
127 |
offset = 0 |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
128 |
strbuf = self.HandleSerialTransaction( |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
129 |
GET_TRACE_VARIABLETransaction()) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
130 |
size = len(strbuf) - 4 |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
131 |
if size > 0 and self.PLCStatus == "Started": |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
132 |
tick = ctypes.cast( |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
133 |
ctypes.c_char_p(strbuf[:4]), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
134 |
ctypes.POINTER(ctypes.c_int)).contents |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
135 |
buffer = ctypes.cast( |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
136 |
ctypes.c_char_p(strbuf[4:]), |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
137 |
ctypes.c_void_p) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
138 |
for idx, iectype, forced in self._Idxs: |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
139 |
cursor = ctypes.c_void_p(buffer.value + offset) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
140 |
c_type,unpack_func, pack_func = self.TypeTranslator.get(iectype, (None,None,None)) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
141 |
if c_type is not None and offset < size: |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
142 |
res.append(unpack_func(ctypes.cast(cursor, |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
143 |
ctypes.POINTER(c_type)).contents)) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
144 |
offset += ctypes.sizeof(c_type) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
145 |
else: |
557
b155ada1c14a
Removed PLCprint, not existing in LPC connector context.
Lolitech
parents:
548
diff
changeset
|
146 |
#if c_type is None: |
b155ada1c14a
Removed PLCprint, not existing in LPC connector context.
Lolitech
parents:
548
diff
changeset
|
147 |
#PLCprint("Debug error - " + iectype + " not supported !") |
b155ada1c14a
Removed PLCprint, not existing in LPC connector context.
Lolitech
parents:
548
diff
changeset
|
148 |
#if offset >= size: |
b155ada1c14a
Removed PLCprint, not existing in LPC connector context.
Lolitech
parents:
548
diff
changeset
|
149 |
#PLCprint("Debug error - buffer too small !") |
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
150 |
break |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
151 |
if offset and offset == size: |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
152 |
return self.PLCStatus, tick.value, res |
557
b155ada1c14a
Removed PLCprint, not existing in LPC connector context.
Lolitech
parents:
548
diff
changeset
|
153 |
#PLCprint("Debug error - wrong buffer unpack !") |
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
154 |
return self.PLCStatus, None, None |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
155 |