示例#1
0
 def queneAdd(self):
     self.label_log.setText("发送中")
     for i in range(len(self.items)):
         if (self.JudgeValidator(self.items[i].text(1))):
             if (self.motoA.isChecked()):
                 self.sq.put(
                     protocol.de_convert([
                         'out', 'Motor_A', i + 1,
                         float(self.items[i].text(1))
                     ]))
             if (self.motoB.isChecked()):
                 self.sq.put(
                     protocol.de_convert([
                         'out', 'Motor_B', i + 1,
                         float(self.items[i].text(1))
                     ]))
             if (self.motoC.isChecked()):
                 self.sq.put(
                     protocol.de_convert([
                         'out', 'Motor_C', i + 1,
                         float(self.items[i].text(1))
                     ]))
             if (self.motoD.isChecked()):
                 self.sq.put(
                     protocol.de_convert([
                         'out', 'Motor_D', i + 1,
                         float(self.items[i].text(1))
                     ]))
             self.label_log.setText("请选择电机")
             if (self.motoA.isChecked() | self.motoB.isChecked()
                     | self.motoC.isChecked() | self.motoD.isChecked()):
                 self.label_log.setText("发送成功")
示例#2
0
    def stop_send(self):
        self.sq.put(protocol.de_convert('stop'))

        self.showtimer.stop()
        self.timeOn = False
        self.graphtimer.stop()

        for i in range(16):
            self.changeLight(i + 1, True)
示例#3
0
 def motor_stop(self):
     # 判断显示电机的参数
     item = self.comboBox_moto.currentText()
     # 判断显示电机的参数
     if item == 'MotoA':
         moto = 'Motor_A'
     elif item == 'MotoB':
         moto = 'Motor_B'
     elif item == 'MotoC':
         moto = 'Motor_C'
     else:
         moto = 'Motor_D'
     self.sq.put(protocol.de_convert(['stop', moto]))
示例#4
0
 def dataset(self):
     # 判断显示电机的参数
     item = self.comboBox_moto.currentText()
     # 判断显示电机的参数
     if item == 'MotoA':
         moto = 'Motor_A'
     elif item == 'MotoB':
         moto = 'Motor_B'
     elif item == 'MotoC':
         moto = 'Motor_C'
     else:
         moto = 'Motor_D'
     #母线
     if self.lineEdit_set1.isModified():
         self.sq.put(
             protocol.de_convert(
                 ['out', moto, 17,
                  float(self.lineEdit_set1.text())]))
     #转速
     if self.lineEdit_set2.isModified():
         self.sq.put(
             protocol.de_convert(
                 ['out', moto, 5,
                  float(self.lineEdit_set2.text())]))
示例#5
0
    def start_send(self):
        self.sq.put(protocol.de_convert('start'))
        self.point_x = 0
        if self.lineEdit.text():
            self.timebase = int(self.lineEdit.text())
            self.sq.put(
                protocol.de_convert(
                    ['time', 'Motor_A',
                     int(self.lineEdit.text())]))
        else:
            self.timebase = 10
            self.sq.put(protocol.de_convert(['time', 'Motor_A', 10]))

        #set show time and timeOn flag
        self.showtimer.start(self.timebase)
        self.showtimer.timeout.connect(self.showtime)
        self.timeOn = True

        for i in range(16):
            self.changeLight(i + 1, True)

        #set timer for drawing picture
        self.graphtimer.start(100)
        self.graphtimer.timeout.connect(self.animate)