Skip to content

Commit 11d484f

Browse files
author
Matthew Matz
committed
Graphing improvements, unwrapping 1 layer to expose graph directly in demo
1 parent 6bc77ea commit 11d484f

File tree

6 files changed

+132
-77
lines changed

6 files changed

+132
-77
lines changed

src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ category.communicate = Communicate
262262
category.communicate.serial-lcd = Serial LCD
263263
category.communicate.serial-terminal = Terminal
264264
category.communicate.oled = OLED
265-
category.communicate.graphing = Graphing Output
265+
category.communicate.graphing = Graph
266266
category.communicate.protocols = Protocols
267267
category.communicate.xbee = XBee
268268
category.communicate.WS2812B = RGB LEDs

src/main/webapp/WEB-INF/includes/pageparts/editor-menu.jsp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<%@page contentType="text/html" pageEncoding="UTF-8"%>
88
<%@ include file="/WEB-INF/includes/include.jsp"%>
99

10+
<c:set var="experimental" scope="page" value="${properties:experimentalmenu(false)}" />
11+
1012
<nav class="navbar navbar-default clearfix" role="navigation">
1113
<div style="width:100%;">
1214
<div style="display:inline;"><span><a id="nav-logo" href="<url:getUrl url="/"/>">BlocklyProp<br><strong>BETA</strong></a></span>
@@ -47,11 +49,14 @@
4749
</c:if>
4850
<a onclick="loadIntoEeprom()" data-toggle="tooltip" title="Load and run (save code to EEPROM)" data-placement="bottom" class="btn btn-success btn-circle"><i class="glyphicon glyphicon-save"></i></a>
4951
<a onclick="serial_console()" data-toggle="tooltip" title="Open Serial Terminal" data-placement="bottom" class="btn btn-primary btn-circle"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="15"><rect x="1" y="1" width="12" height="13" rx="1" ry="1" style="stroke:#fff;stroke-width:2;fill:none;"/><path d="M3,4.5 L10,4.5 M3,6.5 L6,6.5 M3,8.5 L8,8.5" style="stroke:#fff;stroke-width:1;fill:none;"/></svg></a>
50-
<% if ("1".equals(request.getParameter("graphing"))) {%>
51-
<a onclick="graphing_console()" data-toggle="tooltip" title="Open Graphing Output" data-placement="bottom" class="btn btn-primary btn-circle"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="14">
52-
<path d="M.5,0 L.5,13.5 L12.5,13.5 M3.5,0 L3.5,13.5 M6.5,0 L6.5,13.5 M9.5,0 L9.5,13.5 M12.5,0 L12.5,13.5 M.5,3.5 L12.5,3.5 M.5,7 L12.5,7 M.5,10.5 L12.5,10.5 M.5,.5 L12.5,.5" style="stroke:rgba(255,255,255,.6);stroke-width:1;fill:none;"/>
53-
<path d="M0,13 L6,5 L9,8 L14,2" style="stroke:#fff;stroke-width:2;fill:none;"/>
54-
</svg></a><% } %>
52+
<c:choose>
53+
<c:when test="${experimental == true}">
54+
<a onclick="graphing_console()" data-toggle="tooltip" title="Open Graphing Output" data-placement="bottom" class="btn btn-primary btn-circle"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="14">
55+
<path d="M.5,0 L.5,13.5 L12.5,13.5 M3.5,0 L3.5,13.5 M6.5,0 L6.5,13.5 M9.5,0 L9.5,13.5 M12.5,0 L12.5,13.5 M.5,3.5 L12.5,3.5 M.5,7 L12.5,7 M.5,10.5 L12.5,10.5 M.5,.5 L12.5,.5" style="stroke:rgba(255,255,255,.6);stroke-width:1;fill:none;"/>
56+
<path d="M0,13 L6,5 L9,8 L14,2" style="stroke:#fff;stroke-width:2;fill:none;"/>
57+
</svg></a>
58+
</c:when>
59+
</c:choose>
5560
</div>
5661
<div style="display:inline; clear:right; float:right; padding-right: 10px;" align="right">
5762

@@ -88,7 +93,6 @@
8893
<li><a id="upload-project" href="#"><fmt:message key="editor.upload" /></a></li>
8994
<hr style="line-height:5px; margin:5px;">
9095
<li><a href="#" onclick="configure_client()"><fmt:message key="editor.run.configure" /></a></li>
91-
9296
</ul></span>
9397
</div>
9498
</div>

