equal
deleted
inserted
replaced
9 # See COPYING file for copyrights details. |
9 # See COPYING file for copyrights details. |
10 |
10 |
11 from __future__ import absolute_import |
11 from __future__ import absolute_import |
12 from __future__ import division |
12 from __future__ import division |
13 from builtins import str as text |
13 from builtins import str as text |
|
14 import codecs |
14 import wx |
15 import wx |
15 |
16 |
16 |
17 |
17 mailbox_protocols = ["AoE", "EoE", "CoE", "FoE", "SoE", "VoE"] |
18 mailbox_protocols = ["AoE", "EoE", "CoE", "FoE", "SoE", "VoE"] |
18 |
19 |
183 """ |
184 """ |
184 Constructor |
185 Constructor |
185 @param controler: _EthercatSlaveCTN class in EthercatSlave.py |
186 @param controler: _EthercatSlaveCTN class in EthercatSlave.py |
186 """ |
187 """ |
187 self.Controler = controler |
188 self.Controler = controler |
188 |
189 self.HexDecode = codecs.getdecoder("hex_codec") |
189 self.ClearSDODataSet() |
190 self.ClearSDODataSet() |
190 |
191 |
191 # ------------------------------------------------------------------------------- |
192 # ------------------------------------------------------------------------------- |
192 # Used Master State |
193 # Used Master State |
193 # ------------------------------------------------------------------------------- |
194 # ------------------------------------------------------------------------------- |
590 self.BinaryCode = return_val |
591 self.BinaryCode = return_val |
591 self.Controler.SiiData = self.BinaryCode |
592 self.Controler.SiiData = self.BinaryCode |
592 |
593 |
593 # append zero-filled padding data up to EEPROM size |
594 # append zero-filled padding data up to EEPROM size |
594 for dummy in range(self.SmartViewInfosFromXML["eeprom_size"] - len(self.BinaryCode)): |
595 for dummy in range(self.SmartViewInfosFromXML["eeprom_size"] - len(self.BinaryCode)): |
595 self.BinaryCode = self.BinaryCode + 'ff'.decode('hex') |
596 self.BinaryCode = self.BinaryCode + self.HexDecode('ff')[0] |
596 |
597 |
597 return self.BinaryCode |
598 return self.BinaryCode |
598 |
599 |
599 def HexRead(self, binary): |
600 def HexRead(self, binary): |
600 """ |
601 """ |
858 for i in range(padding): |
859 for i in range(padding): |
859 eeprom.append("ff") |
860 eeprom.append("ff") |
860 |
861 |
861 # convert binary code |
862 # convert binary code |
862 for index in range(eeprom_size): |
863 for index in range(eeprom_size): |
863 eeprom_binary = eeprom_binary + eeprom[index].decode('hex') |
864 eeprom_binary = eeprom_binary + self.HexDecode(eeprom[index])[0] |
864 |
865 |
865 return eeprom_binary |
866 return eeprom_binary |
866 |
867 |
867 def ExtractEEPROMStringCategory(self, device): |
868 def ExtractEEPROMStringCategory(self, device): |
868 """ |
869 """ |