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 23bab3a0..8700057a 100644 --- a/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties +++ b/src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties @@ -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 diff --git a/src/main/webapp/cdn/blockly/generators/propc/base.js b/src/main/webapp/cdn/blockly/generators/propc/base.js index 90f98d04..6cc1d654 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/base.js +++ b/src/main/webapp/cdn/blockly/generators/propc/base.js @@ -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); diff --git a/src/main/webapp/cdn/blockly/generators/propc/s3.js b/src/main/webapp/cdn/blockly/generators/propc/s3.js index 664d7ab4..9b34f5de 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/s3.js +++ b/src/main/webapp/cdn/blockly/generators/propc/s3.js @@ -1658,4 +1658,42 @@ Blockly.propc.mic_s3_get = function () { var code = 's3_readMic()'; return [code, Blockly.propc.ORDER_NONE]; -}; \ No newline at end of file +}; + +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();'; +}; diff --git a/src/main/webapp/cdn/blockly/generators/propc/sensors.js b/src/main/webapp/cdn/blockly/generators/propc/sensors.js index 81ee55c0..95559e0b 100644 --- a/src/main/webapp/cdn/blockly/generators/propc/sensors.js +++ b/src/main/webapp/cdn/blockly/generators/propc/sensors.js @@ -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); diff --git a/src/main/webapp/cdn/blockly/language/en/_messages.js b/src/main/webapp/cdn/blockly/language/en/_messages.js index 0111fea5..1beb4439 100644 --- a/src/main/webapp/cdn/blockly/language/en/_messages.js +++ b/src/main/webapp/cdn/blockly/language/en/_messages.js @@ -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"; diff --git a/src/main/webapp/frame/framec.jsp b/src/main/webapp/frame/framec.jsp index 1f9886e0..fc22ab34 100644 --- a/src/main/webapp/frame/framec.jsp +++ b/src/main/webapp/frame/framec.jsp @@ -1322,6 +1322,7 @@ " include="s3" colour=140> "> +