package com.dev.fbs9600_mon;
|
|
import javax.swing.JPanel;
|
|
import java.awt.BorderLayout;
|
import java.awt.GridLayout;
|
|
import javax.swing.border.TitledBorder;
|
import javax.swing.border.EtchedBorder;
|
import javax.swing.filechooser.FileFilter;
|
|
import java.awt.Color;
|
import java.awt.FlowLayout;
|
|
import javax.swing.JTextField;
|
|
import java.awt.Font;
|
import java.util.Date;
|
|
import javax.swing.JComboBox;
|
import javax.swing.DefaultComboBoxModel;
|
import javax.swing.JButton;
|
import javax.swing.JFileChooser;
|
import javax.swing.JOptionPane;
|
import javax.swing.UIManager;
|
import javax.swing.JCheckBox;
|
|
import com.Com;
|
import com.LimitedDocument;
|
import java.awt.event.ActionListener;
|
import java.awt.event.ActionEvent;
|
import java.io.File;
|
import java.io.FileWriter;
|
import java.io.IOException;
|
import java.io.PrintWriter;
|
|
import javax.swing.SwingConstants;
|
import javax.swing.JTabbedPane;
|
|
import org.apache.logging.log4j.Logger;
|
|
import main.page_debug_inf;
|
import main.page_dfu;
|
|
public class module_mon_page extends JPanel {
|
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
public SPCommMon Comm_Mon = null;
|
public static final float BattResLowLimit = (float) 0.95;
|
public static final float BattResHighLimit = (float) 1.05;
|
public String mLastTestID = "";
|
public boolean MonVol_Is_Adj = false;
|
public boolean MonRes_Is_Test = false;
|
public boolean MonBianHao_Is_Test = false;
|
|
private JTextField tf_addr;
|
private JTextField tf_version;
|
private JTextField tf_moscurr;
|
private JTextField tf_lockbit;
|
private JTextField tf_ssb;
|
private JTextField tf_junheng_curr;
|
private JTextField tf_vol;
|
JComboBox<String> cb_voltype;
|
private JTextField tf_vol_offset_cal;
|
private JTextField tf_vol_slope_cal;
|
private JTextField tf_tmp;
|
private JTextField tf_temp_cal;
|
private JTextField tf_junheng_volset;
|
private JTextField tf_BianHaoTest;
|
private JTextField tf_res;
|
private JTextField tf_res_conn;
|
private JTextField tf_rescurr;
|
private JTextField tf_res_lubo_asys_code;
|
JComboBox<String> cb_restype;
|
private JTextField tf_res_cal;
|
private JTextField tf_id;
|
private JTextField tf_code_mask;
|
private JTextField tf_test_man_name;
|
private JTextField tf_record_test_file;
|
private JTextField tf_save_test_notice;
|
JCheckBox ckb_res_gbtest;
|
|
private JButton btn_save_test_data;
|
private JButton btn_open_record_file;
|
private JButton btn_vol_offset_cal;
|
private JButton btn_vol_slope_cal;
|
private JButton btn_vol_cal_rst;
|
private JButton btn_temp_cal;
|
private JButton btn_temp_cal_rst;
|
private JButton btn_junheng_volset;
|
private JButton btn_BianHaoTest;
|
private JButton btn_start_res;
|
private JButton btn_start_res_2s;
|
private JButton btn_res_cal;
|
private JButton btn_res_cal_rst;
|
private JTabbedPane tabbedPane;
|
|
private page_dfu panel_mon_dfu;
|
private mon_page_bianhao panel_mon_bianhao;
|
private page_debug_inf panel_mon_debug;
|
private JButton btn_tow_cal;
|
private JPanel panel_36;
|
private JTextField textField_2p_param;
|
private double test_vol_1 = 0, test_vol_2 = 0;
|
private double real_vol_1 = 0, real_vol_2 = 0;
|
private int mon_param_offset = 0;
|
private int mon_param_slope = 0;
|
//private int mon_cal_step = 0;
|
|
/**
|
* Create the panel.
|
*/
|
public module_mon_page() {
|
setLayout(new BorderLayout(0, 0));
|
|
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
add(tabbedPane, BorderLayout.CENTER);
|
|
JPanel panel = new JPanel();
|
tabbedPane.addTab("\u57FA\u672C\u6D4B\u8BD5", null, panel, null);
|
panel.setLayout(new GridLayout(5, 0, 0, 0));
|
|
JPanel panel_1 = new JPanel();
|
panel_1.setBorder(new TitledBorder(null, "\u8C03\u8BD5\u8BB0\u5F55", TitledBorder.LEADING, TitledBorder.TOP, null, null));
|
panel.add(panel_1);
|
panel_1.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
|
JPanel panel_3 = new JPanel();
|
panel_3.setBorder(null);
|
panel_1.add(panel_3);
|
panel_3.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
|
JPanel panel_30 = new JPanel();
|
panel_30.setBorder(new TitledBorder(null, "\u6761\u7801\u8F93\u5165", TitledBorder.LEADING, TitledBorder.TOP, null, null));
|
panel_3.add(panel_30);
|
panel_30.setLayout(new BorderLayout(0, 0));
|
|
tf_id = new JTextField();
|
panel_30.add(tf_id, BorderLayout.NORTH);
|
tf_id.setColumns(10);
|
|
JPanel panel_31 = new JPanel();
|
panel_31.setBorder(new TitledBorder(null, "\u6761\u7801\u5F15\u5BFC", TitledBorder.LEADING, TitledBorder.TOP, null, null));
|
panel_3.add(panel_31);
|
panel_31.setLayout(new BorderLayout(0, 0));
|
|
tf_code_mask = new JTextField();
|
panel_31.add(tf_code_mask, BorderLayout.NORTH);
|
tf_code_mask.setColumns(6);
|
|
JPanel panel_34 = new JPanel();
|
panel_34.setBorder(new TitledBorder(null, "\u5B58\u50A8\u7ED3\u679C", TitledBorder.LEADING, TitledBorder.TOP, null, null));
|
panel_3.add(panel_34);
|
panel_34.setLayout(new BorderLayout(0, 0));
|
|
tf_save_test_notice = new JTextField();
|
panel_34.add(tf_save_test_notice, BorderLayout.NORTH);
|
tf_save_test_notice.setColumns(6);
|
|
JPanel panel_32 = new JPanel();
|
panel_32.setBorder(new TitledBorder(null, "\u8C03\u8BD5\u4EBA", TitledBorder.LEADING, TitledBorder.TOP, null, null));
|
panel_3.add(panel_32);
|
panel_32.setLayout(new BorderLayout(0, 0));
|
|
tf_test_man_name = new JTextField();
|
panel_32.add(tf_test_man_name, BorderLayout.NORTH);
|
tf_test_man_name.setColumns(6);
|
|
JPanel panel_33 = new JPanel();
|
panel_33.setBorder(new TitledBorder(null, "\u5B58\u50A8", TitledBorder.LEADING, TitledBorder.TOP, null, null));
|
panel_3.add(panel_33);
|
|
btn_save_test_data = new JButton("\u5B58\u50A8");
|
btn_save_test_data.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_save_test_data.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent arg0) {
|
if(tf_id.getText().trim().length() < 3) {
|
JOptionPane.showMessageDialog(null, "ÌõÐÎÂëIDδÊäÈë!");
|
tf_id.grabFocus();
|
return;
|
}
|
|
if(mLastTestID.equals(tf_id.getText().trim())) {
|
JOptionPane.showMessageDialog(null, "IDΪ " + mLastTestID + " µÄ¼Ç¼ÒѾ´æÔÚ!");
|
tf_id.grabFocus();
|
return;
|
}
|
|
if(tf_test_man_name.getText().trim().length() < 1) {
|
JOptionPane.showMessageDialog(null, "µ÷ÊÔÈËδÌîд, ÇëÌîдµ÷ÊÔÈËÐÕÃû!");
|
tf_test_man_name.grabFocus();
|
return;
|
}
|
|
if(false == MonVol_Is_Adj) {
|
JOptionPane.showMessageDialog(null, "µçѹδУ׼, ½ûÖ¹´æ´¢!");
|
return;
|
}
|
if(false == MonRes_Is_Test) {
|
JOptionPane.showMessageDialog(null, "ÄÚ×èδ²âÊÔ, ½ûÖ¹´æ´¢!");
|
return;
|
}
|
if(false == MonBianHao_Is_Test) {
|
JOptionPane.showMessageDialog(null, "±àºÅδ²âÊÔ, ½ûÖ¹´æ´¢!");
|
return;
|
}
|
|
String file_name = tf_record_test_file.getText().trim();
|
if((0 == file_name.length()) || (false == file_name.contains(".csv"))){
|
JOptionPane.showMessageDialog(null, "´æ´¢ÎļþδѡÔñ, ÇëÑ¡ÔñÒ»¸öÒѾ½¨Á¢ºÃµÄºó׺ÃûΪ.csvµÄÎļþ!");
|
return;
|
}
|
|
String str_save = tf_id.getText();
|
str_save += "," + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
str_save += "," + tf_test_man_name.getText();
|
str_save += "," + tf_addr.getText();
|
str_save += "," + tf_version.getText();
|
str_save += "," + cb_voltype.getSelectedItem().toString();
|
str_save += "," + tf_moscurr.getText();
|
str_save += "," + tf_lockbit.getText();
|
str_save += "," + tf_ssb.getText();
|
str_save += "," + tf_junheng_curr.getText();
|
str_save += "," + tf_vol.getText();
|
str_save += "," + tf_vol_offset_cal.getText();
|
str_save += "," + tf_vol_slope_cal.getText();
|
str_save += "," + tf_tmp.getText();
|
str_save += "," + tf_temp_cal.getText();
|
str_save += "," + tf_res.getText();
|
str_save += "," + tf_res_conn.getText();
|
str_save += "," + tf_rescurr.getText();
|
str_save += "," + cb_restype.getSelectedItem().toString();
|
str_save += "," + tf_res_cal.getText();
|
|
int res_ref = 0;
|
if(tf_res_cal.getText().trim().length() > 0) {
|
res_ref = Integer.parseInt(tf_res_cal.getText().trim());
|
}
|
|
String res_res = ",ÄÚ×è²»ºÏ¸ñ";
|
if((res_ref > 0) && (Comm_Mon.dt_res > 0)) {
|
if((Math.abs(res_ref-Comm_Mon.dt_res)*100 / res_ref) < 5) {
|
res_res = ",ÄÚ×èºÏ¸ñ";
|
}
|
}
|
str_save += res_res;
|
|
String bianhao_res = "," + Comm_Mon.getBianHaoTest_Str();
|
str_save += bianhao_res;
|
|
FileWriter fw = null;
|
try {
|
//Èç¹ûÎļþ´æÔÚ£¬Ôò×·¼ÓÄÚÈÝ£»Èç¹ûÎļþ²»´æÔÚ£¬Ôò´´½¨Îļþ
|
File f = new File(tf_record_test_file.getText());
|
fw = new FileWriter(f, true);
|
|
PrintWriter pw = new PrintWriter(fw);
|
pw.println(str_save);
|
pw.flush();
|
|
fw.flush();
|
pw.close();
|
fw.close();
|
|
btn_save_test_data.setEnabled(false);
|
tf_save_test_notice.setText("´æ´¢³É¹¦");
|
mLastTestID = tf_id.getText();
|
tf_id.setText("");
|
} catch (IOException e) {
|
e.printStackTrace();
|
JOptionPane.showMessageDialog(null, "ÎļþÕýÔÚʹÓÃÖлòÒì³£: " + e.getMessage());
|
}
|
|
//System.out.println(str_save);
|
tf_id.grabFocus();
|
}
|
});
|
panel_33.setLayout(new BorderLayout(0, 0));
|
panel_33.add(btn_save_test_data, BorderLayout.NORTH);
|
|
JPanel panel_4 = new JPanel();
|
panel_4.setBorder(new TitledBorder(null, "\u8BB0\u5F55\u6587\u4EF6", TitledBorder.LEADING, TitledBorder.TOP, null, null));
|
panel_1.add(panel_4);
|
panel_4.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
|
|
tf_record_test_file = new JTextField();
|
panel_4.add(tf_record_test_file);
|
tf_record_test_file.setColumns(24);
|
|
JPanel panel_35 = new JPanel();
|
panel_4.add(panel_35);
|
panel_35.setLayout(new GridLayout(0, 2, 0, 0));
|
|
JCheckBox ckb_check_moduel_fn = new JCheckBox("\u7B5B\u9009");
|
panel_35.add(ckb_check_moduel_fn);
|
|
btn_open_record_file = new JButton("\u9009\u62E9");
|
btn_open_record_file.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
panel_35.add(btn_open_record_file);
|
btn_open_record_file.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
JFileChooser fc_file_parseDir = new JFileChooser();
|
fc_file_parseDir.setFileFilter(new FileFilter() {
|
@Override
|
public boolean accept(File f) {
|
if (f.isDirectory())
|
return true;
|
|
return (f.getName().toUpperCase().endsWith(".CSV"));
|
}
|
|
@Override
|
public String getDescription() {
|
return "*.CSV";
|
}
|
});
|
|
fc_file_parseDir.setDialogTitle("´ò¿ªµ÷ÊԼǼÎļþ!");
|
if(JFileChooser.APPROVE_OPTION == fc_file_parseDir.showOpenDialog(null)) {
|
String file_name = fc_file_parseDir.getSelectedFile().getAbsolutePath();
|
String str_save = "\nÌõÐÎÂëID";
|
str_save += ",¼Ç¼ʱ¼ä";
|
str_save += ",µ÷ÊÔÈË";
|
str_save += ",Ä£¿éµØÖ·";
|
str_save += ",Ä£¿é°æ±¾";
|
str_save += ",µçѹÀàÐÍ";
|
str_save += ",MOSµçÁ÷mA";
|
str_save += ",Ëø¶¨Î»";
|
str_save += ",¼ÓÃÜλ";
|
str_save += ",¾ùºâµçÁ÷";
|
str_save += ",ʵ²âµçѹmV";
|
str_save += ",Æ«ÒÆmV";
|
str_save += ",бÂÊmV";
|
str_save += ",ʵ²âζȡæ";
|
str_save += ",ζÈУ׼¡æ";
|
str_save += ",ʵ²âÄÚ×èm¦¸";
|
str_save += ",ʵ²âÁ¬Ìõm¦¸";
|
str_save += ",ÄÚ×èµçÁ÷mA";
|
str_save += ",ÄÚ×èģʽ";
|
str_save += ",²Î¿¼ÄÚ×èm¦¸";
|
str_save += ",ÄÚ×è½á¹û";
|
str_save += ",±àºÅ¹¦ÄÜ";
|
|
FileWriter fw = null;
|
try {
|
//Èç¹ûÎļþ´æÔÚ£¬Ôò×·¼ÓÄÚÈÝ£»Èç¹ûÎļþ²»´æÔÚ£¬Ôò´´½¨Îļþ
|
File f = new File(file_name);
|
fw = new FileWriter(f, true);
|
|
PrintWriter pw = new PrintWriter(fw);
|
pw.println(str_save);
|
pw.flush();
|
|
fw.flush();
|
pw.close();
|
fw.close();
|
|
tf_record_test_file.setText(file_name);
|
} catch (IOException e1) {
|
e1.printStackTrace();
|
JOptionPane.showMessageDialog(null, "ÎļþÕýÔÚʹÓÃÖлòÒì³£: " + e1.getMessage());
|
}
|
}
|
}
|
});
|
|
JPanel panel_2 = new JPanel();
|
panel_2.setBorder(new TitledBorder(null, "\u6A21\u5757\u4FE1\u606F", TitledBorder.LEADING, TitledBorder.TOP, null, null));
|
panel.add(panel_2);
|
panel_2.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
|
|
JPanel panel_8 = new JPanel();
|
panel_8.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u6A21\u5757\u5730\u5740", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_2.add(panel_8);
|
panel_8.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
tf_addr = new JTextField();
|
tf_addr.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_addr.setEditable(false);
|
tf_addr.setColumns(6);
|
panel_8.add(tf_addr);
|
|
JPanel panel_9 = new JPanel();
|
panel_9.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u6A21\u5757\u7248\u672C", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_2.add(panel_9);
|
panel_9.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
tf_version = new JTextField();
|
tf_version.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_version.setEditable(false);
|
tf_version.setColumns(6);
|
panel_9.add(tf_version);
|
|
JPanel panel_10 = new JPanel();
|
panel_10.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u7535\u538B\u7C7B\u578B", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_2.add(panel_10);
|
panel_10.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
cb_voltype = new JComboBox<String>();
|
cb_voltype.setModel(new DefaultComboBoxModel<String>(new String[] {"\u672A\u77E5", "12V", "02V", "04V", "\u672A\u77E5", "\u672A\u77E5", "\u672A\u77E5", "\u672A\u77E5", "\u672A\u77E5", "\u672A\u77E5", "\u672A\u77E5", "\u672A\u77E5", "\u672A\u77E5", "\u672A\u77E5"}));
|
cb_voltype.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
panel_10.add(cb_voltype);
|
|
JPanel panel_11 = new JPanel();
|
panel_11.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "MOS\u7535\u6D41(mA)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_2.add(panel_11);
|
panel_11.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
tf_moscurr = new JTextField();
|
tf_moscurr.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_moscurr.setEditable(false);
|
tf_moscurr.setColumns(6);
|
panel_11.add(tf_moscurr);
|
|
JPanel panel_12 = new JPanel();
|
panel_12.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u9501\u5B9A\u4F4D", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_2.add(panel_12);
|
panel_12.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
tf_lockbit = new JTextField();
|
tf_lockbit.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_lockbit.setEditable(false);
|
tf_lockbit.setColumns(6);
|
panel_12.add(tf_lockbit);
|
|
JPanel panel_13 = new JPanel();
|
panel_13.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u52A0\u5BC6\u4F4D", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_2.add(panel_13);
|
panel_13.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
tf_ssb = new JTextField();
|
tf_ssb.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_ssb.setEditable(false);
|
tf_ssb.setColumns(6);
|
panel_13.add(tf_ssb);
|
|
JPanel panel_14 = new JPanel();
|
panel_14.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u5747\u8861\u7535\u6D41(A)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_2.add(panel_14);
|
panel_14.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
tf_junheng_curr = new JTextField();
|
tf_junheng_curr.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_junheng_curr.setEditable(false);
|
tf_junheng_curr.setColumns(6);
|
panel_14.add(tf_junheng_curr);
|
|
JPanel panel_24 = new JPanel();
|
panel_2.add(panel_24);
|
FlowLayout flowLayout = (FlowLayout) panel_24.getLayout();
|
flowLayout.setHgap(20);
|
panel_24.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u5E7F\u64AD\u4E0E\u7A7A\u6307\u4EE4", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
|
ckb_res_gbtest = new JCheckBox("\u9009\u62E9");
|
panel_24.add(ckb_res_gbtest);
|
|
JPanel panel_5 = new JPanel();
|
panel_5.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u7535\u538B", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel.add(panel_5);
|
panel_5.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
|
|
JPanel panel_15 = new JPanel();
|
panel_15.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u5B9E\u6D4B\u7535\u538B(mV)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_5.add(panel_15);
|
panel_15.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
|
tf_vol = new JTextField();
|
tf_vol.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_vol.setColumns(6);
|
panel_15.add(tf_vol);
|
|
JPanel panel_16 = new JPanel();
|
panel_16.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u504F\u79FB(mV) \u659C\u7387(mV)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_5.add(panel_16);
|
panel_16.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
|
tf_vol_offset_cal = new JTextField();
|
tf_vol_offset_cal.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_vol_offset_cal.setColumns(6);
|
tf_vol_offset_cal.setDocument(new LimitedDocument(6, "0123456789"));
|
panel_16.add(tf_vol_offset_cal);
|
|
tf_vol_slope_cal = new JTextField();
|
tf_vol_slope_cal.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_vol_slope_cal.setColumns(6);
|
tf_vol_slope_cal.setDocument(new LimitedDocument(6, "0123456789"));
|
panel_16.add(tf_vol_slope_cal);
|
|
JPanel panel_17 = new JPanel();
|
panel_17.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u6821\u51C6\u64CD\u4F5C", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_5.add(panel_17);
|
|
btn_vol_offset_cal = new JButton("\u504F\u79FB");
|
btn_vol_offset_cal.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Mon) {
|
if(SPCommMon.DEV_TYPE_MON_SWM == Comm_Mon.m_DEV_TYPE) {
|
test_vol_1 = Double.parseDouble(tf_vol.getText().trim());
|
real_vol_1 = Double.parseDouble(tf_vol_offset_cal.getText().trim());
|
btn_vol_offset_cal.setEnabled(false);
|
} else {
|
int data_flow = 0x0001;
|
if (tf_vol_offset_cal.getText().length() <= 0) {
|
JOptionPane.showMessageDialog(null, "ÇëÊäÈëÐèҪУ׼ Æ«ÒÆÁ¿ µÄµçѹ!");
|
return;
|
} else {
|
data_flow = Integer.parseInt(tf_vol.getText());
|
data_flow -= Integer.parseInt(tf_vol_offset_cal.getText());
|
}
|
Comm_Mon.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_MonomerAdjOffSet_RegAddr,
|
(short) data_flow, (short)0xAA55, (short)0x55AA);
|
}
|
}
|
}
|
});
|
panel_17.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
btn_vol_offset_cal.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_vol_offset_cal.setEnabled(false);
|
panel_17.add(btn_vol_offset_cal);
|
|
btn_vol_slope_cal = new JButton("\u659C\u7387");
|
btn_vol_slope_cal.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Mon) {
|
if(SPCommMon.DEV_TYPE_MON_SWM == Comm_Mon.m_DEV_TYPE) {
|
test_vol_2 = Double.parseDouble(tf_vol.getText().trim());
|
real_vol_2 = Double.parseDouble(tf_vol_slope_cal.getText().trim());
|
try {
|
double y2 = real_vol_2;
|
double y1 = real_vol_1;
|
double x2 = test_vol_2;
|
double x1 = test_vol_1;
|
|
if(Math.abs(x2-x1) < 200) {
|
JOptionPane.showMessageDialog(null, "Á½´Î²âÁ¿µçѹֵ֮¼ä²î¾à̫С,²»ÄÜУ׼!");
|
return;
|
}
|
|
double a = (y2-y1) / (x2-x1);
|
mon_param_slope = (int)(a*50000 + 0.5);
|
mon_param_offset = (int)(y2 - x2*a + 0.5);
|
|
} catch (Exception e1) {
|
JOptionPane.showMessageDialog(null, "ÇëÊäÈëÓÐЧµÄʵ¼Êµçѹֵ!");
|
return;
|
}
|
textField_2p_param.setText("slop: " + mon_param_slope + ", offset: " + mon_param_offset);
|
btn_vol_slope_cal.setEnabled(false);
|
} else {
|
short data_flow = 0x0001;
|
if (tf_vol_slope_cal.getText().length() <= 0) {
|
JOptionPane.showMessageDialog(null, "ÇëÊäÈëÐèҪУ׼ бÂÊ µÄµçѹ!");
|
return;
|
} else {
|
data_flow = (short) Integer.parseInt(tf_vol_slope_cal.getText());
|
}
|
Comm_Mon.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_MonomerAdjVol_RegAddr,
|
data_flow, (short)0xAA55, (short)0x55AA);
|
MonVol_Is_Adj = true;
|
}
|
}
|
}
|
});
|
btn_vol_slope_cal.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_vol_slope_cal.setEnabled(false);
|
panel_17.add(btn_vol_slope_cal);
|
|
JPanel panel_18 = new JPanel();
|
panel_18.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u590D\u4F4D\u64CD\u4F5C", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_5.add(panel_18);
|
panel_18.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
btn_vol_cal_rst = new JButton("\u590D\u4F4D\u6821\u51C6");
|
btn_vol_cal_rst.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Mon) {
|
MonVol_Is_Adj = false;
|
Comm_Mon.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_MonomerAdjReset_RegAddr,
|
(short)0xAA55, (short)0x55AA, (short)0xF77F);
|
|
btn_vol_offset_cal.setEnabled(true);
|
btn_vol_slope_cal.setEnabled(true);
|
}
|
}
|
});
|
|
btn_tow_cal = new JButton("\u4E24\u70B9\u6821\u51C6");
|
btn_tow_cal.setEnabled(false);
|
btn_tow_cal.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent arg0) {
|
if(null != Comm_Mon) {
|
try {
|
if(Math.abs(mon_param_offset) > 3000) {
|
JOptionPane.showMessageDialog(null, "Æ«ÒÆÁ¿ÊýÖµ³¬¹ý3000,²»ÄÜУ׼!");
|
return;
|
}
|
if(Math.abs(mon_param_slope-50000) > 10000) {
|
JOptionPane.showMessageDialog(null, "бÂÊÊýֵƫ²î³¬¹ý50000µÄ20%,²»ÄÜУ׼!");
|
return;
|
}
|
|
Comm_Mon.setCommCmd(SPCommMon.CMD_TYPE_WRITE, SPCommMon.UART_MonomerAdjVol_RegAddr,
|
(short) mon_param_slope, (short)mon_param_offset, (short)0x55AA);
|
} catch (Exception e1) {
|
JOptionPane.showMessageDialog(null, "У׼²ÎÊýÊýÖµ¸ñʽ²»ÕýÈ·!");
|
return;
|
}
|
|
mon_param_slope = 0;
|
mon_param_offset = 0;
|
textField_2p_param.setText("slop: " + mon_param_slope + ", offset: " + mon_param_offset);
|
btn_vol_offset_cal.setEnabled(true);
|
btn_vol_slope_cal.setEnabled(true);
|
}
|
}
|
});
|
panel_18.add(btn_tow_cal);
|
btn_vol_cal_rst.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_vol_cal_rst.setEnabled(false);
|
panel_18.add(btn_vol_cal_rst);
|
|
panel_36 = new JPanel();
|
panel_36.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u659C\u7387\u548C\u504F\u79FB", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_5.add(panel_36);
|
panel_36.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
textField_2p_param = new JTextField();
|
panel_36.add(textField_2p_param);
|
textField_2p_param.setColumns(16);
|
|
JPanel panel_6 = new JPanel();
|
panel_6.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u6E29\u5EA6", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel.add(panel_6);
|
panel_6.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
|
|
JPanel panel_19 = new JPanel();
|
panel_19.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u5B9E\u6D4B\u6E29\u5EA6\uFF08\u2103\uFF09", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_6.add(panel_19);
|
panel_19.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
tf_tmp = new JTextField();
|
tf_tmp.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_tmp.setColumns(6);
|
panel_19.add(tf_tmp);
|
|
JPanel panel_20 = new JPanel();
|
panel_20.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u6821\u51C6\u6E29\u5EA6\uFF08\u2103\uFF09", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_6.add(panel_20);
|
panel_20.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
tf_temp_cal = new JTextField();
|
tf_temp_cal.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_temp_cal.setColumns(6);
|
tf_temp_cal.setDocument(new LimitedDocument(6, "0123456789."));
|
panel_20.add(tf_temp_cal);
|
|
JPanel panel_21 = new JPanel();
|
panel_21.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u6821\u51C6\u64CD\u4F5C", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_6.add(panel_21);
|
panel_21.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
btn_temp_cal = new JButton("\u6821\u51C6");
|
btn_temp_cal.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Mon) {
|
short data_flow = 0x0001;
|
if (tf_temp_cal.getText().length() <= 0) {
|
JOptionPane.showMessageDialog(null, "ÇëÊäÈëÐèҪУ׼µÄζÈ!");
|
return;
|
} else {
|
data_flow = (short) ((Double.parseDouble(tf_temp_cal.getText())+10.0) * 10);
|
}
|
Comm_Mon.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_MonomerAdjTemp_RegAddr,
|
data_flow, (short)0xAA55, (short)0x55AA);
|
}
|
}
|
});
|
btn_temp_cal.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_temp_cal.setEnabled(false);
|
panel_21.add(btn_temp_cal);
|
|
btn_temp_cal_rst = new JButton("\u590D\u4F4D");
|
btn_temp_cal_rst.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Mon) {
|
Comm_Mon.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_MonomerAdjTemp_RegAddr,
|
(short)0xFF00, (short)0xAA55, (short)0x55AA);
|
}
|
}
|
});
|
btn_temp_cal_rst.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_temp_cal_rst.setEnabled(false);
|
panel_21.add(btn_temp_cal_rst);
|
|
JPanel panel_23 = new JPanel();
|
panel_23.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u7F16\u53F7\u6D4B\u8BD5", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_6.add(panel_23);
|
panel_23.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
tf_BianHaoTest = new JTextField();
|
tf_BianHaoTest.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_BianHaoTest.setColumns(6);
|
panel_23.add(tf_BianHaoTest);
|
|
btn_BianHaoTest = new JButton("\u542F\u52A8\u6D4B\u8BD5");
|
btn_BianHaoTest.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_BianHaoTest.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Mon) {
|
MonBianHao_Is_Test = true;
|
Comm_Mon.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_MonomerLowSign_RegAddr,
|
(short)0xAA55, (short)0x55AA, (short)0xF77F);
|
}
|
}
|
});
|
panel_23.add(btn_BianHaoTest);
|
|
JPanel panel_22 = new JPanel();
|
panel_6.add(panel_22);
|
panel_22.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u5747\u8861\u7535\u538B\u8BBE\u7F6E(mV)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_22.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
tf_junheng_volset = new JTextField();
|
tf_junheng_volset.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_junheng_volset.setColumns(6);
|
tf_junheng_volset.setDocument(new LimitedDocument(6, "0123456789"));
|
panel_22.add(tf_junheng_volset);
|
|
btn_junheng_volset = new JButton("\u8BBE\u7F6E");
|
btn_junheng_volset.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_junheng_volset.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Mon) {
|
short data_flow = 0x0001;
|
if (tf_junheng_volset.getText().length() <= 0) {
|
JOptionPane.showMessageDialog(null, "ÇëÊäÈëÐèÒªÉèÖõľùºâµçѹ!");
|
return;
|
} else {
|
data_flow = (short) (Integer.parseInt(tf_junheng_volset.getText()));
|
}
|
Comm_Mon.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_MonomerSetJunHengVol_RegAddr,
|
data_flow, (short)0x1234, (short)0x1234);
|
}
|
}
|
});
|
panel_22.add(btn_junheng_volset);
|
|
JPanel panel_7 = new JPanel();
|
panel_7.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u5185\u963B", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel.add(panel_7);
|
panel_7.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
|
JPanel panel_25 = new JPanel();
|
panel_25.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u5B9E\u6D4B\u5185\u963B/\u8FDE\u63A5\u6761(u\u03A9/x0.01mV)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_7.add(panel_25);
|
panel_25.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 5));
|
|
tf_res = new JTextField();
|
tf_res.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_res.setColumns(6);
|
panel_25.add(tf_res);
|
|
tf_res_conn = new JTextField();
|
tf_res_conn.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_res_conn.setColumns(6);
|
panel_25.add(tf_res_conn);
|
|
JCheckBox ck_auto_restest_start = new JCheckBox("\u81EA\u52A8");
|
ck_auto_restest_start.setVerticalAlignment(SwingConstants.BOTTOM);
|
ck_auto_restest_start.setHorizontalAlignment(SwingConstants.LEFT);
|
panel_25.add(ck_auto_restest_start);
|
|
JPanel panel_26 = new JPanel();
|
panel_25.add(panel_26);
|
panel_26.setLayout(new BorderLayout(0, 0));
|
|
btn_start_res = new JButton("\u542F\u52A8");
|
btn_start_res.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_start_res.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Mon) {
|
short data_flow = 0x0001;
|
if(0 == cb_restype.getSelectedIndex()) {
|
MonRes_Is_Test = true;
|
}
|
|
if(1 == cb_restype.getSelectedIndex()) {
|
data_flow = (short) 0xF200;
|
} else if(2 == cb_restype.getSelectedIndex()) {
|
data_flow = (short) 0xF100;
|
}
|
//Start_Tint = 0;
|
Comm_Mon.setCommCmd_gb(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_MonomerResTest_RegAddr,
|
data_flow, (short)0x1234, (short)0x1234, ckb_res_gbtest.isSelected());
|
//frmSerialport.setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
try {
|
Thread.sleep(300);
|
} catch (InterruptedException e1) {
|
// TODO Auto-generated catch block
|
e1.printStackTrace();
|
}
|
//frmSerialport.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
|
Comm_Mon.clearResDataBuf();
|
}
|
}
|
});
|
panel_25.add(btn_start_res);
|
|
btn_start_res_2s = new JButton("2s");
|
btn_start_res_2s.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_start_res_2s.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Mon) {
|
short data_flow = 0x0001;
|
if(0 == cb_restype.getSelectedIndex()) {
|
MonRes_Is_Test = true;
|
}
|
|
data_flow = (short) 0xFA00;
|
|
//Start_Tint = 0;
|
Comm_Mon.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_MonomerResTest_RegAddr,
|
data_flow, (short)0x1234, (short)0x1234);
|
//frmSerialport.setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
try {
|
Thread.sleep(300);
|
} catch (InterruptedException e1) {
|
// TODO Auto-generated catch block
|
e1.printStackTrace();
|
}
|
//frmSerialport.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
|
Comm_Mon.clearResDataBuf();
|
}
|
}
|
});
|
btn_start_res_2s.setEnabled(false);
|
panel_25.add(btn_start_res_2s);
|
|
JPanel panel_27 = new JPanel();
|
panel_27.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u7535\u6D41(mA) AsysCode", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_7.add(panel_27);
|
panel_27.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 5));
|
|
tf_rescurr = new JTextField();
|
tf_rescurr.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_rescurr.setColumns(4);
|
panel_27.add(tf_rescurr);
|
|
tf_res_lubo_asys_code = new JTextField();
|
tf_res_lubo_asys_code.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_res_lubo_asys_code.setColumns(4);
|
panel_27.add(tf_res_lubo_asys_code);
|
|
JPanel panel_28 = new JPanel();
|
panel_28.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u5185\u963B\u6A21\u5F0F", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_7.add(panel_28);
|
panel_28.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
cb_restype = new JComboBox<String>();
|
cb_restype.setModel(new DefaultComboBoxModel<String>(new String[] {"\u653E\u7535\u6A21\u5F0F", "\u5E26\u901A\u5F55\u6CE2", "\u76F4\u6D41\u5F55\u6CE2"}));
|
cb_restype.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
panel_28.add(cb_restype);
|
|
JPanel panel_29 = new JPanel();
|
panel_29.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "\u6807\u51C6\u5185\u963B\u503C(u\u03A9)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_7.add(panel_29);
|
panel_29.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 5));
|
|
tf_res_cal = new JTextField();
|
tf_res_cal.setFont(new Font("Dialog", Font.PLAIN, 18));
|
tf_res_cal.setColumns(6);
|
tf_res_cal.setDocument(new LimitedDocument(6, "0123456789"));
|
panel_29.add(tf_res_cal);
|
|
btn_res_cal = new JButton("\u6821\u51C6");
|
btn_res_cal.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_res_cal.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Mon) {
|
if(2 == cb_restype.getSelectedIndex()) {
|
JOptionPane.showMessageDialog(null, "Ö±Á÷¼²¨Ä£Ê½Ï½ûֹУ׼!");
|
return;
|
}
|
|
short data_flow = 0x0001;
|
if (tf_res_cal.getText().length() <= 0) {
|
JOptionPane.showMessageDialog(null, "ÇëÊäÈëÐèҪУ׼µÄÄÚ×è!");
|
return;
|
} else {
|
data_flow = (short) (Double.parseDouble(tf_res_cal.getText()));
|
}
|
Comm_Mon.setCommCmd_gb(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_MonomerAdjRes_RegAddr,
|
data_flow, (short)0xAA55, (short)0x55AA, ckb_res_gbtest.isSelected());
|
}
|
}
|
});
|
btn_res_cal.setEnabled(false);
|
panel_29.add(btn_res_cal);
|
|
btn_res_cal_rst = new JButton("\u590D\u4F4D");
|
btn_res_cal_rst.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_res_cal_rst.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Mon) {
|
if(2 == cb_restype.getSelectedIndex()) {
|
JOptionPane.showMessageDialog(null, "Ö±Á÷¼²¨Ä£Ê½Ï½ûÖ¹¸´Î»²ÎÊý!");
|
return;
|
}
|
|
Comm_Mon.setCommCmd_gb(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_MonomerAdjRes_RegAddr,
|
(short)0xFF00, (short)0xAA55, (short)0x55AA, ckb_res_gbtest.isSelected());
|
MonRes_Is_Test = false;
|
}
|
}
|
});
|
btn_res_cal_rst.setEnabled(false);
|
panel_29.add(btn_res_cal_rst);
|
|
panel_mon_dfu = new page_dfu();
|
tabbedPane.addTab("\u7A0B\u5E8F\u5347\u7EA7", null, panel_mon_dfu, null);
|
|
panel_mon_bianhao = new mon_page_bianhao();
|
tabbedPane.addTab("\u7F16\u53F7\u6D4B\u8BD5", null, panel_mon_bianhao, null);
|
|
panel_mon_debug = new page_debug_inf();
|
tabbedPane.addTab("\u8C03\u8BD5\u4FE1\u606F", null, panel_mon_debug, null);
|
|
setButttonState(false);
|
}
|
|
public void setButttonState(boolean state) {
|
btn_vol_offset_cal.setEnabled(state);
|
btn_vol_slope_cal.setEnabled(state);
|
btn_vol_cal_rst.setEnabled(state);
|
btn_temp_cal.setEnabled(state);
|
btn_temp_cal_rst.setEnabled(state);
|
btn_junheng_volset.setEnabled(state);
|
btn_BianHaoTest.setEnabled(state);
|
btn_start_res.setEnabled(state);
|
btn_start_res_2s.setEnabled(state);
|
btn_res_cal.setEnabled(state);
|
btn_res_cal_rst.setEnabled(state);
|
|
if(false == state) {
|
btn_tow_cal.setEnabled(state);
|
} else {
|
if(null != Comm_Mon) {
|
if(SPCommMon.DEV_TYPE_MON_SWM == Comm_Mon.m_DEV_TYPE) {
|
btn_tow_cal.setEnabled(state);
|
}
|
}
|
}
|
|
panel_mon_bianhao.setButttonState(state);
|
panel_mon_dfu.setButttonState(state);
|
}
|
|
public boolean openCommPort(int comm_type, String spname_or_ipaddr, int bitrate_or_ipport,
|
int dev_type, int multy_comm_type, JTextField tf_addr, Logger log) {
|
boolean res = false;
|
Comm_Mon = new SPCommMon(tf_addr, bitrate_or_ipport, dev_type, multy_comm_type,
|
panel_mon_dfu.ta_dfu_inf, panel_mon_debug, log);
|
Comm_Mon.setCmdNullEn(false);
|
|
if(true == Comm_Mon.OpenCommPort(comm_type, spname_or_ipaddr, bitrate_or_ipport)) {
|
Thread spcommThread = new Thread(Comm_Mon);
|
spcommThread.start();
|
|
panel_mon_dfu.set_SerialComm_Mon(Comm_Mon);
|
panel_mon_bianhao.set_SerialComm_Mon(Comm_Mon);
|
|
panel_mon_dfu.setDfu_Mon_Addr(tf_addr.getText(), tf_addr.getText());
|
|
setButttonState(true);
|
|
res = true;
|
}
|
|
return res;
|
}
|
|
public void closeCommPort() {
|
if(null != Comm_Mon) {
|
Comm_Mon.exitCommPortThread();
|
Comm_Mon = null;
|
panel_mon_dfu.set_SerialComm_Mon(Comm_Mon);
|
panel_mon_bianhao.set_SerialComm_Mon(Comm_Mon);
|
|
setButttonState(false);
|
}
|
}
|
|
public void updateData() {
|
if(null != Comm_Mon) {
|
//tf_target_addr.setText(String.valueOf(SerialComm_Mon.dt_target_addr));
|
tf_addr.setText(String.format("%d", Comm_Mon.dt_addr));
|
tf_version.setText(String.format("V%1.1f", ((double)Comm_Mon.dt_version)/10));
|
cb_voltype.setSelectedIndex(Comm_Mon.dt_voltype+1);
|
tf_moscurr.setText(String.format("%d", Comm_Mon.dt_abn_curr));
|
tf_lockbit.setText(String.format("%d", Comm_Mon.dt_lockpage_count));
|
tf_ssb.setText(String.format("%d", Comm_Mon.dt_ssb));
|
tf_junheng_curr.setText(String.format("%1.3f", ((double)Comm_Mon.dt_junhengcurr)/1000));
|
|
tf_vol.setText(String.format("%d", Comm_Mon.dt_vol));
|
tf_tmp.setText(String.format("%1.1f",((double) Comm_Mon.dt_tmp)/10 - 10.0));
|
if(Comm_Mon.dt_res >= 0) {
|
tf_res.setText(String.format("%d", Comm_Mon.dt_res));
|
tf_res_conn.setText(String.format("%d", Comm_Mon.dt_res_conn));
|
String str_stdres = tf_res_cal.getText();
|
float batt_res = Comm_Mon.dt_res;
|
float std_res = 0;
|
if(str_stdres.length() > 0) {
|
std_res = Float.parseFloat(str_stdres);
|
}
|
if((batt_res < std_res*BattResLowLimit) || (batt_res > std_res*BattResHighLimit)) {
|
tf_res.setBackground(Color.RED);
|
} else {
|
tf_res.setBackground(Color.WHITE);
|
}
|
} else {
|
tf_res.setText("-----");
|
tf_res_conn.setText("-----");
|
tf_res.setBackground(Color.WHITE);
|
}
|
if(Comm_Mon.dt_rescurr >= 0) {
|
tf_rescurr.setText(String.format("%d", Comm_Mon.dt_rescurr));
|
} else {
|
tf_rescurr.setText("-----");
|
}
|
if(Comm_Mon.dt_res_asyscode >= 0) {
|
tf_res_lubo_asys_code.setText(String.format("%d", Comm_Mon.dt_res_asyscode));
|
} else {
|
tf_res_lubo_asys_code.setText("-----");
|
}
|
|
tf_BianHaoTest.setText(Comm_Mon.getBianHaoTest_Str());
|
if(Comm_Mon.mBianHao_TestRes < 0) {
|
tf_BianHaoTest.setBackground(Color.WHITE);
|
} else if(1== Comm_Mon.mBianHao_TestRes) {
|
tf_BianHaoTest.setBackground(Color.RED);
|
} else if(2== Comm_Mon.mBianHao_TestRes) {
|
tf_BianHaoTest.setBackground(Color.RED);
|
} if(0== Comm_Mon.mBianHao_TestRes) {
|
tf_BianHaoTest.setBackground(Color.WHITE);
|
}
|
/*
|
tf_addr_now.setText(String.format("%03d", SerialComm_Mon.mAddrSettedNow));
|
ta_set_num_resinf.setText(SerialComm_Mon.dt_set_addr_res_inf);
|
|
//System.out.println("SerialComm_Mon.dt_new_tag:" + SerialComm_Mon.dt_new_tag);
|
if((SerialComm_Mon.dt_new_tag != dt_new_tag_old)) {
|
dt_new_tag_old = SerialComm_Mon.dt_new_tag;
|
if(true == dt_new_tag_old) {
|
Calendar cld = Calendar.getInstance();
|
Start_Tint = (cld.getTimeInMillis()/1000);
|
} else {
|
Start_Tint = 0;
|
}
|
}
|
if(Start_Tint > 0) {
|
Calendar cld = Calendar.getInstance();
|
long end_t = (cld.getTimeInMillis()/1000);
|
long dt_t = 10-(end_t-Start_Tint);
|
if(dt_t >= 0) {
|
panel_15.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
|
String.format("ÄÚ×è/Á¬½ÓÌõ(u¦¸/x0.01mV) ²âÊÔʱÏÞ%d", dt_t),
|
TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
} else {
|
Start_Tint = 0;
|
if(ck_auto_restest_start.isSelected()) {
|
if(((0==SerialComm_Mon.dt_voltype) && (SerialComm_Mon.dt_vol>10000) && (SerialComm_Mon.dt_vol<13200))
|
||((0==SerialComm_Mon.dt_voltype) && (SerialComm_Mon.dt_vol>5000) && (SerialComm_Mon.dt_vol<6700))
|
||((1==SerialComm_Mon.dt_voltype) && (SerialComm_Mon.dt_vol>1500) && (SerialComm_Mon.dt_vol<2200))) {
|
btn_start_res.doClick();
|
}
|
}
|
}
|
}*/
|
}
|
}
|
}
|