Subversion Repositories Projects

Rev

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

Rev 556 Rev 564
Line 113... Line 113...
113
        if parVerbose:
113
        if parVerbose:
114
          print "Opening comPort... "
114
          print "Opening comPort... "
115
        mk = mkProto.MkComm()
115
        mk = mkProto.MkComm()
116
        mk.open(comPort=parComPort)
116
        mk.open(comPort=parComPort)
Line -... Line 117...
-
 
117
       
117
       
118
        time.sleep(.1)
118
        msg = mk.getVersionMsg()
119
        msg = mk.getVersionMsg()
119
        version = msg.getVersion()
120
        version = msg.getVersion()
120
        if parVerbose:
121
        if parVerbose:
121
          print "Version: %d.%d" % version
122
          print "Version: %d.%d" % version
Line 124... Line 125...
124
          sys.exit(2)
125
          sys.exit(2)
Line 125... Line 126...
125
         
126
         
126
         
127
         
127
        msg = mk.getDebugMsg()
128
        msg = mk.getDebugMsg()
128
        voltage = msg.getVoltage()
129
        voltage = msg.getVoltage()
129
        if (voltage > 4.2*3):
130
        if (voltage == 0):
-
 
131
          minVoltage = 0
-
 
132
        else:
-
 
133
          if (voltage > 4.2*3):
130
          minVoltage = 4*3.5
134
            minVoltage = 4*3.5
Line 131... Line 135...
131
        else:
135
          else:
132
          minVoltage = 3*3.5
136
            minVoltage = 3*3.5
133
 
137
 
Line 158... Line 162...
158
          for motor in parMotors:
162
          for motor in parMotors:
159
            motorSpeeds[motor-1] = speed
163
            motorSpeeds[motor-1] = speed
160
          for i in range(0,10):
164
          for i in range(0,10):
161
            time.sleep(.1)
165
            time.sleep(.1)
162
            mk.setMotorTest(motorSpeeds)
166
            mk.setMotorTest(motorSpeeds)
163
         
167
           
164
          for channel in parChannels:
168
          for channel in parChannels:
165
            channelName = CHANNEL_NAMES[channel]
169
            channelName = CHANNEL_NAMES[channel]
166
            if parVerbose:
170
            if parVerbose:
167
              print "Getting data... " ,
171
              print "Getting data... " ,
168
            data = mk.doVibrationTest(motorSpeeds, parNbSamples, channel)
172
            data = mk.doVibrationTest(motorSpeeds, parNbSamples, channel)
Line 175... Line 179...
175
            voltage = msg.getVoltage()
179
            voltage = msg.getVoltage()
Line 176... Line 180...
176
       
180
       
177
            if voltage<minVoltage:
181
            if voltage<minVoltage:
178
              print "VOLTAGE TOO LOW, TEST ABORTED"
182
              print "VOLTAGE TOO LOW, TEST ABORTED"
179
              sys.exit(2)
183
              sys.exit(2)
180
           
184
             
181
            pp = maxval-minval;  
185
            pp = maxval-minval;  
182
            print "%10s Speed=%3d U=%2.1fV Channel=%-10s Min=%3d Max=%3d pp=%3d" % (parTestName,  speed, voltage, channelName, minval, maxval, pp),
186
            print "%10s Speed=%3d U=%2.1fV Channel=%-10s Min=%3d Max=%3d pp=%3d" % (parTestName,  speed, voltage, channelName, minval, maxval, pp),
Line 183... Line 187...
183
            print "*"*(min(pp,200)/5)
187
            print "*"*(min(pp,200)/5)
Line 213... Line 217...
213
                  logfile.write("%s,%d\n" % (prevData[i], value))
217
                  logfile.write("%s,%d\n" % (prevData[i], value))
214
                  i += 1
218
                  i += 1
215
                logfile.close()
219
                logfile.close()
216
                if parVerbose:
220
                if parVerbose:
217
                  print "OK"
221
                  print "OK"
218
         
222
                 
-
 
223
        mk.close()
-
 
224
             
219
    except Exception,e:
225
    except Exception,e:
220
      print
226
      print
221
      print "== ERROR ==: \"%s\"" % e
227
      print "== ERROR ==: \"%s\"" % e
222
      if parVerbose:
228
      if parVerbose:
223
        print
229
        print
224
        print "Traceback:"
230
        print "Traceback:"
225
        traceback.print_exc()
231
        traceback.print_exc()
226
        print
232
        print
227
      raw_input("Press ENTER, the application will close")
233
      raw_input("Press ENTER, the application will close")
228
      print
-
 
229
234
      print
-
 
235
     
-
 
236
230
237