</VariousControls>
</Aads>
<LDads>
- <umfTarg>1</umfTarg>
+ <umfTarg>0</umfTarg>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<noStLib>0</noStLib>
return
d = b''
if cfg == 1:
- #B6 read cfg, 节气因子4B,工艺4B,前气开度4B,流量计补偿值4B,流量计气体修正系数4B
+ #B6 read cfg, 节气因子4B,工艺4B,前气开度4B,流量计补偿值4B,流量计气体修正系数4B, 气路选择掉电保存
cmd = 0x00B7
- d = struct.pack( '>LLLlL',
+ d = struct.pack( '>LLLlLL',
#int(self.lineEdit_cfg_method.text()),
self.cb_cfg_method.currentIndex(),
int(self.lineEdit_cfg_factor.text()),
int(self.lineEdit_cfg_prev.text()),
100000, #填无效值
- 100000 #填无效值
+ 100000, #填无效值
+ 1 if self.cb_path_save.isChecked() else 0
)
print( "write cfg cmd:%04X"%cmd, d.hex())
elif cfg == 2:
cmd = 0x00B7
- d = struct.pack( '>LLLlL',
+ d = struct.pack( '>LLLlLL',
100000, #填无效值
100000, #填无效值
100000, #填无效值
int(self.lineEdit_flow_comp.text()),
#int(self.lineEdit_flow_coeff.text())
- gas_coefficient[ self.cb_flow_coeff.currentIndex()][1]
+ gas_coefficient[ self.cb_flow_coeff.currentIndex()][1],
+ 0xFFFFFFFF, #填无效值
)
elif cfg == 3:
cmd = 0x00B9
elif cmd == 0x00B6 and len(data)>=20: #参数读取
print( "B6 resp:", data.hex() )
#//节气因子4B,工艺4B,前气开度4B,流量计补偿值4B,流量计气体修正系数4B
- method, factor, prev, comp, coeff = struct.unpack( '>LLLlL', data )
+ method, factor, prev, comp, coeff, bypass_save = struct.unpack( '>LLLlLL', data )
#self.lineEdit_cfg_method.setText( "%d"%method )
self.lineEdit_cfg_factor.setText( "%d"%factor )
self.lineEdit_cfg_prev.setText( "%d"%prev )
if gas_coefficient[idx][1] == coeff:
self.cb_flow_coeff.setCurrentIndex(idx)
break
+ self.cb_path_save.setChecked( bypass_save == 1 )
elif cmd == 0x00B8 and len(data)>=128+16: #参数读取
print( "B8 resp:", data.hex() )
</rect>
</property>
<property name="currentIndex">
- <number>2</number>
+ <number>3</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
</property>
</item>
</widget>
+ <widget class="QCheckBox" name="cb_path_save">
+ <property name="geometry">
+ <rect>
+ <x>260</x>
+ <y>120</y>
+ <width>131</width>
+ <height>41</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>气路选择断电保存</string>
+ </property>
+ </widget>
</widget>
<widget class="QGroupBox" name="groupBox_12">
<property name="geometry">
<rect>
<x>20</x>
- <y>210</y>
+ <y>220</y>
<width>421</width>
<height>131</height>
</rect>
<property name="geometry">
<rect>
<x>20</x>
- <y>350</y>
+ <y>370</y>
<width>421</width>
<height>131</height>
</rect>
<property name="geometry">
<rect>
<x>20</x>
- <y>490</y>
+ <y>520</y>
<width>421</width>
<height>131</height>
</rect>
net_cfg_t net;
cal_t cal;
uint8_t remote_locked; //1:locked 远程锁定
+ uint8_t bypass_save; //1:bypass 断电保存, other:断电不保存
+ uint8_t bypass; //1:bypass, other:
uint8_t flag;
}dev_cfg_t;
osMutexId_t sflash_lock;
uint32_t welding_record_number; //焊接记录长度
- uint32_t ui_bypass;
+// uint32_t ui_bypass;
uint32_t welding_start; //1焊接中, 0:焊接未开始
uint32_t welding_time; //焊接持续时间
cfg->net.tcp_server[i] = 0;
}
}
+ if( cfg->bypass_save != 1){
+ cfg->bypass = 0;
+ }
+
// for( int i=0; i<sizeof(cfg->net.tcp_port); i++ ){
// if( cfg->net.tcp_port[i] <= 0x20 || cfg->net.tcp_port[i]>0x7f ){
// cfg->net.tcp_port[i] = 0;
case 0xB5: //焊接数据清0
break;
case 0xB6: //设备参数读取
- //工艺4B,节气因子4B,前气开度4B,流量计补偿值4B,流量计气体修正系数4B
+ //工艺4B,节气因子4B,前气开度4B,流量计补偿值4B,流量计气体修正系数4B, bypas断电保存 4B
put_u32_big( &resp[0], g_dev.cfg.welding_method );
put_u32_big( &resp[4], g_dev.cfg.save_gas_factor );
put_u32_big( &resp[8], g_dev.cfg.valve_open_default );
put_u32_big( &resp[12], g_dev.cfg.cal.flow_comp_x1000 );
put_u32_big( &resp[16], g_dev.cfg.cal.flow_coeff_x1000 );
- tx_n = wrap_resp_pkt( tx_pkt, pkt->cmd, resp, 20 );
+ put_u32_big( &resp[20], g_dev.cfg.bypass_save );
+ tx_n = wrap_resp_pkt( tx_pkt, pkt->cmd, resp, 24 );
break;
case 0xB7: //设备参数写入
- //工艺4B,节气因子4B,前气开度4B,流量计补偿值4B,流量计气体修正系数4B
+ //工艺4B,节气因子4B,前气开度4B,流量计补偿值4B,流量计气体修正系数4B, bypas断电保存 4B
{
uint32_t method = get_u32_big( &pkt->pdata[0] );
uint32_t factor = get_u32_big( &pkt->pdata[4] );
uint32_t valve_open = get_u32_big( &pkt->pdata[8] );
int32_t comp = get_u32_big( &pkt->pdata[12] );
uint32_t coeff = get_u32_big( &pkt->pdata[16] );
+ uint32_t bypass_save = get_u32_big( &pkt->pdata[20] );
if( factor >=2 && factor <= 30 )
g_dev.cfg.save_gas_factor = factor;
g_dev.cfg.cal.flow_comp_x1000 = comp;
if(coeff == 0 ||( coeff >100 && coeff < 3000 ) )
g_dev.cfg.cal.flow_coeff_x1000 = coeff;
+ if( bypass_save == 1 || bypass_save == 0 )
+ g_dev.cfg.bypass_save = bypass_save;
dev_cfg_store( &g_dev.cfg );
ui_cfg_remote_update();
put_u32_big( &resp[8], g_dev.cfg.valve_open_default );
put_u32_big( &resp[12], g_dev.cfg.cal.flow_comp_x1000 );
put_u32_big( &resp[16], g_dev.cfg.cal.flow_coeff_x1000 );
- tx_n = wrap_resp_pkt( tx_pkt, pkt->cmd, resp, 20 );
+ put_u32_big( &resp[20], g_dev.cfg.bypass_save );
+ tx_n = wrap_resp_pkt( tx_pkt, pkt->cmd, resp, 24 );
break;
}
case 0xB8: //WIFI参数读取
}
}else if( ctrl_addr == lcd_valve_bypass_addr ){//比例阀旁路
uint8_t bypass = ctrl_value;
- g_dev.ui_bypass = bypass;
+ //g_dev.ui_bypass = bypass;
+ g_dev.cfg.bypass = bypass;
+ dev_cfg_store( &g_dev.cfg );
}else if( ctrl_addr == lcd_wifi_config_addr ){ //点击配置按钮
lcd_read( lcd_wifi_ssid_addr, lcd_net_cfg_size/2 );
}else if( ctrl_addr == lcd_flow_cal_start_addr ){ //点击流量校准按钮
void lcd_update_cfg( void )
{
char port_str[8];
- uint16_t reg_values[3];
+ uint16_t reg_values[4];
reg_values[0] = g_dev.cfg.welding_method+1;
reg_values[1] = g_dev.cfg.save_gas_factor;
reg_values[2] = g_dev.cfg.valve_open_default;
- lcd_write( lcd_welding_method_addr, reg_values, 3 );
+ reg_values[3] = g_dev.cfg.bypass;
+ lcd_write( lcd_welding_method_addr, reg_values, 4 );
osDelay(10 );
lcd_write_text( lcd_wifi_ssid_addr, (uint8_t*)&g_dev.cfg.net.wifi_ssid, lcd_wifi_ssid_size );
reg_values[4] = g_dev.cfg.welding_method+1;
reg_values[5] = g_dev.cfg.save_gas_factor;
reg_values[6] = g_dev.cfg.valve_open_default;
- lcd_write( lcd_welding_current_addr, reg_values, 7 );
+ reg_values[7] = g_dev.cfg.bypass==1?1:0;
+ lcd_write( lcd_welding_current_addr, reg_values, 8 );
osDelay(10 );
lcd_write_text( lcd_wifi_ssid_addr, (uint8_t*)&g_dev.cfg.net.wifi_ssid, lcd_wifi_ssid_size );
osDelay(10 );
g_dev.state &= ~(TEMP_ERR);
}
#endif
- if( !bypass && (g_dev.ui_bypass || tem_err_state ) ){
+ if( !bypass && (g_dev.cfg.bypass || tem_err_state ) ){
//屏上点击旁路或温度故障,开启旁路
bypass = 1;
- }else if( bypass && !g_dev.ui_bypass && !tem_err_state ){
+ }else if( bypass && !g_dev.cfg.bypass && !tem_err_state ){
//恢复正常,关闭旁路
bypass = 0;
}