Subversion Repositories Projects

Rev

Rev 645 | Rev 647 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 645 Rev 646
Line 370... Line 370...
370
        self.accRollCb.SetValue(1)
370
        self.accRollCb.SetValue(1)
371
        self.accNickCb.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
371
        self.accNickCb.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
372
        self.label_3.SetMinSize((110, -1))
372
        self.label_3.SetMinSize((110, -1))
373
        self.label_3.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
373
        self.label_3.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
374
        self.label_4.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
374
        self.label_4.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
375
        self.speedCtrl.SetToolTipString("e.g. \n 100 \n 100,150 \n 100-200:10")
375
        self.speedCtrl.SetToolTipString("e.g. \n 100 \n 100,150 \n 100-200:10 \n 50,100-200:10 \n 5*100,5*200")
376
        self.bitmap_button_1.SetToolTipString("Start Measurement")
376
        self.bitmap_button_1.SetToolTipString("Start Measurement")
377
        self.bitmap_button_1.SetSize(self.bitmap_button_1.GetBestSize())
377
        self.bitmap_button_1.SetSize(self.bitmap_button_1.GetBestSize())
378
        self.static_line_1.SetMinSize((800,3))
378
        self.static_line_1.SetMinSize((800,3))
379
        self.graphCtrl.SetMinSize((800,300))
379
        self.graphCtrl.SetMinSize((800,300))
380
        self.label_40.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
380
        self.label_40.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
Line 686... Line 686...
686
          mp.motors = map(int,self.motorsCtrl.GetValue().split(','))
686
          mp.motors = map(int,self.motorsCtrl.GetValue().split(','))
687
          mp.channels = []
687
          mp.channels = []
688
          if self.accTopCb.IsChecked(): mp.channels.append(5)
688
          if self.accTopCb.IsChecked(): mp.channels.append(5)
689
          if self.accRollCb.IsChecked(): mp.channels.append(6)
689
          if self.accRollCb.IsChecked(): mp.channels.append(6)
690
          if self.accNickCb.IsChecked(): mp.channels.append(7)
690
          if self.accNickCb.IsChecked(): mp.channels.append(7)
691
          s = self.speedCtrl.GetValue()
-
 
-
 
691
         
692
          if s=="test1":
692
          mp.speeds = []
693
            mp.speeds = (100,100,100,100,100,100,100,100, 200,200,200,200,200,200,200,200, 100,200, 100,200, 100,200, 100,200)
-
 
694
          elif s=="test2":
693
          for speedTxt in self.speedCtrl.GetValue().split(","):
695
            mp.speeds = (100,100,100,100,100, 150,150,150,150,150, 200,200,200,200,200, 100,150,200, 100,150,200, 100,150,200, 100,150,200)          
-
 
696
          elif s.count("-") == 1:
694
              if speedTxt.count("-") == 1:
697
              # assume from-to:step format
695
                  # assume from-to:step format
698
              s = s.split("-")
696
                  speedTxt = speedTxt.split("-")
699
              if len(s) != 2: raise Exception("Invalid format")
697
                  if len(speedTxt) != 2: raise Exception("Invalid format")
700
              s[1] = s[1].split(":")
698
                  speedTxt[1] = speedTxt[1].split(":")
701
              if len(s[1]) != 2: raise Exception("Invalid format")
699
                  if len(speedTxt[1]) != 2: raise Exception("Invalid format")
702
              mp.speeds = range(int(s[0]),int(s[1][0])+int(s[1][1]),int(s[1][1]))
700
                  mp.speeds = range(int(speedTxt[0]),int(speedTxt[1][0])+int(speedTxt[1][1]),int(speedTxt[1][1]))
703
          else:
701
              else:
-
 
702
                  # assume s or s*n format
-
 
703
                  if speedTxt.count("*") == 1:
704
              mp.speeds = map(int,s.split(','))
704
                      speedTxt = speedTxt.split("*")
-
 
705
                      for i in range(int(speedTxt[0])):
-
 
706
                        mp.speeds.append(int(speedTxt[1]))
-
 
707
                  else:
-
 
708
                      mp.speeds.append(int(speedTxt))
705
        except Exception,e:
709
        except Exception,e:
706
          dial = wx.MessageDialog(None, 'Invalid paramters', 'Error', wx.OK |
710
          dial = wx.MessageDialog(None, 'Invalid paramters', 'Error', wx.OK |
707
            wx.ICON_ERROR)
711
            wx.ICON_ERROR)
708
          dial.ShowModal()
712
          dial.ShowModal()
709
          raise e
713
          raise e
Line 833... Line 837...
833
            speeds[motor-1] = speed
837
            speeds[motor-1] = speed
834
        for i in range(int(settlingTime*10)):
838
        for i in range(int(settlingTime*10)):
835
          self._testCancel()
839
          self._testCancel()
836
          self.mk.setMotorTest(speeds)
840
          self.mk.setMotorTest(speeds)
837
          time.sleep(.1)
841
          time.sleep(.1)
-
 
842
        self.currSpeed = speed
Line 838... Line 843...
838
       
843
       
839
                   
844
                   
840
    def _run(self):
845
    def _run(self):
-
 
846
        self.running = True
841
        self.running = True
847
        self._sendEvent("Starting test \"%s\"" % self.param.descr)    
842
        self._sendEvent("Starting test \"%s\"" % self.param.descr)    
848
        self.currSpeed = 0
843
 
849
       
844
        try:
850
        try:
Line 845... Line 851...
845
            self._sendEvent("Opening SerialPort \"%s\"" % self.param.serialPort)
851
            self._sendEvent("Opening SerialPort \"%s\"" % self.param.serialPort)
Line 876... Line 882...
876
           
882
           
877
            self._sendEvent("Starting motor(s) (speed=%d)... " % self.param.motorStartupSpeed, speed=self.param.motorStartupSpeed)
883
            self._sendEvent("Starting motor(s) (speed=%d)... " % self.param.motorStartupSpeed, speed=self.param.motorStartupSpeed)
Line 878... Line 884...
878
            self._setMotorSpeed(self.param.motorStartupSpeed, self.param.motorStartupSettlingTime)
884
            self._setMotorSpeed(self.param.motorStartupSpeed, self.param.motorStartupSettlingTime)
-
 
885
         
879
         
886
            for speed in self.param.speeds:
880
            for speed in self.param.speeds:
887
                if speed != self.currSpeed:
Line 881... Line 888...
881
                self._sendEvent("Changing motor speed to %d... " % speed, speed=speed)
888
                    self._sendEvent("Changing motor speed to %d... " % speed, speed=speed)
882
                self._setMotorSpeed(speed, 1)
889
                    self._setMotorSpeed(speed, 1)
883
               
890
               
884
                for channel in self.param.channels:
891
                for channel in self.param.channels: