From 8df766cab36f8f7fcc2189f3938070004e5f4851 Mon Sep 17 00:00:00 2001 From: GeraldTM Date: Wed, 19 Apr 2023 15:58:54 -0400 Subject: [PATCH 1/3] add zip and download functionality make json gen better --- docs/assets/css/v2.css | 4 ++++ docs/assets/js/v2.js | 38 ++++++++++++++++++++++++++++++++++++++ docs/index.html | 7 +++++++ 3 files changed, 49 insertions(+) diff --git a/docs/assets/css/v2.css b/docs/assets/css/v2.css index 8e936b450..7db7de39c 100644 --- a/docs/assets/css/v2.css +++ b/docs/assets/css/v2.css @@ -13,3 +13,7 @@ input[type=number] { .v2-tooltip { --bs-tooltip-bg: var(--bs-secondary); } + +.pad{ + padding: 100px; +} \ No newline at end of file diff --git a/docs/assets/js/v2.js b/docs/assets/js/v2.js index 7fcfc267b..dd5b9a6de 100644 --- a/docs/assets/js/v2.js +++ b/docs/assets/js/v2.js @@ -1,3 +1,6 @@ + + + function getFreeSpeedFromMotors() { let motor_count = {} let modules = ['frontright', 'frontleft', 'backright', 'backleft']; @@ -100,6 +103,41 @@ function copyText(name) { navigator.clipboard.writeText(text); } + +function getText(name) { + let text = $(`#${name}-json`).text(); + return text; +} + +//function from https://github.com/eligrey/FileSaver.js/issues/774 +const saveAs = (blob, name) => { + // Namespace is used to prevent conflict w/ Chrome Poper Blocker extension (Issue https://github.com/eligrey/FileSaver.js/issues/561) + const a = document.createElementNS('http://www.w3.org/1999/xhtml', 'a') + a.download = name + a.rel = 'noopener' + a.href = URL.createObjectURL(blob) + + setTimeout(() => URL.revokeObjectURL(a.href), 40 /* sec */ * 1000) + setTimeout(() => a.click(), 0) +} + +function zipDownload() { + const zip = new JSZip(); + let swf = zip.folder("swerve") + let cp = swf.file("controllerproperties.json", getText("controllerproperties")); + let sd = swf.file("swervedrive.json", getText("swervedrive")); + let mod = swf.folder("modules") + let pp = mod.file("physicalproperties.json", getText("physicalproperties")); + let fl = mod.file("frontleft.json", getText("frontleft")); + let fr = mod.file("frontright.json", getText("frontright")); + let bl = mod.file("backleft.json", getText("backleft")); + let br = mod.file("backright.json", getText("backright")); + let pidf = mod.file("pidfproperties.json", getText("pidfproperties")); + + zip.generateAsync({type:"blob"}).then(function (blob) {saveAs(blob, "YAGSL Config.zip")}); + console.log("Downloaded YAGSL Config zip"); +} + $(function () { const tooltipTriggerList = document.querySelectorAll( '[data-bs-toggle="tooltip"]'); // Initialize tooltips: https://getbootstrap.com/docs/5.3/components/tooltips/#enable-tooltips diff --git a/docs/index.html b/docs/index.html index 3c3f78ff7..ca0541dfb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -908,6 +908,9 @@

Module Tuning

+
+ +
@@ -916,7 +919,11 @@

Module Tuning

src="https://code.jquery.com/jquery-3.6.3.min.js"> + + + \ No newline at end of file From 1d55b90d7811fe3c0c9cdccc6ed51aaecf3cdb10 Mon Sep 17 00:00:00 2001 From: GeraldTM Date: Wed, 19 Apr 2023 16:25:09 -0400 Subject: [PATCH 2/3] remove unused css --- docs/assets/css/v2.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/assets/css/v2.css b/docs/assets/css/v2.css index 7db7de39c..8e936b450 100644 --- a/docs/assets/css/v2.css +++ b/docs/assets/css/v2.css @@ -13,7 +13,3 @@ input[type=number] { .v2-tooltip { --bs-tooltip-bg: var(--bs-secondary); } - -.pad{ - padding: 100px; -} \ No newline at end of file From 574a7066f6e9e6ed144b0da0873bd93b574f2677 Mon Sep 17 00:00:00 2001 From: GeraldTM Date: Wed, 19 Apr 2023 16:55:57 -0400 Subject: [PATCH 3/3] Update Readme.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bf323e103..db604f6b7 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ We will be actively montoring this and fix any issues when we can! * Development happens here on `YAGSL-Example`. `YAGSL` and `YAGSL-Lib` are updated on a nightly basis. -### TL;DR Make your configuration [here](https://broncbotz3481.github.io/YAGSL-Example/) and put it into the structure bellow. +### TL;DR Generate and download your configuration [here](https://broncbotz3481.github.io/YAGSL-Example/) and unzip it so that it follows structure below: ```text deploy