Subversion Repositories Projects

Rev

Rev 697 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 697 Rev 698
Line 276... Line 276...
276
            except InvalidMsg:
276
            except InvalidMsg:
277
                if self.printDebugMsg:
277
                if self.printDebugMsg:
278
                  print "DebugMsg: \"%s\"" % line[:-1]
278
                  print "DebugMsg: \"%s\"" % line[:-1]
279
                pass
279
                pass
280
        return msg
280
        return msg
-
 
281
   
-
 
282
    def sendMsg(self, msg):
-
 
283
        self.sendLn(msg.generateUartLine())
Line 281... Line 284...
281
 
284
 
282
    def sendNCRedirectUartFromFC(self):
285
    def sendNCRedirectUartFromFC(self):
283
        self.serPort.flushInput()
286
        self.serPort.flushInput()
284
        msg = MkMsg(address=MkComm.ADDRESS_NC, cmd='u', data=[0])
287
        msg = MkMsg(address=MkComm.ADDRESS_NC, cmd='u', data=[0])
285
        self.sendLn(msg.generateUartLine())
288
        self.sendMsg(msg)
286
        time.sleep(.5)
289
        time.sleep(.5)
Line 287... Line 290...
287
        # No reply expected...   
290
        # No reply expected...   
288
       
291
       
289
    def sendSettings(self, settings):
292
    def sendSettings(self, settings):
290
        msg = MkMsg(address=MkComm.ADDRESS_FC, cmd='s', data=settings)
293
        msg = MkMsg(address=MkComm.ADDRESS_FC, cmd='s', data=settings)
291
        self.sendLn(msg.generateUartLine())
294
        self.sendMsg(msg)
Line 292... Line 295...
292
        time.sleep(1)
295
        time.sleep(1)
293
        msg = self.waitForMsg('S')
296
        msg = self.waitForMsg('S')
Line 300... Line 303...
300
        return msg
303
        return msg
Line 301... Line 304...
301
   
304
   
302
    def getSettingsMsg(self, index=0xFF):
305
    def getSettingsMsg(self, index=0xFF):
303
        self.serPort.flushInput()
306
        self.serPort.flushInput()
304
        msg = MkMsg(address=MkComm.ADDRESS_FC, cmd='q', data=[index])
307
        msg = MkMsg(address=MkComm.ADDRESS_FC, cmd='q', data=[index])
305
        self.sendLn(msg.generateUartLine())
308
        self.sendMsg(msg)
306
        msg = self.waitForMsg('Q')
309
        msg = self.waitForMsg('Q')
307
        msg = SettingsMsg(msg)
310
        msg = SettingsMsg(msg)
Line 308... Line 311...
308
        return msg
311
        return msg
Line 313... Line 316...
313
        msg = VersionMsg(msg)
316
        msg = VersionMsg(msg)
314
        return msg
317
        return msg
Line 315... Line 318...
315
 
318
 
316
    def setMotorTest(self, motorSpeeds):
319
    def setMotorTest(self, motorSpeeds):
317
        msg = MkMsg(address=MkComm.ADDRESS_FC, cmd='t', data=motorSpeeds)
320
        msg = MkMsg(address=MkComm.ADDRESS_FC, cmd='t', data=motorSpeeds)
Line 318... Line 321...
318
        self.sendLn(msg.generateUartLine())
321
        self.sendMsg(msg)
319
       
322
       
320
    def doVibrationTest(self, nbSamples, channel):
323
    def doVibrationTest(self, nbSamples, channel):
321
        data = []
324
        data = []
322
        for i in range(0,(min(nbSamples,1000)/50)):
325
        for i in range(0,(min(nbSamples,1000)/50)):
323
          msg = MkMsg(address=MkComm.ADDRESS_FC, cmd='f', data=[channel, i])
326
          msg = MkMsg(address=MkComm.ADDRESS_FC, cmd='f', data=[channel, i])
324
          self.sendLn(msg.generateUartLine())
327
          self.sendMsg(msg)
325
          msg = self.waitForMsg('F')
328
          msg = self.waitForMsg('F')
Line 326... Line 329...
326
          msg = VibrationDataMsg(msg)
329
          msg = VibrationDataMsg(msg)
Line 331... Line 334...
331
        return data
334
        return data
Line 332... Line -...
332
   
-
 
333
 
-
 
334
 
335
   
335
 
336
 
336
 
337
 
337
 
338