Skip to content

Commit

Permalink
Fix Risc-V selection for Pico 2 W
Browse files Browse the repository at this point in the history
  • Loading branch information
will-v-pi committed Nov 25, 2024
1 parent be6ad1c commit 3a77afb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion web/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,15 @@ var exampleSupportedBoards = [];
const useRiscv = document.getElementsByClassName('use-riscv');
let selectedIndex = getIndexByValue(toolchainSelector, result.toolchainVersion);
const optionBoardTypePico2 = document.getElementById("option-board-type-pico2");
const optionBoardTypePico2W = document.getElementById("option-board-type-pico2_w");

if (result.riscvToolchainVersion === "NONE") {
if (optionBoardTypePico2) {
optionBoardTypePico2.disabled = true
}
if (optionBoardTypePico2W) {
optionBoardTypePico2W.disabled = true
}
const boardTypeSelector = document.getElementById('sel-board-type');

if (boardTypeSelector && boardTypeSelector.value.includes("pico2")) {
Expand All @@ -467,13 +471,17 @@ var exampleSupportedBoards = [];
if (optionBoardTypePico2 && (exampleSupportedBoards.length === 0 || exampleSupportedBoards.includes("pico2"))) {
optionBoardTypePico2.disabled = false;
}
if (optionBoardTypePico2W && (exampleSupportedBoards.length === 0 || exampleSupportedBoards.includes("pico2_w"))) {
optionBoardTypePico2W.disabled = false;
}
}

if (!doProjectImport) {
const board = document.getElementById('sel-board-type').value;
const riscvSelected = document.getElementById('sel-riscv').checked;

if (board !== "pico2") {
const riscvBoards = ["pico2", "pico2_w"]
if (!riscvBoards.includes(board)) {
// ui update to account for hidden elements
const boardTypeRiscvGrid = document.getElementById("board-type-riscv-grid");
// remove grid-cols-2 class
Expand Down

0 comments on commit 3a77afb

Please sign in to comment.