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

Commit

Permalink
Chore: revert operators for flitz+original (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
sverben authored Jan 31, 2024
1 parent 883f680 commit 1b647da
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@angular/router": "16.2.12",
"@blockly/workspace-backpack": "^5.3.3",
"@fortawesome/fontawesome-free": "^6.1.1",
"@leaphy-robotics/leaphy-blocks": "1.9.1",
"@leaphy-robotics/leaphy-blocks": "1.9.2",
"@ngx-translate/core": "^14.0.0",
"@ngx-translate/http-loader": "^7.0.0",
"@serialport/parser-readline": "^10.3.0",
Expand Down
1 change: 1 addition & 0 deletions src/app/domain/robot.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class RobotType {
public libs: string[],
public isWired: boolean = true,
public showLeaphyActuators: boolean = true,
public showLeaphyOperators: boolean = true,
public showCodeOnStart: boolean = false
) { }
}
5 changes: 5 additions & 0 deletions src/app/effects/blockly-editor.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ export class BlocklyEditorEffects {
const toolboxElement = toolboxXmlDoc.getElementById('easyBloqsToolbox');
const leaphyCategories = parser.parseFromString(leaphyToolboxXml, 'text/xml');
const leaphyRobotCategory = leaphyCategories.getElementById(robotType.id);
if (robotType.showLeaphyOperators) {
toolboxElement.removeChild(toolboxXmlDoc.getElementById("l_numbers"))
} else {
toolboxElement.removeChild(toolboxXmlDoc.getElementById("l_operators"))
}
if (robotType.showLeaphyActuators) {
const leaphyExtraCategory = leaphyCategories.getElementById(`${robotType.id}_actuators`);
toolboxElement.prepend(leaphyExtraCategory);
Expand Down
8 changes: 4 additions & 4 deletions src/app/state/app.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export class AppState {
'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_uno', 'Leaphy Original', 'orig.svg', 'Arduino UNO', 'arduino:avr:uno', 'hex', 'arduino:avr',
AppState.defaultLibraries.concat(['QMC5883LCompass', 'Arduino_APDS9960'])
AppState.defaultLibraries.concat(['QMC5883LCompass', 'Arduino_APDS9960']), true, true, false
);
private static leaphyFlitzRobotType = new RobotType('l_flitz_uno', 'Leaphy Flitz', 'flitz.svg', 'Arduino UNO', 'arduino:avr:uno', 'hex', 'arduino:avr',
AppState.defaultLibraries, true, false
AppState.defaultLibraries, true, false, 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
AppState.defaultLibraries, true, false, false
);
private static leaphyClickRobotType = new RobotType('l_click', 'Leaphy Click', 'click.svg', 'Arduino UNO', 'arduino:avr:uno', 'hex', 'arduino:avr',
AppState.defaultLibraries
Expand All @@ -39,7 +39,7 @@ export class AppState {
AppState.defaultLibraries.concat(['QMC5883LCompass', 'Arduino_APDS9960'])
);
public static microPythonRobotType = new RobotType('l_micropython', 'MicroPython', 'micropython.svg', 'MicroPython', '', 'bin', '',
[], true, false);
[], true, false, false);

public static idToRobotType = {
'l_original_uno': AppState.leaphyOriginalRobotType,
Expand Down
70 changes: 70 additions & 0 deletions src/assets/blockly/base-toolbox.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,76 @@
<block type="controls_whileUntil"></block>
</category>
<category id="l_numbers" toolboxitemid="l_numbers" name="%{BKY_LEAPHY_NUMBERS_CATEGORY}" categorystyle="numbers_category">
<block type="math_number">
<field name="NUM">123</field>
</block>
<sep gap="8"></sep>
<block type="logic_compare">
<value name="A">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
<value name="B">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
</block>
<sep gap="8"></sep>
<block type="math_arithmetic">
<value name="A">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
<value name="B">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
</block>
<sep gap="8"></sep>
<block type="math_random_int">
<value name="FROM">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
<value name="TO">
<shadow type="math_number">
<field name="NUM">100</field>
</shadow>
</value>
</block>
<sep gap="8"></sep>
<block type="logic_operation"></block>
<sep gap="8"></sep>
<block type="logic_boolean"></block>
<sep gap="8"></sep>
<block type="logic_negate"></block>
<sep gap="8"></sep>
<block type="math_round">
<value name="NUM">
<shadow type="math_number">
<field name="NUM">3.1</field>
</shadow>
</value>
</block>
<sep gap="8"></sep>
<block type="math_number_property">
<value name="NUMBER_TO_CHECK">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
</value>
</block>
<sep gap="8"></sep>
<block type="math_trig"></block>
<sep gap="8"></sep>
<block type="math_single"></block>
</category>
<category id="l_operators" toolboxitemid="l_numbers" name="%{BKY_LEAPHY_OPERATORS_CATEGORY}" categorystyle="numbers_category">
<block type="math_number">
<field name="NUM">123</field>
</block>
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1828,10 +1828,10 @@
resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.4.0.tgz#08d6c5e20cf7e4cc02fd181c4b0c225cd31dbb60"
integrity sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==

"@leaphy-robotics/leaphy-blocks@1.9.1":
version "1.9.1"
resolved "https://registry.yarnpkg.com/@leaphy-robotics/leaphy-blocks/-/leaphy-blocks-1.9.1.tgz#57ceca362f95e0ea7c6ffe34e93827234a5c4692"
integrity sha512-hecaMWNIxomFBbnBo5fWGfd7pJZMYK0zai8ByzoxIHfKKhxncJoQr60iT/O0HEpUJ5LZ4YE14WXrrSx8Lk1HOQ==
"@leaphy-robotics/leaphy-blocks@1.9.2":
version "1.9.2"
resolved "https://registry.yarnpkg.com/@leaphy-robotics/leaphy-blocks/-/leaphy-blocks-1.9.2.tgz#c47022eaf768081fc277423105ef075188a40b2c"
integrity sha512-J2NDRresPHWzdArvMgI2QHwvltk+5JauYybwo0hisQcIMlaHx49IsnQtbLRG7FfWx4wGUWJAVqjHV2gUGaAjbQ==
dependencies:
blockly "^10.1.3"
typescript "4.3.2"
Expand Down

0 comments on commit 1b647da

Please sign in to comment.