Skip to content

Commit 34fdf9b

Browse files
committed
Merge branch '8.0' of github.com:OpenFTC/Extracted-RC into 8.0A
# Conflicts: # FtcRobotController/src/main/AndroidManifest.xml # FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetection.java # FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetectionSwitchableCameras.java # FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptTensorFlowObjectDetectionWebcam.java # FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptVuforiaFieldNavigation.java # FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptVuforiaFieldNavigationWebcam.java # FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/internal/FtcRobotControllerActivity.java # Inspection/src/main/java/org/firstinspires/inspection/RcInspectionActivity.java # OnBotJava/src/main/assets/java/templates/ConceptVuforiaFieldNavigationWebcam # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/cf/code/LocalsArraySet.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/cf/code/OneLocalsArray.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/command/dexer/Main.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/OpcodeInfo.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/BaseCodeCursor.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/CodeCursor.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/FillArrayDataPayloadDecodedInstruction.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/FiveRegisterDecodedInstruction.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/FourRegisterDecodedInstruction.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/OneRegisterDecodedInstruction.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/PackedSwitchPayloadDecodedInstruction.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/RegisterRangeDecodedInstruction.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/ShortArrayCodeInput.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/ShortArrayCodeOutput.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/SparseSwitchPayloadDecodedInstruction.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/ThreeRegisterDecodedInstruction.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/TwoRegisterDecodedInstruction.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/io/instructions/ZeroRegisterDecodedInstruction.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/ssa/Dominators.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/ssa/MoveParamCombiner.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/ssa/RegisterMapper.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/util/BitIntSet.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/util/ByteArray.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/util/LabeledList.java # RobotCore/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dx/util/ListIntSet.java # RobotServer/src/main/assets/java/onbotjava-classes.jar # readme.md
2 parents 69043a3 + 3f86727 commit 34fdf9b

249 files changed

Lines changed: 48770 additions & 1659 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Blocks/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ android {
66
defaultConfig {
77
minSdkVersion 23
88
targetSdkVersion 28
9-
versionCode 91
10-
versionName "17.6"
9+
versionCode 97
10+
versionName "20.0"
1111
}
1212
}
1313

