equal
deleted
inserted
replaced
254 app_frame = self.GetCTRoot().AppFrame |
254 app_frame = self.GetCTRoot().AppFrame |
255 dialog = BrowseValuesLibraryDialog(app_frame, |
255 dialog = BrowseValuesLibraryDialog(app_frame, |
256 "Ethercat Slave Type", self.GetSlaveTypesLibrary()) |
256 "Ethercat Slave Type", self.GetSlaveTypesLibrary()) |
257 if dialog.ShowModal() == wx.ID_OK: |
257 if dialog.ShowModal() == wx.ID_OK: |
258 type_infos = dialog.GetValueInfos() |
258 type_infos = dialog.GetValueInfos() |
259 device, alignment = self.GetModuleInfos(type_infos) |
259 device, module_extra_params = self.GetModuleInfos(type_infos) |
260 if device is not None: |
260 if device is not None: |
261 if HAS_MCL and _EthercatCIA402SlaveCTN.NODE_PROFILE in device.GetProfileNumbers(): |
261 if HAS_MCL and _EthercatCIA402SlaveCTN.NODE_PROFILE in device.GetProfileNumbers(): |
262 ConfNodeType = "EthercatCIA402Slave" |
262 ConfNodeType = "EthercatCIA402Slave" |
263 else: |
263 else: |
264 ConfNodeType = "EthercatSlave" |
264 ConfNodeType = "EthercatSlave" |
285 if slave_pos is not None and slave.getInfo().getPhysAddr() != slave_pos: |
285 if slave_pos is not None and slave.getInfo().getPhysAddr() != slave_pos: |
286 return False |
286 return False |
287 type_infos = slave.getType() |
287 type_infos = slave.getType() |
288 if vendor is not None and ExtractHexDecValue(type_infos["vendor"]) != vendor: |
288 if vendor is not None and ExtractHexDecValue(type_infos["vendor"]) != vendor: |
289 return False |
289 return False |
290 device, alignment = self.GetModuleInfos(type_infos) |
290 device, module_extra_params = self.GetModuleInfos(type_infos) |
291 if slave_profile is not None and slave_profile not in device.GetProfileNumbers(): |
291 if slave_profile is not None and slave_profile not in device.GetProfileNumbers(): |
292 return False |
292 return False |
293 return True |
293 return True |
294 |
294 |
295 def GetSlaveName(self, slave_pos): |
295 def GetSlaveName(self, slave_pos): |
423 type_infos = { |
423 type_infos = { |
424 "vendor": slave["vendor_id"], |
424 "vendor": slave["vendor_id"], |
425 "product_code": slave["product_code"], |
425 "product_code": slave["product_code"], |
426 "revision_number":slave["revision_number"], |
426 "revision_number":slave["revision_number"], |
427 } |
427 } |
428 device, alignment = self.GetModuleInfos(type_infos) |
428 device, module_extra_params = self.GetModuleInfos(type_infos) |
429 if device is not None: |
429 if device is not None: |
430 if HAS_MCL and _EthercatCIA402SlaveCTN.NODE_PROFILE in device.GetProfileNumbers(): |
430 if HAS_MCL and _EthercatCIA402SlaveCTN.NODE_PROFILE in device.GetProfileNumbers(): |
431 CTNType = "EthercatCIA402Slave" |
431 CTNType = "EthercatCIA402Slave" |
432 else: |
432 else: |
433 CTNType = "EthercatSlave" |
433 CTNType = "EthercatSlave" |
517 |
517 |
518 def GetSlaveInfos(self, slave_pos): |
518 def GetSlaveInfos(self, slave_pos): |
519 slave = self.GetSlave(slave_pos) |
519 slave = self.GetSlave(slave_pos) |
520 if slave is not None: |
520 if slave is not None: |
521 type_infos = slave.getType() |
521 type_infos = slave.getType() |
522 device, alignment = self.GetModuleInfos(type_infos) |
522 device, module_extra_params = self.GetModuleInfos(type_infos) |
523 if device is not None: |
523 if device is not None: |
524 infos = type_infos.copy() |
524 infos = type_infos.copy() |
525 infos.update({"physics": device.getPhysics(), |
525 infos.update({"physics": device.getPhysics(), |
526 "sync_managers": device.GetSyncManagers(), |
526 "sync_managers": device.GetSyncManagers(), |
527 "entries": self.GetSlaveVariables(device)}) |
527 "entries": self.GetSlaveVariables(device)}) |
531 def GetSlaveVariables(self, slave_pos=None, limits=None, device=None): |
531 def GetSlaveVariables(self, slave_pos=None, limits=None, device=None): |
532 if device is None and slave_pos is not None: |
532 if device is None and slave_pos is not None: |
533 slave = self.GetSlave(slave_pos) |
533 slave = self.GetSlave(slave_pos) |
534 if slave is not None: |
534 if slave is not None: |
535 type_infos = slave.getType() |
535 type_infos = slave.getType() |
536 device, alignment = self.GetModuleInfos(type_infos) |
536 device, module_extra_params = self.GetModuleInfos(type_infos) |
537 if device is not None: |
537 if device is not None: |
538 entries = device.GetEntriesList(limits) |
538 entries = device.GetEntriesList(limits) |
539 entries_list = entries.items() |
539 entries_list = entries.items() |
540 entries_list.sort() |
540 entries_list.sort() |
541 entries = [] |
541 entries = [] |
558 return [] |
558 return [] |
559 |
559 |
560 def GetSlaveVariableDataType(self, slave_pos, index, subindex): |
560 def GetSlaveVariableDataType(self, slave_pos, index, subindex): |
561 slave = self.GetSlave(slave_pos) |
561 slave = self.GetSlave(slave_pos) |
562 if slave is not None: |
562 if slave is not None: |
563 device, alignment = self.GetModuleInfos(slave.getType()) |
563 device, module_extra_params = self.GetModuleInfos(slave.getType()) |
564 if device is not None: |
564 if device is not None: |
565 entries = device.GetEntriesList() |
565 entries = device.GetEntriesList() |
566 entry_infos = entries.get((index, subindex)) |
566 entry_infos = entries.get((index, subindex)) |
567 if entry_infos is not None: |
567 if entry_infos is not None: |
568 return entry_infos["Type"] |
568 return entry_infos["Type"] |
575 continue |
575 continue |
576 slave = self.GetSlave(slave_position) |
576 slave = self.GetSlave(slave_position) |
577 type_infos = slave.getType() |
577 type_infos = slave.getType() |
578 if vendor is not None and ExtractHexDecValue(type_infos["vendor"]) != vendor: |
578 if vendor is not None and ExtractHexDecValue(type_infos["vendor"]) != vendor: |
579 continue |
579 continue |
580 device, alignment = self.GetModuleInfos(type_infos) |
580 device, module_extra_params = self.GetModuleInfos(type_infos) |
581 if slave_profile is not None and slave_profile not in device.GetProfileNumbers(): |
581 if slave_profile is not None and slave_profile not in device.GetProfileNumbers(): |
582 continue |
582 continue |
583 entries.extend(self.GetSlaveVariables(slave_position, limits, device)) |
583 entries.extend(self.GetSlaveVariables(slave_position, limits, device)) |
584 return entries |
584 return entries |
585 |
585 |
596 slave = self.GetSlave(slave_pos) |
596 slave = self.GetSlave(slave_pos) |
597 vars = [] |
597 vars = [] |
598 if slave is not None: |
598 if slave is not None: |
599 type_infos = slave.getType() |
599 type_infos = slave.getType() |
600 |
600 |
601 device, alignment = self.GetModuleInfos(type_infos) |
601 device, module_extra_params = self.GetModuleInfos(type_infos) |
602 if device is not None: |
602 if device is not None: |
603 sync_managers = [] |
603 sync_managers = [] |
604 for sync_manager in device.getSm(): |
604 for sync_manager in device.getSm(): |
605 sync_manager_control_byte = ExtractHexDecValue(sync_manager.getControlByte()) |
605 sync_manager_control_byte = ExtractHexDecValue(sync_manager.getControlByte()) |
606 sync_manager_direction = sync_manager_control_byte & 0x0c |
606 sync_manager_direction = sync_manager_control_byte & 0x0c |