self.btn_connect_devinfo.released.connect( lambda:self.on_btn_connect(1))
self.btn_connect_curr.released.connect( lambda:self.on_btn_connect(2))
#self.btn_download.released.connect( lambda:self.on_btn_connect(3))
+ self.btn_connect_update.released.connect( lambda:self.on_btn_connect(3))
###self.cbx_debug.release
#self.cbx_debug.stateChanged.connect( lambda:self.on_cbx_debug() )
pass
def on_btn_connect( self, id ):
print( 'on btn connect', self.connected, id )
+ if id==3:
+ #read fw ver
+ if self.connected == 0:
+ if self.ser_open():
+ self.tx_cmd( 0x0000 ) #读取版本
+ self.ser_close()
+ return
if self.connected == 0:
if self.ser_open():
if self.tx_cmd( 0x0022, struct.pack( '>L', id )):
print( 'flag', flag )
self.label_fw_ver.setText( "%s V%d.%d"%( "APP"if flag == 0x41 else "BOOT", v_major, v_minor) )
self.lineEdit_uuid.setText( "%08X-%08X-%08X"%( id0, id1, id2 ))
+ self.label_fw_ver_2.setText( "%s V%d.%d"%( "APP"if flag == 0x41 else "BOOT", v_major, v_minor) )
+ self.lineEdit_uuid_2.setText( "%08X-%08X-%08X"%( id0, id1, id2 ))
elif cmd == 0x0024 and len(data)>=10000: #焊接电流原始信息实时上报
self.curr_raw_x = []
self.curr_raw_y = []
log_str = '<font color="#000000">' + str + '</font>'
else:
log_str = '<font color="#000000">' + str + '</font>'
- #self.update_log.append( log_str )
+ self.update_log.append( log_str )
if __name__ == "__main__":
app = QApplication(sys.argv) # 创建一个QApplication,也就是你要开发的软件app
</rect>
</property>
<property name="currentIndex">
- <number>1</number>
+ <number>2</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<property name="geometry">
<rect>
<x>10</x>
- <y>10</y>
+ <y>100</y>
<width>591</width>
<height>591</height>
</rect>
</property>
</widget>
</widget>
+ <widget class="QPushButton" name="btn_connect_update">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>30</y>
+ <width>71</width>
+ <height>61</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>连接</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QGroupBox" name="groupBox_5">
+ <property name="geometry">
+ <rect>
+ <x>100</x>
+ <y>30</y>
+ <width>501</width>
+ <height>61</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>GroupBox</string>
+ </property>
+ <widget class="QLabel" name="label_7">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>21</y>
+ <width>41</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>版本:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_fw_ver_2">
+ <property name="geometry">
+ <rect>
+ <x>70</x>
+ <y>20</y>
+ <width>61</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>V1.0</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_8">
+ <property name="geometry">
+ <rect>
+ <x>150</x>
+ <y>20</y>
+ <width>41</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>UUID:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="lineEdit_uuid_2">
+ <property name="geometry">
+ <rect>
+ <x>190</x>
+ <y>20</y>
+ <width>301</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>00000000-00000000-00000000</string>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </widget>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
//--------------------
#define APP_VER_MAJOR 2
-#define APP_VER_MINOR 1
+#define APP_VER_MINOR 2
#define VREF 2.5f
}else{
//500毫秒刷新 ui
int16_t curr_x10 = g_dev.welding_current*10;
- if( curr_x10 < 45 && curr_x10 > -45 ){ //改为按+-4.5A内显示0
+ if( curr_x10 < 100 && curr_x10 > -100 ){ //改为按+-10.0A内显示0
//传感器采样,未接负载显示 -0.5 到 -2 左右波动,
- //+3A 到 -3A在屏上暂时按 0A显示 避免影响用户体验
+ //+10A 到 -10A在屏上暂时按 0A显示 避免影响用户体验
curr_x10 = 0;
}
reg_values[0] = (uint16_t)curr_x10;
}else{
valve_bypass( 0 ); //旁路电磁阀关闭
//检查焊接电流,判断是否开始焊接
- if( welding_current < 5.0f ){
+ if( welding_current < 10.0f ){ //焊接电流大于10A 认为开始焊接,小于10A认为焊接停止。
//未开始焊接
//按比例阀开度设置电流, 最小0.7v 最大1.0v, 按开度百分比计算电流