Skip to content

Commit

Permalink
Merge pull request #152 from purduesigbots/develop
Browse files Browse the repository at this point in the history
🔖Release 0.6.0
  • Loading branch information
BennyBot authored Apr 20, 2023
2 parents 57f13fa + 7216b5e commit 7ba5e0f
Show file tree
Hide file tree
Showing 27 changed files with 1,108 additions and 188 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Check formatting with Prettier
uses: creyD/prettier_action@v4.2
uses: creyD/prettier_action@v4.3
with:
prettier_options: --check **/*.{js,ts,jsx,tsx,md,css,html}
eslint_check:
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}

15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
# PROS Editor Change Log
# PROS VSCode Extension Change Log

Below are our release notes with their release dates corresponding to each version.

## [0.6.0] - 2023-04-17 - Beta Version

### Added

- Add Experimental Features option
- Add progress bar for uploading
- Automatically Delete old PROS Logs
- Prevent same commands from being run multiple times concurrently
- Detect project slot for run command
- Improve toolchain verification
- [Experimental] Vision Utility installation for windows
- [Experimental] V5 Brain View

## [0.5.0] - 2022-12-12 - Beta Version

### Added
Expand Down
12 changes: 12 additions & 0 deletions media/brainView.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.body__container {
margin: 1rem auto;
display: grid;
}
.selection {
background-color: rgb(60, 60, 60);
color: rgb(240, 240, 240);
border-color: rgb(60, 60, 60);
box-sizing: border-box;
padding: 5px;
width: 100%;
}
90 changes: 90 additions & 0 deletions media/brainView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
(function () {
const vscode = acquireVsCodeApi();

const brainInfo = document.getElementById("brain_info");
const brainList = document.getElementById("brain_list");
const programList = document.getElementById("programs");
const deviceContainer = document.getElementById("device_container");
const nameInput = document.getElementById("name");
const teamInput = document.getElementById("team");

window.addEventListener("message", (event) => {
const message = event.data;

switch (message.type) {
case "deviceInfo":
updateDeviceInfo(message.deviceInfo);
break;
case "deviceList":
updateDeviceList(message.deviceList, message.currentDevice);
}
});

brainList.addEventListener("change", (event) => {
const selector = event.target;
vscode.postMessage({ type: "setPort", port: selector.value });
});

var oldName = "";
nameInput.addEventListener("keydown", (event) => {
if (event.key === "Enter") {
vscode.postMessage({ type: "setName", name: event.target.value });
} else if (event.key === "Escape") {
nameInput.value = oldName;
}
});

var oldTeam = "";
teamInput.addEventListener("keydown", (event) => {
if (event.key === "Enter") {
vscode.postMessage({ type: "setTeam", team: event.target.value });
} else if (event.key === "Escape") {
teamInput.value = oldTeam;
}
});

function updateDeviceInfo(deviceInfo) {
if (deviceInfo.ssn) {
if (deviceInfo.name !== oldName) {
nameInput.value = deviceInfo.name;
oldName = deviceInfo.name;
}
if (deviceInfo.team !== oldTeam) {
teamInput.value = deviceInfo.team;
oldTeam = deviceInfo.team;
}
brainInfo.innerHTML = "Brain Info:<br>";
brainInfo.innerHTML += `VEXos Version: ${deviceInfo.vexos}<br>`;
brainInfo.innerHTML += `CPU0 Firmware Version: ${deviceInfo.cpu0}<br>`;
brainInfo.innerHTML += `CPU1 SDK Version: ${deviceInfo.cpu1}<br>`;
brainInfo.innerHTML += `System ID: ${deviceInfo.ssn}`;
programList.innerHTML = "Programs:<br>";
deviceInfo.programs.forEach((program) => {
//programList.innerHTML += `<option value=${program.slot} ${Number(program.slot) === Number(deviceInfo.currentSlot) ? "selected" : ""}>${program.file}</option>`;
programList.innerHTML += `Slot ${program.slot}: ${program.file}`;
});
deviceContainer.innerHTML = "";
deviceInfo.devices.forEach((device) => {
deviceContainer.innerHTML += `Port ${device.port}: ${device.type}<br>`;
});
} else {
brainInfo.innerHTML = "No Brain Info Available!";
}
}

function updateDeviceList(deviceList, currentDevice) {
brainList.innerHTML = "";
if (deviceList.length === 0) {
programList.innerHTML = "";
brainInfo.innerHTML = "No V5 Devices Found!";
deviceContainer.innerHTML = "";
}
deviceList.forEach((deviceInfo) => {
brainList.innerHTML += `<option value=${deviceInfo.device} ${
deviceInfo.device === currentDevice ? "selected" : ""
}>${deviceInfo.desc}</option>`;
});
}

setInterval(vscode.postMessage, 3000, { type: "updateDeviceList" });
})();
Binary file added media/vexicon.woff
Binary file not shown.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 67 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"color": "#D6B872",
"theme": "dark"
},
"version": "0.5.0",
"version": "0.6.0",
"engines": {
"vscode": "^1.56.0"
},
Expand Down Expand Up @@ -67,9 +67,38 @@
"name": "PROS",
"icon": "media/pros-tux-white.png",
"contextualTitle": "PROS"
},
{
"id": "pros.brainView",
"name": "Brain View",
"type": "webview",
"contextualTitle": "Brain View"
}
]
},
"icons": {
"pros-v5-brain": {
"description": "V5 Brain",
"default": {
"fontPath": "media/vexicon.woff",
"fontCharacter": "\\E00C"
}
},
"pros-v5-controller": {
"description": "V5 Controller",
"default": {
"fontPath": "media/vexicon.woff",
"fontCharacter": "\\E00D"
}
},
"pros-v5-unknown": {
"description": "Unknown V5 Device",
"default": {
"fontPath": "media/vexicon.woff",
"fontCharacter": "\\E00A"
}
}
},
"commands": [
{
"command": "pros.build&upload",
Expand Down Expand Up @@ -143,6 +172,18 @@
"command": "pros.selectProject",
"title": "PROS: Select PROS Project"
},
{
"command": "pros.installVision",
"title": "PROS: Install PROS Vision"
},
{
"command": "pros.uninstallVision",
"title": "PROS: Uninstall PROS Vision"
},
{
"command": "pros.runVision",
"title": "PROS: Run PROS Vision"
},
{
"command": "pros.deleteLogs",
"title": "PROS: Delete Logs"
Expand All @@ -166,29 +207,29 @@
],
"keybindings": [
{
"key": "ctrl+shift+i",
"key": "ctrl+alt+o",
"command": "pros.showterminal",
"mac": "cmd+shift+i"
"mac": "cmd+alt+o"
},
{
"key": "ctrl+shift+b",
"key": "ctrl+alt+b",
"command": "pros.build",
"mac": "cmd+shift+b"
"mac": "cmd+alt+b"
},
{
"key": "ctrl+shift+u",
"key": "ctrl+alt+u",
"command": "pros.upload",
"mac": "cmd+shift+u"
"mac": "cmd+alt+u"
},
{
"key": "ctrl+shift+m",
"key": "ctrl+alt+m",
"command": "pros.build&upload",
"mac": "cmd+shift+m"
"mac": "cmd+alt+m"
},
{
"key": "ctrl+shift+t",
"key": "ctrl+alt+t",
"command": "pros.terminal",
"mac": "cmd+shift+t"
"mac": "cmd+alt+t"
}
],
"menus": {
Expand Down Expand Up @@ -283,11 +324,21 @@
"default": true,
"description": "Prompt for PROS CLI install on startup."
},
"pros.showDeviceConnectNotifications": {
"type": "boolean",
"default": true,
"description": "Show notifications for device connects and disconnects."
},
"pros.useLogger": {
"type": "boolean",
"default": true,
"description": "Log PROS Extension events into a log file. Will help people provide better tech support if something goes wrong."
},
"pros.logHistoryLimit": {
"type": "number",
"default": 60,
"description": "The number of days that log files will be kept before being removed."
},
"pros.OneClick: CliDownloadURL": {
"type": "string",
"default": "default",
Expand All @@ -297,6 +348,11 @@
"type": "string",
"default": "default",
"description": "URL to download PROS Toolchain from. SHOULD NOT BE CHANGED BY MOST USERS!"
},
"pros.Beta: Enable Experimental Features": {
"type": "boolean",
"default": false,
"description": "Enable experimental features. These features are not guaranteed to work and may be removed at any time."
}
}
}
Expand Down
15 changes: 9 additions & 6 deletions src/commands/base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class BaseCommand {
requiresProsProject: boolean;
exited: boolean = false;
extraOutput?: string[];
progressWindow: BackgroundProgress;

constructor(options: BaseCommandOptions) {
// the constructor is what is called whenever a new instance of the class is created
Expand Down Expand Up @@ -79,6 +80,7 @@ export class BaseCommand {
this.requiresProsProject = options.requiresProsProject;
this.extraOutput = options.extraOutput ? [] : undefined;
this.successMessage = options.successMessage;
this.progressWindow = new BackgroundProgress(this.message, true, false);
// As far as implementing this onto each command, there are two ways you can do this.
// The first way is to do it how I layed it out above, where in each command file we make a json object and then pass it into the constructor.
// The second method is to change the above to become an abstract class, and then make a new class for each command which inherits from this class.
Expand Down Expand Up @@ -135,8 +137,10 @@ export class BaseCommand {
// The arguments to pass to the command are the arguments we stored in the constructor.
// The options to pass to the command are the options we stored in the constructor.

const progressWindow = new BackgroundProgress(this.message, true, true);
this.progressWindow.start();

console.log("Running command: " + this.command);
console.log("Args: " + this.args);
const child = child_process.spawn(this.command, this.args, {
cwd: this.cwd,
env: {
Expand Down Expand Up @@ -184,19 +188,18 @@ export class BaseCommand {
});
});

progressWindow.token?.onCancellationRequested(() => {
this.progressWindow.token?.onCancellationRequested(() => {
choiceExit = true;
child.kill();
});

child.on("exit", () => {
progressWindow.stop();
this.progressWindow.stop();
this.exited = true;
console.log("Exited");
});
console.log("eeee starting wait");

await this.waitForExit();
console.log("eeee done waiting");

if (this.successMessage === "hidden") {
return;
Expand Down Expand Up @@ -256,7 +259,7 @@ export class BaseCommand {
vscode.window
.showWarningMessage(
line,
...prompt[0].replace(/[\[\]]/, "").split(/\|/)
...prompt[0].replace(/[\[\]]/g, "").split(/\|/)
)
.then((response) => {
if (response) {
Expand Down
Loading

0 comments on commit 7ba5e0f

Please sign in to comment.