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 9994e8c7..d750bc98 100644
--- a/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties
+++ b/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties
@@ -121,7 +121,7 @@ project.create.previouslink = Previous
project.board.activity-board = Propeller Activity Board WX
project.board.s3 = Scribbler Robot
project.board.heb = Hackable Electronic Badge
-project.board.flip = Propeller Flip
+project.board.flip = Propeller FLiP or Project Board
project.board.other = Other
confirm.request.title = Email confirm request
diff --git a/src/main/webapp/cdn/blockly/generators/propc.js b/src/main/webapp/cdn/blockly/generators/propc.js
index 7d510a07..4e3396b1 100644
--- a/src/main/webapp/cdn/blockly/generators/propc.js
+++ b/src/main/webapp/cdn/blockly/generators/propc.js
@@ -183,7 +183,7 @@ var profile = {
contiguous_pins_end: 11
},
"flip": {
- description: "Propeller Flip Board",
+ description: "Propeller FLiP or Project Board",
digital: [["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"]],
servo: [["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"]],
analog: [["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"], ["A4", "A4"], ["A5", "A5"]],
diff --git a/src/main/webapp/cdn/blockly/generators/propc/communicate.js b/src/main/webapp/cdn/blockly/generators/propc/communicate.js
index a626b616..ec93146b 100644
--- a/src/main/webapp/cdn/blockly/generators/propc/communicate.js
+++ b/src/main/webapp/cdn/blockly/generators/propc/communicate.js
@@ -473,6 +473,133 @@ Blockly.propc.serial_receive_text = function () {
}
};
+
+//--------------- Shift In/Out Blocks ------------------------------------------
+Blockly.Blocks.shift_in = {
+ helpUrl: Blockly.MSG_PROTOCOLS_HELPURL,
+ init: function() {
+ this.setTooltip(Blockly.MSG_SHIFT_IN_TOOLTIP);
+ this.setColour(colorPalette.getColor('protocols'));
+ this.appendDummyInput()
+ .appendField("shift in")
+ .appendField(new Blockly.FieldDropdown(
+ [['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']]), "BITS")
+ .appendField("bits")
+ .appendField(new Blockly.FieldDropdown([["MSB first","MSB"], ["LSB first","LSB"]]), "MODE")
+ .appendField(new Blockly.FieldDropdown([["before clock","PRE"], ["after clock","POST"]]), "ORDER")
+ .appendField("DATA")
+ .appendField(new Blockly.FieldDropdown(profile.default.digital), "DATA")
+ .appendField("CLK")
+ .appendField(new Blockly.FieldDropdown(profile.default.digital), "CLK");
+ this.setInputsInline(true);
+ this.setOutput(true, null);
+ }
+};
+
+Blockly.propc.shift_in = function() {
+ var bits = this.getFieldValue('BITS');
+ var mode = this.getFieldValue('MODE');
+ var ord = this.getFieldValue('ORDER');
+ var dat = this.getFieldValue('DATA');
+ var clk = this.getFieldValue('CLK');
+
+ return ['shift_in(' + dat + ', ' + clk + ', ' + mode + ord + ', ' + bits + ')', Blockly.propc.ORDER_NONE];
+};
+
+Blockly.Blocks.shift_out = {
+ helpUrl: Blockly.MSG_PROTOCOLS_HELPURL,
+ init: function() {
+ this.setTooltip(Blockly.MSG_SHIFT_OUT_TOOLTIP);
+ this.setColour(colorPalette.getColor('protocols'));
+ this.appendValueInput("VALUE")
+ .setCheck("Number")
+ .appendField("shift out the")
+ .appendField(new Blockly.FieldDropdown(
+ [['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']]), "BITS")
+ .appendField("lowest bits of");
+ this.appendDummyInput()
+ .appendField(new Blockly.FieldDropdown([["MSB first","MSBFIRST"], ["LSB first","LSBFIRST"]]), "MODE")
+ .appendField("DATA")
+ .appendField(new Blockly.FieldDropdown(profile.default.digital), "DATA")
+ .appendField("CLK")
+ .appendField(new Blockly.FieldDropdown(profile.default.digital), "CLK");
+ this.setInputsInline(true);
+ this.setPreviousStatement(true, null);
+ this.setNextStatement(true, null);
+ }
+};
+
+Blockly.propc.shift_out = function() {
+ var bits = this.getFieldValue('BITS');
+ var mode = this.getFieldValue('MODE');
+ var dat = this.getFieldValue('DATA');
+ var clk = this.getFieldValue('CLK');
+ var val = Blockly.propc.valueToCode(this, 'VALUE', Blockly.propc.ORDER_NONE) || '0';
+
+ return 'shift_out(' + dat + ', ' + clk + ', ' + mode + ', ' + bits + ', ' + val + ');\n';
+};
+
+
//--------------- Serial LCD Blocks --------------------------------------------
Blockly.Blocks.debug_lcd_init = {
helpUrl: Blockly.MSG_SERIAL_LCD_HELPURL,
@@ -1497,12 +1624,12 @@ Blockly.Blocks.wx_init = {
bkg_colors.setColours(['#FFFFFF','#000000']).setColumns(2);
this.setColour(colorPalette.getColor('protocols'));
this.appendDummyInput()
- .appendField("Simple WX initialize DO")
- .appendField(new Blockly.FieldDropdown([['31 (WX)', '31']].concat(profile.default.digital)), "DO")
+ .appendField("Simple WX initialize mode")
+ .appendField(new Blockly.FieldDropdown([['Terminal on USB', 'USB_PGM_TERM'], ['Terminal on WX', 'USB_PGM'], ['Term & Programming on WX', 'WX_ALL_COM']]), "MODE") // .concat(profile.default.digital)
+ .appendField(" DO")
+ .appendField(new Blockly.FieldDropdown([['WX Socket', '31']].concat(profile.default.digital)), "DO")
.appendField("DI")
- .appendField(new Blockly.FieldDropdown([['30 (WX)', '30']].concat(profile.default.digital)), "DI")
- .appendField(" mode")
- .appendField(new Blockly.FieldDropdown([['Terminal via Wifi', 'USB_PGM'], ['Terminal via USB', 'USB_PGM_TERM']].concat(profile.default.digital)), "MODE");
+ .appendField(new Blockly.FieldDropdown([['WX Socket', '30']].concat(profile.default.digital)), "DI");
this.setInputsInline(false);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
@@ -1515,7 +1642,7 @@ Blockly.propc.wx_init = function() {
var bkg = (this.getFieldValue('BKG') === '#FFFFFF') ? '1' : '0';
var title = this.getFieldValue('TITLE');
var mode = this.getFieldValue('MODE');
- if(pin_do === '31' && pin_di === '30' && mode === 'USB_PGM') mode = 'WX_ALL_COM';
+ //if(pin_do === '31' && pin_di === '30' && mode === 'USB_PGM') mode = 'WX_ALL_COM';
var code = '';
code += 'wifi_start(' + pin_do + ', ' + pin_di + ', 115200, ' + mode + ');\n';
code += 'wifi_setBuffer(__wxBffr, sizeof(__wxBffr));\n';
@@ -1537,7 +1664,7 @@ Blockly.propc.wx_init = function() {
Blockly.Blocks.wx_config_page = {
helpUrl: Blockly.MSG_SWX_HELPURL,
init: function() {
- this.setTooltip(Blockly.MSG_SWX_INIT_TOOLTIP);
+ this.setTooltip(Blockly.MSG_SWX_CONFIG_PAGE_TOOLTIP);
var bkg_colors = new Blockly.FieldColour("#FFFFFF");
bkg_colors.setColours(['#FFFFFF','#000000']).setColumns(2);
this.setColour(colorPalette.getColor('protocols'));
diff --git a/src/main/webapp/cdn/blockly/generators/propc/gpio.js b/src/main/webapp/cdn/blockly/generators/propc/gpio.js
index 087105a7..c1289b95 100644
--- a/src/main/webapp/cdn/blockly/generators/propc/gpio.js
+++ b/src/main/webapp/cdn/blockly/generators/propc/gpio.js
@@ -1053,14 +1053,127 @@ Blockly.propc.activitybot_display_calibration = function() {
code = '';
code += 'if(!abd_intTabSetup) interpolation_table_setup();\n';
- code += 'print("=== LEFT SERVO ===\\n");\n';
- code += 'print("Table Entries = %d, Zero Speed Index = %d\\n\\n", abd_elCntL, abd_cntrLidx);\n';
+ code += 'print("=== LEFT SERVO ===\\r");\n';
+ code += 'print("Table Entries = %d, Zero Speed Index = %d\\r\\r", abd_elCntL, abd_cntrLidx);\n';
code += 'print("Index, Servo Drive, Encoder Ticks/Second\\n");\n';
- code += 'for(int __rIdx = 0; __rIdx < abd_elCntL; __rIdx++) print("%d, %d, %d\\n", __rIdx, abd_spdrL[__rIdx], abd_spdmL[__rIdx]);\n';
- code += 'print("\\n\\n=== RIGHT SERVO ===\\n");\n';
- code += 'print("Table Entries = %d, Zero Speed Index = %d\\n\\n", abd_elCntR, abd_cntrRidx);\n';
- code += 'print("Index, Servo Drive, Encoder Ticks/Second\\n");\n';
- code += 'for(int __rIdx = 0; __rIdx < abd_elCntR; __rIdx++) print("%d, %d, %d\\n", __rIdx, abd_spdrR[__rIdx], abd_spdmR[__rIdx]);\n';
+ code += 'for(int __rIdx = 0; __rIdx < abd_elCntL; __rIdx++) print("%d, %d, %d\\r", __rIdx, abd_spdrL[__rIdx], abd_spdmL[__rIdx]);\n';
+ code += 'print("\\r\\r=== RIGHT SERVO ===\\r");\n';
+ code += 'print("Table Entries = %d, Zero Speed Index = %d\\r\\r", abd_elCntR, abd_cntrRidx);\n';
+ code += 'print("Index, Servo Drive, Encoder Ticks/Second\\r");\n';
+ code += 'for(int __rIdx = 0; __rIdx < abd_elCntR; __rIdx++) print("%d, %d, %d\\r", __rIdx, abd_spdrR[__rIdx], abd_spdmR[__rIdx]);\n';
return code;
};
+
+Blockly.Blocks.mcp320x_read = {
+ helpUrl: Blockly.MSG_ANALOG_PULSES_HELPURL,
+ init: function() {
+ this.setTooltip(Blockly.MSG_MCP320X_READ_TOOLTIP);
+ this.setColour(colorPalette.getColor('io'));
+ this.appendDummyInput()
+ .appendField(new Blockly.FieldDropdown([["MCP3202","2"], ["MCP3204","4"], ["MCP8208","8"]], function (ch_c) {
+ this.sourceBlock_.updateShape_({"CH_C": ch_c});}), "CHIP")
+ .appendField("CS")
+ .appendField(new Blockly.FieldDropdown(profile.default.digital), "CS_PIN")
+ .appendField("CLK")
+ .appendField(new Blockly.FieldDropdown(profile.default.digital), "CLK_PIN")
+ .appendField("DO")
+ .appendField(new Blockly.FieldDropdown(profile.default.digital), "DO_PIN")
+ .appendField("DI")
+ .appendField(new Blockly.FieldDropdown(profile.default.digital), "DI_PIN");
+ this.appendDummyInput('CHANNELS')
+ .setAlign(Blockly.ALIGN_RIGHT)
+ .appendField("channel")
+ .appendField(new Blockly.FieldDropdown([["1","1"], ["2", "2"]]), "CHAN")
+ .appendField("read (0-3.3V) in volt-100ths");
+ this.setInputsInline(false);
+ this.setOutput(true, null);
+ },
+ mutationToDom: function () {
+ var container = document.createElement('mutation');
+ var ch_c = this.getFieldValue('CHIP');
+ container.setAttribute('chip', ch_c);
+ return container;
+ },
+ domToMutation: function (xmlElement) {
+ var ch_c = xmlElement.getAttribute('chip');
+ this.updateShape_({"CH_C": ch_c});
+ },
+ updateShape_: function (details) {
+
+ var num = details['CH_C'];
+ if (details['CH_C'] === undefined) {
+ num = this.getFieldValue('CH_C');
+ }
+
+ var chan_count = [];
+
+ for (var i = 1; i <= num; i++) {
+ chan_count.push([i.toString(), i.toString()]);
+ }
+
+ this.removeInput('CHANNELS');
+ this.appendDummyInput('CHANNELS')
+ .setAlign(Blockly.ALIGN_RIGHT)
+ .appendField("channel")
+ .appendField(new Blockly.FieldDropdown(chan_count), "CHAN")
+ .appendField("read (0-3.3V) in volt-100ths");
+ }
+};
+
+Blockly.propc.mcp320x_read = function() {
+ var chip = parseInt(this.getFieldValue('CHIP'));
+ var cs_pin = this.getFieldValue('CS_PIN');
+ var clk_pin = this.getFieldValue('CLK_PIN');
+ var do_pin = this.getFieldValue('DO_PIN');
+ var di_pin = this.getFieldValue('DI_PIN');
+ var channel = '000' + parseInt(this.getFieldValue('CHANNEL')).toString(2) + "1";
+
+ if(chip < 4) {
+ channel = "11" + channel.substr(0,1) + "1";
+ } else {
+ channel = "11" + channel.substr(0,3) + "0";
+ }
+
+ var func = '';
+ func += 'int __Mvref = 330;';
+ func += 'int read_mcp320x(int __McsPin, int __MclkPin, int __MdoPin, int __MdiPin, int __Mbits, int __Mdata, int __MVr) {\n';
+ func += ' high(__McsPin); low(__MclkPin); low(__McsPin);\n';
+ func += ' shift_out(__MdiPin, __MclkPin, MSBFIRST, __Mbits, __Mdata);\n';
+ func += ' int __Mvolts = shift_in(__MdiPin, __MclkPin, MSBPOST, 12);\n';
+ func += ' high(__McsPin); high(__MclkPin);\n return ((__Mvolts * __MVr) / 4096);}';
+ Blockly.propc.global_vars_["mcp320x_read"] = func;
+
+
+ var code = '';
+ code += 'read_mcp320x(' + cs_pin + ', ' + clk_pin + ', ' + do_pin;
+ code += ', ' + di_pin + ', ' + channel.length + ', 0b' + channel + ', __Mvref)';
+
+ return [code, Blockly.propc.ORDER_NONE];
+};
+
+Blockly.Blocks.mcp320x_set_vref = {
+ helpUrl: Blockly.MSG_ANALOG_PULSES_HELPURL,
+ init: function() {
+ this.setTooltip(Blockly.MSG_MCP320X_SET_VREF_TOOLTIP);
+ this.setColour(colorPalette.getColor('io'));
+ this.appendDummyInput()
+ .appendField("MCP320X set Vref to")
+ .appendField(new Blockly.FieldTextInput('330',
+ Blockly.FieldTextInput.numberValidator), "VREF")
+ .appendField("volt 100ths");
+ this.setInputsInline(true);
+ this.setPreviousStatement(true, null);
+ this.setNextStatement(true, null);
+ }
+};
+
+Blockly.propc.mcp320x_set_vref = function() {
+ var vref = parseInt(this.getFieldValue('VREF'));
+
+ var code = '';
+ if(Blockly.propc.global_vars_["mcp320x_read"] !== undefined) {
+ code += '__Mvref = ' + vref + ';\n';
+ }
+ return code;
+};
\ No newline at end of file
diff --git a/src/main/webapp/cdn/blockly/language/en/_messages.js b/src/main/webapp/cdn/blockly/language/en/_messages.js
index 30e565dd..05a1066a 100644
--- a/src/main/webapp/cdn/blockly/language/en/_messages.js
+++ b/src/main/webapp/cdn/blockly/language/en/_messages.js
@@ -308,7 +308,10 @@ Blockly.MSG_SERIAL_TX_TOOLTIP = "Serial transmit number: sends 32-bit integer as
Blockly.MSG_SERIAL_SEND_TEXT_TOOLTIP = "Serial transmit text: sends text as characters terminated by a 0 (NULL).";
Blockly.MSG_SERIAL_RX_TOOLTIP = "Serial receive number: receives 4 bytes MSB first and stores a a 32-bit integer.";
Blockly.MSG_SERIAL_RECEIVE_TEXT_TOOLTIP = "Serial receive text: receives and stores characters into a variable until a 0 (NULL).";
-Blockly.MSG_SWX_INIT_TOOLTIP = "Simple WX initialize: Requires simplewx.html file. Match DO/DI to Propeller I/O pin connections. Set terminal routing, page title, and background color.";
+Blockly.MSG_SHIFT_IN_TOOLTIP = "Shift In: serially shifts in a specified number of bits and provides an integer value.";
+Blockly.MSG_SHIFT_OUT_TOOLTIP = "Shift Out: serially shifts in a specified number of bits from the specified value.";
+Blockly.MSG_SWX_INIT_TOOLTIP = "Simple WX initialize: Requires simplewx.html file. Match DO/DI to Propeller I/O pin connections, set terminal and program routing.";
+Blockly.MSG_SWX_CONFIG_PAGE_TOOLTIP = "Simple WX configure page: Requires simplewx.html file. Set terminal page title and background color.";
Blockly.MSG_SWX_SET_TOOLTIP = "Simple WX set widget: Requires simplewx.html file. Set location, type, color, and values for a new widget.";
Blockly.MSG_SWX_READ_TOOLTIP = "Simple WX read widgets: Requires simplewx.html file. Reads the current values of all the widgets.";
Blockly.MSG_SWX_GET_TOOLTIP = "Simple WX widget value: Requires simplewx.html file. Provides the value of a widget from when it was last read.";
@@ -357,6 +360,8 @@ Blockly.MSG_PULSE_OUT_TOOLTIP = "Pulse-out: outputs a high or low pulse to the s
Blockly.MSG_PWM_START_TOOLTIP = "PWM initialize: sets up PWM object in the Propeller.";
Blockly.MSG_PWM_SET_TOOLTIP = "PWM set: sends the specified PWM pulses out the Propeller I/O pin specified. Set duty cycle to 0 to stop sending pulses.";
Blockly.MSG_PWM_STOP_TOOLTIP = "PWM stop: Stops PWM object, frees up resources used on the Propeller.";
+Blockly.MSG_MCP320X_SET_VREF_TOOLTIP = "MCP320X set Vref: Set to the Vref voltage of the A/D chip.";
+Blockly.MSG_MCP320X_READ_TOOLTIP = "MCP320X read: Reads an analog voltage from the specified channel. Match to Propeller I/O pin connections.";
Blockly.MSG_WAV_PLAY_TOOLTIP = "WAV play: Plays the specified .WAV file stored on the SD card.";
Blockly.MSG_WAV_STATUS_TOOLTIP = "WAV status: returns 1/true if a .WAV file is playing, returns 0/false if not.";
Blockly.MSG_WAV_VOLUME_TOOLTIP = "WAV volume: sets the volume of the WAV player - 0 (quietest) to 10 (loudest).";
diff --git a/src/main/webapp/frame/framec.jsp b/src/main/webapp/frame/framec.jsp
index 4ce62631..3b6e6283 100644
--- a/src/main/webapp/frame/framec.jsp
+++ b/src/main/webapp/frame/framec.jsp
@@ -477,6 +477,14 @@
+
+
+
+
+ 10
+
+
+
">
@@ -557,7 +565,13 @@
-
+
+
+
+ 10
+
+
+
@@ -682,6 +696,10 @@
+ " include="flip">
+
+
+
" exclude="s3" colour="200">
" exclude="s3">