From 5d5064e17c215ad5a09949094dac84b4166de5ab Mon Sep 17 00:00:00 2001 From: Jim Ewald Date: Thu, 11 Aug 2016 15:10:43 -0700 Subject: [PATCH 001/153] Swapped dropdown defaults --- src/main/webapp/cdn/blockly/generators/propc/serial.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/cdn/blockly/generators/propc/serial.js b/src/main/webapp/cdn/blockly/generators/propc/serial.js index 37241a56..96985240 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/serial.js +++ b/src/main/webapp/cdn/blockly/generators/propc/serial.js @@ -91,9 +91,9 @@ Blockly.Blocks.xbee_setup = { this.appendDummyInput() .appendField("XBee setup") .appendField("DI pin#") - .appendField(new Blockly.FieldDropdown(profile.default.digital), 'DI_PIN') + .appendField(new Blockly.FieldDropdown(profile.default.digital), 'DO_PIN') .appendField("DO pin#") - .appendField(new Blockly.FieldDropdown(profile.default.digital), 'DO_PIN'); + .appendField(new Blockly.FieldDropdown(profile.default.digital), 'DI_PIN'); this.setInputsInline(true); this.setPreviousStatement(true, null); From ce28b6f13eeb2a5daf2295f0b12bce892e646f10 Mon Sep 17 00:00:00 2001 From: Jim Ewald Date: Fri, 12 Aug 2016 13:07:25 -0700 Subject: [PATCH 002/153] Correct missing comma in function call --- src/main/webapp/cdn/blockly/generators/propc/oled.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/webapp/cdn/blockly/generators/propc/oled.js b/src/main/webapp/cdn/blockly/generators/propc/oled.js index 4f77268a..bb7c64d9 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/oled.js +++ b/src/main/webapp/cdn/blockly/generators/propc/oled.js @@ -462,8 +462,7 @@ Blockly.propc.oled_draw_rectangle = function() { code += point_x + ', ' + point_y + ', '; code += width + ', ' + height + ', '; - code += ((Number(width) + Number(height)) / 20); -// code += '((' + width + ' + ' + height + ') / 20)' + ', '; + code += ((Number(width) + Number(height)) / 20) + ', '; code += 'oledc_color565('+ color_red + ', ' + color_green + ', ' + color_blue + ')'; } From 607e93068abec67fdb11cc6e5141b6174485039b Mon Sep 17 00:00:00 2001 From: Jim Ewald Date: Fri, 12 Aug 2016 13:48:29 -0700 Subject: [PATCH 003/153] Update XBee blocks from demo branch --- .../cdn/blockly/generators/propc/oled.js | 35 ++++---- .../cdn/blockly/generators/propc/serial.js | 88 ------------------- src/main/webapp/frame/framec.jsp | 6 +- 3 files changed, 22 insertions(+), 107 deletions(-) diff --git a/src/main/webapp/cdn/blockly/generators/propc/oled.js b/src/main/webapp/cdn/blockly/generators/propc/oled.js index bb7c64d9..4ffdbfa6 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/oled.js +++ b/src/main/webapp/cdn/blockly/generators/propc/oled.js @@ -26,7 +26,6 @@ if (!Blockly.Blocks) Blockly.Blocks = {}; - Blockly.Blocks.oled_initialize = { init: function() { this.setColour(colorPalette.getColor('protocols')); @@ -62,7 +61,6 @@ Blockly.Blocks.oled_font_loader = { } }; - Blockly.Blocks.oled_clear_screen = { init: function() { this.appendDummyInput() @@ -156,33 +154,40 @@ Blockly.Blocks.oled_draw_triangle = { // First x/y coordinates this.appendValueInput("POINT_X0") .setCheck(null) - .appendField("draw triangle point one at"); + .appendField("draw triangle at 1(x)"); this.appendValueInput("POINT_Y0") .setCheck(null) - .appendField(","); + .setAlign(Blockly.ALIGN_RIGHT) + .appendField("(y)"); // Second x/y coordinates this.appendValueInput("POINT_X1") .setCheck(null) - .appendField("point two"); + .setAlign(Blockly.ALIGN_RIGHT) + .appendField("2(x)"); this.appendValueInput("POINT_Y1") .setCheck(null) - .appendField(","); + .setAlign(Blockly.ALIGN_RIGHT) + .appendField("(y)"); // Third x/y coordinates this.appendValueInput("POINT_X2") .setCheck(null) - .appendField("point three"); + .setAlign(Blockly.ALIGN_RIGHT) + .appendField("3(x)"); this.appendValueInput("POINT_Y2") .setCheck(null) - .appendField(","); + .setAlign(Blockly.ALIGN_RIGHT) + .appendField("(y)"); // Color picker control this.appendDummyInput() + .setAlign(Blockly.ALIGN_LEFT) .appendField("color") .appendField(new Blockly.FieldColour("#ff0000"), "flood") + .setAlign(Blockly.ALIGN_RIGHT) .appendField("fill") .appendField(new Blockly.FieldCheckbox("TRUE"), "ck_fill"); // Other details - this.setInputsInline(true); + this.setInputsInline(false); this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour(colorPalette.getColor('protocols')); @@ -261,7 +266,7 @@ Blockly.Blocks.oled_text_color = { Blockly.Blocks.oled_get_max_height = { init: function() { this.appendDummyInput() - .appendField("getHeight") + .appendField("max height") this.setPreviousStatement(false, null); this.setNextStatement(false, null); this.setOutput(true, "Number"); @@ -271,11 +276,10 @@ Blockly.Blocks.oled_get_max_height = { } }; - Blockly.Blocks.oled_get_max_width = { init: function() { this.appendDummyInput() - .appendField("getWidth") + .appendField("max width") this.setPreviousStatement(false, null); this.setNextStatement(false, null); this.setOutput(true, "Number"); @@ -285,8 +289,6 @@ Blockly.Blocks.oled_get_max_width = { } }; - - Blockly.propc.oled_initialize = function () { var cs_pin = this.getFieldValue("CS"); var dc_pin = this.getFieldValue("DC"); @@ -302,7 +304,7 @@ Blockly.propc.oled_initialize = function () { Blockly.propc.oled_font_loader = function () { - Blockly.propc.definitions_["oledfonts"] = '#include "oledc_fontloader.h"'; + Blockly.propc.definitions_["oledfonts"] = '#include "oledc_fontLoader.h"'; var code = 'oledc_fontLoader();'; return code; @@ -518,7 +520,6 @@ Blockly.propc.oled_text_color = function() { return code; }; - Blockly.propc.oled_get_max_height = function() { // Ensure header file is included Blockly.propc.definitions_["oledtools"] = '#include "oledc.h"'; @@ -539,8 +540,6 @@ Blockly.propc.oled_get_max_height = function() { return [code, Blockly.propc.ORDER_NONE]; }; -// oledc_drawPixel(oledc_getHeight(), (oledc_getWidth()), oledc_color565(255, 255, 102)); - Blockly.propc.oled_get_max_width = function() { // Ensure header file is included Blockly.propc.definitions_["oledtools"] = '#include "oledc.h"'; diff --git a/src/main/webapp/cdn/blockly/generators/propc/serial.js b/src/main/webapp/cdn/blockly/generators/propc/serial.js index 96985240..bfba4512 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/serial.js +++ b/src/main/webapp/cdn/blockly/generators/propc/serial.js @@ -85,64 +85,6 @@ Blockly.Blocks.serial_rx_byte = { } }; -Blockly.Blocks.xbee_setup = { - init: function () { - this.setColour(colorPalette.getColor('protocols')); - this.appendDummyInput() - .appendField("XBee setup") - .appendField("DI pin#") - .appendField(new Blockly.FieldDropdown(profile.default.digital), 'DO_PIN') - .appendField("DO pin#") - .appendField(new Blockly.FieldDropdown(profile.default.digital), 'DI_PIN'); - - this.setInputsInline(true); - this.setPreviousStatement(true, null); - this.setNextStatement(true, null); - } -}; - -Blockly.Blocks.xbee_transmit = { - init: function () { - this.setColour(colorPalette.getColor('protocols')); - this.appendDummyInput() - .appendField("XBee transmit data") - .appendField(new Blockly.FieldVariable(Blockly.LANG_VARIABLES_GET_ITEM), 'BUFFER'); - - this.setInputsInline(true); - this.setPreviousStatement(true, null); - this.setNextStatement(true, null); - }, - getVars: function () { - return [this.getFieldValue('BUFFER')]; - }, - renameVar: function (oldName, newName) { - if (Blockly.Names.equals(oldName, this.getFieldValue('BUFFER'))) { - this.setTitleValue(newName, 'BUFFER'); - } - } -}; - -Blockly.Blocks.xbee_receive = { - init: function () { - this.setColour(colorPalette.getColor('protocols')); - this.appendDummyInput() - .appendField("XBee receive data and store in") - .appendField(new Blockly.FieldVariable(Blockly.LANG_VARIABLES_GET_ITEM), 'BUFFER'); - - this.setInputsInline(true); - this.setPreviousStatement(true, null); - this.setNextStatement(true, null); - }, - getVars: function () { - return [this.getFieldValue('BUFFER')]; - }, - renameVar: function (oldName, newName) { - if (Blockly.Names.equals(oldName, this.getFieldValue('BUFFER'))) { - this.setTitleValue(newName, 'BUFFER'); - } - } -}; - Blockly.propc.serial_open = function () { var dropdown_rx_pin = this.getFieldValue('RXPIN'); var dropdown_tx_pin = this.getFieldValue('TXPIN'); @@ -188,33 +130,3 @@ Blockly.propc.serial_rx_byte = function () { return ['fdserial_rxCheck(fdser)', Blockly.propc.ORDER_ATOMIC]; }; - -Blockly.propc.xbee_setup = function () { - var do_pin = this.getFieldValue('DO_PIN'); - var di_pin = this.getFieldValue('DI_PIN'); - - Blockly.propc.definitions_["include fdserial"] = '#include "fdserial.h"'; - - Blockly.propc.global_vars_["xbee"] = "fdserial *xbee;"; - Blockly.propc.setups_["xbee"] = 'xbee = fdserial_open(' + di_pin + ', ' + do_pin + ', 0, 9600);\n'; - - return ''; -}; - -Blockly.propc.xbee_transmit = function () { - var data = Blockly.propc.variableDB_.getName(this.getFieldValue('BUFFER'), Blockly.Variables.NAME_TYPE); - - Blockly.propc.definitions_["include fdserial"] = '#include "fdserial.h"'; - - var code = 'dprint(xbee, "%d\\n", ' + data + ');\n'; - return code; -}; - -Blockly.propc.xbee_receive = function () { - var data = Blockly.propc.variableDB_.getName(this.getFieldValue('BUFFER'), Blockly.Variables.NAME_TYPE); - - Blockly.propc.definitions_["include fdserial"] = '#include "fdserial.h"'; - - var code = 'dscan(xbee, "%d", &' + data + ');\n'; - return code; -}; diff --git a/src/main/webapp/frame/framec.jsp b/src/main/webapp/frame/framec.jsp index e9334e9a..9327b229 100644 --- a/src/main/webapp/frame/framec.jsp +++ b/src/main/webapp/frame/framec.jsp @@ -31,6 +31,7 @@ + @@ -77,7 +78,7 @@ function init(profileName, peripherals) { filterToolbox(profileName, peripherals); - Blockly.inject(document.body, {toolbox: document.getElementById('toolbox'), trashcan: true, media: '', path: ''}); // path: '/' , + Blockly.inject(document.body, {toolbox: document.getElementById('toolbox'), trashcan: true, media: '', path: '', comments: false}); // path: '/' , if (window.parent.init) { // Let the top-level application know that Blockly is ready. @@ -140,6 +141,7 @@ + " colour="220"> @@ -185,6 +187,8 @@ + + From c5407c79392df4ad97c792d9320d0e8527edad12 Mon Sep 17 00:00:00 2001 From: Jim Ewald Date: Fri, 12 Aug 2016 13:51:53 -0700 Subject: [PATCH 004/153] Bring in xbee.js file from demo --- .../cdn/blockly/generators/propc/xbee.js | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 src/main/webapp/cdn/blockly/generators/propc/xbee.js diff --git a/src/main/webapp/cdn/blockly/generators/propc/xbee.js b/src/main/webapp/cdn/blockly/generators/propc/xbee.js new file mode 100644 index 00000000..a373fe83 --- /dev/null +++ b/src/main/webapp/cdn/blockly/generators/propc/xbee.js @@ -0,0 +1,117 @@ +/** + * Visual Blocks Language + * + * Copyright 2016 Vale Tolpegin. + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview XBee blocks. + * @author valetolpegin@gmail.com (Vale Tolpegin) + */ +'use strict'; + +//define blocks +if (!Blockly.Blocks) + Blockly.Blocks = {}; + + +Blockly.Blocks.xbee_setup = { + init: function () { + this.setColour(colorPalette.getColor('protocols')); + this.appendDummyInput() + .appendField("XBee setup") + .appendField("DI pin#") + .appendField(new Blockly.FieldDropdown(profile.default.digital), 'DO_PIN') + .appendField("DO pin#") + .appendField(new Blockly.FieldDropdown(profile.default.digital), 'DI_PIN'); + + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +Blockly.Blocks.xbee_transmit = { + init: function () { + this.setColour(colorPalette.getColor('protocols')); + this.appendDummyInput() + .appendField("XBee transmit data") + .appendField(new Blockly.FieldVariable(Blockly.LANG_VARIABLES_GET_ITEM), 'BUFFER'); + + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + }, + getVars: function () { + return [this.getFieldValue('BUFFER')]; + }, + renameVar: function (oldName, newName) { + if (Blockly.Names.equals(oldName, this.getFieldValue('BUFFER'))) { + this.setTitleValue(newName, 'BUFFER'); + } + } +}; + +Blockly.Blocks.xbee_receive = { + init: function () { + this.setColour(colorPalette.getColor('protocols')); + this.appendDummyInput() + .appendField("XBee receive data and store in") + .appendField(new Blockly.FieldVariable(Blockly.LANG_VARIABLES_GET_ITEM), 'BUFFER'); + + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + }, + getVars: function () { + return [this.getFieldValue('BUFFER')]; + }, + renameVar: function (oldName, newName) { + if (Blockly.Names.equals(oldName, this.getFieldValue('BUFFER'))) { + this.setTitleValue(newName, 'BUFFER'); + } + } +}; + +Blockly.propc.xbee_setup = function () { + var do_pin = this.getFieldValue('DO_PIN'); + var di_pin = this.getFieldValue('DI_PIN'); + + Blockly.propc.definitions_["include fdserial"] = '#include "fdserial.h"'; + + Blockly.propc.global_vars_["xbee"] = "fdserial *xbee;"; + Blockly.propc.setups_["xbee"] = 'xbee = fdserial_open(' + di_pin + ', ' + do_pin + ', 0, 9600);\n'; + + return ''; +}; + +Blockly.propc.xbee_transmit = function () { + var data = Blockly.propc.variableDB_.getName(this.getFieldValue('BUFFER'), Blockly.Variables.NAME_TYPE); + + Blockly.propc.definitions_["include fdserial"] = '#include "fdserial.h"'; + + var code = 'dprint(xbee, "%d\\n", ' + data + ');\n'; + return code; +}; + +Blockly.propc.xbee_receive = function () { + var data = Blockly.propc.variableDB_.getName(this.getFieldValue('BUFFER'), Blockly.Variables.NAME_TYPE); + + Blockly.propc.definitions_["include fdserial"] = '#include "fdserial.h"'; + + var code = 'dscan(xbee, "%d", &' + data + ');\n'; + return code; +}; From 6a635f3264ebf230f516e93a0795366f4ac8bfb7 Mon Sep 17 00:00:00 2001 From: Jim Ewald Date: Fri, 12 Aug 2016 14:36:56 -0700 Subject: [PATCH 005/153] Update code to compute rectangle corner radius --- src/main/webapp/cdn/blockly/generators/propc/oled.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/cdn/blockly/generators/propc/oled.js b/src/main/webapp/cdn/blockly/generators/propc/oled.js index 4ffdbfa6..e6168446 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/oled.js +++ b/src/main/webapp/cdn/blockly/generators/propc/oled.js @@ -464,7 +464,7 @@ Blockly.propc.oled_draw_rectangle = function() { code += point_x + ', ' + point_y + ', '; code += width + ', ' + height + ', '; - code += ((Number(width) + Number(height)) / 20) + ', '; + code += '((' + width + ') + (' + height + ') / 20),'; code += 'oledc_color565('+ color_red + ', ' + color_green + ', ' + color_blue + ')'; } From d09811884b1c55b00aab1f0a83a24ebff749e59f Mon Sep 17 00:00:00 2001 From: Jim Ewald Date: Sun, 30 Oct 2016 05:51:38 -0700 Subject: [PATCH 006/153] Update database version dependancies --- pom.xml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 18d7d801..1bb3946f 100644 --- a/pom.xml +++ b/pom.xml @@ -90,7 +90,7 @@ mysql mysql-connector-java - 5.1.35 + 5.1.40 @@ -224,15 +224,16 @@ + org.slf4j slf4j-api - 1.7.6 + 1.7.21 org.slf4j slf4j-log4j12 - 1.7.6 + 1.7.21 @@ -457,7 +458,7 @@ mysql mysql-connector-java - 5.1.6 + 5.1.40 @@ -472,8 +473,6 @@ 1.8.3 - - com.parallax.client @@ -487,7 +486,6 @@ 1.0-SNAPSHOT - \ No newline at end of file From f2c0b3ae11793769ac1875592fac4c8083226889 Mon Sep 17 00:00:00 2001 From: Jim Ewald Date: Sun, 30 Oct 2016 09:20:24 -0700 Subject: [PATCH 007/153] Update log4j configuration file to 2.x specification --- pom.xml | 1 + src/main/config/default/log4j.xml | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 1bb3946f..b5ccc02d 100644 --- a/pom.xml +++ b/pom.xml @@ -55,6 +55,7 @@ 1.7 1.7 + true diff --git a/src/main/config/default/log4j.xml b/src/main/config/default/log4j.xml index da0f2592..7edfdbe0 100644 --- a/src/main/config/default/log4j.xml +++ b/src/main/config/default/log4j.xml @@ -6,9 +6,12 @@ - - - - - + + + + + + + + \ No newline at end of file From 46f574e5fbbcb775e45a2de05c63b69bfbda937e Mon Sep 17 00:00:00 2001 From: David Carrier Date: Mon, 31 Oct 2016 17:00:16 -0700 Subject: [PATCH 008/153] Added analog and digital pin input blocks --- .../cdn/blockly/generators/spin/scribbler.js | 37 +++++++++++++++++++ src/main/webapp/frame/framespin.jsp | 4 ++ 2 files changed, 41 insertions(+) diff --git a/src/main/webapp/cdn/blockly/generators/spin/scribbler.js b/src/main/webapp/cdn/blockly/generators/spin/scribbler.js index 75999dd3..9cad38ab 100644 --- a/src/main/webapp/cdn/blockly/generators/spin/scribbler.js +++ b/src/main/webapp/cdn/blockly/generators/spin/scribbler.js @@ -536,6 +536,26 @@ Blockly.Blocks.scribbler_ping = { } }; +Blockly.Blocks.digital_input = { + init: function () { + this.appendDummyInput("") + .appendField("Digital reading on") + .appendField(new Blockly.FieldDropdown([['P0', '0'], ['P1', '1'], ['P2', '2'], ['P3', '3'], ['P4', '4'], ['P5', '5']]), "DIGITAL_PIN"); + this.setOutput(true, "Boolean"); + this.setColour(colorPalette.getColor('input')); + } +}; + +Blockly.Blocks.analog_input = { + init: function () { + this.appendDummyInput("") + .appendField("Analog reading on") + .appendField(new Blockly.FieldDropdown([['A0', '0'], ['A1', '1']]), "ANALOG_PIN"); + this.setOutput(true, "Number"); + this.setColour(colorPalette.getColor('input')); + } +}; + Blockly.Blocks.spin_integer = { init: function () { this.appendDummyInput() @@ -955,6 +975,23 @@ Blockly.Spin.scribbler_ping = function () { return [code, Blockly.Spin.ORDER_ATOMIC]; }; +Blockly.Spin.digital_input = function () { + var Pin = window.parseInt(this.getFieldValue('DIGITAL_PIN')); + var Code = 'Scribbler.DigitalInput(' + Pin + ')'; + return [Code, Blockly.Spin.ORDER_ATOMIC]; +}; + +Blockly.Spin.analog_input = function () { + Blockly.Spin.definitions_[ "include_scribbler" ] = 'OBJscribbler : "Block_Wrapper"'; + if (Blockly.Spin.setups_[ 'setup_scribbler' ] === undefined) { + Blockly.Spin.setups_[ 'setup_scribbler' ] = 'Scribbler.Start'; + } + + var Pin = window.parseInt(this.getFieldValue('ANALOG_PIN')); + var Code = 'Scribbler.ADC(' + Pin + ')'; + return [Code, Blockly.Spin.ORDER_ATOMIC]; +}; + Blockly.Spin.scribbler_servo = function () { Blockly.Spin.definitions_[ "include_scribbler" ] = 'OBJscribbler : "Block_Wrapper"'; if (Blockly.Spin.setups_[ 'setup_scribbler_servo' ] === undefined) { diff --git a/src/main/webapp/frame/framespin.jsp b/src/main/webapp/frame/framespin.jsp index 1b0ca857..9daf92f5 100644 --- a/src/main/webapp/frame/framespin.jsp +++ b/src/main/webapp/frame/framespin.jsp @@ -202,6 +202,10 @@ + + + + From 6aebbfb7620124594d29d8347fb56cf533a42760 Mon Sep 17 00:00:00 2001 From: David Carrier Date: Mon, 7 Nov 2016 16:55:09 -0800 Subject: [PATCH 009/153] Added Move Motors XY block and analog/digital input blocks --- .../cdn/blockly/generators/spin/scribbler.js | 42 +++++++++++++++++-- src/main/webapp/frame/framespin.jsp | 17 ++++++++ 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/cdn/blockly/generators/spin/scribbler.js b/src/main/webapp/cdn/blockly/generators/spin/scribbler.js index 9cad38ab..444c8bb3 100644 --- a/src/main/webapp/cdn/blockly/generators/spin/scribbler.js +++ b/src/main/webapp/cdn/blockly/generators/spin/scribbler.js @@ -338,6 +338,30 @@ Blockly.Blocks.move_motors_distance = { } }; +Blockly.Blocks.move_motors_xy = { + init: function () { + this.appendDummyInput() + .appendField("in ") + .appendField(new Blockly.FieldDropdown([['inches (-20,755,429 to 20,755,429)', ' * 100_000 / 1933'], ['tenths of an inch (-207,554,294 to 207,554,294)', ' * 10_000 / 1933'], ['centimeters (-52,720,723 to 52,720,723)', ' * 10_000 / 491'], ['millimeters (-527,207,235 to 527,207,235)', ' * 1_000 / 491'], ['encoder counts (-1,073,741,823 to 1,073,741,823)', '']]), 'MULTIPLIER'); + this.appendDummyInput() + .appendField("move the Scribbler robot to the"); + this.appendValueInput("X_DISTANCE") + .setCheck("Number") + .appendField("left(-)/right(+) by"); + this.appendValueInput("Y_DISTANCE") + .setCheck("Number") + .appendField("back(-)/forward(+) by"); + this.appendValueInput("MOTOR_SPEED") + .setCheck("Number") + .appendField("at a top speed of (1 to 100)%"); + + this.setInputsInline(false); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(colorPalette.getColor('io')); + } +}; + // Move the motors... Blockly.Blocks.move_motors_angle = { init: function () { @@ -346,7 +370,7 @@ Blockly.Blocks.move_motors_angle = { .appendField("rotate the Scribbler robot (-1,080 to 1,080)\u00B0"); this.appendValueInput("ROTATE_RADIUS") .setCheck("Number") - .appendField("around a radius in") + .appendField("around a radius to the left(-)/right(+) in") .appendField(new Blockly.FieldDropdown([['inches (-85 to 85) of', ' * 100_000 / 1933'], ['tenths of an inch (-850 to 850) of', ' * 10_000 / 1933'], ['centimeters (-216 to 216) of', ' * 10_000 / 491'], ['millimeters (-2,160 to 2,160) of', ' * 1_000 / 491'], ['encoder counts (-4,400 to 4,400) of', '']]), 'RADIUS_MULTIPLIER'); this.appendValueInput("ROTATE_SPEED") .setCheck("Number") @@ -825,6 +849,19 @@ Blockly.Spin.move_motors_distance = function () { return 'Scribbler.MotorSetDistance(' + left_distance + distance_multiplier + ', ' + right_distance + distance_multiplier + ', ' + top_speed + ')\n'; }; +Blockly.Spin.move_motors_xy = function () { + Blockly.Spin.definitions_[ "include_scribbler" ] = 'OBJscribbler : "Block_Wrapper"'; + if (Blockly.Spin.setups_[ 'setup_scribbler' ] === undefined) { + Blockly.Spin.setups_[ 'setup_scribbler' ] = 'Scribbler.Start'; + } + + var distance_multiplier = this.getFieldValue('MULTIPLIER'); + var x_distance = Blockly.Spin.valueToCode(this, 'X_DISTANCE', Blockly.Spin.ORDER_ATOMIC) || '0'; + var y_distance = Blockly.Spin.valueToCode(this, 'X_DISTANCE', Blockly.Spin.ORDER_ATOMIC) || '0'; + var top_speed = Blockly.Spin.valueToCode(this, 'MOTOR_SPEED', Blockly.Spin.ORDER_ATOMIC) || '0'; + return 'Scribbler.MoveXY(' + x_distance + distance_multiplier + ', ' + y_distance + distance_multiplier + ', ' + top_speed + ')\n'; +}; + Blockly.Spin.move_motors_angle = function () { Blockly.Spin.definitions_[ "include_scribbler" ] = 'OBJscribbler : "Block_Wrapper"'; if (Blockly.Spin.setups_[ 'setup_scribbler' ] === undefined) { @@ -1046,6 +1083,5 @@ Blockly.Spin.factory_reset = function () { Blockly.Spin.setups_[ 'setup_scribbler_default' ] = 'Scribbler_Default.Start'; } - return - + return }; diff --git a/src/main/webapp/frame/framespin.jsp b/src/main/webapp/frame/framespin.jsp index 9daf92f5..627ef153 100644 --- a/src/main/webapp/frame/framespin.jsp +++ b/src/main/webapp/frame/framespin.jsp @@ -248,6 +248,23 @@ + + + + 0 + + + + + 0 + + + + + 0 + + + From 584b67f2bec448c4c8ff7b2db5cce37e8d3310a1 Mon Sep 17 00:00:00 2001 From: David Carrier Date: Tue, 8 Nov 2016 17:16:02 -0800 Subject: [PATCH 010/153] Added temporary pin output block --- .../cdn/blockly/generators/spin/scribbler.js | 21 +++++++++++++++++++ src/main/webapp/frame/framespin.jsp | 1 + 2 files changed, 22 insertions(+) diff --git a/src/main/webapp/cdn/blockly/generators/spin/scribbler.js b/src/main/webapp/cdn/blockly/generators/spin/scribbler.js index 444c8bb3..525af586 100644 --- a/src/main/webapp/cdn/blockly/generators/spin/scribbler.js +++ b/src/main/webapp/cdn/blockly/generators/spin/scribbler.js @@ -570,6 +570,21 @@ Blockly.Blocks.digital_input = { } }; +Blockly.Blocks.digital_output = { + init: function () { + this.appendDummyInput("") + .appendField("set") + .appendField(new Blockly.FieldDropdown([['P0', '0'], ['P1', '1'], ['P2', '2'], ['P3', '3'], ['P4', '4'], ['P5', '5']]), "OUTPUT_PIN"); + this.appendDummyInput("") + .appendField("to") + .appendField(new Blockly.FieldDropdown([['high', "HIGH"], ['low', "LOW"], ['input', "INPUT"], ['output', "OUTPUT"], ['toggle state', "TOGGLE_STATE"], ['toggle direction', "TOGGLE_DIRECTION"]]), "OUTPUT_ACTION"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(colorPalette.getColor('io')); + } +}; + Blockly.Blocks.analog_input = { init: function () { this.appendDummyInput("") @@ -1018,6 +1033,12 @@ Blockly.Spin.digital_input = function () { return [Code, Blockly.Spin.ORDER_ATOMIC]; }; +Blockly.Spin.digital_output = function () { + var Pin = window.parseInt(this.getFieldValue('OUTPUT_PIN')); + var Action = this.getFieldValue('OUTPUT_ACTION'); + return 'Scribbler.DigitalOutput(' + Pin + ', Scribbler#' + Action + ')\n'; +}; + Blockly.Spin.analog_input = function () { Blockly.Spin.definitions_[ "include_scribbler" ] = 'OBJscribbler : "Block_Wrapper"'; if (Blockly.Spin.setups_[ 'setup_scribbler' ] === undefined) { diff --git a/src/main/webapp/frame/framespin.jsp b/src/main/webapp/frame/framespin.jsp index 627ef153..be634da8 100644 --- a/src/main/webapp/frame/framespin.jsp +++ b/src/main/webapp/frame/framespin.jsp @@ -208,6 +208,7 @@ + STRAIGHT From 6d2ad7fbbbe9bc514d807a88ce627958478a36e0 Mon Sep 17 00:00:00 2001 From: Jim Ewald Date: Tue, 8 Nov 2016 19:32:38 -0800 Subject: [PATCH 011/153] Updates from David C. --- .../cdn/blockly/generators/spin/scribbler.js | 100 +++++++++++++++++- src/main/webapp/frame/framespin.jsp | 22 ++++ 2 files changed, 119 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/cdn/blockly/generators/spin/scribbler.js b/src/main/webapp/cdn/blockly/generators/spin/scribbler.js index 75999dd3..525af586 100644 --- a/src/main/webapp/cdn/blockly/generators/spin/scribbler.js +++ b/src/main/webapp/cdn/blockly/generators/spin/scribbler.js @@ -338,6 +338,30 @@ Blockly.Blocks.move_motors_distance = { } }; +Blockly.Blocks.move_motors_xy = { + init: function () { + this.appendDummyInput() + .appendField("in ") + .appendField(new Blockly.FieldDropdown([['inches (-20,755,429 to 20,755,429)', ' * 100_000 / 1933'], ['tenths of an inch (-207,554,294 to 207,554,294)', ' * 10_000 / 1933'], ['centimeters (-52,720,723 to 52,720,723)', ' * 10_000 / 491'], ['millimeters (-527,207,235 to 527,207,235)', ' * 1_000 / 491'], ['encoder counts (-1,073,741,823 to 1,073,741,823)', '']]), 'MULTIPLIER'); + this.appendDummyInput() + .appendField("move the Scribbler robot to the"); + this.appendValueInput("X_DISTANCE") + .setCheck("Number") + .appendField("left(-)/right(+) by"); + this.appendValueInput("Y_DISTANCE") + .setCheck("Number") + .appendField("back(-)/forward(+) by"); + this.appendValueInput("MOTOR_SPEED") + .setCheck("Number") + .appendField("at a top speed of (1 to 100)%"); + + this.setInputsInline(false); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(colorPalette.getColor('io')); + } +}; + // Move the motors... Blockly.Blocks.move_motors_angle = { init: function () { @@ -346,7 +370,7 @@ Blockly.Blocks.move_motors_angle = { .appendField("rotate the Scribbler robot (-1,080 to 1,080)\u00B0"); this.appendValueInput("ROTATE_RADIUS") .setCheck("Number") - .appendField("around a radius in") + .appendField("around a radius to the left(-)/right(+) in") .appendField(new Blockly.FieldDropdown([['inches (-85 to 85) of', ' * 100_000 / 1933'], ['tenths of an inch (-850 to 850) of', ' * 10_000 / 1933'], ['centimeters (-216 to 216) of', ' * 10_000 / 491'], ['millimeters (-2,160 to 2,160) of', ' * 1_000 / 491'], ['encoder counts (-4,400 to 4,400) of', '']]), 'RADIUS_MULTIPLIER'); this.appendValueInput("ROTATE_SPEED") .setCheck("Number") @@ -536,6 +560,41 @@ Blockly.Blocks.scribbler_ping = { } }; +Blockly.Blocks.digital_input = { + init: function () { + this.appendDummyInput("") + .appendField("Digital reading on") + .appendField(new Blockly.FieldDropdown([['P0', '0'], ['P1', '1'], ['P2', '2'], ['P3', '3'], ['P4', '4'], ['P5', '5']]), "DIGITAL_PIN"); + this.setOutput(true, "Boolean"); + this.setColour(colorPalette.getColor('input')); + } +}; + +Blockly.Blocks.digital_output = { + init: function () { + this.appendDummyInput("") + .appendField("set") + .appendField(new Blockly.FieldDropdown([['P0', '0'], ['P1', '1'], ['P2', '2'], ['P3', '3'], ['P4', '4'], ['P5', '5']]), "OUTPUT_PIN"); + this.appendDummyInput("") + .appendField("to") + .appendField(new Blockly.FieldDropdown([['high', "HIGH"], ['low', "LOW"], ['input', "INPUT"], ['output', "OUTPUT"], ['toggle state', "TOGGLE_STATE"], ['toggle direction', "TOGGLE_DIRECTION"]]), "OUTPUT_ACTION"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(colorPalette.getColor('io')); + } +}; + +Blockly.Blocks.analog_input = { + init: function () { + this.appendDummyInput("") + .appendField("Analog reading on") + .appendField(new Blockly.FieldDropdown([['A0', '0'], ['A1', '1']]), "ANALOG_PIN"); + this.setOutput(true, "Number"); + this.setColour(colorPalette.getColor('input')); + } +}; + Blockly.Blocks.spin_integer = { init: function () { this.appendDummyInput() @@ -805,6 +864,19 @@ Blockly.Spin.move_motors_distance = function () { return 'Scribbler.MotorSetDistance(' + left_distance + distance_multiplier + ', ' + right_distance + distance_multiplier + ', ' + top_speed + ')\n'; }; +Blockly.Spin.move_motors_xy = function () { + Blockly.Spin.definitions_[ "include_scribbler" ] = 'OBJscribbler : "Block_Wrapper"'; + if (Blockly.Spin.setups_[ 'setup_scribbler' ] === undefined) { + Blockly.Spin.setups_[ 'setup_scribbler' ] = 'Scribbler.Start'; + } + + var distance_multiplier = this.getFieldValue('MULTIPLIER'); + var x_distance = Blockly.Spin.valueToCode(this, 'X_DISTANCE', Blockly.Spin.ORDER_ATOMIC) || '0'; + var y_distance = Blockly.Spin.valueToCode(this, 'X_DISTANCE', Blockly.Spin.ORDER_ATOMIC) || '0'; + var top_speed = Blockly.Spin.valueToCode(this, 'MOTOR_SPEED', Blockly.Spin.ORDER_ATOMIC) || '0'; + return 'Scribbler.MoveXY(' + x_distance + distance_multiplier + ', ' + y_distance + distance_multiplier + ', ' + top_speed + ')\n'; +}; + Blockly.Spin.move_motors_angle = function () { Blockly.Spin.definitions_[ "include_scribbler" ] = 'OBJscribbler : "Block_Wrapper"'; if (Blockly.Spin.setups_[ 'setup_scribbler' ] === undefined) { @@ -955,6 +1027,29 @@ Blockly.Spin.scribbler_ping = function () { return [code, Blockly.Spin.ORDER_ATOMIC]; }; +Blockly.Spin.digital_input = function () { + var Pin = window.parseInt(this.getFieldValue('DIGITAL_PIN')); + var Code = 'Scribbler.DigitalInput(' + Pin + ')'; + return [Code, Blockly.Spin.ORDER_ATOMIC]; +}; + +Blockly.Spin.digital_output = function () { + var Pin = window.parseInt(this.getFieldValue('OUTPUT_PIN')); + var Action = this.getFieldValue('OUTPUT_ACTION'); + return 'Scribbler.DigitalOutput(' + Pin + ', Scribbler#' + Action + ')\n'; +}; + +Blockly.Spin.analog_input = function () { + Blockly.Spin.definitions_[ "include_scribbler" ] = 'OBJscribbler : "Block_Wrapper"'; + if (Blockly.Spin.setups_[ 'setup_scribbler' ] === undefined) { + Blockly.Spin.setups_[ 'setup_scribbler' ] = 'Scribbler.Start'; + } + + var Pin = window.parseInt(this.getFieldValue('ANALOG_PIN')); + var Code = 'Scribbler.ADC(' + Pin + ')'; + return [Code, Blockly.Spin.ORDER_ATOMIC]; +}; + Blockly.Spin.scribbler_servo = function () { Blockly.Spin.definitions_[ "include_scribbler" ] = 'OBJscribbler : "Block_Wrapper"'; if (Blockly.Spin.setups_[ 'setup_scribbler_servo' ] === undefined) { @@ -1009,6 +1104,5 @@ Blockly.Spin.factory_reset = function () { Blockly.Spin.setups_[ 'setup_scribbler_default' ] = 'Scribbler_Default.Start'; } - return - + return }; diff --git a/src/main/webapp/frame/framespin.jsp b/src/main/webapp/frame/framespin.jsp index 1b0ca857..be634da8 100644 --- a/src/main/webapp/frame/framespin.jsp +++ b/src/main/webapp/frame/framespin.jsp @@ -202,8 +202,13 @@ + + + + + STRAIGHT @@ -244,6 +249,23 @@ + + + + 0 + + + + + 0 + + + + + 0 + + + From eff3ed732930cee299ff3a9d2842f22c35747486 Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Mon, 14 Nov 2016 10:21:58 -0800 Subject: [PATCH 012/153] Add help for robot and IMU blocks --- src/main/webapp/cdn/blockly/language/en/_messages.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/cdn/blockly/language/en/_messages.js b/src/main/webapp/cdn/blockly/language/en/_messages.js index 3fb5eac7..fcc70c14 100644 --- a/src/main/webapp/cdn/blockly/language/en/_messages.js +++ b/src/main/webapp/cdn/blockly/language/en/_messages.js @@ -864,6 +864,8 @@ Blockly.MSG_ANALOG_PULSE_IN_OUT_HELPURL = "http://learn.parallax.com/ab-blocks/p Blockly.MSG_ANALOG_RC_TIME_HELPURL = "http://learn.parallax.com/ab-blocks/rc-time"; Blockly.MSG_AUDIO_HELPURL = "http://learn.parallax.com/ab-blocks/audio"; Blockly.MSG_SERVO_HELPURL = "http://learn.parallax.com/ab-blocks/servo"; +Blockly.MSG_ROBOT_HELPURL = "http://learn.parallax.com/ab-blocks/robot"; +Blockly.MSG_IMU_HELPURL = "http://learn.parallax.com/ab-blocks/imu"; //----------Activity Board (Propeller C) block tooltips ---------------------------- @@ -987,6 +989,12 @@ Blockly.MSG_BASE_FREQOUT_TOOLTIP = "frequency out: sends pulses to the I/O pin a Blockly.MSG_SERVO_MOVE_TOOLTIP = "Standard servo: sets the position of a standard servo connected to the I/O pin."; Blockly.MSG_SERVO_SPEED_TOOLTIP = "CR servo speed: sets the speed of a continuous rotation servo connected to the I/O pin."; Blockly.MSG_SERVO_SET_RAMP_TOOLTIP = "CR servo set ramp: sets the amount a servo's speed can change each update cycle."; +Blockly.MSG_ROBOT_DRIVE_INIT_TOOLTIP = "Robot drive init: set up the Robot's drive system on the Propeller"; +Blockly.MSG_ROBOT_DRIVE_DISTANCE_TOOLTIP = "Robot drive distance: drives each wheel a specified distance."; +Blockly.MSG_ROBOT_DRIVE_SPEED_TOOLTIP = "Robot drive speed: drives each wheel at a specified speed."; +Blockly.MSG_ROBOT_ACTIVITYBOT_CALIBRATE_TOOLTIP = "ActivityBot Calibrate: runs the ActivityBot calibration routine."; +Blockly.MSG_ROBOT_ACTIVITYBOT_DISPLAY_CALIBRATION_TOOLTIP = "ActivityBot Display Calibration: displays the calibration results on the terminal."; + //-------Scribbler 3 help URLs --------------------------------------------- Blockly.MSG_S3_COMMUNICATE_HELPURL = "http://learn.parallax.com/s3-blocks/communicate"; @@ -1061,4 +1069,4 @@ Blockly.MSG_S3_SERIAL_SEND_CHAR_TOOLTIP = "send character: send a character out Blockly.MSG_S3_SERIAL_SEND_CTRL_TOOLTIP = "send control character: send a special character out from the serial port"; Blockly.MSG_S3_SERIAL_CURSOR_XY_TOOLTIP = "set cursor position: set the cursor position in the terminal"; Blockly.MSG_S3_SERIAL_RX_BYTE_TOOLTIP = "receive character: receieve a character from the serial port"; -Blockly.MSG_S3_FACTORY_RESET_TOOLTIP = "factory reset: use to reload the factory default demo program back onto the Scribbler"; \ No newline at end of file +Blockly.MSG_S3_FACTORY_RESET_TOOLTIP = "factory reset: use to reload the factory default demo program back onto the Scribbler"; From 6d3e6035ef333317435c549e0b6cb2d4ff3d76f7 Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Mon, 14 Nov 2016 10:28:11 -0800 Subject: [PATCH 013/153] Update robot blocks --- src/main/webapp/frame/framec.jsp | 47 ++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/src/main/webapp/frame/framec.jsp b/src/main/webapp/frame/framec.jsp index d8442afa..d7c4e7cb 100644 --- a/src/main/webapp/frame/framec.jsp +++ b/src/main/webapp/frame/framec.jsp @@ -52,7 +52,7 @@ - + @@ -787,21 +787,34 @@ - " exclude="heb,activity-board" > - "> - - - - - - - - "> - - - - - + " exclude="heb" colour="295"> + + + + + 64 + + + + + 64 + + + + + + + 64 + + + + + 64 + + + + + " include="heb" colour="290"> "> @@ -886,4 +899,4 @@ - \ No newline at end of file + From ea78418d25be16dbfbe26b27c31c58585e910f5e Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Mon, 14 Nov 2016 10:30:02 -0800 Subject: [PATCH 014/153] Commented out content Moved blocks to abdrive.js --- src/main/webapp/cdn/blockly/generators/propc/activitybot.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/webapp/cdn/blockly/generators/propc/activitybot.js b/src/main/webapp/cdn/blockly/generators/propc/activitybot.js index 64b09f8d..23cee9c9 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/activitybot.js +++ b/src/main/webapp/cdn/blockly/generators/propc/activitybot.js @@ -21,6 +21,8 @@ * @fileoverview Generating C for ActivityBot Blocks * @author valetolpegin@gmail.com (Vale Tolpegin) */ + +/** ------------moved content to abdrive.js------------------ 'use strict'; if (!Blockly.Blocks) @@ -59,3 +61,4 @@ Blockly.propc.activitybot_calibrate = function() { Blockly.propc.activitybot_display_calibration = function() { return 'drive_displayInterpolation();\n'; } +*/ From ceae3c6101fadee6ff09690c56af11c7edafb932 Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Mon, 14 Nov 2016 10:32:23 -0800 Subject: [PATCH 015/153] Update robot drive blocks --- .../cdn/blockly/generators/propc/abdrive.js | 208 +++++++++++++----- 1 file changed, 156 insertions(+), 52 deletions(-) diff --git a/src/main/webapp/cdn/blockly/generators/propc/abdrive.js b/src/main/webapp/cdn/blockly/generators/propc/abdrive.js index 9c8f4986..14225e34 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/abdrive.js +++ b/src/main/webapp/cdn/blockly/generators/propc/abdrive.js @@ -27,68 +27,101 @@ if (!Blockly.Blocks) Blockly.Blocks = {}; - -Blockly.Blocks.ab_drive_goto = { +Blockly.Blocks.activitybot_calibrate = { + helpUrl: Blockly.MSG_ROBOT_HELPURL, init: function() { + this.setTooltip(Blockly.MSG_ACTIVITYBOT_CALIBRATE_TOOLTIP); this.setColour(colorPalette.getColor('robot')); this.appendDummyInput() - .appendField('Drive goto') - .appendField('Left') - .appendField(new Blockly.FieldTextInput('64', - Blockly.FieldTextInput.numberValidator), 'LEFT') - .appendField('Right') - .appendField(new Blockly.FieldTextInput('64', - Blockly.FieldTextInput.numberValidator), 'RIGHT'); + .appendField("ActivityBot calibrate"); this.setPreviousStatement(true, null); this.setNextStatement(true, null); } }; -Blockly.Blocks.ab_drive_speed = { +Blockly.Blocks.activitybot_display_calibration = { + helpUrl: Blockly.MSG_ROBOT_HELPURL, init: function() { + this.setTooltip(Blockly.MSG_ACTIVITYBOT_DISPLAY_CALIBRATION_TOOLTIP); this.setColour(colorPalette.getColor('robot')); this.appendDummyInput() - .appendField('Drive speed') - .appendField('Left') - .appendField(new Blockly.FieldTextInput('64', - Blockly.FieldTextInput.numberValidator), 'LEFT') - .appendField('Right') - .appendField(new Blockly.FieldTextInput('64', - Blockly.FieldTextInput.numberValidator), 'RIGHT'); + .appendField("ActivityBot display calibration"); this.setPreviousStatement(true, null); this.setNextStatement(true, null); } }; -Blockly.Blocks.ab_drive_ramp = { +Blockly.Blocks.ab_drive_init = { + helpUrl: Blockly.MSG_ROBOT_HELPURL, init: function() { - this.setColour(colorPalette.getColor('output')); - this.appendDummyInput() - .appendField("Drive ramp step") - .appendField("Left speed") - .appendField(new Blockly.FieldDropdown([["-1", "-1"], ["-2", "-2"], ["-3", "-3"], ["-4", "-4"], ["-5", "-5"], ["-6", "-6"], ["-7", "-7"], ["-8", "-8"], ["-9", "-9"], ["-10", "-10"], ["-11", "-11"], ["-12", "-12"], ["-13", "-13"], ["-14", "-14"], ["-15", "-15"], ["-16", "-16"], ["-17", "-17"], ["-18", "-18"], ["-19", "-19"], ["-20", "-20"], ["-21", "-21"], ["-22", "-22"], ["-23", "-23"], ["-24", "-24"], ["-25", "-25"], ["-26", "-26"], ["-27", "-27"], ["-28", "-28"], ["-29", "-29"], ["-30", "-30"], ["-31", "-31"], [ "-32", "-32"], ["-33", "-33"], ["-34", "-34"], ["-35", "-35"], ["-36", "-36"], ["-37", "-37"], ["-38", "-38"], ["-39", "-39"], ["-40", "-40"], ["-41", "-41"], ["-42", "-42"], ["-43", "-43"], ["-44", "-44"], ["-45", "-45"], ["-46", "-46"], ["-47", "-47"], ["-48", "-48"], ["-49", "-49"], ["-50", "-50"], ["-51", "-51"], ["-52", "-52"], ["-53", "-53"], ["-54", "-54"], ["-55", "-55"], ["-56", "-56"], ["-57", "-57"], ["-58", "-58"], ["-59", "-59"], ["-60", "-60"], ["-61", "-61"], ["-62", "-62"], ["-63", "-63"], ["-64", "-64"], ["-65", "-65"], ["-66", "-66"], ["-67", "-67"], ["-68", "-68"], ["-69", "-69"], ["-70", "-70"], ["-71", "-71"], ["-72", "-72"], ["-73", "-73"], ["-74", "-74"], ["-75", "-75"], ["-76", "-76"], ["-77", "-77"], ["-78", "-78"], ["-79", "-79"], ["-80", "-80"], ["-81", "-81"], ["-82", "-82"], ["-83", "-83"], ["-84", "-84"], ["-85", "-85"], ["-86", "-86"], ["-87", "-87"], ["-88", "-88"], ["-89", "-89"], ["-90", "-90"], ["-91", "-91"], ["-92", "-92"], ["-93", "-93"], ["-94", "-94"], ["-95", "-95"], ["-96", "-96"], ["-97", "-97"], ["-98", "-98"], ["-99", "-99"], ["-100", "-100"], ["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["24", "24"], ["25", "25"], ["26", "26"], ["27", "27"], ["28", "28"], ["29", "29"], ["30", "30"], ["31", "31"], [ "32", "32"], ["33", "33"], ["34", "34"], ["35", "35"], ["36", "36"], ["37", "37"], ["38", "38"], ["39", "39"], ["40", "40"], ["41", "41"], ["42", "42"], ["43", "43"], ["44", "44"], ["45", "45"], ["46", "46"], ["47", "47"], ["48", "48"], ["49", "49"], ["50", "50"], ["51", "51"], ["52", "52"], ["53", "53"], ["54", "54"], ["55", "55"], ["56", "56"], ["57", "57"], ["58", "58"], ["59", "59"], ["60", "60"], ["61", "61"], ["62", "62"], ["63", "63"], ["64", "64"], ["65", "65"], ["66", "66"], ["67", "67"], ["68", "68"], ["69", "69"], ["70", "70"], ["71", "71"], ["72", "72"], ["73", "73"], ["74", "74"], ["75", "75"], ["76", "76"], ["77", "77"], ["78", "78"], ["79", "79"], ["80", "80"], ["81", "81"], ["82", "82"], ["83", "83"], ["84", "84"], ["85", "85"], ["86", "86"], ["87", "87"], ["88", "88"], ["89", "89"], ["90", "90"], ["91", "91"], ["92", "92"], ["93", "93"], ["94", "94"], ["95", "95"], ["96", "96"], ["97", "97"], ["98", "98"], ["99", "99"], ["100", "100"]]), 'LEFT_SPEED'); + this.setTooltip(Blockly.MSG_ROBOT_DRIVE_INIT_TOOLTIP); + this.setColour(colorPalette.getColor('robot')); this.appendDummyInput() - .appendField("Right speed") - .appendField(new Blockly.FieldDropdown([["-1", "-1"], ["-2", "-2"], ["-3", "-3"], ["-4", "-4"], ["-5", "-5"], ["-6", "-6"], ["-7", "-7"], ["-8", "-8"], ["-9", "-9"], ["-10", "-10"], ["-11", "-11"], ["-12", "-12"], ["-13", "-13"], ["-14", "-14"], ["-15", "-15"], ["-16", "-16"], ["-17", "-17"], ["-18", "-18"], ["-19", "-19"], ["-20", "-20"], ["-21", "-21"], ["-22", "-22"], ["-23", "-23"], ["-24", "-24"], ["-25", "-25"], ["-26", "-26"], ["-27", "-27"], ["-28", "-28"], ["-29", "-29"], ["-30", "-30"], ["-31", "-31"], [ "-32", "-32"], ["-33", "-33"], ["-34", "-34"], ["-35", "-35"], ["-36", "-36"], ["-37", "-37"], ["-38", "-38"], ["-39", "-39"], ["-40", "-40"], ["-41", "-41"], ["-42", "-42"], ["-43", "-43"], ["-44", "-44"], ["-45", "-45"], ["-46", "-46"], ["-47", "-47"], ["-48", "-48"], ["-49", "-49"], ["-50", "-50"], ["-51", "-51"], ["-52", "-52"], ["-53", "-53"], ["-54", "-54"], ["-55", "-55"], ["-56", "-56"], ["-57", "-57"], ["-58", "-58"], ["-59", "-59"], ["-60", "-60"], ["-61", "-61"], ["-62", "-62"], ["-63", "-63"], ["-64", "-64"], ["-65", "-65"], ["-66", "-66"], ["-67", "-67"], ["-68", "-68"], ["-69", "-69"], ["-70", "-70"], ["-71", "-71"], ["-72", "-72"], ["-73", "-73"], ["-74", "-74"], ["-75", "-75"], ["-76", "-76"], ["-77", "-77"], ["-78", "-78"], ["-79", "-79"], ["-80", "-80"], ["-81", "-81"], ["-82", "-82"], ["-83", "-83"], ["-84", "-84"], ["-85", "-85"], ["-86", "-86"], ["-87", "-87"], ["-88", "-88"], ["-89", "-89"], ["-90", "-90"], ["-91", "-91"], ["-92", "-92"], ["-93", "-93"], ["-94", "-94"], ["-95", "-95"], ["-96", "-96"], ["-97", "-97"], ["-98", "-98"], ["-99", "-99"], ["-100", "-100"], ["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["24", "24"], ["25", "25"], ["26", "26"], ["27", "27"], ["28", "28"], ["29", "29"], ["30", "30"], ["31", "31"], [ "32", "32"], ["33", "33"], ["34", "34"], ["35", "35"], ["36", "36"], ["37", "37"], ["38", "38"], ["39", "39"], ["40", "40"], ["41", "41"], ["42", "42"], ["43", "43"], ["44", "44"], ["45", "45"], ["46", "46"], ["47", "47"], ["48", "48"], ["49", "49"], ["50", "50"], ["51", "51"], ["52", "52"], ["53", "53"], ["54", "54"], ["55", "55"], ["56", "56"], ["57", "57"], ["58", "58"], ["59", "59"], ["60", "60"], ["61", "61"], ["62", "62"], ["63", "63"], ["64", "64"], ["65", "65"], ["66", "66"], ["67", "67"], ["68", "68"], ["69", "69"], ["70", "70"], ["71", "71"], ["72", "72"], ["73", "73"], ["74", "74"], ["75", "75"], ["76", "76"], ["77", "77"], ["78", "78"], ["79", "79"], ["80", "80"], ["81", "81"], ["82", "82"], ["83", "83"], ["84", "84"], ["85", "85"], ["86", "86"], ["87", "87"], ["88", "88"], ["89", "89"], ["90", "90"], ["91", "91"], ["92", "92"], ["93", "93"], ["94", "94"], ["95", "95"], ["96", "96"], ["97", "97"], ["98", "98"], ["99", "99"], ["100", "100"]]), 'RIGHT_SPEED'); + .appendField("Robot") + .appendField(new Blockly.FieldDropdown([["ActivityBot", "abdrive.h"], ["Arlo", "arlodrive.h"], ["Servo Differential Drive", "servodiffdrive.h"]], function (bot) { + this.sourceBlock_.updateShape_({"BOT": bot}); + }), "BOT") + .appendField("initialize"); + this.appendDummyInput("PINS") + .appendField(" ramping") + .appendField(new Blockly.FieldDropdown([["none", "2000"], ["light", "16"], ["medium", "8"], ["heavy", "4"], ["maximum", "2"]]), "RAMPING"); this.setInputsInline(true); this.setPreviousStatement(true, null); this.setNextStatement(true, null); + + }, + mutationToDom: function () { + var container = document.createElement('mutation'); + var bot = this.getFieldValue('BOT'); + container.setAttribute('BOT', bot); + return container; + }, + domToMutation: function (xmlElement) { + var bot = xmlElement.getAttribute('BOT'); + this.updateShape_({"BOT": bot}); + }, + updateShape_: function (details) { + + var bot = details['BOT']; + if (details['BOT'] === undefined) { + bot = this.getFieldValue('BOT'); + } + + this.removeInput('PINS'); + this.appendDummyInput("PINS"); + var inputPins = this.getInput('PINS'); + if (bot === 'servodiffdrive.h') { + inputPins.appendField(" left PIN") + .appendField(new Blockly.FieldDropdown(profile.default.digital), "LEFT") + .appendField("right PIN") + .appendField(new Blockly.FieldDropdown(profile.default.digital), "RIGHT") + .appendField(" ramping") + .appendField(new Blockly.FieldDropdown([["none", "2000"], ["light", "16"], ["medium", "8"], ["heavy", "4"], ["maximum", "2"]]), "RAMPING"); + } else { + inputPins.appendField(" ramping") + .appendField(new Blockly.FieldDropdown([["none", "2000"], ["light", "16"], ["medium", "8"], ["heavy", "4"], ["maximum", "2"]]), "RAMPING"); + } } }; -Blockly.Blocks.ab_drive_set_ramp_step = { + +Blockly.Blocks.ab_drive_goto = { + helpUrl: Blockly.MSG_ROBOT_HELPURL, init: function() { - this.setColour(colorPalette.getColor('output')); - this.appendDummyInput() - .appendField("Drive set ramp step") - .appendField("Left rampstep") - .appendField(new Blockly.FieldDropdown([["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"]]), 'LEFT_RAMP_STEP'); + this.setTooltip(Blockly.MSG_ROBOT_DRIVE_DISTANCE_TOOLTIP); + this.setColour(colorPalette.getColor('robot')); this.appendDummyInput() - .appendField("Right rampstep") - .appendField(new Blockly.FieldDropdown([["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"]]), 'RIGHT_RAMP_STEP'); + .appendField('Robot drive distance in') + .appendField(new Blockly.FieldDropdown([["ticks", "TICK"], ["centimeters", "CM"], ["inches", "INCH"]]), "UNITS"); + this.appendValueInput("LEFT") + .setCheck('Number') + .appendField("left"); + this.appendValueInput("RIGHT") + .setCheck('Number') + .appendField("right"); this.setInputsInline(true); this.setPreviousStatement(true, null); @@ -96,38 +129,109 @@ Blockly.Blocks.ab_drive_set_ramp_step = { } }; -Blockly.propc.ab_drive_goto = function() { - var left = Number(this.getFieldValue('LEFT')); - var right = Number(this.getFieldValue('RIGHT')); - - Blockly.propc.definitions_["include abdrive"] = '#include "abdrive.h"'; +Blockly.Blocks.ab_drive_speed = { + helpUrl: Blockly.MSG_ROBOT_HELPURL, + init: function() { + this.setTooltip(Blockly.MSG_ROBOT_DRIVE_SPEED_TOOLTIP); + this.setColour(colorPalette.getColor('robot')); + this.appendValueInput("LEFT") + .setCheck('Number') + .appendField("Robot drive speed left"); + this.appendValueInput("RIGHT") + .setCheck('Number') + .appendField("right"); - return 'drive_goto(' + left + ', ' + right + ');\n'; + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } }; -Blockly.propc.ab_drive_speed = function() { + +Blockly.propc.ab_drive_init = function() { + var bot = this.getFieldValue('BOT'); var left = Number(this.getFieldValue('LEFT')); var right = Number(this.getFieldValue('RIGHT')); + var ramping = Number(this.getFieldValue('RAMPING')); - Blockly.propc.definitions_["include abdrive"] = '#include "abdrive.h"'; + Blockly.propc.definitions_["include abdrive"] = '#include "' + bot + '"'; - return 'drive_speed(' + left + ', ' + right + ');\n'; + if(Blockly.propc.definitions_["include abdrive"] === '#include "servodiffdrive.h"') { + Blockly.propc.setups_["servodiffdrive"] = 'drive_pins(' + left + ',' + right + ');\n'; + Blockly.propc.setups_["sdd_ramping"] = 'drive_setramp(' + ramping + ',' + ramping + ');\n'; + } else { + Blockly.propc.setups_["abd_ramping"] = 'drive_setRampStep(' + ramping + ');\n'; + } + + return ''; }; -Blockly.propc.ab_drive_ramp = function() { - var left_speed = this.getFieldValue('LEFT_SPEED'); - var right_speed = this.getFieldValue('RIGHT_SPEED'); +Blockly.propc.ab_drive_goto = function() { + var left = Blockly.propc.valueToCode(this, 'LEFT', Blockly.propc.ORDER_NONE); + var right = Blockly.propc.valueToCode(this, 'RIGHT', Blockly.propc.ORDER_NONE); + var units = this.getFieldValue('UNITS'); + var bot = Blockly.propc.definitions_["include abdrive"]; + + var code = ''; + + if(bot === '#include "servodiffdrive.h"') { + code += '// Servo Differential Drive does not support "Drive Distance"\n'; + } else if(bot === '#include "abdrive.h"') { + if(units === 'TICK') { + code += 'drive_goto(' + left + ', ' + right + ');\n'; + } else if(units === 'CM') { + code += 'drive_goto((' + left + ' * 40)/13), (' + right + ' * 40)/13);\n'; + } else { + code += 'drive_goto((' + left + ' * 508)/65), (' + right + ' * 508)/65);\n'; + } + } else { + if(units === 'TICK') { + code += 'drive_goto(' + left + ', ' + right + ');\n'; + } else if(units === 'CM') { + code += 'drive_goto((' + left + ' * 2500)/889), (' + right + ' * 2500)/889);\n'; + } else { + code += 'drive_goto((' + left + ' * 50)/7), (' + right + ' * 50)/7);\n'; + } + } + + if(bot === undefined) { + return '// Robot drive system is not initialized!\n'; + } else { + return code; + } +}; - Blockly.propc.definitions_["include abdrive"] = '#include "abdrive.h"'; +Blockly.propc.ab_drive_speed = function() { + var left = Blockly.propc.valueToCode(this, 'LEFT', Blockly.propc.ORDER_NONE); + var right = Blockly.propc.valueToCode(this, 'RIGHT', Blockly.propc.ORDER_NONE); + var bot = Blockly.propc.definitions_["include abdrive"]; + + var code = ''; + + if(bot === '#include "servodiffdrive.h"') { + code = 'drive_speeds(' + left + ', ' + right + ');\n'; + } else { + if(Blockly.propc.setups_["abd_ramping"] === 'drive_setRampStep(2000);\n') { + code = 'drive_speed(' + left + ', ' + right + ');\n'; + } else { + code = 'drive_ramp(' + left + ', ' + right + ');\n'; + } + } - return 'drive_ramp(' + left_speed + ', ' + right_speed + ');\n'; + if(bot === undefined) { + return '// Robot drive system is not initialized!\n'; + } else { + return code; + } }; -Blockly.propc.ab_drive_set_ramp_step = function() { - var left_ramp_speed = this.getFieldValue('LEFT_RAMP_STEP'); - var right_ramp_speed = this.getFieldValue('RIGHT_RAMP_STEP'); +Blockly.propc.activitybot_calibrate = function() { + Blockly.propc.definitions_["activitybot_calibrate"] = '#include "abcalibrate.h"'; + Blockly.propc.setups_["activitybot_calibrate"] = 'cal_servoPins(12, 13);\n\tcal_encoderPins(14, 15);'; - Blockly.propc.definitions_["include abdrive"] = '#include "abdrive.h"'; + return 'cal_activityBot();\n'; +}; - return 'drive_rampStep(' + left_ramp_speed + ', ' + right_ramp_speed + ');\n'; +Blockly.propc.activitybot_display_calibration = function() { + return 'drive_displayInterpolation();\n'; }; From 0beaa0d5e4b3bc7b5d57c4f329da7cf072501b7e Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Mon, 14 Nov 2016 10:35:00 -0800 Subject: [PATCH 016/153] Add OLED sleep/wake/invert --- .../cdn/blockly/generators/propc/oled.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/cdn/blockly/generators/propc/oled.js b/src/main/webapp/cdn/blockly/generators/propc/oled.js index d6f9ff55..339ce949 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/oled.js +++ b/src/main/webapp/cdn/blockly/generators/propc/oled.js @@ -66,8 +66,8 @@ Blockly.Blocks.oled_clear_screen = { this.setTooltip(Blockly.MSG_OLED_CLEAR_SCREEN_TOOLTIP); this.setColour(colorPalette.getColor('protocols')); this.appendDummyInput() - .appendField("OLED clear screen"); - + .appendField("OLED command") + .appendField(new Blockly.FieldDropdown([["clear screen", "CLS"], ["sleep", "SLEEP"], ["wake", "WAKE"], ["invert", "INV"]]), "CMD"); this.setInputsInline(true); this.setPreviousStatement(true, null); this.setNextStatement(true, null); @@ -401,11 +401,22 @@ Blockly.propc.oled_font_loader = function () { Blockly.propc.oled_clear_screen = function() { + var cmd = this.getFieldValue("CMD"); // Ensure header file is included Blockly.propc.definitions_["oledtools"] = '#include "oledc.h"'; - // Emit code to clear the screen - var code = 'oledc_clear(0, 0, oledc_getWidth(), oledc_getHeight() );'; + var code = ''; + + if(cmd === 'CLS') { + code += 'oledc_clear(0, 0, oledc_getWidth(), oledc_getHeight() );\n'; + } else if(cmd === 'WAKE') { + code += 'oledc_wake();\n'; + } else if(cmd === 'SLEEP') { + code += 'oledc_sleep();\n'; + } else if(cmd === 'INV') { + code += 'oledc_invertDisplay();\n'; + } + return code; }; From 035ac41c0ff116c83e808f1aef6dbea8a86fcb31 Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Mon, 14 Nov 2016 10:55:20 -0800 Subject: [PATCH 017/153] Updated distance conversion multiplier fractionally less accurate, but 10x smaller multiplier... --- src/main/webapp/cdn/blockly/generators/propc/abdrive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/cdn/blockly/generators/propc/abdrive.js b/src/main/webapp/cdn/blockly/generators/propc/abdrive.js index 14225e34..ea9cedd1 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/abdrive.js +++ b/src/main/webapp/cdn/blockly/generators/propc/abdrive.js @@ -188,7 +188,7 @@ Blockly.propc.ab_drive_goto = function() { if(units === 'TICK') { code += 'drive_goto(' + left + ', ' + right + ');\n'; } else if(units === 'CM') { - code += 'drive_goto((' + left + ' * 2500)/889), (' + right + ' * 2500)/889);\n'; + code += 'drive_goto((' + left + ' * 253)/90), (' + right + ' * 253)/90);\n'; } else { code += 'drive_goto((' + left + ' * 50)/7), (' + right + ' * 50)/7);\n'; } From 1b0b4d274e60f4f73bb7b23eaa3b82348a925cb6 Mon Sep 17 00:00:00 2001 From: David Carrier Date: Mon, 14 Nov 2016 20:05:18 -0800 Subject: [PATCH 018/153] Separated Spin if, negate, integer compare, and logic compare from common code, to preserve boolean functionality --- .../cdn/blockly/generators/spin/control.js | 2 +- .../cdn/blockly/generators/spin/logic.js | 10 +- .../cdn/blockly/language/common/control.js | 192 ++++++++++++++++-- .../cdn/blockly/language/common/logic.js | 94 ++++++++- src/main/webapp/frame/framespin.jsp | 8 +- 5 files changed, 273 insertions(+), 33 deletions(-) diff --git a/src/main/webapp/cdn/blockly/generators/spin/control.js b/src/main/webapp/cdn/blockly/generators/spin/control.js index 0a609b5d..371d3cc5 100644 --- a/src/main/webapp/cdn/blockly/generators/spin/control.js +++ b/src/main/webapp/cdn/blockly/generators/spin/control.js @@ -56,7 +56,7 @@ Blockly.Spin.controls_repeat = function () { return code; }; -Blockly.Spin.controls_if = function () { +Blockly.Spin.controls_boolean_if = function () { // If/elseif/else condition. var n = 0; var argument = Blockly.Spin.valueToCode(this, 'IF' + n, diff --git a/src/main/webapp/cdn/blockly/generators/spin/logic.js b/src/main/webapp/cdn/blockly/generators/spin/logic.js index fc936355..59946056 100644 --- a/src/main/webapp/cdn/blockly/generators/spin/logic.js +++ b/src/main/webapp/cdn/blockly/generators/spin/logic.js @@ -23,10 +23,10 @@ */ 'use strict'; -Blockly.Spin.logic_compare = function () { +Blockly.Spin.logic_boolean_compare = function () { // Comparison operator. var mode = this.getFieldValue('OP'); - var operator = Blockly.Spin.logic_compare.OPERATORS[mode]; + var operator = Blockly.Spin.logic_boolean_compare.OPERATORS[mode]; var order = (operator == '==' || operator == '!=') ? Blockly.Spin.ORDER_EQUALITY : Blockly.Spin.ORDER_RELATIONAL; var argument0 = Blockly.Spin.valueToCode(this, 'A', order) || '0'; @@ -35,7 +35,7 @@ Blockly.Spin.logic_compare = function () { return [code, order]; }; -Blockly.Spin.logic_compare.OPERATORS = { +Blockly.Spin.logic_boolean_compare.OPERATORS = { EQ: '==', NEQ: '<>', LT: '<', @@ -44,7 +44,7 @@ Blockly.Spin.logic_compare.OPERATORS = { GTE: '=>' }; -Blockly.Spin.logic_operation = function () { +Blockly.Spin.logic_boolean_operation = function () { // Operations 'and', 'or'. var operator = ''; //(this.getFieldValue('OP') == 'AND') ? '&&' : '||'; var order = Blockly.Spin.ORDER_LOGICAL_AND; @@ -70,7 +70,7 @@ Blockly.Spin.logic_operation = function () { return [code, order]; }; -Blockly.Spin.logic_negate = function () { +Blockly.Spin.logic_boolean_negate = function () { // Negation. var order = Blockly.Spin.ORDER_UNARY_PREFIX; var argument0 = Blockly.Spin.valueToCode(this, 'BOOL', order) || 'FALSE'; diff --git a/src/main/webapp/cdn/blockly/language/common/control.js b/src/main/webapp/cdn/blockly/language/common/control.js index 935be2f8..8a4db490 100644 --- a/src/main/webapp/cdn/blockly/language/common/control.js +++ b/src/main/webapp/cdn/blockly/language/common/control.js @@ -26,16 +26,164 @@ Blockly.Blocks.controls_if = { // If/elseif/else condition. category: Blockly.LANG_CATEGORY_CONTROLS, - init: function() { - if(profile.default.description === "Scribbler Robot") { - this.setHelpUrl(Blockly.MSG_S3_CONTROL_HELPURL); - } else { - this.setHelpUrl(Blockly.MSG_CONTROL_HELPURL); + helpUrl: Blockly.LANG_CONTROLS_IF_HELPURL, + init: function () { + this.setColour(colorPalette.getColor('programming')); + this.appendValueInput('IF0') + .setCheck('Boolean') + .appendField(Blockly.LANG_CONTROLS_IF_MSG_IF); + this.appendStatementInput('DO0') + .appendField(Blockly.LANG_CONTROLS_IF_MSG_THEN); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setMutator(new Blockly.Mutator(['controls_if_elseif', + 'controls_if_else'])); + // Assign 'this' to a variable for use in the tooltip closure below. + var thisBlock = this; + this.setTooltip(function () { + if (!thisBlock.elseifCount_ && !thisBlock.elseCount_) { + return Blockly.LANG_CONTROLS_IF_TOOLTIP_1; + } else if (!thisBlock.elseifCount_ && thisBlock.elseCount_) { + return Blockly.LANG_CONTROLS_IF_TOOLTIP_2; + } else if (thisBlock.elseifCount_ && !thisBlock.elseCount_) { + return Blockly.LANG_CONTROLS_IF_TOOLTIP_3; + } else if (thisBlock.elseifCount_ && thisBlock.elseCount_) { + return Blockly.LANG_CONTROLS_IF_TOOLTIP_4; + } + return ''; + }); + this.elseifCount_ = 0; + this.elseCount_ = 0; + }, + mutationToDom: function () { + if (!this.elseifCount_ && !this.elseCount_) { + return null; + } + var container = document.createElement('mutation'); + if (this.elseifCount_) { + container.setAttribute('elseif', this.elseifCount_); + } + if (this.elseCount_) { + container.setAttribute('else', 1); + } + return container; + }, + domToMutation: function (xmlElement) { + this.elseifCount_ = window.parseInt(xmlElement.getAttribute('elseif'), 10); + this.elseCount_ = window.parseInt(xmlElement.getAttribute('else'), 10); + for (var x = 1; x <= this.elseifCount_; x++) { + this.appendValueInput('IF' + x) + .setCheck('Boolean') + .appendField(Blockly.LANG_CONTROLS_IF_MSG_ELSEIF); + this.appendStatementInput('DO' + x) + .appendField(Blockly.LANG_CONTROLS_IF_MSG_THEN); + } + if (this.elseCount_) { + this.appendStatementInput('ELSE') + .appendField(Blockly.LANG_CONTROLS_IF_MSG_ELSE); + } + }, + decompose: function (workspace) { + var containerBlock = Blockly.Block.obtain(workspace, 'controls_if_if'); + containerBlock.initSvg(); + var connection = containerBlock.getInput('STACK').connection; + for (var x = 1; x <= this.elseifCount_; x++) { + var elseifBlock = Blockly.Block.obtain(workspace, 'controls_if_elseif'); + elseifBlock.initSvg(); + connection.connect(elseifBlock.previousConnection); + connection = elseifBlock.nextConnection; + } + if (this.elseCount_) { + var elseBlock = Blockly.Block.obtain(workspace, 'controls_if_else'); + elseBlock.initSvg(); + connection.connect(elseBlock.previousConnection); + } + return containerBlock; + }, + compose: function (containerBlock) { + // Disconnect the else input blocks and remove the inputs. + if (this.elseCount_) { + this.removeInput('ELSE'); + } + this.elseCount_ = 0; + // Disconnect all the elseif input blocks and remove the inputs. + for (var x = this.elseifCount_; x > 0; x--) { + this.removeInput('IF' + x); + this.removeInput('DO' + x); + } + this.elseifCount_ = 0; + // Rebuild the block's optional inputs. + var clauseBlock = containerBlock.getInputTargetBlock('STACK'); + while (clauseBlock) { + switch (clauseBlock.type) { + case 'controls_if_elseif': + this.elseifCount_++; + var ifInput = this.appendValueInput('IF' + this.elseifCount_) + .setCheck('Boolean') + .appendField(Blockly.LANG_CONTROLS_IF_MSG_ELSEIF); + var doInput = this.appendStatementInput('DO' + this.elseifCount_); + doInput.appendField(Blockly.LANG_CONTROLS_IF_MSG_THEN); + // Reconnect any child blocks. + if (clauseBlock.valueConnection_) { + ifInput.connection.connect(clauseBlock.valueConnection_); + } + if (clauseBlock.statementConnection_) { + doInput.connection.connect(clauseBlock.statementConnection_); + } + break; + case 'controls_if_else': + this.elseCount_++; + var elseInput = this.appendStatementInput('ELSE'); + elseInput.appendField(Blockly.LANG_CONTROLS_IF_MSG_ELSE); + // Reconnect any child blocks. + if (clauseBlock.statementConnection_) { + elseInput.connection.connect(clauseBlock.statementConnection_); + } + break; + default: + throw 'Unknown block type.'; + } + clauseBlock = clauseBlock.nextConnection && + clauseBlock.nextConnection.targetBlock(); + } + }, + saveConnections: function (containerBlock) { + // Store a pointer to any connected child blocks. + var clauseBlock = containerBlock.getInputTargetBlock('STACK'); + var x = 1; + while (clauseBlock) { + switch (clauseBlock.type) { + case 'controls_if_elseif': + var inputIf = this.getInput('IF' + x); + var inputDo = this.getInput('DO' + x); + clauseBlock.valueConnection_ = + inputIf && inputIf.connection.targetConnection; + clauseBlock.statementConnection_ = + inputDo && inputDo.connection.targetConnection; + x++; + break; + case 'controls_if_else': + var inputDo = this.getInput('ELSE'); + clauseBlock.statementConnection_ = + inputDo && inputDo.connection.targetConnection; + break; + default: + throw 'Unknown block type.'; + } + clauseBlock = clauseBlock.nextConnection && + clauseBlock.nextConnection.targetBlock(); } - this.setTooltip(Blockly.MSG_CONTROLS_IF_TOOLTIP); + } +}; + +Blockly.Blocks.controls_boolean_if = { + // If/elseif/else condition. + category: Blockly.LANG_CATEGORY_CONTROLS, + helpUrl: Blockly.LANG_CONTROLS_IF_HELPURL, + init: function () { this.setColour(colorPalette.getColor('programming')); this.appendValueInput('IF0') - .setCheck('Number') + .setCheck('Boolean') .appendField(Blockly.LANG_CONTROLS_IF_MSG_IF); this.appendStatementInput('DO0') .appendField(Blockly.LANG_CONTROLS_IF_MSG_THEN); @@ -44,19 +192,19 @@ Blockly.Blocks.controls_if = { this.setMutator(new Blockly.Mutator(['controls_if_elseif', 'controls_if_else'])); // Assign 'this' to a variable for use in the tooltip closure below. - //var thisBlock = this; - //this.setTooltip(function () { - // if (!thisBlock.elseifCount_ && !thisBlock.elseCount_) { - // return Blockly.LANG_CONTROLS_IF_TOOLTIP_1; - // } else if (!thisBlock.elseifCount_ && thisBlock.elseCount_) { - // return Blockly.LANG_CONTROLS_IF_TOOLTIP_2; - // } else if (thisBlock.elseifCount_ && !thisBlock.elseCount_) { - // return Blockly.LANG_CONTROLS_IF_TOOLTIP_3; - // } else if (thisBlock.elseifCount_ && thisBlock.elseCount_) { - // return Blockly.LANG_CONTROLS_IF_TOOLTIP_4; - // } - // return ''; - //}); + var thisBlock = this; + this.setTooltip(function () { + if (!thisBlock.elseifCount_ && !thisBlock.elseCount_) { + return Blockly.LANG_CONTROLS_IF_TOOLTIP_1; + } else if (!thisBlock.elseifCount_ && thisBlock.elseCount_) { + return Blockly.LANG_CONTROLS_IF_TOOLTIP_2; + } else if (thisBlock.elseifCount_ && !thisBlock.elseCount_) { + return Blockly.LANG_CONTROLS_IF_TOOLTIP_3; + } else if (thisBlock.elseifCount_ && thisBlock.elseCount_) { + return Blockly.LANG_CONTROLS_IF_TOOLTIP_4; + } + return ''; + }); this.elseifCount_ = 0; this.elseCount_ = 0; }, @@ -78,7 +226,7 @@ Blockly.Blocks.controls_if = { this.elseCount_ = window.parseInt(xmlElement.getAttribute('else'), 10); for (var x = 1; x <= this.elseifCount_; x++) { this.appendValueInput('IF' + x) - .setCheck('Number') + .setCheck('Boolean') .appendField(Blockly.LANG_CONTROLS_IF_MSG_ELSEIF); this.appendStatementInput('DO' + x) .appendField(Blockly.LANG_CONTROLS_IF_MSG_THEN); @@ -124,7 +272,7 @@ Blockly.Blocks.controls_if = { case 'controls_if_elseif': this.elseifCount_++; var ifInput = this.appendValueInput('IF' + this.elseifCount_) - .setCheck('Number') + .setCheck('Boolean') .appendField(Blockly.LANG_CONTROLS_IF_MSG_ELSEIF); var doInput = this.appendStatementInput('DO' + this.elseifCount_); doInput.appendField(Blockly.LANG_CONTROLS_IF_MSG_THEN); diff --git a/src/main/webapp/cdn/blockly/language/common/logic.js b/src/main/webapp/cdn/blockly/language/common/logic.js index a72458bd..fd8d1f37 100644 --- a/src/main/webapp/cdn/blockly/language/common/logic.js +++ b/src/main/webapp/cdn/blockly/language/common/logic.js @@ -58,6 +58,41 @@ Blockly.Blocks.logic_compare.OPERATORS = ['>', 'GT'], ['\u2265', 'GTE']]; +Blockly.Blocks.logic_boolean_compare = { + // Comparison operator. + category: Blockly.LANG_CATEGORY_LOGIC, + init: function() { + if(profile.default.description === "Scribbler Robot") { + this.setHelpUrl(Blockly.MSG_S3_MATH_HELPURL); + } else { + this.setHelpUrl(Blockly.MSG_NUMBERS_HELPURL); + } + this.setTooltip(Blockly.MSG_LOGIC_COMPARE_TOOLTIP); + this.setColour(colorPalette.getColor('math')); + this.setOutput(true, 'Boolean'); + this.appendValueInput('A') + .setCheck("Number"); + this.appendValueInput('B') + .setCheck("Number") + .appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP'); + this.setInputsInline(true); + // Assign 'this' to a variable for use in the tooltip closure below. + //var thisBlock = this; + //this.setTooltip(function () { + // var op = thisBlock.getFieldValue('OP'); + // return Blockly.Language.logic_compare.TOOLTIPS[op]; + //}); + } +}; + +Blockly.Blocks.logic_boolean_compare.OPERATORS = + [['=', 'EQ'], + ['\u2260', 'NEQ'], + ['<', 'LT'], + ['\u2264', 'LTE'], + ['>', 'GT'], + ['\u2265', 'GTE']]; + //Blockly.Blocks.logic_compare.TOOLTIPS = { // EQ: Blockly.LANG_LOGIC_COMPARE_TOOLTIP_EQ, // NEQ: Blockly.LANG_LOGIC_COMPARE_TOOLTIP_NEQ, @@ -105,6 +140,44 @@ Blockly.Blocks.logic_operation.TOOLTIPS = { OR: Blockly.LANG_LOGIC_OPERATION_TOOLTIP_OR }; +Blockly.Blocks.logic_boolean_operation = { + // Logical operations: 'and', 'or'. + category: Blockly.LANG_CATEGORY_LOGIC, + init: function() { + if(profile.default.description === "Scribbler Robot") { + this.setHelpUrl(Blockly.MSG_S3_MATH_HELPURL); + } else { + this.setHelpUrl(Blockly.MSG_NUMBERS_HELPURL); + } + this.setTooltip(Blockly.MSG_LOGIC_OPERATION_TOOLTIP); + this.setColour(colorPalette.getColor('math')); + this.setOutput(true, 'Boolean'); + this.appendValueInput('A') + .setCheck('Boolean'); + this.appendValueInput('B') + .setCheck('Boolean') + .appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP'); + this.setInputsInline(true); + // Assign 'this' to a variable for use in the tooltip closure below. +// var thisBlock = this; +// this.setTooltip(function() { +// var op = thisBlock.getFieldValue('OP'); +// return Blockly.Language.logic_operation.TOOLTIPS[op]; +// }); + } +}; + +Blockly.Blocks.logic_boolean_operation.OPERATORS = + [[Blockly.LANG_LOGIC_OPERATION_AND, 'AND'], + [Blockly.LANG_LOGIC_OPERATION_OR, 'OR'], + ['and not', 'AND_NOT'], + ['or not', 'OR_NOT']]; + +Blockly.Blocks.logic_boolean_operation.TOOLTIPS = { + AND: Blockly.LANG_LOGIC_OPERATION_TOOLTIP_AND, + OR: Blockly.LANG_LOGIC_OPERATION_TOOLTIP_OR +}; + Blockly.Blocks.logic_negate = { // Negation. category: Blockly.LANG_CATEGORY_LOGIC, @@ -124,6 +197,25 @@ Blockly.Blocks.logic_negate = { } }; +Blockly.Blocks.logic_boolean_negate = { + // Negation. + category: Blockly.LANG_CATEGORY_LOGIC, + init: function() { + if(profile.default.description === "Scribbler Robot") { + this.setHelpUrl(Blockly.MSG_S3_MATH_HELPURL); + } else { + this.setHelpUrl(Blockly.MSG_NUMBERS_HELPURL); + } + this.setTooltip(Blockly.MSG_LOGIC_NEGATE_TOOLTIP); + this.setColour(colorPalette.getColor('math')); + this.setOutput(true, 'Boolean'); + this.appendValueInput('BOOL') + .setCheck('Boolean') + .appendField(Blockly.LANG_LOGIC_NEGATE_INPUT_NOT); + // this.setTooltip(Blockly.LANG_LOGIC_NEGATE_TOOLTIP); + } +}; + Blockly.Blocks.logic_boolean = { // Boolean data type: true and false. category: Blockly.LANG_CATEGORY_LOGIC, @@ -390,4 +482,4 @@ Blockly.propc.string_compare = function () { } return [code, Blockly.propc.ORDER_NONE]; -}; \ No newline at end of file +}; diff --git a/src/main/webapp/frame/framespin.jsp b/src/main/webapp/frame/framespin.jsp index be634da8..9de1cad5 100644 --- a/src/main/webapp/frame/framespin.jsp +++ b/src/main/webapp/frame/framespin.jsp @@ -142,7 +142,7 @@ - + @@ -174,9 +174,9 @@ - - - + + + From 62bbabbba2b05c5f0e7003979cf02047ebc63cac Mon Sep 17 00:00:00 2001 From: Jim Ewald Date: Fri, 18 Nov 2016 12:46:08 -0800 Subject: [PATCH 019/153] Update order of menu items in the Communication sub-menu --- src/main/webapp/frame/framec.jsp | 110 ++++++++++++++++--------------- 1 file changed, 57 insertions(+), 53 deletions(-) diff --git a/src/main/webapp/frame/framec.jsp b/src/main/webapp/frame/framec.jsp index d7c4e7cb..53391af1 100644 --- a/src/main/webapp/frame/framec.jsp +++ b/src/main/webapp/frame/framec.jsp @@ -261,25 +261,6 @@ " exclude="heb" colour="320"> - "> - - <%-- --%> - - - - - - - - - 0 - - - - - - - "> @@ -445,43 +426,14 @@ - "> - - - - - - - - - 0 - - - - - - - - - - - 0 - - - - - 0 - - - - "> - <%-- + <%-- + @@ -515,8 +467,59 @@ 0 - --%> - + + --%> + + "> + + <%-- + + --%> + + + + + + + + + 0 + + + + + + + + "> + + + + + + + + + 0 + + + + + + + + + + + 0 + + + + + 0 + + + "> @@ -689,7 +692,8 @@ - --%> + +--%> " include="activity-board" exclude="heb" colour="200"> " include="activity-board" exclude="heb"> From 5e2519944eb6e6bf09ca2767eeba2f9a2cdd7133 Mon Sep 17 00:00:00 2001 From: Jim Ewald Date: Fri, 18 Nov 2016 12:51:47 -0800 Subject: [PATCH 020/153] Update order of menu items in the Sensor sub-menu --- src/main/webapp/frame/framec.jsp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/webapp/frame/framec.jsp b/src/main/webapp/frame/framec.jsp index 53391af1..ab53080f 100644 --- a/src/main/webapp/frame/framec.jsp +++ b/src/main/webapp/frame/framec.jsp @@ -527,15 +527,25 @@ + + <%-- Sensor menu items --%> " exclude="heb" colour="155"> - "> - - - "> + "> + + + + + "> + + + "> + + + "> @@ -547,9 +557,6 @@ - "> - - "> @@ -567,11 +574,6 @@ - "> - - - - " include="activity-board" colour="155"> "> From b7d6df8beb736d55ff3e3c799d20f640b55bc85f Mon Sep 17 00:00:00 2001 From: Jim Ewald Date: Fri, 18 Nov 2016 13:08:25 -0800 Subject: [PATCH 021/153] Correct the spelling of the hertz abbreviation from 'hz' to 'Hz' --- src/main/webapp/cdn/blockly/language/common/base.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/webapp/cdn/blockly/language/common/base.js b/src/main/webapp/cdn/blockly/language/common/base.js index faf05206..d6ed4445 100644 --- a/src/main/webapp/cdn/blockly/language/common/base.js +++ b/src/main/webapp/cdn/blockly/language/common/base.js @@ -64,14 +64,14 @@ Blockly.Blocks.base_freqout = { this.setTooltip(Blockly.MSG_BASE_FREQOUT_TOOLTIP); this.setColour(colorPalette.getColor('io')); this.appendDummyInput("") - .appendField("frequency PIN") - .appendField(new Blockly.FieldDropdown(profile.default.digital), "PIN"); + .appendField("frequency PIN") + .appendField(new Blockly.FieldDropdown(profile.default.digital), "PIN"); this.appendValueInput("DURATION", 'Number') - .appendField("duration (ms)") - .setCheck('Number'); + .appendField("duration (ms)") + .setCheck('Number'); this.appendValueInput("FREQUENCY", 'Number') - .appendField("frequecy (hz)") - .setCheck('Number'); + .appendField("frequecy (Hz)") + .setCheck('Number'); this.setInputsInline(true); this.setPreviousStatement(true, null); this.setNextStatement(true, null); From 74f4f735af2ddd9cb2b696985fd9019fbc3baf1b Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Fri, 18 Nov 2016 13:37:05 -0800 Subject: [PATCH 022/153] abdrive Block fixes Fixed drive distance block (removed an extra parenthesis) Fixed display activitybot calibration block (wasn't calling terminal) Improved ramping constants Added drive stop block --- .../cdn/blockly/generators/propc/abdrive.js | 55 ++++++++++++++++--- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/src/main/webapp/cdn/blockly/generators/propc/abdrive.js b/src/main/webapp/cdn/blockly/generators/propc/abdrive.js index ea9cedd1..9c03cb29 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/abdrive.js +++ b/src/main/webapp/cdn/blockly/generators/propc/abdrive.js @@ -34,9 +34,6 @@ Blockly.Blocks.activitybot_calibrate = { this.setColour(colorPalette.getColor('robot')); this.appendDummyInput() .appendField("ActivityBot calibrate"); - - this.setPreviousStatement(true, null); - this.setNextStatement(true, null); } }; @@ -99,10 +96,10 @@ Blockly.Blocks.ab_drive_init = { .appendField("right PIN") .appendField(new Blockly.FieldDropdown(profile.default.digital), "RIGHT") .appendField(" ramping") - .appendField(new Blockly.FieldDropdown([["none", "2000"], ["light", "16"], ["medium", "8"], ["heavy", "4"], ["maximum", "2"]]), "RAMPING"); + .appendField(new Blockly.FieldDropdown([["none", "2000"], ["light", "8"], ["medium", "4"], ["heavy", "2"], ["maximum", "1"]]), "RAMPING"); } else { inputPins.appendField(" ramping") - .appendField(new Blockly.FieldDropdown([["none", "2000"], ["light", "16"], ["medium", "8"], ["heavy", "4"], ["maximum", "2"]]), "RAMPING"); + .appendField(new Blockly.FieldDropdown([["none", "2000"], ["light", "8"], ["medium", "4"], ["heavy", "2"], ["maximum", "1"]]), "RAMPING"); } } }; @@ -147,6 +144,42 @@ Blockly.Blocks.ab_drive_speed = { } }; +Blockly.Blocks.ab_drive_stop = { + helpUrl: Blockly.MSG_ROBOT_HELPURL, + init: function() { + this.setTooltip(Blockly.MSG_ROBOT_DRIVE_SPEED_TOOLTIP); + this.setColour(colorPalette.getColor('robot')); + this.appendDummyInput() + .appendField("Robot drive stop"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +Blockly.propc.ab_drive_stop = function() { + var left = Blockly.propc.valueToCode(this, 'LEFT', Blockly.propc.ORDER_NONE); + var right = Blockly.propc.valueToCode(this, 'RIGHT', Blockly.propc.ORDER_NONE); + var bot = Blockly.propc.definitions_["include abdrive"]; + + var code = ''; + + if(bot === '#include "servodiffdrive.h"') { + code = 'drive_speeds(0, 0);\n'; + } else { + if(Blockly.propc.setups_["abd_ramping"] === 'drive_setRampStep(2000);\n') { + code = 'drive_speed(0, 0);\n'; + } else { + code = 'drive_ramp(0, 0);\n'; + } + } + + if(bot === undefined) { + return '// Robot drive system is not initialized!\n'; + } else { + return code; + } +}; Blockly.propc.ab_drive_init = function() { var bot = this.getFieldValue('BOT'); @@ -180,17 +213,17 @@ Blockly.propc.ab_drive_goto = function() { if(units === 'TICK') { code += 'drive_goto(' + left + ', ' + right + ');\n'; } else if(units === 'CM') { - code += 'drive_goto((' + left + ' * 40)/13), (' + right + ' * 40)/13);\n'; + code += 'drive_goto((' + left + ' * 40)/13, (' + right + ' * 40)/13);\n'; } else { - code += 'drive_goto((' + left + ' * 508)/65), (' + right + ' * 508)/65);\n'; + code += 'drive_goto((' + left + ' * 508)/65, (' + right + ' * 508)/65);\n'; } } else { if(units === 'TICK') { code += 'drive_goto(' + left + ', ' + right + ');\n'; } else if(units === 'CM') { - code += 'drive_goto((' + left + ' * 253)/90), (' + right + ' * 253)/90);\n'; + code += 'drive_goto((' + left + ' * 253)/90, (' + right + ' * 253)/90);\n'; } else { - code += 'drive_goto((' + left + ' * 50)/7), (' + right + ' * 50)/7);\n'; + code += 'drive_goto((' + left + ' * 50)/7, (' + right + ' * 50)/7);\n'; } } @@ -233,5 +266,9 @@ Blockly.propc.activitybot_calibrate = function() { }; Blockly.propc.activitybot_display_calibration = function() { + Blockly.propc.definitions_["include abdrive"] = '#include "abdrive.h"'; + + Blockly.propc.serial_terminal_ = true; + return 'drive_displayInterpolation();\n'; }; From 7e60ad4afbe5199ebe4473ddd59b84ccbbe1a7de Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Fri, 18 Nov 2016 13:47:29 -0800 Subject: [PATCH 023/153] Added strings for robot stop block --- .../webapp/cdn/blockly/language/en/_messages.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/cdn/blockly/language/en/_messages.js b/src/main/webapp/cdn/blockly/language/en/_messages.js index fcc70c14..f1855472 100644 --- a/src/main/webapp/cdn/blockly/language/en/_messages.js +++ b/src/main/webapp/cdn/blockly/language/en/_messages.js @@ -865,7 +865,8 @@ Blockly.MSG_ANALOG_RC_TIME_HELPURL = "http://learn.parallax.com/ab-blocks/rc-tim Blockly.MSG_AUDIO_HELPURL = "http://learn.parallax.com/ab-blocks/audio"; Blockly.MSG_SERVO_HELPURL = "http://learn.parallax.com/ab-blocks/servo"; Blockly.MSG_ROBOT_HELPURL = "http://learn.parallax.com/ab-blocks/robot"; -Blockly.MSG_IMU_HELPURL = "http://learn.parallax.com/ab-blocks/imu"; +Blockly.MSG_IMU_HELPURL = "http://learn.parallax.com/ab-blocks/lsm9ds1"; +Blockly.MSG_WS2812B_HELPURL = "http://learn.parallax.com/ab-blocks/ws2812b"; //----------Activity Board (Propeller C) block tooltips ---------------------------- @@ -947,6 +948,10 @@ Blockly.MSG_SERIAL_RECEIVE_TEXT_TOOLTIP = "Serial receive text: receives and sto Blockly.MSG_XBEE_SETUP_TOOLTIP = "XBee initialize: match to Propeller I/O pin connections and XBee Baud rate."; Blockly.MSG_XBEE_TRANSMIT_TOOLTIP = "XBee transmit: sends information to an XBee. Strings and numbers are terminated with an ASCII 13"; Blockly.MSG_XBEE_RECEIVE_TOOLTIP = "XBee receive: receives information from an XBee. Expects strings and numbers to be terminated with an ASCII 13"; +Blockly.MSG_WS2812B_INIT_TOOLTIP = " "; +Blockly.MSG_WS2812B_SET_TOOLTIP = " "; +Blockly.MSG_WS2812B_UPDATE_TOOLTIP = " "; + Blockly.MSG_HMC5883L_INIT_TOOLTIP = "Compass initialize: match to Propeller I/O pin connections."; Blockly.MSG_HMC5883L_READ_TOOLTIP = "Compass heading: get current heading in degrees."; Blockly.MSG_JOYSTICK_INPUT_XAXIS_TOOLTIP = "Joystick x-axis: gets horizontal position of Joystick, match to A/D socket."; @@ -958,6 +963,11 @@ Blockly.MSG_MX2125_TILT_XAXIS_TOOLTIP = "Memsic x tilt: gets x-\tilt in degrees Blockly.MSG_MX2125_TILT_YAXIS_TOOLTIP = "Memsic y tilt: gets y-tilt in degrees from level with horizon, match to Propeller I/O pin."; Blockly.MSG_MMA7455_INIT_TOOLTIP = "Accelerometer initialize: match to Propeller I/O pin connections."; Blockly.MSG_MMA7455_ACCELERATION_TOOLTIP = "Accelerometer store values: stores measured x, y, & z acceleration in specified variables."; +Blockly.MSG_LSM9DS1_INIT_TOOLTIP = " "; +Blockly.MSG_LSM9DS1_READ_TOOLTIP = " "; +Blockly.MSG_LSM9DS1_TILT_TOOLTIP = " "; +Blockly.MSG_LSM9DS1_HEADING_TOOLTIP = " "; + Blockly.MSG_SENSOR_PING_TOOLTIP = "Ping))) distance: gets distance measured in the specified units, match to Propeller I/O pin."; Blockly.MSG_PIR_SENSOR_TOOLTIP = "PIR sensor: returns 1/true if motion is detected, match to Propeller I/O pin."; Blockly.MSG_RFID_ENABLE_TOOLTIP = "RFID initialize: match to Propeller I/O pin connections."; @@ -992,6 +1002,7 @@ Blockly.MSG_SERVO_SET_RAMP_TOOLTIP = "CR servo set ramp: sets the amount a servo Blockly.MSG_ROBOT_DRIVE_INIT_TOOLTIP = "Robot drive init: set up the Robot's drive system on the Propeller"; Blockly.MSG_ROBOT_DRIVE_DISTANCE_TOOLTIP = "Robot drive distance: drives each wheel a specified distance."; Blockly.MSG_ROBOT_DRIVE_SPEED_TOOLTIP = "Robot drive speed: drives each wheel at a specified speed."; +Blockly.MSG_ROBOT_DRIVE_STOP_TOOLTIP = "Robot drive stop: stops the robot from driving."; Blockly.MSG_ROBOT_ACTIVITYBOT_CALIBRATE_TOOLTIP = "ActivityBot Calibrate: runs the ActivityBot calibration routine."; Blockly.MSG_ROBOT_ACTIVITYBOT_DISPLAY_CALIBRATION_TOOLTIP = "ActivityBot Display Calibration: displays the calibration results on the terminal."; From f5c50feda743cd187b4eae9044a15a59042eef47 Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Fri, 18 Nov 2016 13:56:09 -0800 Subject: [PATCH 024/153] Add robot drive stop block --- src/main/webapp/frame/framec.jsp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/webapp/frame/framec.jsp b/src/main/webapp/frame/framec.jsp index d7c4e7cb..1340e25a 100644 --- a/src/main/webapp/frame/framec.jsp +++ b/src/main/webapp/frame/framec.jsp @@ -813,6 +813,7 @@ + From dc1be43e063e747744d97c3c334d3362b62a5aad Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Sat, 19 Nov 2016 22:30:47 -0800 Subject: [PATCH 025/153] Add robot and RGB-LED blocks, begin cleanup Commenting .js files that will no longer be needed --- src/main/webapp/frame/framec.jsp | 102 ++++++++++++------------------- 1 file changed, 39 insertions(+), 63 deletions(-) diff --git a/src/main/webapp/frame/framec.jsp b/src/main/webapp/frame/framec.jsp index fd793575..ef44e122 100644 --- a/src/main/webapp/frame/framec.jsp +++ b/src/main/webapp/frame/framec.jsp @@ -24,37 +24,43 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + '; + + // a footer to generate a watermark with the project's information at the bottom-right corner of the SVG + var SVGfooter = ''; + SVGfooter += ''; + SVGfooter += 'Parallax BlocklyProp Project'; + SVGfooter += 'User: ' + projectData['user'] + ''; + SVGfooter += 'Title: ' + projectData['name'] + ''; + SVGfooter += 'Project ID: ' + idProject + ''; + SVGfooter += 'Device: ' + projectData['board'] + ''; + + // Check for any file extentions at the end of the submitted name, and truncate if any + if(value.indexOf(".") !== -1) value = value.substring(0,value.indexOf(".")); + // Check to make sure the filename is not too long + if(value.length >= 30) value = value.substring(0, 29); + // Replace any illegal characters + value = value.replace(/[\\/:*?\"<>|]/g, '_'); + + // Assemble both the SVG (image) of the blocks and the blocks' XML definition + saveData(SVGheader + projSVGcode + SVGfooter + projXMLcode + '', value + '.svg'); + } + }); +}; + +function uploadCode() { + $('#upload-dialog').modal('show'); +}; + +function uploadHandler(files) { + + var UploadReader = new FileReader(); + UploadReader.onload = function() { + var parsed = new DOMParser().parseFromString(this.result, "text/xml"); + var xmlString = (new XMLSerializer()).serializeToString(parsed); + + //validate file, screen for potentially malicious code. + if(files[0].type === 'image/svg+xml' + && xmlString.indexOf("'; + }; +}; + +function replaceCode() { + $('#upload-dialog').modal('hide'); + if(uploadedXML !== '') { + var newCode = uploadedXML; + newCode = newCode.substring(42,newCode.length); + newCode = newCode.substring(0,(newCode.length - 6)); + + window.frames["content_blocks"].location.reload(); + window.frames["content_blocks"].setProfile(projectData['board']); + window.frames["content_blocks"].init(projectData['board'], []); + projectData['code'] = '' + newCode + ''; + window.frames["content_blocks"].load(projectData['code']); + + // Reset all of the upload fields and containers + uploadedXML =''; + $('#selectfile').val(''); + document.getElementById("selectfile-verify-notvalid").style.visibility = "hidden"; + document.getElementById("selectfile-verify-valid").style.visibility = "hidden"; + } +}; + +function appendCode() { + $('#upload-dialog').modal('hide'); + if(uploadedXML !== '') { + var projCode = projectData['code']; + projCode = projCode.substring(42,projCode.length); + projCode = projCode.substring(0,(projCode.length - 6)); + + var newCode = uploadedXML; + newCode = newCode.substring(42,newCode.length); + newCode = newCode.substring(0,(newCode.length - 6)); + + window.frames["content_blocks"].location.reload(); + window.frames["content_blocks"].setProfile(projectData['board']); + window.frames["content_blocks"].init(projectData['board'], []); + projectData['code'] = '' + projCode + newCode + ''; + window.frames["content_blocks"].load(projectData['code']); + + // Reset all of the upload fields and containers + uploadedXML =''; + $('#selectfile').val(''); + document.getElementById("selectfile-verify-notvalid").style.visibility = "hidden"; + document.getElementById("selectfile-verify-valid").style.visibility = "hidden"; + } +}; + +function clearWorkspace() { + utils.confirm(Blockly.Msg.DIALOG_CLEAR_WORKSPACE, Blockly.Msg.DIALOG_CLEAR_WORKSPACE_WARNING, function (value) { + if (value) { + window.frames["content_blocks"].location.reload(); + window.frames["content_blocks"].setProfile(projectData['board']); + window.frames["content_blocks"].init(projectData['board'], []); + projectData['code'] = ''; + window.frames["content_blocks"].load(projectData['code']); + } + }); +}; + From 39e68d0faa26e63b021845002f24d706fdb66ae4 Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Wed, 4 Jan 2017 14:26:43 -0800 Subject: [PATCH 134/153] Add upload modals --- src/main/webapp/editor/blocklyc.jsp | 31 +++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/editor/blocklyc.jsp b/src/main/webapp/editor/blocklyc.jsp index a0e1690c..a5867ae5 100644 --- a/src/main/webapp/editor/blocklyc.jsp +++ b/src/main/webapp/editor/blocklyc.jsp @@ -64,6 +64,29 @@ + + @@ -89,13 +112,13 @@ From 38aea27ff760cf7b32f01cb8ae7b4aa3078972a8 Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Wed, 4 Jan 2017 14:28:00 -0800 Subject: [PATCH 135/153] Fix unreachable code Moved code after return --- src/main/webapp/cdn/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/cdn/utils.js b/src/main/webapp/cdn/utils.js index d274d991..8ae20807 100644 --- a/src/main/webapp/cdn/utils.js +++ b/src/main/webapp/cdn/utils.js @@ -72,7 +72,8 @@ var utils = { for (var i = 0; i < parArr.length; i++) { parr = parArr[i].split("="); - if (parr[0] == parameter) { + if (parr[0] === parameter) { + returnBool = true; return (decode) ? decodeURIComponent(parr[1]) : parr[1]; } else { returnBool = false; From db3d3aebc65786e08e5ce5b4069931b88336d7bb Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Wed, 4 Jan 2017 14:29:45 -0800 Subject: [PATCH 136/153] Add proper HTML to output Prevents error from being thrown --- .../com/parallax/server/blocklyprop/servlets/PingServlet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/parallax/server/blocklyprop/servlets/PingServlet.java b/src/main/java/com/parallax/server/blocklyprop/servlets/PingServlet.java index 60fdc011..60e3f863 100644 --- a/src/main/java/com/parallax/server/blocklyprop/servlets/PingServlet.java +++ b/src/main/java/com/parallax/server/blocklyprop/servlets/PingServlet.java @@ -24,7 +24,7 @@ public class PingServlet extends HttpServlet { */ @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - resp.getWriter().write("pong"); + resp.getWriter().write("pong"); } } From 7afffb44073f9d9e2078eb0566a730b680c85680 Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Wed, 4 Jan 2017 14:31:45 -0800 Subject: [PATCH 137/153] Prevent user info from being discarded Now returs user screenname when the user owns the current project --- .../server/blocklyprop/converter/ProjectConverter.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/parallax/server/blocklyprop/converter/ProjectConverter.java b/src/main/java/com/parallax/server/blocklyprop/converter/ProjectConverter.java index ae2d9524..55ec6d4e 100644 --- a/src/main/java/com/parallax/server/blocklyprop/converter/ProjectConverter.java +++ b/src/main/java/com/parallax/server/blocklyprop/converter/ProjectConverter.java @@ -84,10 +84,8 @@ public JsonObject toJson(ProjectRecord project) { result.addProperty("modified", DateConversion.toDateTimeString(project.getModified().getTime())); boolean isYours = project.getIdUser().equals(BlocklyPropSecurityUtils.getCurrentUserId()); result.addProperty("yours", isYours); - if (!isYours) { - result.addProperty("user", userService.getUserScreenName(project.getIdUser())); - - } else { + result.addProperty("user", userService.getUserScreenName(project.getIdUser())); + if (isYours) { List projectSharingRecords = projectSharingService.getSharingInfo(project.getId()); if (projectSharingRecords != null && !projectSharingRecords.isEmpty()) { result.addProperty("share-key", projectSharingRecords.get(0).getSharekey()); @@ -126,9 +124,7 @@ public JsonObject toJson(Project project) { result.addProperty("modified", DateConversion.toDateTimeString(project.getModified().getTime())); boolean isYours = project.getIdUser().equals(BlocklyPropSecurityUtils.getCurrentUserId()); result.addProperty("yours", isYours); - if (!isYours) { - result.addProperty("user", userService.getUserScreenName(project.getIdUser())); - } + result.addProperty("user", userService.getUserScreenName(project.getIdUser())); if (project.getBasedOn() != null) { JsonObject basedOn = new JsonObject(); From 12fbcdfcddf8430880b07b0630540d143dac9fd7 Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Wed, 4 Jan 2017 14:42:14 -0800 Subject: [PATCH 138/153] Add links to new functions Added, but commented out for soft-deploy --- .../WEB-INF/includes/pageparts/editor-menu.jsp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/webapp/WEB-INF/includes/pageparts/editor-menu.jsp b/src/main/webapp/WEB-INF/includes/pageparts/editor-menu.jsp index 48136ae3..4dca73fc 100644 --- a/src/main/webapp/WEB-INF/includes/pageparts/editor-menu.jsp +++ b/src/main/webapp/WEB-INF/includes/pageparts/editor-menu.jsp @@ -13,6 +13,12 @@ From 7bc4408329e05c2fd767bc78aac408e406d747de Mon Sep 17 00:00:00 2001 From: Jim Ewald Date: Sat, 7 Jan 2017 14:03:02 -0800 Subject: [PATCH 139/153] Add board check and checksum to upload feature --- .../translations.properties | 1 + .../includes/pageparts/editor-menu.jsp | 4 +- src/main/webapp/cdn/editor.js | 66 ++++++++++++++----- src/main/webapp/editor/blocklyc.jsp | 9 +-- 4 files changed, 58 insertions(+), 22 deletions(-) diff --git a/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties b/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties index a4dfcb0a..2f0a2b3b 100644 --- a/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties +++ b/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties @@ -221,6 +221,7 @@ editor.upload = Upload editor.upload.selectfile = Select File editor.upload.valid = The selected file appears valid. editor.upload.notvalid = The selected file is not valid. +editor.upload.boardtype.warning = Warning! You are about to upload a blocks file from a different board than you are currently using. If the blocks you are trying to upload are not available for your current board, uploading this blocks file into your project may break your project. If your project does break after uploading this file - do not save it! Click your browser's refresh button to reload your project. editor.clear-workspace = Clear Workspace editor.button.close = Close editor.button.cancel = Cancel diff --git a/src/main/webapp/WEB-INF/includes/pageparts/editor-menu.jsp b/src/main/webapp/WEB-INF/includes/pageparts/editor-menu.jsp index 4dca73fc..8bf27676 100644 --- a/src/main/webapp/WEB-INF/includes/pageparts/editor-menu.jsp +++ b/src/main/webapp/WEB-INF/includes/pageparts/editor-menu.jsp @@ -98,10 +98,10 @@ diff --git a/src/main/webapp/cdn/editor.js b/src/main/webapp/cdn/editor.js index e81084ac..f0a0dcb6 100644 --- a/src/main/webapp/cdn/editor.js +++ b/src/main/webapp/cdn/editor.js @@ -1,4 +1,4 @@ -/* + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. @@ -163,6 +163,14 @@ setInterval(function () { $.get(baseUrl + 'ping'); }, 60000); +function hashCode(str) { + var hash = 0, i = 0, len = str.length; + while ( i < len ) { + hash = ((hash << 5) - hash + str.charCodeAt(i++)) << 0; + } + return (hash + 2147483647) + 1; +}; + function downloadCode() { var projXMLcode = projectData['code']; projXMLcode = projXMLcode.substring(42,projXMLcode.length); @@ -232,8 +240,11 @@ function downloadCode() { // Replace any illegal characters value = value.replace(/[\\/:*?\"<>|]/g, '_'); + var xmlChecksum = hashCode(projXMLcode).toString(); + var xmlChecksum = '000000000000'.substring(xmlChecksum.length, 12) + xmlChecksum; + // Assemble both the SVG (image) of the blocks and the blocks' XML definition - saveData(SVGheader + projSVGcode + SVGfooter + projXMLcode + '', value + '.svg'); + saveData(SVGheader + projSVGcode + SVGfooter + projXMLcode + '' + xmlChecksum + '', value + '.svg'); } }); }; @@ -248,20 +259,40 @@ function uploadHandler(files) { UploadReader.onload = function() { var parsed = new DOMParser().parseFromString(this.result, "text/xml"); var xmlString = (new XMLSerializer()).serializeToString(parsed); + var xmlValid = false; + var uploadBoardType = ''; //validate file, screen for potentially malicious code. if(files[0].type === 'image/svg+xml' && xmlString.indexOf("Device: '); + uploadBoardType = xmlString.substring((boardIndex + 40), xmlString.indexOf('', (boardIndex + 41))); + if(uploadBoardType !== projectData['board']) { + document.getElementById("selectfile-verify-boardtype").style.display = "block"; + } + } + }; + + + if(xmlValid === true) { + document.getElementById("selectfile-verify-valid").style.display = "block"; document.getElementById("selectfile-replace").disabled = false; document.getElementById("selectfile-append").disabled = false; uploadedXML = xmlString; } else { - document.getElementById("selectfile-verify-notvalid").style.visibility = "visible"; + document.getElementById("selectfile-verify-notvalid").style.display = "block"; document.getElementById("selectfile-replace").disabled = true; document.getElementById("selectfile-append").disabled = true; uploadedXML = ''; @@ -271,17 +302,26 @@ function uploadHandler(files) { UploadReader.readAsText(files[0]); if(uploadedXML !== '') { - uploadedXML = uploadedXML.substring(uploadedXML.indexOf("'; }; }; +function clearUploadInfo() { + // Reset all of the upload fields and containers + uploadedXML =''; + $('#selectfile').val(''); + document.getElementById("selectfile-verify-notvalid").style.display = "none"; + document.getElementById("selectfile-verify-valid").style.display = "none"; + document.getElementById("selectfile-verify-boardtype").style.display = "none"; +}; + function replaceCode() { $('#upload-dialog').modal('hide'); if(uploadedXML !== '') { var newCode = uploadedXML; newCode = newCode.substring(42,newCode.length); - newCode = newCode.substring(0,(newCode.length - 6)); + newCode = newCode.substring(0,(newCode.length - 29)); window.frames["content_blocks"].location.reload(); window.frames["content_blocks"].setProfile(projectData['board']); @@ -290,10 +330,7 @@ function replaceCode() { window.frames["content_blocks"].load(projectData['code']); // Reset all of the upload fields and containers - uploadedXML =''; - $('#selectfile').val(''); - document.getElementById("selectfile-verify-notvalid").style.visibility = "hidden"; - document.getElementById("selectfile-verify-valid").style.visibility = "hidden"; + clearUploadInfo(); } }; @@ -315,10 +352,7 @@ function appendCode() { window.frames["content_blocks"].load(projectData['code']); // Reset all of the upload fields and containers - uploadedXML =''; - $('#selectfile').val(''); - document.getElementById("selectfile-verify-notvalid").style.visibility = "hidden"; - document.getElementById("selectfile-verify-valid").style.visibility = "hidden"; + clearUploadInfo(); } }; diff --git a/src/main/webapp/editor/blocklyc.jsp b/src/main/webapp/editor/blocklyc.jsp index a5867ae5..3451be23 100644 --- a/src/main/webapp/editor/blocklyc.jsp +++ b/src/main/webapp/editor/blocklyc.jsp @@ -69,20 +69,21 @@ From 1075f4846e835e4abcd31ee93c324346c2722208 Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Mon, 9 Jan 2017 00:22:36 -0800 Subject: [PATCH 140/153] Improved top nav bar UI system --- .../translations.properties | 18 +- .../includes/pageparts/editor-menu.jsp | 174 ++++++--------- .../cdn/blockly/language/en/_messages.js | 4 + src/main/webapp/cdn/blocklyc.js | 76 ++++++- src/main/webapp/cdn/blocklypropclient.js | 3 +- src/main/webapp/cdn/blocklyspin.js | 29 ++- src/main/webapp/cdn/editor.js | 19 +- src/main/webapp/cdn/lib/xterm.css | 1 - src/main/webapp/cdn/style-editor.css | 209 +++++++++++++++++- 9 files changed, 402 insertions(+), 131 deletions(-) diff --git a/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties b/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties index 2f0a2b3b..748d7c59 100644 --- a/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties +++ b/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties @@ -195,11 +195,12 @@ login.forgotlink = Forgot your password? login.notconfirmedlink = Email not yet confirmed? editor.newproject.title = New project -editor.newproject.spin = S3 Robot +editor.newproject.spin = Scribbler Robot editor.newproject.c = Propeller C editor.projects.title = Projects editor.view.title = View editor.view.blocks = Blocks +editor.view.code = Code editor.view.c = Propeller C editor.view.spin = Spin editor.view.xml = XML @@ -211,18 +212,19 @@ editor.run.terminal = Serial terminal editor.run.configure = Configure client editor.project = Project editor.save = Save -editor.save-as = Save as +editor.save-as = Save project as editor.client.title = BlocklyPropClient -editor.client.checking = Checking for BlocklyPropClient -editor.client.available = BlocklyPropClient available -editor.client.not-available = BlocklyPropClient not available -editor.download = Download -editor.upload = Upload +editor.client.checking = Looking for BlocklyPropClient +editor.client.available = Select the correct port, then click or . +editor.client.available.short = Select the correct port, then click . +editor.client.not-available = BlocklyPropClient is not running +editor.download = Download blocks file +editor.upload = Upload blocks file editor.upload.selectfile = Select File editor.upload.valid = The selected file appears valid. editor.upload.notvalid = The selected file is not valid. editor.upload.boardtype.warning = Warning! You are about to upload a blocks file from a different board than you are currently using. If the blocks you are trying to upload are not available for your current board, uploading this blocks file into your project may break your project. If your project does break after uploading this file - do not save it! Click your browser's refresh button to reload your project. -editor.clear-workspace = Clear Workspace +editor.clear-workspace = Clear workspace editor.button.close = Close editor.button.cancel = Cancel editor.button.replace = Replace diff --git a/src/main/webapp/WEB-INF/includes/pageparts/editor-menu.jsp b/src/main/webapp/WEB-INF/includes/pageparts/editor-menu.jsp index 8bf27676..a7dd309d 100644 --- a/src/main/webapp/WEB-INF/includes/pageparts/editor-menu.jsp +++ b/src/main/webapp/WEB-INF/includes/pageparts/editor-menu.jsp @@ -7,110 +7,78 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ include file="/WEB-INF/includes/include.jsp"%> - diff --git a/src/main/webapp/cdn/blockly/language/en/_messages.js b/src/main/webapp/cdn/blockly/language/en/_messages.js index 614b0361..debe356c 100644 --- a/src/main/webapp/cdn/blockly/language/en/_messages.js +++ b/src/main/webapp/cdn/blockly/language/en/_messages.js @@ -48,6 +48,10 @@ Blockly.Msg.DIALOG_CLEAR_WORKSPACE_WARNING = 'Are you sure you want to clear you Blockly.Msg.DIALOG_CHANGED_SINCE = 'The project has been changed since the last save.'; Blockly.Msg.DIALOG_PROJECT_SAVED = 'Project saved'; Blockly.Msg.DIALOG_PROJECT_SAVED_TEXT = 'The project has been saved'; +Blockly.Msg.DIALOG_SIDE_FILES = ''; +Blockly.Msg.DIALOG_SIDE_FILES_WARNING = ''; +Blockly.Msg.DIALOG_NO_CLIENT = ' BlocklyPropClient is not running'; +Blockly.Msg.DIALOG_CLIENT_SEARCHING = ' Looking for BlocklyPropClient'; // Variable renaming. Blockly.MSG_CHANGE_VALUE_TITLE = 'Change value:'; diff --git a/src/main/webapp/cdn/blocklyc.js b/src/main/webapp/cdn/blocklyc.js index 6aeb8118..180d2878 100644 --- a/src/main/webapp/cdn/blocklyc.js +++ b/src/main/webapp/cdn/blocklyc.js @@ -43,15 +43,32 @@ function tabClick(id) { // Deselect all tabs and hide all panes. for (var x in TABS_) { - if (document.getElementById('tab_' + TABS_[x])) { - document.getElementById('tab_' + TABS_[x]).className = 'taboff'; - } + //if (document.getElementById('tab_' + TABS_[x])) { + // document.getElementById('tab_' + TABS_[x]).className = 'taboff'; + //} document.getElementById('content_' + TABS_[x]).style.display = 'none'; } // Select the active tab. selected = id.replace('tab_', ''); - document.getElementById(id).className = 'active'; + //document.getElementById(id).className = 'active'; + + if (id === 'tab_blocks') { + document.getElementById('btn-view-blocks').style.display = 'none'; + var btns = document.getElementsByClassName("btn-view-code"); + for (var i = 0; i < btns.length; i++) + { + btns[i].style.display = 'inline'; + } + } else { + document.getElementById('btn-view-blocks').style.display = 'inline'; + var btns = document.getElementsByClassName("btn-view-code"); + for (var i = 0; i < btns.length; i++) + { + btns[i].style.display = 'none'; + } + } + // Show the selected pane. var content = document.getElementById('content_' + selected); content.style.display = 'block'; @@ -98,6 +115,7 @@ function init(blockly) { window.Blockly = blockly; // Make the 'Blocks' tab line up with the toolbox. + /* if (Blockly.Toolbox) { window.setTimeout(function () { document.getElementById('tab_blocks').style.minWidth = @@ -105,6 +123,7 @@ function init(blockly) { // Account for the 19 pixel margin and on each side. }, 1); } + */ loadProject(); } @@ -228,7 +247,7 @@ function serial_console() { connection.onerror = function (error) { console.log('WebSocket Error'); console.log(error); - // term.destroy(); + // term.destroy(); }; // Log messages from the server connection.onmessage = function (e) { @@ -316,3 +335,50 @@ $(document).ready(function () { getComPort = function () { return $('#comPort').find(":selected").text(); }; + +function downloadPropC() { + var propcCode = Blockly.propc.workspaceToCode(Blockly.mainWorkspace); + var isEmptyProject = propcCode.indexOf("EMPTY_PROJECT") > -1; + if (isEmptyProject) { + alert("You can't download an empty project"); + } else { + utils.confirm('Downloading a SimpleIDE project', 'To open your project in SimpleIDE, two files will be downloaded. They must both be saved in the same folder on your computer.', function (confirmed) { + if (confirmed) { + utils.prompt("Download SimpleIDE files", "Filename:", 'Project' + idProject, function (value) { + if (value) { + + var sideFileContent = ".c\n>compiler=C\n>memtype=cmm main ram compact\n"; + sideFileContent += ">optimize=-Os\n>-m32bit-doubles\n>-fno-exceptions\n>defs::-std=c99\n"; + sideFileContent += ">-lm\n>BOARD::ACTIVITYBOARD"; + + var saveData = (function () { + var a = document.createElement("a"); + document.body.appendChild(a); + a.style = "display: none"; + return function (data, fileName) { + var blob = new Blob([data], {type: "octet/stream"}); + var url = window.URL.createObjectURL(blob); + a.href = url; + a.download = fileName; + a.click(); + window.URL.revokeObjectURL(url); + }; + }()); + + // Check for any file extentions at the end of the submitted name, and truncate if any + if(value.indexOf(".") !== -1) value = value.substring(0,value.indexOf(".")); + // Check to make sure the filename is not too long + if(value.length >= 30) value = value.substring(0, 29); + // Replace any illegal characters + value = value.replace(/[\\/:*?\"<>|]/g, '_'); + + saveData(propcCode, value + ".c"); + saveData(value + sideFileContent, value + ".side"); + } + }); + } + }); + } + + +} diff --git a/src/main/webapp/cdn/blocklypropclient.js b/src/main/webapp/cdn/blocklypropclient.js index 7d7bee51..f27a0e32 100644 --- a/src/main/webapp/cdn/blocklypropclient.js +++ b/src/main/webapp/cdn/blocklypropclient.js @@ -41,6 +41,7 @@ check_client = function () { client_available = true; $("#client-available").removeClass("hidden"); + $("#client-searching").addClass("hidden"); $("#client-unavailable").addClass("hidden"); // $("#client_status").text($("#client_status").data('available')).removeClass("not_available").addClass("available"); if (check_com_ports && typeof (check_com_ports) === "function") { @@ -52,7 +53,7 @@ check_client = function () { }).fail(function () { clearInterval(check_com_ports_interval); client_available = false; - $("#client_status").text($("#client_status").data('not-available')).removeClass("available").addClass("not_available"); + $("#client-searching").addClass("hidden"); $("#client-available").addClass("hidden"); $("#client-unavailable").removeClass("hidden"); setTimeout(check_client, 2000); diff --git a/src/main/webapp/cdn/blocklyspin.js b/src/main/webapp/cdn/blocklyspin.js index 95326e4f..b1378d7c 100644 --- a/src/main/webapp/cdn/blocklyspin.js +++ b/src/main/webapp/cdn/blocklyspin.js @@ -41,19 +41,35 @@ function tabClick(id) { // Deselect all tabs and hide all panes. for (var x in TABS_) { - if (document.getElementById('tab_' + TABS_[x])) { - document.getElementById('tab_' + TABS_[x]).className = 'taboff'; - } + //if (document.getElementById('tab_' + TABS_[x])) { + // document.getElementById('tab_' + TABS_[x]).className = 'taboff'; + //} if (document.getElementById('content_' + TABS_[x])) { document.getElementById('content_' + TABS_[x]).style.display = 'none'; - } else { + //} else { // document.getElementByName('content_' + TABS_[x])[0].style.display = 'none'; } } // Select the active tab. selected = id.replace('tab_', ''); - document.getElementById(id).className = 'active'; + //document.getElementById(id).className = 'active'; + if (id === 'tab_blocks') { + document.getElementById('btn-view-blocks').style.display = 'none'; + var btns = document.getElementsByClassName("btn-view-code"); + for (var i = 0; i < btns.length; i++) + { + btns[i].style.display = 'inline'; + } + } else { + document.getElementById('btn-view-blocks').style.display = 'inline'; + var btns = document.getElementsByClassName("btn-view-code"); + for (var i = 0; i < btns.length; i++) + { + btns[i].style.display = 'none'; + } + } + // Show the selected pane. var content = document.getElementById('content_' + selected); content.style.display = 'block'; @@ -94,6 +110,7 @@ function init(blockly) { window.Blockly = blockly; // Make the 'Blocks' tab line up with the toolbox. + /* if (Blockly.Toolbox) { window.setTimeout(function () { document.getElementById('tab_blocks').style.minWidth = @@ -101,6 +118,8 @@ function init(blockly) { // Account for the 19 pixel margin and on each side. }, 1); } + */ + loadProject(); } diff --git a/src/main/webapp/cdn/editor.js b/src/main/webapp/cdn/editor.js index f0a0dcb6..38331dc5 100644 --- a/src/main/webapp/cdn/editor.js +++ b/src/main/webapp/cdn/editor.js @@ -33,7 +33,24 @@ $(document).ready(function () { $('#save-project').on('click', function () { saveProject(); + + var elem = document.getElementById('save-project'); + elem.style.paddingLeft = '10px'; + elem.style.background = 'rgb(92, 184, 92)'; + elem.style.borderColor = 'rgb(76, 174, 76)'; + + setTimeout(function() { + elem.innerHTML = 'Save ✓'; + }, 600); + + setTimeout(function() { + elem.innerHTML = 'Save  '; + elem.style.paddingLeft = '15px'; + elem.style.background = '#337ab7'; + elem.style.borderColor = '#2e6da4'; + }, 1750); }); + $('#save-project-as').on('click', function () { saveProjectAs(); }); @@ -64,7 +81,7 @@ saveProject = function () { var previousOwner = projectData['yours']; projectData = data; projectData['code'] = code; // Save code in projectdata to be able to verify if code has changed upon leave - utils.showMessage(Blockly.Msg.DIALOG_PROJECT_SAVED, Blockly.Msg.DIALOG_PROJECT_SAVED_TEXT); + //utils.showMessage(Blockly.Msg.DIALOG_PROJECT_SAVED, Blockly.Msg.DIALOG_PROJECT_SAVED_TEXT); if (!previousOwner) { window.location.href = baseUrl + 'projecteditor?id=' + data['id']; } diff --git a/src/main/webapp/cdn/lib/xterm.css b/src/main/webapp/cdn/lib/xterm.css index d9f3a0ad..c7d7b9d4 100644 --- a/src/main/webapp/cdn/lib/xterm.css +++ b/src/main/webapp/cdn/lib/xterm.css @@ -2147,5 +2147,4 @@ */ .terminal .xterm-rows > div { line-height: normal; - white-space: nowrap; } diff --git a/src/main/webapp/cdn/style-editor.css b/src/main/webapp/cdn/style-editor.css index fdc83d50..ce687eed 100644 --- a/src/main/webapp/cdn/style-editor.css +++ b/src/main/webapp/cdn/style-editor.css @@ -128,11 +128,11 @@ button:hover { } .not_available { - color: #ff6666 !important; + color: #a94442 !important; } .available { - color: #33cc00 !important; + color: #8a6d3b !important; } .space_left { @@ -147,11 +147,13 @@ button:hover { background-image: url('images/logo_small.png'); background-repeat: no-repeat; background-size: 50px 50px; - padding-left: 60px; - margin-left: 0; + padding-left: 55px; + margin-left: 5px; + margin-top: 5px; height: 50px; - font-size: 25px; - display: block; + font-size: 22px; + line-height: 25px; + display: inline; float: left; } @@ -186,8 +188,201 @@ nav .nav > li > a:first-child { background-color: transparent; } +/* New Nav Scheme */ + +.btn-circle { + width: 30px; + height: 30px; + text-align: center; + padding: 6px 0; + font-size: 14px; + line-height: 1.3; + border-radius: 15px; +} + +#save-project { + -webkit-transition: padding-left 1s, background 1s, border 1s; + transition: padding-left 1s, background 1s, border 1s; + padding-top: 5px; + padding-bottom: 5px; + padding-left: 15px; + font-size: 12px; + line-height: 1.5; + color: #fff; + width: 58px; + background-color: #337ab7; + border-color: #2e6da4; + display: inline-block; + margin-bottom: 0; + text-align: left; + white-space: nowrap; + vertical-align: middle; + cursor: pointer; + border: 1px solid transparent; + border-radius: 4px; + text-decoration: none; +} + +#save-project:hover { + box-shadow: 2px 2px 5px #89a; +} + +.btn-view-blocks:hover { + box-shadow: 2px 2px 5px #89a; + color: #fff; + text-decoration: none; +} + +.btn-view-code:hover { + box-shadow: 2px 2px 5px #89a; + color: #333; + text-decoration: none; + background-color: #eee; +} + +.btn-view-blocks { + padding:7px 10px 7px 10px; + font-size: 12px; + line-height: 1.5; + color: #fff; + background-color: #337ab7; + display: inline-block; + margin-bottom: 0; + text-align: center; + white-space: nowrap; + vertical-align: middle; + cursor: pointer; + border: 1px solid #2e6da4; + border-radius: 4px; + text-decoration: none; +} + +.btn-view-code { + padding:7px 10px 7px 10px; + font-size: 12px; + line-height: 1.5; + color: #333; + background-color: white; + display: inline-block; + margin-bottom: 0; + text-align: center; + white-space: nowrap; + vertical-align: middle; + cursor: pointer; + border: 1px solid #ccc; + border-radius: 4px; + text-decoration: none; +} + +#comPort { + padding: 6px 8px 6px 8px; + font-size: 12px; + line-height: 1.5; + margin: 2px 2px 2px 2px; + text-align: left; + white-space: nowrap; + vertical-align: middle; + cursor: pointer; + border: 1px solid #ccc; + border-radius: 3px; + text-decoration: none; + background: white; + /* + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOmh0bWw9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHdpZHRoPSI4IiBoZWlnaHQ9IjIwIj48Zz48cGF0aCBmaWxsPSIjMDAwMDAwIiBkPSJNIDAsMTAgOCwxMCA0LDE0IHoiPjwvcGF0aD48L2c+PC9zdmc+Cg==) 90% 35% / 13% no-repeat; + */ +} + +#comPort:hover { + background-color: #eee; + border-color: #adadad; + box-shadow: 2px 2px 5px #888; +} +/*target Internet Explorer 9 and Internet Explorer 10:*/ + +@media screen and (min-width: 0\0) { + select { + background: none; + padding: 5px; + } +} + +#options-menu:hover { + background-color: #eee; +} + +.project-name-wrapper { + font-size: 20px; + line-height: 25px; + color: #337ab7; + text-decoration: none; + display:inline; + float:right; + padding-right: 10px; +} + +.bp-client-available { + background:none; + border:1px solid rgba(0, 0, 0, 0); + border-radius:4px; + box-sizing:border-box; + color:#333 !important; + display:inline; + font-size:14px; + height:auto; + line-height:20px; + padding: 4px 4px 4px 0px; + text-decoration:none; + text-size-adjust:100%; + width:auto; + -webkit-tap-highlight-color:rgba(0, 0, 0, 0); +} + +.client-searching-link { + color:#8a6d3b !important; +} + +.bp-client-warning { + background-color:#fcf8e3; + border:1px solid rgb(250, 235, 204); + border-radius:4px; + box-sizing:border-box; + color:#8a6d3b !important; + display:inline; + font-size:14px; + height:auto; + line-height:20px; + padding:4px; + text-decoration:none; + text-size-adjust:100%; + width:auto; + -webkit-tap-highlight-color:rgba(0, 0, 0, 0); +} + +.client-unavailable-link { + color:rgb(169, 68, 66) !important; +} + +.bp-client-danger { + background-color:#f2dede; + border:1px solid rgb(235, 204, 209); + border-radius:4px; + box-sizing:border-box; + color:rgb(169, 68, 66) !important; + display:inline; + font-size:14px; + height:auto; + line-height:20px; + padding:4px; + text-decoration:none; + text-size-adjust:100%; + width:auto; + -webkit-tap-highlight-color:rgba(0, 0, 0, 0); +} + .xterm-rows { overflow-x: scroll; - overflow-y: hidden; } From d4848a46d0c525bb7cfdee2bd3d3538ccfce19e5 Mon Sep 17 00:00:00 2001 From: Jim Ewald Date: Mon, 9 Jan 2017 10:19:20 -0800 Subject: [PATCH 141/153] Embed application and build numbers into the internationalization file --- .../internationalization/translations.properties | 6 ++++-- src/main/webapp/WEB-INF/includes/pageparts/footer.jsp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties b/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties index 2f0a2b3b..07bf3cd5 100644 --- a/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties +++ b/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties @@ -26,8 +26,10 @@ footer.licenselink = License footer.changelog = Change log footer.librarieslink = External libraries footer.clientdownloadlink = BlocklyProp-client -footer.appversion = v0.93 -footer.buildversion = 252 + +application.major = 0 +application.minor = 94 +application.build = 296 html.content_missing = Content missing diff --git a/src/main/webapp/WEB-INF/includes/pageparts/footer.jsp b/src/main/webapp/WEB-INF/includes/pageparts/footer.jsp index 9fdc5b19..990a8367 100644 --- a/src/main/webapp/WEB-INF/includes/pageparts/footer.jsp +++ b/src/main/webapp/WEB-INF/includes/pageparts/footer.jsp @@ -22,7 +22,7 @@ From 9519eb79d3b90c8677af4dd3629bb2978aa2be00 Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Mon, 9 Jan 2017 10:27:38 -0800 Subject: [PATCH 142/153] file fix --- src/main/webapp/cdn/editor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/cdn/editor.js b/src/main/webapp/cdn/editor.js index 38331dc5..98d461cb 100644 --- a/src/main/webapp/cdn/editor.js +++ b/src/main/webapp/cdn/editor.js @@ -290,7 +290,9 @@ function uploadHandler(files) { uploadedXML = xmlString.substring(xmlString.indexOf("|]/g, '_'); var xmlChecksum = hashCode(projXMLcode).toString(); + var xmlChecksum = '000000000000'.substring(xmlChecksum.length, 12) + xmlChecksum; // Assemble both the SVG (image) of the blocks and the blocks' XML definition @@ -274,8 +275,9 @@ function uploadHandler(files) { var UploadReader = new FileReader(); UploadReader.onload = function() { - var parsed = new DOMParser().parseFromString(this.result, "text/xml"); - var xmlString = (new XMLSerializer()).serializeToString(parsed); + //var parsed = new DOMParser().parseFromString(this.result, "text/xml"); + //var xmlString = (new XMLSerializer()).serializeToString(parsed); + var xmlString = this.result; var xmlValid = false; var uploadBoardType = ''; @@ -290,9 +292,7 @@ function uploadHandler(files) { uploadedXML = xmlString.substring(xmlString.indexOf(" Looking for BlocklyPropClient -editor.client.available = Select the correct port, then click or . +editor.client.available = Select the correct port, then click or . editor.client.available.short = Select the correct port, then click . editor.client.not-available = BlocklyPropClient is not running editor.download = Download blocks file diff --git a/src/main/webapp/cdn/blockly/generators/propc/s3.js b/src/main/webapp/cdn/blockly/generators/propc/s3.js index ba38bf15..bdedcdd6 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/s3.js +++ b/src/main/webapp/cdn/blockly/generators/propc/s3.js @@ -414,7 +414,7 @@ Blockly.Blocks.scribbler_play = { .appendField("for a") .appendField(new Blockly.FieldDropdown([['sixteenth', '63'], ['dotted sixteenth', '94'], ['eighth', '125'], ['dotted eighth', '188'], ['quarter', '250'], ['dotted quarter', '375'], ['half', '500'], ['dotted half', '750'], ['whole', '1000'], ['dotted whole', '1500']]), 'NOTE_DURATION') .appendField("note at a") - .appendField(new Blockly.FieldDropdown([['loud', '100'], ['medium', '50'], ['quiet', '25']]), 'NOTE_VOLUME') + .appendField(new Blockly.FieldDropdown([['loud', '50'], ['medium', '30'], ['quiet', '15']]), 'NOTE_VOLUME') .appendField("volume"); this.setPreviousStatement(true, null); this.setNextStatement(true, null); @@ -613,7 +613,7 @@ Blockly.propc.play_polyphony = function() { var dur = Blockly.propc.valueToCode(this, 'POLYPHONY_DURATION', Blockly.propc.ORDER_ATOMIC) || 250; var vol = Blockly.propc.valueToCode(this, 'POLYPHONY_VOLUME', Blockly.propc.ORDER_ATOMIC) || 50; - return 's3_setVolume(' + vol + ');\ns3_playNote(' + fq1 + ', ' + fq2 + ', ' + dur + ');\n'; + return 's3_setVolume((' + vol + ' / 2));\ns3_playNote(' + fq1 + ', ' + fq2 + ', ' + dur + ');\n'; }; Blockly.Blocks.line_sensor = { diff --git a/src/main/webapp/cdn/blockly/generators/spin/scribbler.js b/src/main/webapp/cdn/blockly/generators/spin/scribbler.js index cf47f3e4..bf148649 100644 --- a/src/main/webapp/cdn/blockly/generators/spin/scribbler.js +++ b/src/main/webapp/cdn/blockly/generators/spin/scribbler.js @@ -275,7 +275,7 @@ Blockly.Blocks.scribbler_play = { .appendField("for a") .appendField(new Blockly.FieldDropdown([['sixteenth', '63'], ['dotted sixteenth', '94'], ['eighth', '125'], ['dotted eighth', '188'], ['quarter', '250'], ['dotted quarter', '375'], ['half', '500'], ['dotted half', '750'], ['whole', '1000'], ['dotted whole', '1500']]), 'NOTE_DURATION') .appendField("note at a") - .appendField(new Blockly.FieldDropdown([['loud', '100'], ['medium', '50'], ['quiet', '25']]), 'NOTE_VOLUME') + .appendField(new Blockly.FieldDropdown([['loud', '50'], ['medium', '30'], ['quiet', '15']]), 'NOTE_VOLUME') .appendField("volume"); this.setPreviousStatement(true, null); this.setNextStatement(true, null); @@ -909,7 +909,7 @@ Blockly.Spin.play_tone = function () { var Frequency = Blockly.Spin.valueToCode(this, 'FREQUENCY', Blockly.Spin.ORDER_ATOMIC) || '0'; var Note_Duration = Blockly.Spin.valueToCode(this, 'NOTE_DURATION', Blockly.Spin.ORDER_ATOMIC) || '0'; var Volume = Blockly.Spin.valueToCode(this, 'NOTE_VOLUME', Blockly.Spin.ORDER_ATOMIC) || '0'; - return 'Scribbler.SetVolume(' + Volume + ')\nScribbler.PlayNote(' + Frequency + ', 0, ' + Note_Duration + ')\n'; + return 'Scribbler.SetVolume((' + Volume + ' / 2))\nScribbler.PlayNote(' + Frequency + ', 0, ' + Note_Duration + ')\n'; }; Blockly.Spin.play_polyphony = function () { @@ -922,7 +922,7 @@ Blockly.Spin.play_polyphony = function () { var Frequency2 = Blockly.Spin.valueToCode(this, 'FREQUENCY_2', Blockly.Spin.ORDER_ATOMIC) || '0'; var Polyphony_Duration = Blockly.Spin.valueToCode(this, 'POLYPHONY_DURATION', Blockly.Spin.ORDER_ATOMIC) || '0'; var Volume = Blockly.Spin.valueToCode(this, 'POLYPHONY_VOLUME', Blockly.Spin.ORDER_ATOMIC) || '0'; - return 'Scribbler.SetVolume(' + Volume + ')\nScribbler.PlayNote(' + Frequency1 + ', ' + Frequency2 + ', ' + Polyphony_Duration + ')\n'; + return 'Scribbler.SetVolume((' + Volume + ' / 2))\nScribbler.PlayNote(' + Frequency1 + ', ' + Frequency2 + ', ' + Polyphony_Duration + ')\n'; }; Blockly.Spin.line_sensor = function () { diff --git a/src/main/webapp/cdn/blockly/language/en/_messages.js b/src/main/webapp/cdn/blockly/language/en/_messages.js index debe356c..5eeb5ccd 100644 --- a/src/main/webapp/cdn/blockly/language/en/_messages.js +++ b/src/main/webapp/cdn/blockly/language/en/_messages.js @@ -267,7 +267,7 @@ Blockly.MSG_SYSTEM_COUNTER_TOOLTIP = "system counter: 0 to 4,294,967,295 before Blockly.MSG_VARIABLES_SET_TOOLTIP = "set variable: name and attach initial value block."; Blockly.MSG_VARIABLES_GET_TOOLTIP = "use variable: choose set variables from dropdown."; Blockly.MSG_PROCEDURES_DEFNORETURN_TOOLTIP = "define function: group blocks to re-use ending with return; name group."; -Blockly.MSG_PROCEDURES_CALLNORETURN_TOOLTIP = "return: Required at the end of code enclosed in a “define function” block."; +Blockly.MSG_PROCEDURES_CALLNORETURN_TOOLTIP = "return: use in a “define function” block to go back to the main code."; Blockly.MSG_MAKE_PIN_TOOLTIP = "make PIN (dropdown): Select I/O pin and setting with menus."; Blockly.MSG_MAKE_PIN_INPUT_TOOLTIP = "make PIN (programmable): Select I/O pin with value and setting with menu."; Blockly.MSG_CHECK_PIN_TOOLTIP = "check PIN (dropdown): Get the state of I/O pin; high = 1, low = 0."; diff --git a/src/main/webapp/cdn/utils.js b/src/main/webapp/cdn/utils.js index 8ae20807..484f4684 100644 --- a/src/main/webapp/cdn/utils.js +++ b/src/main/webapp/cdn/utils.js @@ -5,7 +5,7 @@ var utils = { message: message, buttons: { confirm: { - lable: "Ok", + label: "Ok", className: "btn-primary" } } @@ -24,7 +24,7 @@ var utils = { callback: callback }, confirm: { - lable: "Confirm", + label: "Confirm", className: "btn-primary", callback: callback } @@ -45,7 +45,7 @@ var utils = { } }, confirm: { - lable: "Confirm", + label: "Confirm", className: "btn-primary", callback: function () { callback(true); diff --git a/src/main/webapp/frame/framec.jsp b/src/main/webapp/frame/framec.jsp index 50829de1..6a1d5a51 100644 --- a/src/main/webapp/frame/framec.jsp +++ b/src/main/webapp/frame/framec.jsp @@ -1039,9 +1039,11 @@ +<%-- " include="s3" exclude="heb, activity-board"> +--%> From 72e37e61dcff1f94cd97cca62fc86b672552648f Mon Sep 17 00:00:00 2001 From: Matthew Matz Date: Mon, 9 Jan 2017 16:43:54 -0800 Subject: [PATCH 145/153] add upload modal to SPIN editor --- src/main/webapp/editor/blocklyspin.jsp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main/webapp/editor/blocklyspin.jsp b/src/main/webapp/editor/blocklyspin.jsp index 3efcc412..26b384f9 100644 --- a/src/main/webapp/editor/blocklyspin.jsp +++ b/src/main/webapp/editor/blocklyspin.jsp @@ -61,6 +61,30 @@ + +