V2.2
authorkyz <kyz@kyz.pub>
Sun, 24 Mar 2024 06:01:46 +0000 (14:01 +0800)
committerkyz <kyz@kyz.pub>
Sun, 24 Mar 2024 06:01:46 +0000 (14:01 +0800)
1.焊接电流按正负10A判断, 范围内认为焊接未开始,LCD显示电流为0
2.固件下载工具功能优化

tools_v2/test.py
tools_v2/test.ui
user/user.h
user/user_ui.c
user/user_valve_ctrl.c

index 95e49f853c74879e47c25c1ad181ee37a42fd9d1..ff11d207c95c777c05a9d8a81d2bcafa59fef356 100644 (file)
@@ -53,6 +53,7 @@ class App( QDialog, ui_welding.Ui_Dialog ):
         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() )
@@ -246,6 +247,13 @@ class App( QDialog, ui_welding.Ui_Dialog ):
         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 )):
@@ -335,6 +343,8 @@ class App( QDialog, ui_welding.Ui_Dialog ):
            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 = []
@@ -496,7 +506,7 @@ class App( QDialog, ui_welding.Ui_Dialog ):
             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
index 4612d152893f1fac61cf2af42c566da94bf62ba4..94e5fd357a7c97f27f71ce9de7e5959d9877f75c 100644 (file)
      </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">
index a60ed21e26049cab01711f9453672421a67fbdff..2d966d1d397d1ad214bb2b904448598a66d17f37 100644 (file)
@@ -26,7 +26,7 @@
 //--------------------
 
 #define APP_VER_MAJOR 2
-#define APP_VER_MINOR 1
+#define APP_VER_MINOR 2
 
 #define VREF  2.5f
 
index 633f7a24fa10dbd7666816762bc75de9cb11fca2..a85facd9428626859da2df326ca9fbde4ce57df6 100644 (file)
@@ -356,9 +356,9 @@ void user_ui_task( void* unused )
         }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;
index b98422065fbedfd3df83f1ae09f7c5b78f9a8e35..4a3fc59eefad35500ec4242315db1201812eca2e 100644 (file)
@@ -504,7 +504,7 @@ void user_valve_ctrl_task( void* unused )
         }else{
             valve_bypass( 0 );           //旁路电磁阀关闭
             //检查焊接电流,判断是否开始焊接
-            if( welding_current < 5.0f ){
+            if( welding_current < 10.0f ){  //焊接电流大于10A 认为开始焊接,小于10A认为焊接停止。
                 //未开始焊接
 
                 //按比例阀开度设置电流, 最小0.7v  最大1.0v, 按开度百分比计算电流