Blocks/src/main/assets/blocks/FtcBlocksProjects_common.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,11 +397,12 @@ function finishNewOrUploadProject(projectName, blkFileContent, errorElement, dia
397397
// Create a headless workspace to generate the JavaScript.
398398
var jsFileContent = '';
399399
try {
400-
var workspace = new Blockly.Workspace();
400+
// workspace is a global variable defined in vars.js
401+
workspace = new Blockly.Workspace();
401402
// For consistency with previous versions, we explicitly set oneBasedIndex to true.
402403
workspace.options.oneBasedIndex = true;
403404
Blockly.Xml.domToWorkspace(dom, workspace);
404-
jsFileContent = Blockly.JavaScript.workspaceToCode(workspace);
405+
jsFileContent = generateJavaScriptCode();
405406
} catch (e) {
406407
errorElement.innerHTML = 'Error: Could not generate code for blocks. ' + e;
407408
return;

Blocks/src/main/assets/blocks/FtcBlocks_common.js

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -223,18 +223,7 @@ function saveProjectNow(opt_success_callback) {
223223
const blkFileContent = getCurrentBlkFileContent();
224224

225225
// Generate JavaScript code.
226-
const disabled = disableOrphans();
227-
let jsFileContent = Blockly.JavaScript.workspaceToCode(workspace);
228-
const identifiersUsed = collectIdentifiersUsed();
229-
reenableOrphans(disabled);
230-
231-
let comment = IDENTIFIERS_USED_PREFIX;
232-
let delimiter = '';
233-
for (let identifier of identifiersUsed) {
234-
comment += delimiter + identifier;
235-
delimiter = ',';
236-
}
237-
jsFileContent = comment + '\n\n' + jsFileContent;
226+
const jsFileContent = generateJavaScriptCode();
238227

239228
saveProject(currentProjectName, blkFileContent, jsFileContent,
240229
function(success, errorMessage) {
@@ -259,51 +248,6 @@ function saveProjectNow(opt_success_callback) {
259248
}
260249
}
261250

262-
function disableOrphans() {
263-
Blockly.Events.disable();
264-
var disabled = [];
265-
var blocks = workspace.getTopBlocks(true);
266-
for (var x = 0, block; block = blocks[x]; x++) {
267-
if (block.type != 'procedures_defnoreturn' &&
268-
block.type != 'procedures_defreturn' &&
269-
block.isEnabled()) {
270-
do {
271-
block.setEnabled(false);
272-
disabled.push(block);
273-
block = block.getNextBlock();
274-
} while (block);
275-
}
276-
}
277-
Blockly.Events.enable();
278-
return disabled;
279-
}
280-
281-
function reenableOrphans(disabled) {
282-
Blockly.Events.disable();
283-
for (var x = 0, block; block = disabled[x]; x++) {
284-
block.setEnabled(true);
285-
}
286-
Blockly.Events.enable();
287-
}
288-
289-
function collectIdentifiersUsed() {
290-
const identifiersUsed = new Set();
291-
const allBlocks = workspace.getAllBlocks();
292-
for (let iBlock = 0, block; block = allBlocks[iBlock]; iBlock++) {
293-
if (block.isEnabled()) {
294-
for (var iFieldName = 0; iFieldName < identifierFieldNames.length; iFieldName++) {
295-
const identifierFieldName = identifierFieldNames[iFieldName];
296-
const field = block.getField(identifierFieldName);
297-
if (field) {
298-
const identifier = field.getValue();
299-
identifiersUsed.add(identifier);
300-
}
301-
}
302-
}
303-
}
304-
return identifiersUsed;
305-
}
306-
307251
/**
308252
* After saving the project, downloads the blk file.
309253
* Called from Download button onclick.

Blocks/src/main/assets/blocks/color.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,8 @@ Blockly.JavaScript['normalizedColors_getProperty_Number'] = function(block) {
656656
var normalizedColors = Blockly.JavaScript.valueToCode(
657657
block, 'NORMALIZED_COLORS', Blockly.JavaScript.ORDER_MEMBER);
658658
var code = normalizedColors + '.' + property;
659-
return [code, Blockly.JavaScript.ORDER_MEMBER];
659+
var blockLabel = 'NormalizedColors.' + block.getField('PROP').getText();
660+
return wrapJavaScriptCode(code, blockLabel);
660661
};
661662

662663
Blockly.FtcJava['normalizedColors_getProperty_Number'] = function(block) {

Blocks/src/main/assets/blocks/runtime.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,30 @@
2424
// blocksOpMode
2525
// telemetry
2626

27+
28+
var currentBlockLabel = '';
29+
2730
function callRunOpMode() {
2831
blocksOpMode.scriptStarting();
2932
try {
3033
// Call the runOpMode method in the generated javascript.
3134
runOpMode();
3235
} catch (e) {
33-
blocksOpMode.caughtException(String(e));
36+
blocksOpMode.caughtException(String(e), currentBlockLabel);
3437
}
3538
blocksOpMode.scriptFinished();
3639
}
3740

41+
function startBlockExecution(blockLabel) {
42+
currentBlockLabel = blockLabel;
43+
return true;
44+
}
45+
46+
function endBlockExecution(value) {
47+
currentBlockLabel = '';
48+
return value;
49+
}
50+
3851
function telemetryAddTextData(key, data) {
3952
switch (typeof data) {
4053
case 'string':

Blocks/src/main/assets/blocks/samples/ConceptTensorFlowObjectDetection.blk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<block type="tfod_setZoom" id="wc!x$n$!eF21(Z6Cu:iN">
119119
<value name="MAGNIFICATION">
120120
<shadow type="math_number" id="1KoG{M+xaV:C|)KGJ!_]">
121-
<field name="NUM">2.5</field>
121+
<field name="NUM">1.0</field>
122122
</shadow>
123123
</value>
124124
<value name="ASPECT_RATIO">

Blocks/src/main/assets/blocks/samples/ConceptTensorFlowObjectDetectionCustomModel.blk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ If your model is based on SSD MobileNet V1 FPN 640x640 or SSD MobileNet V2 FPNLi
255255
<block type="tfod_setZoom" id=";ZJ]=-U*#}KtN^c{*n}K">
256256
<value name="MAGNIFICATION">
257257
<shadow type="math_number" id="U|o7?|l{@X,7N?tnx+E.">
258-
<field name="NUM">2.5</field>
258+
<field name="NUM">1.0</field>
259259
</shadow>
260260
</value>
261261
<value name="ASPECT_RATIO">

Blocks/src/main/assets/blocks/samples/ConceptTensorFlowObjectDetectionSwitchableCameras.blk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
<block type="tfod_setZoom" id="vSb=@hTz=nXMZN-T0R7r">
123123
<value name="MAGNIFICATION">
124124
<shadow type="math_number" id="qKv3X|N=wOGF@rg4S`u#">
125-
<field name="NUM">2.5</field>
125+
<field name="NUM">1.0</field>
126126
</shadow>
127127
</value>
128128
<value name="ASPECT_RATIO">

Blocks/src/main/assets/blocks/samples/ConceptTensorFlowObjectDetectionWebcam.blk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
<block type="tfod_setZoom" id="aB1GwzHR*MIIKAnQObG!">
117117
<value name="MAGNIFICATION">
118118
<shadow type="math_number" id="$|tmDEP2DSJ6saa+-BMd">
119-
<field name="NUM">2.5</field>
119+
<field name="NUM">1.0</field>
120120
</shadow>
121121
</value>
122122
<value name="ASPECT_RATIO">

Blocks/src/main/assets/blocks/samples/ConceptVuforiaNav.blk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
</mutation>
100100
<value name="ARG0">
101101
<block type="vuforiaCurrentGame_typedEnum_trackableName" id="I^C(6*4wS[c!C~=qU5^I">
102-
<field name="TRACKABLE_NAME">Blue Storage</field>
102+
<field name="TRACKABLE_NAME">Red Audience Wall</field>
103103
</block>
104104
</value>
105105
</block>
@@ -116,7 +116,7 @@
116116
</mutation>
117117
<value name="ARG0">
118118
<block type="vuforiaCurrentGame_typedEnum_trackableName" id="kGly,#j?1@;!pX^@n_lV">
119-
<field name="TRACKABLE_NAME">Blue Alliance Wall</field>
119+
<field name="TRACKABLE_NAME">Red Rear Wall</field>
120120
</block>
121121
</value>
122122
</block>
@@ -133,7 +133,7 @@
133133
</mutation>
134134
<value name="ARG0">
135135
<block type="vuforiaCurrentGame_typedEnum_trackableName" id="z+i+S6WP`l+Ku1!]815o">
136-
<field name="TRACKABLE_NAME">Red Storage</field>
136+
<field name="TRACKABLE_NAME">Blue Audience Wall</field>
137137
</block>
138138
</value>
139139
</block>
@@ -150,7 +150,7 @@
150150
</mutation>
151151
<value name="ARG0">
152152
<block type="vuforiaCurrentGame_typedEnum_trackableName" id="@zukx]XD6dmQj8hc!{f=">
153-
<field name="TRACKABLE_NAME">Red Alliance Wall</field>
153+
<field name="TRACKABLE_NAME">Blue Rear Wall</field>
154154
</block>
155155
</value>
156156
</block>
@@ -316,7 +316,7 @@
316316
<block type="vuforiaCurrentGame_track" id="4jZQVo^K@])BLe3f~lUi">
317317
<value name="TRACKABLE_NAME">
318318
<shadow type="vuforiaCurrentGame_typedEnum_trackableName" id="rg.#y[B/+7C=n6YeRc__">
319-
<field name="TRACKABLE_NAME">Blue Storage</field>
319+
<field name="TRACKABLE_NAME">Red Audience Wall</field>
320320
</shadow>
321321
<block type="variables_get" id="#iCxj]yw%~i6|giT1)gf">
322322
<field name="VAR" id="Q3J-AM0*4@;V}.Qq#{4:">trackableName</field>

0 commit comments

Comments
 (0)