From b0d4e21748d97b2e5556105163127ed9a22318c6 Mon Sep 17 00:00:00 2001 From: ErikBoesen Date: Fri, 27 May 2016 11:41:48 -0400 Subject: [PATCH] Set/get system for manipulation of values not in the dashboard --- README.md | 2 +- tuning.html | 7 ++++++- tuning.js | 24 +++++++++++++++++++----- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c842c0e..2d347ad 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file diff --git a/tuning.html b/tuning.html index c714699..c82d1ab 100644 --- a/tuning.html +++ b/tuning.html @@ -2,4 +2,9 @@ -
\ No newline at end of file +
+ + + + +
diff --git a/tuning.js b/tuning.js index 73ea01a..3afe9b9 100644 --- a/tuning.js +++ b/tuning.js @@ -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 @@ -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 \ No newline at end of file