292 return [("Add Ethercat Slave", "Add Ethercat Slave to Master", self.OnAddEthercatSlave)] |
292 return [("Add Ethercat Slave", "Add Ethercat Slave to Master", self.OnAddEthercatSlave)] |
293 |
293 |
294 def OnAddEthercatSlave(self, event): |
294 def OnAddEthercatSlave(self, event): |
295 app_frame = self.GetCTRoot().AppFrame |
295 app_frame = self.GetCTRoot().AppFrame |
296 dialog = BrowseValuesLibraryDialog(app_frame, |
296 dialog = BrowseValuesLibraryDialog(app_frame, |
297 "Ethercat Slave Type", self.GetSlaveTypesLibrary()) |
297 "Ethercat Slave Type", |
|
298 self.GetSlaveTypesLibrary()) |
298 if dialog.ShowModal() == wx.ID_OK: |
299 if dialog.ShowModal() == wx.ID_OK: |
299 type_infos = dialog.GetValueInfos() |
300 type_infos = dialog.GetValueInfos() |
300 device, module_extra_params = self.GetModuleInfos(type_infos) |
301 device, module_extra_params = self.GetModuleInfos(type_infos) |
301 if device is not None: |
302 if device is not None: |
302 if HAS_MCL and _EthercatCIA402SlaveCTN.NODE_PROFILE in device.GetProfileNumbers(): |
303 if HAS_MCL and _EthercatCIA402SlaveCTN.NODE_PROFILE in device.GetProfileNumbers(): |
441 def _ScanNetwork(self): |
442 def _ScanNetwork(self): |
442 app_frame = self.GetCTRoot().AppFrame |
443 app_frame = self.GetCTRoot().AppFrame |
443 |
444 |
444 execute = True |
445 execute = True |
445 if len(self.Children) > 0: |
446 if len(self.Children) > 0: |
446 dialog = wx.MessageDialog(app_frame, |
447 dialog = wx.MessageDialog( |
|
448 app_frame, |
447 _("The current network configuration will be deleted.\nDo you want to continue?"), |
449 _("The current network configuration will be deleted.\nDo you want to continue?"), |
448 _("Scan Network"), |
450 _("Scan Network"), |
449 wx.YES_NO | wx.ICON_QUESTION) |
451 wx.YES_NO | wx.ICON_QUESTION) |
450 execute = dialog.ShowModal() == wx.ID_YES |
452 execute = dialog.ShowModal() == wx.ID_YES |
451 dialog.Destroy() |
453 dialog.Destroy() |
742 self.FileGenerator.DeclareVariable( |
744 self.FileGenerator.DeclareVariable( |
743 pos, index, subindex, var_type, "Q", name, True) |
745 pos, index, subindex, var_type, "Q", name, True) |
744 |
746 |
745 self.FileGenerator.GenerateCFile(Gen_Ethercatfile_path, location_str, self.BaseParams.getIEC_Channel()) |
747 self.FileGenerator.GenerateCFile(Gen_Ethercatfile_path, location_str, self.BaseParams.getIEC_Channel()) |
746 |
748 |
747 LocationCFilesAndCFLAGS.insert(0, |
749 LocationCFilesAndCFLAGS.insert( |
|
750 0, |
748 (current_location, |
751 (current_location, |
749 [(Gen_Ethercatfile_path, '"-I%s"' % os.path.abspath(self.GetCTRoot().GetIECLibPath()))], |
752 [(Gen_Ethercatfile_path, '"-I%s"' % os.path.abspath(self.GetCTRoot().GetIECLibPath()))], |
750 True)) |
753 True)) |
751 LDFLAGS.append("-lethercat_rtdm -lrtdm") |
754 LDFLAGS.append("-lethercat_rtdm -lrtdm") |
752 |
755 |