def __init__( self ):
super().__init__()
self.setupUi(self)
- self.setWindowTitle( u"焊接控制器调试工具 V0.10")
+ self.setWindowTitle( u"焊接控制器调试工具 V1.0")
self.trigger_rx_pkt.connect( self.on_rx_pkt )
self.trigger_ctrl_write.connect( self.on_ctrl_write_signal )
#self.btn_download.released.connect( lambda:self.on_btn_connect(3))
self.btn_connect_update.released.connect( lambda:self.on_btn_connect(3))
+ self.cb_debug_valve_curr.stateChanged.connect( self.on_cb_debug_valve_curr )
+ self.btn_debug_valve_curr.released.connect( self.on_btn_debug_write )
+ self.btn_debug_valve_curr.setEnabled(0)
+ self.slider_debug_valve_curr.valueChanged.connect( lambda value:self.line_debug_valve_curr.setText( str(value) ))
+ self.slider_debug_welding_curr.valueChanged.connect( lambda value:self.lineEdit_debug_value.setText( str(value) ))
###self.cbx_debug.release
#self.cbx_debug.stateChanged.connect( lambda:self.on_cbx_debug() )
self.cb_weld_curr_debug.stateChanged.connect( self.on_cb_weld_curr_debug )
self.close_debug_mode()
self.btn_debug_write.setEnabled(0)
self.debug_mode = 0
+
+ def on_cb_debug_valve_curr(self):
+ if self.cb_debug_valve_curr.isChecked():
+ self.btn_debug_valve_curr.setEnabled(1)
+ self.debug_mode = 2
+ else:
+ self.close_debug_mode()
+ self.btn_debug_valve_curr.setEnabled(0)
+ self.debug_mode = 0
+ self.btn_debug_valve_curr.setStyleSheet( "background-color: green" if self.debug_mode==2 else "background-color: lightgray" )
+
def on_btn_debug_write( self ):
if self.ser_opened:
- curr = int( self.lineEdit_debug_value.text() )
- print( 'curr', curr, 'debug_mode', self.debug_mode )
if self.debug_mode == 1:
+ curr = int( self.lineEdit_debug_value.text() )
+ print( 'tx welding curr', curr, 'debug_mode', self.debug_mode )
cmd = self.wrap_welding_curr_pkt( curr )
self.ser.write( cmd )
elif self.debug_mode == 2:
- cmd = self.wrap_valve_curr_pkt( curr )
- self.ser.write( cmd )
+ curr_ma = int( self.line_debug_valve_curr.text() )
+ if curr_ma >= 0 and curr_ma <= 200:
+ print( 'tx valve curr', curr_ma, 'mA, debug_mode', self.debug_mode )
+ cmd = self.wrap_valve_curr_pkt( curr_ma )
+ self.ser.write( cmd )
def on_table_select( self, index ):
print( "on table select ", index )
<rect>
<x>0</x>
<y>0</y>
- <width>1352</width>
+ <width>1333</width>
<height>862</height>
</rect>
</property>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
- <string>Tab 1</string>
+ <string>设备状态</string>
</attribute>
<widget class="QFrame" name="frame_curr">
<property name="geometry">
<string>80</string>
</property>
</widget>
- <widget class="QSlider" name="horizontalSlider">
+ <widget class="QSlider" name="slider_debug_welding_curr">
<property name="geometry">
<rect>
<x>230</x>
<height>31</height>
</rect>
</property>
+ <property name="maximum">
+ <number>600</number>
+ </property>
+ <property name="pageStep">
+ <number>10</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<rect>
<x>90</x>
<y>0</y>
- <width>441</width>
+ <width>381</width>
<height>61</height>
</rect>
</property>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
- <string>Tab 2</string>
+ <string>焊接电流调试</string>
</attribute>
<widget class="QFrame" name="frame_curr_raw">
<property name="geometry">
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
- <string>页</string>
+ <string>固件更新</string>
</attribute>
<widget class="QGroupBox" name="groupBox_3">
<property name="geometry">
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
- <string>页</string>
+ <string>参数</string>
</attribute>
<widget class="QPushButton" name="btn_debug_write_2">
<property name="geometry">
</rect>
</property>
<property name="text">
- <string>99.9</string>
+ <string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<x>490</x>
<y>40</y>
<width>421</width>
- <height>131</height>
+ <height>91</height>
</rect>
</property>
<property name="title">
<property name="geometry">
<rect>
<x>10</x>
- <y>60</y>
+ <y>30</y>
<width>71</width>
<height>31</height>
</rect>
<property name="geometry">
<rect>
<x>90</x>
- <y>60</y>
+ <y>30</y>
<width>141</width>
<height>31</height>
</rect>
<property name="geometry">
<rect>
<x>330</x>
- <y>40</y>
+ <y>10</y>
<width>81</width>
<height>71</height>
</rect>
<property name="geometry">
<rect>
<x>250</x>
- <y>40</y>
+ <y>10</y>
<width>81</width>
<height>71</height>
</rect>
<property name="geometry">
<rect>
<x>490</x>
- <y>190</y>
+ <y>140</y>
<width>421</width>
- <height>131</height>
+ <height>91</height>
</rect>
</property>
<property name="title">
<property name="geometry">
<rect>
<x>10</x>
- <y>60</y>
+ <y>30</y>
<width>71</width>
<height>31</height>
</rect>
<property name="geometry">
<rect>
<x>90</x>
- <y>60</y>
+ <y>30</y>
<width>141</width>
<height>31</height>
</rect>
<property name="geometry">
<rect>
<x>330</x>
- <y>40</y>
+ <y>10</y>
<width>81</width>
<height>71</height>
</rect>
<property name="geometry">
<rect>
<x>250</x>
- <y>40</y>
+ <y>10</y>
<width>81</width>
<height>71</height>
</rect>
<property name="geometry">
<rect>
<x>490</x>
- <y>340</y>
+ <y>240</y>
<width>421</width>
- <height>151</height>
+ <height>111</height>
</rect>
</property>
<property name="title">
<property name="geometry">
<rect>
<x>20</x>
- <y>90</y>
+ <y>70</y>
<width>51</width>
<height>31</height>
</rect>
<property name="geometry">
<rect>
<x>20</x>
- <y>40</y>
+ <y>20</y>
<width>71</width>
<height>31</height>
</rect>
<property name="geometry">
<rect>
<x>330</x>
- <y>40</y>
+ <y>20</y>
<width>81</width>
<height>71</height>
</rect>
<property name="geometry">
<rect>
<x>250</x>
- <y>40</y>
+ <y>20</y>
<width>81</width>
<height>71</height>
</rect>
<property name="geometry">
<rect>
<x>100</x>
- <y>40</y>
+ <y>20</y>
<width>131</width>
<height>31</height>
</rect>
<property name="geometry">
<rect>
<x>100</x>
- <y>90</y>
+ <y>70</y>
<width>131</width>
<height>31</height>
</rect>
<property name="geometry">
<rect>
<x>490</x>
- <y>510</y>
+ <y>360</y>
<width>421</width>
- <height>151</height>
+ <height>111</height>
</rect>
</property>
<property name="title">
<property name="geometry">
<rect>
<x>330</x>
- <y>40</y>
+ <y>30</y>
<width>81</width>
<height>71</height>
</rect>
<property name="geometry">
<rect>
<x>250</x>
- <y>40</y>
+ <y>30</y>
<width>81</width>
<height>71</height>
</rect>
<property name="geometry">
<rect>
<x>120</x>
- <y>80</y>
+ <y>70</y>
<width>111</width>
<height>31</height>
</rect>
<property name="geometry">
<rect>
<x>10</x>
- <y>30</y>
+ <y>20</y>
<width>131</width>
<height>31</height>
</rect>
<property name="geometry">
<rect>
<x>140</x>
- <y>30</y>
+ <y>20</y>
<width>101</width>
<height>31</height>
</rect>
<property name="geometry">
<rect>
<x>490</x>
- <y>670</y>
+ <y>470</y>
<width>421</width>
<height>61</height>
</rect>
<widget class="QGroupBox" name="groupBox_25">
<property name="geometry">
<rect>
- <x>20</x>
- <y>660</y>
+ <x>490</x>
+ <y>540</y>
<width>421</width>
<height>101</height>
</rect>
</widget>
<widget class="QWidget" name="tab_9">
<attribute name="title">
- <string>页</string>
+ <string>在线操作</string>
</attribute>
<widget class="QGroupBox" name="groupBox_20">
<property name="geometry">
</property>
</widget>
</widget>
+ <widget class="QGroupBox" name="groupBox_debug_valve_curr">
+ <property name="geometry">
+ <rect>
+ <x>290</x>
+ <y>30</y>
+ <width>231</width>
+ <height>201</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>控制电流调试</string>
+ </property>
+ <widget class="QPushButton" name="btn_debug_valve_curr">
+ <property name="geometry">
+ <rect>
+ <x>150</x>
+ <y>10</y>
+ <width>71</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>写入</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="line_debug_valve_curr">
+ <property name="geometry">
+ <rect>
+ <x>80</x>
+ <y>20</y>
+ <width>41</width>
+ <height>41</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>200</string>
+ </property>
+ </widget>
+ <widget class="QSlider" name="slider_debug_valve_curr">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>70</y>
+ <width>211</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>200</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_debug_curr_unit_4">
+ <property name="geometry">
+ <rect>
+ <x>130</x>
+ <y>20</y>
+ <width>21</width>
+ <height>41</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>mA</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" name="cb_debug_valve_curr">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>20</y>
+ <width>51</width>
+ <height>41</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>启用</string>
+ </property>
+ </widget>
+ </widget>
</widget>
<widget class="QWidget" name="tab_10">
<attribute name="title">
#define HW_V3 3
#define HW_V4 4
+#define REPORT_POWER_ON_TOTAL_TIME 0 //统计和报告开机总时长
+
#define WELDING_START_CURRENT 15.0f //15A为启动电流
#define VOL 0.01f
//调试功能
uint32_t debug_report; //主动上报数据, 0:关闭, 1:上报控制信息, 2:上报焊接电流信息
- uint32_t debug_curr; //模拟数据, 0:关闭, 1:模拟焊接电流
+ uint32_t debug_curr; //模拟数据, 0:关闭, 1:模拟焊接电流, 2,比例阀控制电流调试输出
float debug_welding_curr; //模拟焊接电流 A
uint32_t wifi_connected; //0:disconnect, 1:wifi connected, 2:tcp connected
uint32_t offline_secs; //offline time; 没有rtc电池,计算的离线累计通电时间,1分钟保存一次
uint32_t offline_locked; //0:unlocked, 1:locked
+
+ float debug_valve_curr; //0--0.2A 调试输出比例阀输出电流
}dev_info_t;
extern TIM_HandleTypeDef htim2; //htim2 用于触发DMA ADC采集
}
}
-void device_poweron_total_time_update( uint32_t secs ){
+void device_poweron_total_time_update( uint32_t secs )
+{
+#if REPORT_POWER_ON_TOTAL_TIME
static int n = 0;
static int welding = 0;
n++;
n = 0;
lfs_store_all_time(g_dev.all_time_total);
}
+#endif //REPORT_POWER_ON_TOTAL_TIME
}
\ No newline at end of file
g_dev.debug_curr = 1;
break;
case 0x00f2:
- //写比例阀控制电流, 取消
- //g_dev.debug_valve_curr = get_u32_big( pkt->pdata )/1000.0f;
- //g_dev.debug_curr = 2;
+ //写比例阀控制电流
+ g_dev.debug_valve_curr = get_u32_big( pkt->pdata )/1000.0f;
+ g_dev.debug_curr = 2;
break;
case 0x0022:
if( pkt->data_len >=4 ){
uint32_t lfs_load_all_time(void)
{
uint32_t secs = 0;
+#if REPORT_POWER_ON_TOTAL_TIME
if( user_lfs_read( ALL_TIME_PATH, (uint8_t*)&secs, sizeof( secs ) ) == sizeof( secs ) ){
}
+#endif
return secs;
}
}
}
+#if 1
+ //"调试比例阀驱动电流调节"
+ if( g_dev.debug_curr == 2 ){
+ g_dev.valve_curr_out = g_dev.debug_valve_curr;
+ }
+#endif
//更新比例阀驱动电流
user_valve_set_current( g_dev.valve_curr_out );