src/main/webapp/cdn/blockly/generators/propc/communicate.js

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3168,19 +3168,15 @@ Blockly.Blocks.graph_output = {
31683168
// this.setTooltip(Blockly.MSG_GRAPH_OUTPUT_TOOLTIP);
31693169
this.setColour(colorPalette.getColor('protocols'));
31703170
this.appendDummyInput()
3171-
.appendField('Graphing output');
3171+
.appendField('Graph');
31723172
this.appendValueInput('PRINTa')
31733173
.setAlign(Blockly.ALIGN_RIGHT)
31743174
.setCheck('Number')
31753175
.appendField('value');
3176-
this.appendValueInput('PRINTb')
3177-
.setAlign(Blockly.ALIGN_RIGHT)
3178-
.setCheck('Number')
3179-
.appendField('value');
31803176
this.setPreviousStatement(true);
31813177
this.setNextStatement(true);
31823178
this.setMutator(new Blockly.Mutator(['graph_dec']));
3183-
this.optionList_ = ['dec', 'dec'];
3179+
this.optionList_ = ['dec'];
31843180
},
31853181
mutationToDom: function (workspace) {
31863182
// Create XML to represent menu options.
@@ -3266,7 +3262,7 @@ Blockly.Blocks.graph_output = {
32663262
}
32673263
if (this.getInput('PRINT0') && this.getInput('PRINTa')) {
32683264
this.removeInput('PRINTa');
3269-
this.removeInput('PRINTb');
3265+
//this.removeInput('PRINTb');
32703266
}
32713267
}
32723268
};
@@ -3320,25 +3316,23 @@ Blockly.Blocks.graph_settings = {
33203316
// this.setTooltip(Blockly.MSG_GRAPH_SETTINGS_TOOLTIP);
33213317
this.setColour(colorPalette.getColor('protocols'));
33223318
this.appendDummyInput()
3323-
.appendField("Graph settings");
3324-
this.appendDummyInput()
3325-
.appendField("x-axis")
3319+
.appendField("Graph initialize x-axis")
33263320
.appendField(new Blockly.FieldDropdown([
3327-
["keep 10 seconds of data", "10,S"],
3328-
["keep 20 seconds of data", "20,S"],
3329-
["keep 30 seconds of data", "30,S"],
3330-
["keep 40 seconds of data", "40,S"],
3331-
["keep 50 seconds of data", "50,S"],
3332-
["keep 60 seconds of data", "60,S"],
3333-
["keep 90 seconds of data", "90,S"] // Add comma back when resetting
3321+
["10 seconds", "10,S"],
3322+
["20 seconds", "20,S"],
3323+
["30 seconds", "30,S"],
3324+
["40 seconds", "40,S"],
3325+
["50 seconds", "50,S"],
3326+
["60 seconds", "60,S"],
3327+
["90 seconds", "90,S"] // Add comma back when resetting
33343328
// ["trigger on value 1 rising edge", "1,TU"],
33353329
// ["trigger on value 1 falling edge", "1,TD"],
33363330
// ["trigger on value 1 zero crossing", "1,TZ"]
3337-
]), "XAXIS");
3338-
this.appendDummyInput()
3331+
]), "XAXIS")
3332+
.appendField('y-axis ')
33393333
.appendField(new Blockly.FieldDropdown([
3340-
["y-axis autoscale", "AUTO"],
3341-
["y-axis range", "FIXED"]]), "YSETTING")
3334+
["autoscale", "AUTO"],
3335+
["range", "FIXED"]]), "YSETTING")
33423336
.appendField("minimum", 'LABELMIN')
33433337
.appendField(new Blockly.FieldTextInput('0',
33443338
Blockly.FieldTextInput.numberValidator), "YMIN")
@@ -3361,6 +3355,7 @@ Blockly.Blocks.graph_settings = {
33613355
this.setInputsInline(false);
33623356
this.setPreviousStatement(true, null);
33633357
this.setNextStatement(true, null);
3358+
this.render();
33643359
},
33653360
onchange: function () {
33663361
if (this.getFieldValue('YSETTING') === 'AUTO') {

0 commit comments

Comments
 (0)