From b3ea191ea9b7ed8a9be1e7a4f8005e2f92bd44fd Mon Sep 17 00:00:00 2001 From: Koen <98043234+koen1711@users.noreply.github.com> Date: Tue, 23 Apr 2024 09:30:05 +0200 Subject: [PATCH] chore: add board selector (#245) * chore: add board selector * chore: prettier * fix: switch from blocks to env issue * chore: prettier * chore: fix esp32 protocol * chore: fix rp2040 protocol * chore: change generics to baserobots (DRY) * fix: arduino every -> arduino nano every * chore: remove feature flags for block env --- src/app/domain/robots.ts | 85 +++++++++++++++++-- .../components/header/header.component.html | 20 +++++ .../components/header/header.component.scss | 5 ++ .../components/header/header.component.ts | 24 +++++- .../button-bar/button-bar.component.html | 3 +- .../button-bar/button-bar.component.ts | 2 + src/app/state/app.state.ts | 11 ++- 7 files changed, 137 insertions(+), 13 deletions(-) diff --git a/src/app/domain/robots.ts b/src/app/domain/robots.ts index ce5fda94..122c15f3 100644 --- a/src/app/domain/robots.ts +++ b/src/app/domain/robots.ts @@ -1,3 +1,4 @@ +import { arduino } from "@leaphy-robotics/leaphy-blocks"; import Avrdude from "../services/arduino-uploader/protocols/avrdude"; import { BaseNano, @@ -6,6 +7,8 @@ import { BaseUno, RobotType, } from "./robot.type"; +import DFU from "../services/arduino-uploader/protocols/dfu"; +import Pico from "../services/arduino-uploader/protocols/pico"; const defaultLibraries = [ "Leaphy Extensions", @@ -121,15 +124,6 @@ export const arduinoUnoRobotType = new BaseUno( }, ); -export const genericRobotType = new BaseUno( - "l_code", - "Leaphy C++", - "c++.svg", - null, - defaultLibraries.concat(["QMC5883LCompass", "Arduino_APDS9960"]), - {}, -); - export const arduinoNanoRobotType = new BaseNano( "l_nano", "Arduino Nano", @@ -195,3 +189,76 @@ export const arduinoMegaRobotType = new RobotType( showLeaphySensors: true, }, ); + +/* Generic robots for the C++ code editor */ + +export const genericRobotType = new BaseUno( + "l_code", + "Leaphy C++", + "c++.svg", + null, + [], +); + +export const arduinoUnoRobotTypeGeneric = new BaseUno( + "l_uno", + "Arduino Uno", + "uno.svg", + null, + [], +); + +export const arduinoMegaRobotTypeGeneric = new RobotType( + "l_mega", + { protocol: Avrdude, microcontroller: "atmega2560" }, + "Arduino Mega", + "mega.svg", + null, + "arduino:avr:mega", + "arduino:avr", + [], +); + +export const arduinoNanoRobotTypeGeneric = new BaseNano( + "l_nano", + "Arduino Nano", + "nano.svg", + null, + [], +); + +export const arduinoNanoESP32RobotTypeGeneric = new BaseNanoESP32( + "l_nano_esp32", + "Arduino Nano ESP32", + "nano.svg", + null, + [], +); + +export const arduinoNanoEveryRobotTypeGeneric = new RobotType( + "l_nano_every", + { protocol: Avrdude, microcontroller: "megaavr" }, + "Arduino Nano Every", + "nano.svg", + null, + "megaavr:avr:every", + "megaavr:avr", + [], +); + +export const arduinoNanoRP2040RobotTypeGeneric = new BaseNanoRP2040( + "l_nano_rp2040", + "Arduino Nano RP2040", + "nano.svg", + null, + [], +); + +export const genericRobots = [ + arduinoUnoRobotTypeGeneric, + arduinoNanoRobotTypeGeneric, + arduinoNanoESP32RobotTypeGeneric, + arduinoNanoRP2040RobotTypeGeneric, + arduinoMegaRobotTypeGeneric, + arduinoNanoEveryRobotTypeGeneric, +]; diff --git a/src/app/modules/components/header/header.component.html b/src/app/modules/components/header/header.component.html index 49eef160..57dd1153 100644 --- a/src/app/modules/components/header/header.component.html +++ b/src/app/modules/components/header/header.component.html @@ -8,9 +8,29 @@