Skip to content

Commit

Permalink
load from any url
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-8 committed Nov 26, 2024
1 parent 4de4af7 commit 19a8db1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
19 changes: 12 additions & 7 deletions docs/ds/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ <h1>RCMv3 Driver Station</h1>
<button onclick="saveWifiSettings();">save wifi settings and reboot</button>
<button onclick="loadWifiSettings();">load wifi settings from robot</button>
<br>
<div id="load-projects-div">
load example project from <a target="_blank" rel="noopener noreferrer"
href="https://github.com/RCMgames/RCMv3-examples">here</a>:
<br>
<input id="projecturl" type="text"
value="https://raw.githubusercontent.com/RCMgames/RCMv3-examples/refs/heads/main/"></input>
<br>
<input id="project-name" type="text"></input>
<br>
<button onclick="loadProject();">load project</button>
</div>
<br>
enable robot:
<input id="robot-enabled" type="checkbox" style="width:30px;height:30px;"></input>
<br>
Expand Down Expand Up @@ -90,13 +102,6 @@ <h1>RCMv3 Driver Station</h1>
</span>
</div>
<br>
<div id="load-projects-div">
load example project from <a target="_blank" rel="noopener noreferrer"
href="https://github.com/RCMgames/RCMv3-examples">here</a>:
<input id="project-name" type="text"></input>
<button onclick="loadProject();">load project</button>
</div>
<br>
<div id="console"></div>
<br>
<footer style="text-align: center;">
Expand Down
11 changes: 5 additions & 6 deletions docs/ds/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ let loadedParameterPreset = [];

let miscConfigInfo = {};

//TODO: add way to load projects (UI and/or robot config) from github

document.addEventListener("DOMContentLoaded", () => {
if (window.location.hostname == "rcmgames.github.io") {
errorConnecting();
Expand Down Expand Up @@ -2119,8 +2117,9 @@ function saveMiscConfigInfo() {

function loadProject() {
let projectName = document.getElementById("project-name").value;
// TODO: load from any URL, just default to RCMv3-examples
let projectURL = "https://raw.githubusercontent.com/RCMgames/RCMv3-examples/refs/heads/main/" + projectName;
loadUI(projectURL + "/UIdata.json");
loadConfig(projectURL + "/config.json");
// TODO: option to append instead of replace
let projectUrl = document.getElementById("projecturl").value;
let projectFullURL = projectUrl + projectName;
loadUI(projectFullURL + "/UIdata.json");
loadConfig(projectFullURL + "/config.json");
}

0 comments on commit 19a8db1

Please sign in to comment.