Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Commit

Permalink
Make function to refresh a camera
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonWerbel authored and AndrewLester committed Feb 17, 2020
1 parent 33b6708 commit becc51d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,20 @@ connection.on('status-change', (status, _, __) => {
}
});


cameraRefresh1.addEventListener('click', () => {
function refreshCamera(camera) {
if (!NetworkTables.isRobotConnected()) {
alert('Error: Robot is not connected!');
return;
}
cameras[camera1OptionSelect.selectedIndex].loadCameraStream();
cameras[camera].loadCameraStream();
}

cameraRefresh1.addEventListener('click', () => {
refreshCamera(camera1OptionSelect.selectedIndex);
});

cameraRefresh2.addEventListener('click', () => {
if (!NetworkTables.isRobotConnected()) {
alert('Error: Robot is not connected!');
return;
}
cameras[camera2OptionSelect.selectedIndex].loadCameraStream();
refreshCamera(camera2OptionSelect.selectedIndex);
});

camera1OptionSelect.addEventListener('change', () => {
Expand Down

0 comments on commit becc51d

Please sign in to comment.