Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
chore: change toolbox layout to match excel sheet (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeftadeGraaf authored Jan 4, 2024
1 parent ae8edee commit f5ec1e4
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 81 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@angular/platform-browser-dynamic": "~15.2.9",
"@angular/router": "~15.2.9",
"@fortawesome/fontawesome-free": "^6.1.1",
"@leaphy-robotics/leaphy-blocks": "1.5.4",
"@leaphy-robotics/leaphy-blocks": "1.6.0",
"@ngx-translate/core": "^14.0.0",
"@ngx-translate/http-loader": "^7.0.0",
"@serialport/parser-readline": "^10.3.0",
Expand Down
2 changes: 1 addition & 1 deletion src/app/domain/robot.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class RobotType {
public core: string,
public libs: string[],
public isWired: boolean = true,
public showLeaphyExtra: boolean = true,
public showLeaphyActuators: boolean = true,
public showCodeOnStart: boolean = false
) { }
}
4 changes: 2 additions & 2 deletions src/app/effects/backend.wired.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import * as Blockly from 'blockly/core';


const fileExtensions = [
".l_flitz",
".l_flitz_uno",
".l_flitz_nano",
".l_original",
".l_original_uno",
".l_click",
".l_uno",
".l_nano",
Expand Down
4 changes: 2 additions & 2 deletions src/app/effects/blockly-editor.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ export class BlocklyEditorEffects {
const toolboxElement = toolboxXmlDoc.getElementById('easyBloqsToolbox');
const leaphyCategories = parser.parseFromString(leaphyToolboxXml, 'text/xml');
const leaphyRobotCategory = leaphyCategories.getElementById(robotType.id);
if (robotType.showLeaphyExtra) {
const leaphyExtraCategory = leaphyCategories.getElementById(`${robotType.id}_extra`);
if (robotType.showLeaphyActuators) {
const leaphyExtraCategory = leaphyCategories.getElementById(`${robotType.id}_actuators`);
toolboxElement.prepend(leaphyExtraCategory);
}
toolboxElement.prepend(leaphyRobotCategory);
Expand Down
16 changes: 8 additions & 8 deletions src/app/state/app.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ export class AppState {
private static defaultLibraries = [
'Leaphy Original Extension', 'Leaphy Extra Extension', 'Servo', 'Adafruit GFX Library', 'Adafruit SSD1306', 'Adafruit LSM9DS1 Library', 'Adafruit Unified Sensor'
]
private static leaphyOriginalRobotType = new RobotType('l_original', 'Leaphy Original', 'orig.svg', 'Arduino UNO', 'arduino:avr:uno', 'hex', 'arduino:avr',
private static leaphyOriginalRobotType = new RobotType('l_original_uno', 'Leaphy Original', 'orig.svg', 'Arduino UNO', 'arduino:avr:uno', 'hex', 'arduino:avr',
AppState.defaultLibraries.concat(['QMC5883LCompass', 'Arduino_APDS9960'])
);
private static leaphyFlitzRobotType = new RobotType('l_flitz', 'Leaphy Flitz', 'flitz.svg', 'Arduino UNO', 'arduino:avr:uno', 'hex', 'arduino:avr',
private static leaphyFlitzRobotType = new RobotType('l_flitz_uno', 'Leaphy Flitz', 'flitz.svg', 'Arduino UNO', 'arduino:avr:uno', 'hex', 'arduino:avr',
AppState.defaultLibraries, true, false
);
private static leaphyFlitzNanoRobotType = new RobotType('l_flitz_nano', 'Flitz Nano', 'flitz_nano.svg', 'Arduino Nano', 'arduino:avr:nano', 'hex', 'arduino:avr',
AppState.defaultLibraries, true, false
);
private static leaphyClickRobotType = new RobotType('l_click', 'Leaphy Click', 'click.svg', 'Arduino UNO', 'arduino:avr:uno', 'hex', 'arduino:avr',
Expand All @@ -34,18 +37,15 @@ export class AppState {
AppState.defaultLibraries.concat(['Leaphy WiFi Extension'])
);
public static genericRobotType = new RobotType('l_code', 'Generic Robot', null, 'Arduino UNO', 'arduino:avr:uno', 'hex', 'arduino:avr',
AppState.defaultLibraries.concat(['QMC5883LCompass', 'Arduino_APDS9960'])
);
private static leaphyFlitzNanoRobotType = new RobotType('l_flitz_nano', 'Flitz Nano', 'flitz_nano.svg', 'Arduino Nano', 'arduino:avr:nano', 'hex', 'arduino:avr',
AppState.defaultLibraries, true, false
AppState.defaultLibraries.concat(['QMC5883LCompass', 'Arduino_APDS9960'])
);
private static arduinoNanoRobotType = new RobotType('l_nano', 'Arduino Nano', 'nano.svg', 'Arduino NANO', 'arduino:avr:nano', 'hex', 'arduino:avr',
AppState.defaultLibraries.concat(['QMC5883LCompass', 'Arduino_APDS9960'])
);

public static idToRobotType = {
'l_original': AppState.leaphyOriginalRobotType,
'l_flitz': AppState.leaphyFlitzRobotType,
'l_original_uno': AppState.leaphyOriginalRobotType,
'l_flitz_uno': AppState.leaphyFlitzRobotType,
'l_click': AppState.leaphyClickRobotType,
'l_uno': AppState.arduinoUnoRobotType,
'l_wifi': AppState.leaphyWiFiRobotType,
Expand Down
Loading

0 comments on commit f5ec1e4

Please sign in to comment.