package com.dev.fbs9600_curr;
|
|
import java.awt.BorderLayout;
|
import java.awt.Color;
|
import java.awt.FlowLayout;
|
import java.awt.Font;
|
import java.awt.GridLayout;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
|
import javax.swing.BoxLayout;
|
import javax.swing.DefaultComboBoxModel;
|
import javax.swing.JButton;
|
import javax.swing.JComboBox;
|
import javax.swing.JOptionPane;
|
import javax.swing.JPanel;
|
import javax.swing.JTextField;
|
import javax.swing.UIManager;
|
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.LineBorder;
|
import javax.swing.border.TitledBorder;
|
|
import com.LimitedDocument;
|
import com.dev.fbs9600_mon.SPCommMon;
|
|
import javax.swing.JTabbedPane;
|
|
import org.apache.logging.log4j.Logger;
|
|
import main.page_debug_inf;
|
import main.page_dfu;
|
|
public class module_curr_page extends JPanel {
|
public SPCommMon Comm_Curr = null;
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
private JTextField tf_addr;
|
private JTextField tf_version;
|
private JTextField tf_curr;
|
private JTextField tf_setaddr;
|
private JTextField tf_peak_curr;
|
private JTextField tf_currrange_set;
|
private JButton btn_curr_test_start;
|
private JTextField tf_peakavg_curr;
|
private JTextField tf_lockbit;
|
private JTextField tf_ssb;
|
private JTextField tf_CurrSlope_Set;
|
private JButton btn_currrange_write;
|
private JButton btn_SetCurr1_Slope;
|
private JButton btn_addr_write;
|
private JButton btn_junheng_volset;
|
private JButton btnNewButton;
|
private JButton btnNewButton_1;
|
private JButton btnNewButton_2;
|
private JButton btnNewButton_3;
|
private JTextField tf_curr_range;
|
private JTextField tf_curr_slope;
|
private JTextField tf_curr_float;
|
private JTextField tf_curr_float_slope;
|
private JTextField tf_Currfloat_Slope_Set;
|
private JComboBox<?> cb_float_dir;
|
private JComboBox<?> cb_dir;
|
|
private page_dfu panel_dfu;
|
private page_debug_inf panel_debug;
|
private JTabbedPane tabbedPane;
|
|
/**
|
* Create the panel.
|
*/
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
public module_curr_page() {
|
setLayout(new BorderLayout(0, 0));
|
|
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
add(tabbedPane, BorderLayout.CENTER);
|
|
JPanel panel_28 = new JPanel();
|
tabbedPane.addTab("\u57FA\u672C\u6D4B\u8BD5", null, panel_28, null);
|
panel_28.setLayout(new GridLayout(4, 0, 0, 0));
|
|
JPanel panel_4 = new JPanel();
|
panel_28.add(panel_4);
|
panel_4.setBorder(new TitledBorder(null, "\u6A21\u5757\u4FE1\u606F", TitledBorder.LEADING, TitledBorder.TOP, null, null));
|
panel_4.setLayout(new GridLayout(0, 5, 0, 0));
|
|
JPanel panel_5 = new JPanel();
|
panel_5.setBorder(new TitledBorder(new EmptyBorder(0, 0, 0, 0), "\u6A21\u5757\u5730\u5740", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_4.add(panel_5);
|
panel_5.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
|
tf_addr = new JTextField();
|
tf_addr.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
tf_addr.setEditable(false);
|
panel_5.add(tf_addr);
|
tf_addr.setColumns(10);
|
|
JPanel panel_6 = new JPanel();
|
panel_6.setBorder(new TitledBorder(new EmptyBorder(0, 0, 0, 0), "\u6A21\u5757\u7248\u672C", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_4.add(panel_6);
|
panel_6.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
|
tf_version = new JTextField();
|
tf_version.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
tf_version.setEditable(false);
|
panel_6.add(tf_version);
|
tf_version.setColumns(10);
|
|
JPanel panel_62 = new JPanel();
|
panel_62.setBorder(new TitledBorder(new EmptyBorder(0, 0, 0, 0), "\u9501\u5B9A\u4F4D", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_4.add(panel_62);
|
panel_62.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
|
tf_lockbit = new JTextField();
|
tf_lockbit.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
tf_lockbit.setEditable(false);
|
panel_62.add(tf_lockbit);
|
tf_lockbit.setColumns(10);
|
|
JPanel panel_63 = new JPanel();
|
panel_63.setBorder(new TitledBorder(new EmptyBorder(0, 0, 0, 0), "\u52A0\u5BC6\u4F4D", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_4.add(panel_63);
|
panel_63.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
|
tf_ssb = new JTextField();
|
tf_ssb.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
tf_ssb.setEditable(false);
|
panel_63.add(tf_ssb);
|
tf_ssb.setColumns(10);
|
|
JPanel panel_16 = new JPanel();
|
panel_4.add(panel_16);
|
panel_16.setBorder(new TitledBorder(new EmptyBorder(0, 0, 0, 0), "\u7535\u6D41\u91CF\u7A0B(A)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_16.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
|
tf_curr_range = new JTextField();
|
tf_curr_range.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
tf_curr_range.setEditable(false);
|
panel_16.add(tf_curr_range);
|
tf_curr_range.setColumns(10);
|
|
JPanel panel_10 = new JPanel();
|
panel_28.add(panel_10);
|
panel_10.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u7535\u6D41\u6D4B\u91CF", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_10.setLayout(new GridLayout(0, 6, 0, 0));
|
|
JPanel panel_11 = new JPanel();
|
panel_11.setBorder(new TitledBorder(new EmptyBorder(0, 0, 0, 0), "\u7535\u6D41(A)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_10.add(panel_11);
|
panel_11.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
|
tf_curr = new JTextField();
|
tf_curr.setEditable(false);
|
tf_curr.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
panel_11.add(tf_curr);
|
tf_curr.setColumns(10);
|
|
JPanel panel_7 = new JPanel();
|
panel_7.setBorder(new TitledBorder(new EmptyBorder(0, 0, 0, 0), "\u7535\u6D41\u65B9\u5411", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_10.add(panel_7);
|
panel_7.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
|
cb_dir = new JComboBox();
|
cb_dir.setModel(new DefaultComboBoxModel(new String[] {"\u5145\u7535", "\u653E\u7535"}));
|
panel_7.add(cb_dir);
|
|
JPanel panel_17 = new JPanel();
|
panel_17.setBorder(new TitledBorder(new EmptyBorder(0, 0, 0, 0), "\u7535\u6D41\u7CFB\u6570", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_10.add(panel_17);
|
panel_17.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
|
tf_curr_slope = new JTextField();
|
tf_curr_slope.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
tf_curr_slope.setEditable(false);
|
panel_17.add(tf_curr_slope);
|
tf_curr_slope.setColumns(10);
|
|
JPanel panel_3 = new JPanel();
|
panel_3.setBorder(new TitledBorder(new EmptyBorder(0, 0, 0, 0), "\u6D6E\u5145\u7535\u6D41(A)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_10.add(panel_3);
|
panel_3.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
|
tf_curr_float = new JTextField();
|
tf_curr_float.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
tf_curr_float.setEditable(false);
|
panel_3.add(tf_curr_float);
|
tf_curr_float.setColumns(10);
|
|
JPanel panel_18 = new JPanel();
|
panel_18.setBorder(new TitledBorder(new EmptyBorder(0, 0, 0, 0), "\u6D6E\u5145\u7535\u6D41\u65B9\u5411", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_10.add(panel_18);
|
panel_18.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
|
cb_float_dir = new JComboBox();
|
cb_float_dir.setModel(new DefaultComboBoxModel(new String[] {"\u5145\u7535", "\u653E\u7535"}));
|
panel_18.add(cb_float_dir);
|
|
JPanel panel_19 = new JPanel();
|
panel_19.setBorder(new TitledBorder(new EmptyBorder(0, 0, 0, 0), "\u6D6E\u5145\u7535\u6D41\u7CFB\u6570", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_10.add(panel_19);
|
panel_19.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
|
tf_curr_float_slope = new JTextField();
|
tf_curr_float_slope.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
tf_curr_float_slope.setEditable(false);
|
panel_19.add(tf_curr_float_slope);
|
tf_curr_float_slope.setColumns(10);
|
|
JPanel panel_15 = new JPanel();
|
panel_28.add(panel_15);
|
panel_15.setBorder(new TitledBorder(new LineBorder(new Color(171, 173, 179), 1, true), "\u53C2\u6570\u8BBE\u7F6E\u4E0E\u64CD\u4F5C", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_15.setLayout(new GridLayout(0, 5, 0, 0));
|
|
JPanel panel_14 = new JPanel();
|
panel_15.add(panel_14);
|
panel_14.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u8BBE\u7F6E\u901A\u4FE1\u5730\u5740", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_14.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
|
|
tf_setaddr = new JTextField();
|
tf_setaddr.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
panel_14.add(tf_setaddr);
|
tf_setaddr.setColumns(8);
|
|
btn_addr_write = new JButton("\u8BBE\u7F6E");
|
btn_addr_write.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_addr_write.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent arg0) {
|
if(null != Comm_Curr) {
|
short data_flow = 0x0001;
|
if (tf_setaddr.getText().length() <= 0) {
|
JOptionPane.showMessageDialog(null, "ÇëÊäÈëÐèÒªÉèÖõĵØÖ·!");
|
return;
|
} else {
|
data_flow = (short) (Integer.parseInt(tf_setaddr.getText()));
|
}
|
Comm_Curr.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_CurrAddrSet_RegAddr,
|
data_flow, (short)0xABCD, (short)0x1234);
|
}
|
}
|
});
|
panel_14.add(btn_addr_write);
|
|
JPanel panel_24 = new JPanel();
|
panel_15.add(panel_24);
|
panel_24.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u8BBE\u7F6E\u7535\u6D41\u91CF\u7A0B\uFF08A\uFF09", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_24.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
|
|
tf_currrange_set = new JTextField();
|
tf_currrange_set.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
tf_currrange_set.setDocument(new LimitedDocument(4, "0123456789."));
|
panel_24.add(tf_currrange_set);
|
tf_currrange_set.setColumns(8);
|
|
btn_currrange_write = new JButton("\u8BBE\u7F6E");
|
btn_currrange_write.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_currrange_write.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Curr) {
|
short data_flow = 0x0001;
|
if (tf_currrange_set.getText().length() <= 0) {
|
JOptionPane.showMessageDialog(null, "ÇëÊäÈëÐèÒªÉèÖõĵçÁ÷Á¿³Ì(A)!");
|
return;
|
} else {
|
data_flow = (short) (Integer.parseInt(tf_currrange_set.getText()));
|
}
|
Comm_Curr.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_CurrRangeSet_RegAddr,
|
data_flow, (short)0xABCD, (short)0x1234);
|
}
|
}
|
});
|
panel_24.add(btn_currrange_write);
|
|
JPanel panel_25 = new JPanel();
|
panel_15.add(panel_25);
|
panel_25.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u542F\u52A8\u7EB9\u6CE2\u7535\u6D41\u6D4B\u91CF", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
|
btn_curr_test_start = new JButton("\u542F\u52A8");
|
btn_curr_test_start.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_curr_test_start.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent arg0) {
|
if(null != Comm_Curr) {
|
short data_flow = 0x0001;
|
Comm_Curr.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_CurrTestStart_RegAddr,
|
data_flow, (short)0xABCD, (short)0x1234);
|
}
|
}
|
});
|
panel_25.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
btn_curr_test_start.setEnabled(false);
|
panel_25.add(btn_curr_test_start);
|
|
JPanel panel_22 = new JPanel();
|
panel_15.add(panel_22);
|
panel_22.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u7EB9\u6CE2\u7535\u6D41(mA)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_22.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
tf_peakavg_curr = new JTextField();
|
tf_peakavg_curr.setEditable(false);
|
tf_peakavg_curr.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
tf_peakavg_curr.setDocument(new LimitedDocument(6, "0123456789"));
|
panel_22.add(tf_peakavg_curr);
|
tf_peakavg_curr.setColumns(10);
|
|
JPanel panel_13 = new JPanel();
|
panel_15.add(panel_13);
|
panel_13.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u7EB9\u6CE2\u5CF0\u503C\uFF08mA\uFF09", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_13.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
tf_peak_curr = new JTextField();
|
tf_peak_curr.setEditable(false);
|
panel_13.add(tf_peak_curr);
|
tf_peak_curr.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
tf_peak_curr.setDocument(new LimitedDocument(6, "0123456789"));
|
tf_peak_curr.setColumns(10);
|
|
JPanel panel_12 = new JPanel();
|
panel_28.add(panel_12);
|
panel_12.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u7535\u6D41\u6821\u51C6", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_12.setLayout(new BoxLayout(panel_12, BoxLayout.X_AXIS));
|
|
JPanel panel_77 = new JPanel();
|
panel_77.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u6821\u51C6\u7535\u6D41\u659C\u7387(A)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_12.add(panel_77);
|
panel_77.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
|
|
tf_CurrSlope_Set = new JTextField();
|
tf_CurrSlope_Set.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
panel_77.add(tf_CurrSlope_Set);
|
tf_CurrSlope_Set.setColumns(8);
|
tf_CurrSlope_Set.setDocument(new LimitedDocument(6, "0123456789."));
|
|
btn_SetCurr1_Slope = new JButton("\u8BBE\u7F6E");
|
btn_SetCurr1_Slope.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btn_SetCurr1_Slope.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent arg0) {
|
if(null != Comm_Curr) {
|
short data_flow = 0x0001;
|
if (tf_CurrSlope_Set.getText().length() <= 0) {
|
JOptionPane.showMessageDialog(null, "ÇëÊäÈëÐèÒªÉèÖõĵçÁ÷ϵÊý!");
|
return;
|
}
|
if(tf_curr.getText().length() <= 0) {
|
JOptionPane.showMessageDialog(null, "ʵ¼Ê²âÊÔµçÁ÷ÖµÎÞЧ!");
|
return;
|
}
|
float test_curr = Float.parseFloat(tf_curr.getText());
|
if(test_curr < 5) {
|
JOptionPane.showMessageDialog(null, "ÊäÈëµçÁ÷±ØÐë´óÓÚ5A£¬·ñÔò²»ÄÜУ׼!");
|
return;
|
}
|
|
{
|
float set_curr = Float.parseFloat(tf_CurrSlope_Set.getText());
|
data_flow = (short) ((set_curr/test_curr) * 10000);
|
if(data_flow > 30000) data_flow = (short) 30000;
|
if(data_flow < 2000) data_flow = 2000;
|
}
|
Comm_Curr.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_SetCurrSlope_RegAddr,
|
data_flow, (short)0xABCD, (short)0x1234);
|
}
|
}
|
});
|
panel_77.add(btn_SetCurr1_Slope);
|
|
btnNewButton = new JButton("\u590D\u4F4D");
|
btnNewButton.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
btnNewButton.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Curr) {
|
short data_flow = 10000;
|
Comm_Curr.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_SetCurrSlope_RegAddr,
|
data_flow, (short)0xABCD, (short)0x1234);
|
}
|
}
|
});
|
panel_77.add(btnNewButton);
|
|
JPanel panel_36 = new JPanel();
|
panel_12.add(panel_36);
|
panel_36.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u8BBE\u7F6E\u7535\u6D41\u96F6\u70B9", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
|
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 arg0) {
|
if(null != Comm_Curr) {
|
short data_flow = 0x0001;
|
Comm_Curr.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_CurrOffset_RegAddr,
|
data_flow, (short)0xABCD, (short)0x1234);
|
}
|
}
|
});
|
panel_36.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
panel_36.add(btn_junheng_volset);
|
|
JPanel panel_23 = new JPanel();
|
panel_23.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u6821\u51C6\u6D6E\u5145\u7535\u6D41\u659C\u7387(A)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
panel_12.add(panel_23);
|
panel_23.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
|
|
tf_Currfloat_Slope_Set = new JTextField();
|
tf_Currfloat_Slope_Set.setFont(new Font("ËÎÌå", Font.PLAIN, 18));
|
panel_23.add(tf_Currfloat_Slope_Set);
|
tf_Currfloat_Slope_Set.setColumns(8);
|
tf_Currfloat_Slope_Set.setDocument(new LimitedDocument(6, "0123456789."));
|
|
btnNewButton_1 = new JButton("\u8BBE\u7F6E");
|
btnNewButton_1.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Curr) {
|
short data_flow = 0x0001;
|
if (tf_Currfloat_Slope_Set.getText().length() <= 0) {
|
JOptionPane.showMessageDialog(null, "ÇëÊäÈëÐèÒªÉèÖõĵçÁ÷ϵÊý!");
|
return;
|
}
|
if(tf_curr_float.getText().length() <= 0) {
|
JOptionPane.showMessageDialog(null, "ʵ¼Ê²âÊÔµçÁ÷ÖµÎÞЧ!");
|
return;
|
}
|
float test_curr_float = Float.parseFloat(tf_curr_float.getText());
|
if(test_curr_float < 3) {
|
JOptionPane.showMessageDialog(null, "ÊäÈ븡³äµçÁ÷±ØÐë´óÓÚ3A£¬·ñÔò²»ÄÜУ׼!");
|
return;
|
}
|
|
{
|
float set_curr_float = Float.parseFloat(tf_Currfloat_Slope_Set.getText());
|
data_flow = (short) ((set_curr_float/test_curr_float) * 10000);
|
if(data_flow > 30000) data_flow = (short) 30000;
|
if(data_flow < 2000) data_flow = 2000;
|
}
|
Comm_Curr.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_SetCurrFloat_Slope_RegAddr,
|
data_flow, (short)0xABCD, (short)0x1234);
|
}
|
}
|
});
|
btnNewButton_1.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
panel_23.add(btnNewButton_1);
|
|
btnNewButton_2 = new JButton("\u590D\u4F4D");
|
btnNewButton_2.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Curr) {
|
short data_flow = 10000;
|
Comm_Curr.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_SetCurrFloat_Slope_RegAddr,
|
data_flow, (short)0xABCD, (short)0x1234);
|
}
|
}
|
});
|
btnNewButton_2.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
panel_23.add(btnNewButton_2);
|
|
JPanel panel_26 = new JPanel();
|
panel_26.setBorder(new TitledBorder(null, "\u8BBE\u7F6E\u6D6E\u5145\u7535\u6D41\u96F6\u70B9", TitledBorder.LEADING, TitledBorder.TOP, null, null));
|
panel_12.add(panel_26);
|
panel_26.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
btnNewButton_3 = new JButton("\u8BBE \u7F6E");
|
btnNewButton_3.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(null != Comm_Curr) {
|
short data_flow = 0x0001;
|
Comm_Curr.setCommCmd(SPCommMon.CMD_TYPE_WRITE,
|
SPCommMon.UART_CurrFloat_Offset_RegAddr,
|
data_flow, (short)0xABCD, (short)0x1234);
|
}
|
}
|
});
|
btnNewButton_3.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
|
panel_26.add(btnNewButton_3);
|
|
panel_dfu = new page_dfu();
|
tabbedPane.addTab("\u7A0B\u5E8F\u5347\u7EA7", null, panel_dfu, null);
|
|
panel_debug = new page_debug_inf();
|
tabbedPane.addTab("\u8C03\u8BD5\u4FE1\u606F", null, panel_debug, null);
|
|
setButttonState(false);
|
}
|
|
public void setButttonState(boolean state) {
|
btn_currrange_write.setEnabled(state);
|
btn_SetCurr1_Slope.setEnabled(state);
|
btn_addr_write.setEnabled(state);
|
btn_junheng_volset.setEnabled(state);
|
btn_curr_test_start.setEnabled(state);
|
btnNewButton.setEnabled(state);
|
btnNewButton_1.setEnabled(state);
|
btnNewButton_2.setEnabled(state);
|
btnNewButton_3.setEnabled(state);
|
|
panel_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_Curr = new SPCommMon(tf_addr, bitrate_or_ipport, dev_type, multy_comm_type,
|
panel_dfu.ta_dfu_inf, panel_debug, log);
|
Comm_Curr.setCmdNullEn(false);
|
|
if(true == Comm_Curr.OpenCommPort(comm_type, spname_or_ipaddr, bitrate_or_ipport)) {
|
Thread spcommThread = new Thread(Comm_Curr);
|
spcommThread.start();
|
|
panel_dfu.set_SerialComm_Mon(Comm_Curr);
|
panel_dfu.setDfu_Mon_Addr(tf_addr.getText(), tf_addr.getText());
|
|
setButttonState(true);
|
|
res = true;
|
}
|
|
return res;
|
}
|
|
public void closeCommPort() {
|
if(null != Comm_Curr) {
|
Comm_Curr.exitCommPortThread();
|
Comm_Curr = null;
|
panel_dfu.set_SerialComm_Mon(Comm_Curr);
|
|
setButttonState(false);
|
}
|
}
|
|
public void updateData() {
|
try{
|
if(null != Comm_Curr) {
|
tf_addr.setText(String.format("%d", Comm_Curr.dt_addr));
|
tf_version.setText(String.format("V%1.1f", ((double)Comm_Curr.dt_version)/10));
|
tf_lockbit.setText(String.format("%d", Comm_Curr.dt_lockpage_count));
|
tf_ssb.setText(String.format("%d", Comm_Curr.dt_ssb));
|
|
tf_curr.setText(String.format("%1.1f", ((double)Comm_Curr.dt_curr)/10));
|
cb_dir.setSelectedIndex(Comm_Curr.dt_curr_dir%cb_dir.getItemCount());
|
|
tf_curr_float.setText(String.format("%1.2f", ((double)Comm_Curr.dt_curr_float)/100));
|
cb_float_dir.setSelectedIndex(Comm_Curr.dt_curr_float_dir%cb_float_dir.getItemCount());
|
|
tf_peakavg_curr.setText(String.format("%1.2f", ((double)Comm_Curr.dt_peakavg_curr)/100));
|
tf_peak_curr.setText(String.format("%1.2f", ((double)Comm_Curr.dt_peak_curr)/100));
|
|
tf_curr_range.setText(String.format("%d", Comm_Curr.dt_currrange));
|
tf_curr_slope.setText(String.format("%d", Comm_Curr.dt_curr_slope));
|
tf_curr_float_slope.setText(String.format("%d", Comm_Curr.dt_curr_float_slope));
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
//JOptionPane.showMessageDialog(null, "updateData():" + e.getMessage());
|
}
|
}
|
}
|