Skip to content

Commit

Permalink
Fix picotool version, and Pico 2 W version parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
will-v-pi committed Nov 25, 2024
1 parent c518847 commit eebd963
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/commands/switchBoard.mts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
cmakeUpdateSDK,
} from "../utils/cmakeUtil.mjs";
import { join } from "path";
import { compareLtMajor } from "../utils/semverUtil.mjs";
import { compareLt } from "../utils/semverUtil.mjs";
import type UI from "../ui.mjs";
import { updateVSCodeStaticConfigs } from "../utils/vscodeConfigUtil.mjs";
import { getSupportedToolchains } from "../utils/toolchainUtil.mjs";
Expand All @@ -33,11 +33,11 @@ export default class SwitchBoardCommand extends Command {
Promise<[string, boolean] | undefined> {
const quickPickItems: string[] = ["pico", "pico_w"];

if (!compareLtMajor(sdkVersion, "2.0.0")) {
if (!compareLt(sdkVersion, "2.0.0")) {
quickPickItems.push("pico2");
}

if (!compareLtMajor(sdkVersion, "2.1.0")) {
if (!compareLt(sdkVersion, "2.1.0")) {
quickPickItems.push("pico2_w");
}

Expand Down
15 changes: 11 additions & 4 deletions src/utils/cmakeUtil.mts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { readFile, writeFile } from "fs/promises";
import { rimraf, windows as rimrafWindows } from "rimraf";
import { homedir } from "os";
import which from "which";
import { compareLtMajor } from "./semverUtil.mjs";
import { compareLt } from "./semverUtil.mjs";
import { buildCMakeIncPath } from "./download.mjs";

export const CMAKE_DO_NOT_EDIT_HEADER_PREFIX =
Expand Down Expand Up @@ -369,11 +369,18 @@ export async function cmakeUpdateSDK(
if (
picoBoard !== null &&
((picoBoard[1].includes("pico2") &&
compareLtMajor(newSDKVersion, "2.0.0")) ||
compareLt(newSDKVersion, "2.0.0")) ||
(picoBoard[1].includes('pico2_w') &&
compareLtMajor(newSDKVersion, "2.1.0")))
compareLt(newSDKVersion, "2.1.0")))
) {
const result = await window.showQuickPick(["pico", "pico_w"], {
const quickPickItems = ["pico", "pico_w"];
if (!compareLt(newSDKVersion, "2.0.0")) {
quickPickItems.push("pico2");
}
if (!compareLt(newSDKVersion, "2.1.0")) {
quickPickItems.push("pico2_w");
}
const result = await window.showQuickPick(quickPickItems, {
placeHolder: "The new SDK version does not support your current board",
canPickMany: false,
ignoreFocusOut: true,
Expand Down
1 change: 1 addition & 0 deletions src/webview/newProjectPanel.mts
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ export class NewProjectPanel {
result: versionBundle !== undefined,
toolchainVersion: versionBundle?.toolchain,
riscvToolchainVersion: riscvToolchain,
picotoolVersion: versionBundle?.picotool,
},
});
}
Expand Down

0 comments on commit eebd963

Please sign in to comment.