Skip to content

Commit 4b7f315

Browse files
dubug port removal update UI implementation WIP
1 parent db9c1ac commit 4b7f315

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

serial_stuff.pde

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,15 @@ void watchSerialStatus() {
288288
// if serial port was physically disconnected
289289
if (!(portStillAvailable(debugPortName))) {
290290
ToogleDebugSerial.setOff();
291+
292+
// remove the port from list
293+
debugSerialListMenu.removeItem(debugPortName);
294+
debugSerialListMenu.update();
295+
//d
296+
debugSerialListMenu.setLabel(emptyDebugPortMenuLabel);
297+
debugSerialListMenu.close();
298+
debugSerialListMenu.setMouseOver(false);
299+
debugPortName = "DEBUG_PORT";
291300
}
292301
}
293302
delay(3000);

ui_stuff.pde

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ UI elements:
77
5. [*][Button] Upload to HW.
88
7. [*] Test Exported APP on Mac OS.
99
8. [*] Test Exported APP and adjust on Windows.
10-
9. [TBD] Test Exported APP on Linux. (yaml lib used by prog.py not working asked developer)
10+
9. [*] Test Exported APP on Linux. (yaml lib used by prog.py not working asked developer)
1111
10.[*] Icon lock/unlock bug resolve.
1212
11.[*] key board shortcut to show debugg port controls.
1313
12.[*] Debug port ui (port menu + switch)show hide.
@@ -58,6 +58,9 @@ int listItemHeight = 100;
5858
int listItemWidth = 220;
5959
int gapTopFromFrame = 35;
6060

61+
String emptyUploadPortMenuLabel = "Select upload port . . .";
62+
String emptyDebugPortMenuLabel = "Select debug port . . .";
63+
6164

6265
void setupOnScreenConsosle(ControlFont f) {
6366
myTextarea = cp5.addTextarea("txt")
@@ -146,7 +149,7 @@ void createUploadPortsMenu(ControlFont f) {
146149
.setSize(listItemWidth, listItemHeight)
147150
.setBarHeight(objHeights)
148151
.setFont(f)
149-
.setLabel("Select upload port . . .")
152+
.setLabel(emptyUploadPortMenuLabel)
150153
.setColorLabel(washed_text_color)
151154
.setItemHeight(objHeights)
152155
.addItems(workablePortsArray)
@@ -222,7 +225,7 @@ void createDebugPortsMenu(ControlFont f) {
222225
.setSize(listItemWidth, listItemHeight)
223226
.setBarHeight(objHeights)
224227
.setFont(f)
225-
.setLabel("Select debug port . . .")
228+
.setLabel(emptyDebugPortMenuLabel)
226229
.setColorLabel(washed_text_color)
227230
.setItemHeight(objHeights)
228231
.addItems(workablePortsArray)
@@ -370,8 +373,24 @@ void refreshPorts() {
370373
String[] workablePortsArray = filterSerialList(serialPortsList);
371374
printArray(workablePortsArray);
372375

373-
// Update the list
376+
// Update the Port Menu lists
374377
uploadSerialListMenu.setItems(workablePortsArray).update();
378+
debugSerialListMenu.setItems(workablePortsArray).update();
379+
380+
// if the previous port not is not there, update the header of the menu list
381+
if (!(portStillAvailable(uploadPortName))) {
382+
uploadSerialListMenu.setLabel(emptyUploadPortMenuLabel);
383+
uploadSerialListMenu.close();
384+
uploadSerialListMenu.setMouseOver(false);
385+
uploadPortName = "UPLOAD_PORT";
386+
}
387+
if (!(portStillAvailable(debugPortName))) {
388+
debugSerialListMenu.setLabel(emptyDebugPortMenuLabel);
389+
debugSerialListMenu.close();
390+
debugSerialListMenu.setMouseOver(false);
391+
debugPortName = "DEBUG_PORT";
392+
393+
}
375394
}
376395

377396

0 commit comments

Comments
 (0)