def ok_callback(self): try: from g_settings import mc, debug_window print "trying to connect to {}".format(self.ports[self.comboBox.currentIndex()][0]) ser = serial.Serial(self.ports[self.comboBox.currentIndex()][0],115200,timeout=None) mc.uC = ser debug_window.debug_output("connected to the arduino") self.time_to_close() except serial.serialutil.SerialException: debug_window.debug_output("Could not connect to the selected Port")
def reset_all_values(self): self.comboBox.setCurrentIndex(1) self.comboBox_2.setCurrentIndex(3) self.comboBox_3.setCurrentIndex(0) self.spinBox.setValue(255) self.spinBox_2.setValue(48) self.spinBox_3.setValue(128) self.spinBox_4.setValue(16) self.comboBox_4.setCurrentIndex(0) self.comboBox_5.setCurrentIndex(1) self.comboBox_6.setCurrentIndex(1) self.comboBox_7.setCurrentIndex(2) self.comboBox_19.setCurrentIndex(2) self.comboBox_9.setCurrentIndex(3) self.comboBox_10.setCurrentIndex(3) from g_settings import debug_window debug_window.debug_output("Resetting all of the values")
def send_all_values(self): from g_settings import debug_window, mc debug_window.debug_output("SENDING ALL OF THE VALUES") debug_window.debug_output("CONTROL TAB: {}".format(self.get_ctrl_tab_data())) debug_window.debug_output("TORQUE TAB: {}".format(self.get_torque_tab_data())) debug_window.debug_output("OFF TAB: {}".format(self.get_off_tab_data())) debug_window.debug_output("BLANK TAB: {}".format(self.get_blank_tab_data())) debug_window.debug_output("DECAY TAB: {}".format(self.get_decay_tab_data())) debug_window.debug_output("DRIVE TAB: {}".format(self.get_drive_tab_data())) sts = "" ctrl = self.get_ctrl_tab_data() sts += "{},{},{}".format(int(str(ctrl[0]), base=2), int(str(ctrl[1]), base=2), int(str(ctrl[2]), base=2)) sts += ",{}".format(self.get_torque_tab_data()) # fine being 8 bit number sts += ",{}".format(self.get_off_tab_data()) # fine being 8 bit number sts += ",{}".format(self.get_blank_tab_data()) # fine being 8 bit number decay = self.get_decay_tab_data() sts += ",{},{}".format(int(decay[0]), # fine being 8 bit number int(str(decay[1]), base=2)) drive = self.get_drive_tab_data() sts += ",{},{},{},{},{},{}".format( int(str(drive[0]), base=2), int(str(drive[1]), base=2), int(str(drive[2]), base=2), int(str(drive[3]), base=2), int(str(drive[4]), base=2), int(str(drive[5]), base=2)) debug_window.debug_output(sts) mc.send_string("D{}".format(sts))