| | |
| | | import dikuai.addzhangaiwu; |
| | | import gecaoji.Device; |
| | | import set.Sets; |
| | | import set.debug; |
| | | import udpdell.UDPServer; |
| | | import zhangaiwu.AddDikuai; |
| | | import yaokong.Control04; |
| | |
| | | stopButtonActive = false; |
| | | updateStopButtonIcon(); |
| | | } |
| | | if (!beginMowingSession()) { |
| | | startButtonShowingPause = true; |
| | | statusLabel.setText("待机"); |
| | | updateStartButtonAppearance(); |
| | | return; |
| | | } |
| | | Control04.sendStartCommandIfDebugSerialOpen(); |
| | | if (!beginMowingSession()) { |
| | | startButtonShowingPause = true; |
| | | statusLabel.setText("待机"); |
| | | updateStartButtonAppearance(); |
| | | return; |
| | | } |
| | | } else { |
| | | statusLabel.setText("暂停中"); |
| | | pauseMowingSession(); |
| | | Control04.sendPauseCommandIfDebugSerialOpen(); |
| | | } |
| | | updateStartButtonAppearance(); |
| | | } |
| | |
| | | statusLabel.setText("已结束"); |
| | | startButtonShowingPause = false; |
| | | stopMowingSession(); |
| | | Control04.sendStopCommandIfDebugSerialOpen(); |
| | | } else { |
| | | statusLabel.setText("待机"); |
| | | startButtonShowingPause = true; |
| | |
| | | if (bluetoothBtn == null) { |
| | | return; |
| | | } |
| | | if (Bluelink.isConnected()) { |
| | | Bluelink.disconnect(); |
| | | bluetoothConnected = false; |
| | | } else { |
| | | boolean success = Bluelink.connect(); |
| | | if (success) { |
| | | bluetoothConnected = true; |
| | | } else { |
| | | bluetoothConnected = false; |
| | | JOptionPane.showMessageDialog(this, "蓝牙连接失败,请重试", "提示", JOptionPane.WARNING_MESSAGE); |
| | | } |
| | | } |
| | | updateBluetoothButtonIcon(); |
| | | // 弹出系统调试页面 |
| | | showDebugDialog(); |
| | | } |
| | | |
| | | private void showDebugDialog() { |
| | | Window parentWindow = SwingUtilities.getWindowAncestor(this); |
| | | debug debugDialog = new debug(parentWindow, THEME_COLOR); |
| | | debugDialog.setLocationRelativeTo(this); // 居中显示在首页 |
| | | debugDialog.setVisible(true); |
| | | } |
| | | |
| | | private void updateBluetoothButtonIcon() { |