Skip to content

Commit

Permalink
Set/get system for manipulation of values not in the dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBoesen committed May 27, 2016
1 parent 793de78 commit b0d4e21
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ Addon for direct manipulation of individual NetworkTables values through FRC Das

## Installation
1. Copy the contents of `tuning.html` to wherever in the dashboard you desire.
2. Add #tuning to the list labeled "Major parts of interface" in `style.css`.
2. Add `#tuning` to the list labeled "Major parts of interface" in `style.css`.
3. Copy the contents of `tuning.css` to `style.css` in the dashboard. Of course, you can put it anywhere else you would normally put CSS.
4. Copy the sections of `tuning.js` to where the comments above each section say they should go.
7 changes: 6 additions & 1 deletion tuning.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@
<button id="tuningButton">Tuning</button>

<!-- The actual tuning window -->
<div id="tuning"></div>
<div id="tuning">
<input type="text" placeholder="Property" id="name">
<input type="text" placeholder="Value" id="value">
<button id="set">Set</button>
<button id="get">Get</button>
</div>
24 changes: 19 additions & 5 deletions tuning.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
// This should be added inside the definition of the 'ui' object at the starting of ui.js.

,
tuning: {
list: document.getElementById('tuning'),
button: document.getElementById('tuningButton')
}
,
tuning: {
list: document.getElementById('tuning'),
button: document.getElementById('tuningButton'),
name: document.getElementById('name'),
value: document.getElementById('value'),
set: document.getElementById('set'),
get: document.getElementById('get')
}

// End section

Expand Down Expand Up @@ -85,4 +89,14 @@ ui.tuning.button.onclick = function() {
}
};

// Manages get and set buttons at the top of the tuning pane
ui.tuning.set.onclick = function() {
if (ui.tuning.name.value && ui.tuning.value.value) { // Make sure the inputs have content
NetworkTables.setValue(ui.tuning.name.value, ui.tuning.value.value);
}
};
ui.tuning.get.onclick = function() {
ui.tuning.value.value = NetworkTables.getValue(ui.tuning.name.value);
};

// End section

0 comments on commit b0d4e21

Please sign in to comment.