LPCBeremiz.py
changeset 572 c965548cb6f7
parent 571 427bf9130d12
child 574 1b6bd9f590aa
equal deleted inserted replaced
571:427bf9130d12 572:c965548cb6f7
   373                 os.makedirs(dstpath)
   373                 os.makedirs(dstpath)
   374                 mycopytree(srcpath, dstpath)
   374                 mycopytree(srcpath, dstpath)
   375             elif os.path.isfile(srcpath):
   375             elif os.path.isfile(srcpath):
   376                 shutil.copy2(srcpath, dstpath)
   376                 shutil.copy2(srcpath, dstpath)
   377 
   377 
   378 [SIMULATION_MODE, ONLINE_MODE] = range(2)
   378 [SIMULATION_MODE, TRANSFER_MODE] = range(2)
   379 
   379 
   380 class LPCPluginsRoot(PluginsRoot):
   380 class LPCPluginsRoot(PluginsRoot):
   381 
   381 
   382     PluginMethods = [
   382     PluginMethods = [
   383         {"bitmap" : opjimg("Debug"),
   383         {"bitmap" : opjimg("Debug"),
   492                     status = ""
   492                     status = ""
   493                 self.logger.write(_("PLC is %s\n")%status)
   493                 self.logger.write(_("PLC is %s\n")%status)
   494                 
   494                 
   495                 if self.StatusTimer and not self.StatusTimer.IsRunning():
   495                 if self.StatusTimer and not self.StatusTimer.IsRunning():
   496                     # Start the status Timer
   496                     # Start the status Timer
   497                     self.StatusTimer.Start(milliseconds=1000, oneShot=False)
   497                     self.StatusTimer.Start(milliseconds=2000, oneShot=False)
   498                 
   498                 
   499                 if self.previous_plcstate=="Started":
   499                 if self.previous_plcstate=="Started":
   500                     if self.DebugAvailable() and self.GetIECProgramsAndVariables():
   500                     if self.DebugAvailable() and self.GetIECProgramsAndVariables():
   501                         self.logger.write(_("Debug connect matching running PLC\n"))
   501                         self.logger.write(_("Debug connect matching running PLC\n"))
   502                         #TODO re-enable
   502                         #TODO re-enable
   505                         self.logger.write_warning(_("Debug do not match PLC - stop/transfert/start to re-enable\n"))
   505                         self.logger.write_warning(_("Debug do not match PLC - stop/transfert/start to re-enable\n"))
   506             
   506             
   507             elif self.StatusTimer and self.StatusTimer.IsRunning():
   507             elif self.StatusTimer and self.StatusTimer.IsRunning():
   508                 self.StatusTimer.Stop()
   508                 self.StatusTimer.Stop()
   509             
   509             
   510             if self.CurrentMode == ONLINE_MODE:
   510             if self.CurrentMode == TRANSFER_MODE:
   511                 
   511                 
   512                 if self.OnlineMode == "BOOTLOADER":
   512                 if self.OnlineMode == "BOOTLOADER":
   513                     self.BeginTransfer()
   513                     self.BeginTransfer()
   514                 
   514                 
   515                 elif self.OnlineMode == "APPLICATION":
   515                 elif self.OnlineMode == "APPLICATION":
   793         else:
   793         else:
   794             return None
   794             return None
   795 
   795 
   796     def _Transfer(self):
   796     def _Transfer(self):
   797         if self.CurrentMode is None and self.OnlineMode != "OFF":
   797         if self.CurrentMode is None and self.OnlineMode != "OFF":
   798             self.CurrentMode = ONLINE_MODE
   798             self.CurrentMode = TRANSFER_MODE
   799             
   799             
   800             PluginsRoot._build(self)
   800             PluginsRoot._build(self)
   801             
   801             
   802             ID_ABORTTRANSFERTIMER = wx.NewId()
   802             ID_ABORTTRANSFERTIMER = wx.NewId()
   803             self.AbortTransferTimer = wx.Timer(self.AppFrame, ID_ABORTTRANSFERTIMER)
   803             self.AbortTransferTimer = wx.Timer(self.AppFrame, ID_ABORTTRANSFERTIMER)