Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ register.do.email = Email:
register.do.password = Password:
register.do.confirm_password = Confirm password:
register.do.submit = Register
register.done.title = Register successful
register.done.title = Registration successful
register.done.text = Please check your email to confirm your email account.
register.error.email_already_used = Email already used
register.error.passwords_dont_match = Passwords don't match
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/cdn/blockly/generators/propc/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Blockly.Blocks.math_number = {
this.setHelpUrl(Blockly.MSG_S3_MATH_HELPURL);
this.setColour(colorPalette.getColor('math'));
} else {
this.setHelpUrl(Blockly.Blockly.MSG_VALUES_HELPURL);
this.setHelpUrl(Blockly.MSG_VALUES_HELPURL);
this.setColour(colorPalette.getColor('programming'));
}
this.setTooltip(Blockly.MSG_MATH_NUMBER_TOOLTIP);
Expand Down
40 changes: 39 additions & 1 deletion src/main/webapp/cdn/blockly/generators/propc/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -1658,4 +1658,42 @@ Blockly.propc.mic_s3_get = function () {

var code = 's3_readMic()';
return [code, Blockly.propc.ORDER_NONE];
};
};

Blockly.Blocks.calibrate_line_sensor = {
init: function () {
this.setColour(colorPalette.getColor('input'));
this.appendDummyInput()
.appendField("line sensor calibrate");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setHelpUrl(Blockly.MSG_S3_SENSORS_HELPURL);
this.setTooltip(Blockly.MSG_S3_LINE_CALIBRATE_TOOLTIP);
}
};

Blockly.propc.calibrate_line_sensor = function () {
Blockly.propc.definitions_[ "include_scribbler" ] = '#include "s3.h"';
Blockly.propc.setups_[ 's3_setup' ] = 's3_setup();pause(1000);';

var func = 'void s3_calibrate_line_sensor(void) {int __lineSenCal[4];\n__lineSenCal[0] = ';
func += 's3_lineSensor(S3_LEFT);\n__lineSenCal[1] = s3_lineSensor(S3_RIGHT);\n__lineSenCal[2] = ';
func += 's3_lineSensor(S3_LEFT);\n__lineSenCal[3] = s3_lineSensor(S3_RIGHT);\n';
func += 'int __calibrate_timer = CNT + (CLKFREQ/1000) * 3672;\ns3_motorSet(75, -75, 0);';
func += '\nwhile(CNT < __calibrate_timer) {int __tempLineSen = s3_lineSensor(S3_LEFT);\n';
func += 'if (__tempLineSen < __lineSenCal[0]) __lineSenCal[0] = __tempLineSen;\n';
func += 'if (__tempLineSen > __lineSenCal[1]) __lineSenCal[1] = __tempLineSen;\n';
func += '__tempLineSen = s3_lineSensor(S3_RIGHT);\nif (__tempLineSen < __lineSenCal[2]) ';
func += '__lineSenCal[2] = __tempLineSen;\nif (__tempLineSen > __lineSenCal[3]) ';
func += '__lineSenCal[3] = __tempLineSen;}s3_motorSet(0, 0, 0);\n';
func += 'if (__lineSenCal[2] > __lineSenCal[0]) __lineSenCal[0] = __lineSenCal[2];\n';
func += 'if (__lineSenCal[3] < __lineSenCal[1]) __lineSenCal[1] = __lineSenCal[3];\n';
func += 'scribbler_set_line_threshold((__lineSenCal[0] + __lineSenCal[1]) / 2);\n';
func += 'scribbler_write_line_threshold();\n}';

Blockly.propc.methods_["s3_calibrate_line_sensor"] = func;
Blockly.propc.method_declarations_["s3_calibrate_line_sensor"] =
'void s3_calibrate_line_sensor(void);';

return 's3_calibrate_line_sensor();';
};
2 changes: 1 addition & 1 deletion src/main/webapp/cdn/blockly/generators/propc/sensors.js
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ Blockly.Blocks.lsm9ds1_tilt = {
};

Blockly.propc.lsm9ds1_tilt = function () {
var t1_axis = '__imu' + this.getFieldValue('A1')[0].toUpperCase();
var t1_axis = '__imu' + this.getFieldValue('A1')[6].toUpperCase();
var t2_axis = '__imu' + this.getFieldValue('A2')[0].toUpperCase();
var g_axis = '__imu' + this.getFieldValue('G_AXIS');
var storage1 = Blockly.propc.variableDB_.getName(this.getFieldValue('VAR1'), Blockly.Variables.NAME_TYPE);
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/cdn/blockly/language/en/_messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ Blockly.MSG_S3_LOGIC_OPERATION_TOOLTIP = "boolean comparison: and, or, and not,
Blockly.MSG_S3_LOGIC_NEGATE_TOOLTIP = "not: returns false if input is true and true if input is false";
Blockly.MSG_S3_LOGIC_COMPARE_TOOLTIP = "compare values: boolean comparison returns true or false";
Blockly.MSG_S3_LINE_SENSOR_TOOLTIP = "line sensor reading: detection of a line by the sensors under the Scribbler";
Blockly.MSG_S3_LINE_CALIBRATE_TOOLTIP = "line sensor calibrate: Use this block at the top of a line following program.\nSpins the Scribbler robot in place and calibrates the\nline following sensors by scanning the surface beneath it."
Blockly.MSG_S3_OBSTACLE_SENSOR_TOOLTIP = "obstacle sensor reading: detection of obstacles from the front sensors";
Blockly.MSG_S3_LIGHT_SENSOR_TOOLTIP = "light sensor reading: measurements of light from the front sensors";
Blockly.MSG_S3_STALL_SENSOR_TOOLTIP = "tail wheel stall: returns true of tail wheel is not spinning";
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/frame/framec.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,7 @@
</category>
<category name="<fmt:message key="category.sensor-input" />" include="s3" colour=140>
<category name="<fmt:message key="category.sensor-input.s3-line" />">
<block type="calibrate_line_sensor"></block>
<block type="scribbler_if_line"></block>
<block type="line_sensor"></block>
</category>
Expand Down