Skip to content

Commit c599ace

Browse files
committed
Added basic gamepad support for Sphero.
Improved performance for bytetool implementation.
1 parent 820fa0f commit c599ace

File tree

24 files changed

+332
-260
lines changed

24 files changed

+332
-260
lines changed

src/mode/default/mod.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ goog.require('cwc.ui.Preview');
2828

2929

3030
/**
31-
* @typedef {cwc.mode.ev3.Connection|
31+
* @typedef {cwc.mode.lego.ev3.Connection|
3232
* cwc.mode.makeblock.mbot.Connection|
3333
* cwc.mode.makeblock.mbotRanger.Connection|
3434
* cwc.mode.sphero.Connection|
@@ -54,7 +54,7 @@ cwc.mode.default.RendererTypes;
5454

5555

5656
/**
57-
* @typedef {cwc.mode.ev3.Runner|
57+
* @typedef {cwc.mode.lego.ev3.Runner|
5858
* cwc.mode.makeblock.mbot.Runner|
5959
* cwc.mode.makeblock.mbotRanger.Runner|
6060
* cwc.mode.sphero.Runner}
@@ -63,7 +63,7 @@ cwc.mode.default.RunnerTypes;
6363

6464

6565
/**
66-
* @typedef {cwc.mode.ev3.Monitor|
66+
* @typedef {cwc.mode.lego.ev3.Monitor|
6767
* cwc.mode.sphero.Monitor|
6868
* cwc.mode.makeblock.mbot.Monitor|
6969
* cwc.mode.makeblock.mbotRanger.Monitor}

src/mode/ev3/advanced/mod.js renamed to src/mode/lego/ev3/advanced/mod.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,52 +17,52 @@
1717
*
1818
* @author [email protected] (Markus Bordihn)
1919
*/
20-
goog.provide('cwc.mode.ev3.advanced.Mod');
20+
goog.provide('cwc.mode.lego.ev3.advanced.Mod');
2121

2222
goog.require('cwc.mode.default.Mod');
23-
goog.require('cwc.mode.ev3.Calibration');
24-
goog.require('cwc.mode.ev3.Connection');
25-
goog.require('cwc.mode.ev3.Hints');
26-
goog.require('cwc.mode.ev3.Monitor');
27-
goog.require('cwc.mode.ev3.Runner');
23+
goog.require('cwc.mode.lego.ev3.Calibration');
24+
goog.require('cwc.mode.lego.ev3.Connection');
25+
goog.require('cwc.mode.lego.ev3.Hints');
26+
goog.require('cwc.mode.lego.ev3.Monitor');
27+
goog.require('cwc.mode.lego.ev3.Runner');
2828
goog.require('cwc.renderer.external.EV3');
2929

3030

3131
/**
3232
* @constructor
3333
* @param {!cwc.utils.Helper} helper
3434
*/
35-
cwc.mode.ev3.advanced.Mod = function(helper) {
36-
/** @type {!cwc.mode.ev3.Connection} */
37-
this.connection = new cwc.mode.ev3.Connection(helper);
35+
cwc.mode.lego.ev3.advanced.Mod = function(helper) {
36+
/** @type {!cwc.mode.lego.ev3.Connection} */
37+
this.connection = new cwc.mode.lego.ev3.Connection(helper);
3838

3939
/** @type {!cwc.mode.default.Mod} */
4040
this.mod = new cwc.mode.default.Mod(helper);
4141

42-
/** @type {!cwc.mode.ev3.Monitor} */
43-
this.monitor = new cwc.mode.ev3.Monitor(helper, this.connection);
42+
/** @type {!cwc.mode.lego.ev3.Monitor} */
43+
this.monitor = new cwc.mode.lego.ev3.Monitor(helper, this.connection);
4444

4545
/** @type {!cwc.renderer.external.EV3} */
4646
this.renderer = new cwc.renderer.external.EV3(helper);
4747

48-
/** @type {!cwc.mode.ev3.Runner} */
49-
this.runner = new cwc.mode.ev3.Runner(helper, this.connection);
48+
/** @type {!cwc.mode.lego.ev3.Runner} */
49+
this.runner = new cwc.mode.lego.ev3.Runner(helper, this.connection);
5050

51-
/** @type {!cwc.mode.ev3.Calibration} */
52-
this.calibration = new cwc.mode.ev3.Calibration(helper, this.connection,
51+
/** @type {!cwc.mode.lego.ev3.Calibration} */
52+
this.calibration = new cwc.mode.lego.ev3.Calibration(helper, this.connection,
5353
this.runner);
5454
};
5555

5656

5757
/**
5858
* Decorates the different parts of the modification.
5959
*/
60-
cwc.mode.ev3.advanced.Mod.prototype.decorate = function() {
60+
cwc.mode.lego.ev3.advanced.Mod.prototype.decorate = function() {
6161
this.mod.setConnection(this.connection);
6262
this.mod.setMonitor(this.monitor);
6363
this.mod.setRenderer(this.renderer);
6464
this.mod.setRunner(this.runner);
6565
this.mod.decorate();
66-
this.mod.editor.setLocalHints(cwc.mode.ev3.Hints);
66+
this.mod.editor.setLocalHints(cwc.mode.lego.ev3.Hints);
6767
this.calibration.decorate();
6868
};

src/mode/ev3/blockly/mod.js renamed to src/mode/lego/ev3/blockly/mod.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
*
1818
* @author [email protected] (Markus Bordihn)
1919
*/
20-
goog.provide('cwc.mode.ev3.blockly.Mod');
20+
goog.provide('cwc.mode.lego.ev3.blockly.Mod');
2121

2222
goog.require('cwc.mode.default.Mod');
23-
goog.require('cwc.mode.ev3.Calibration');
24-
goog.require('cwc.mode.ev3.Connection');
25-
goog.require('cwc.mode.ev3.Monitor');
26-
goog.require('cwc.mode.ev3.Runner');
23+
goog.require('cwc.mode.lego.ev3.Calibration');
24+
goog.require('cwc.mode.lego.ev3.Connection');
25+
goog.require('cwc.mode.lego.ev3.Monitor');
26+
goog.require('cwc.mode.lego.ev3.Runner');
2727
goog.require('cwc.renderer.external.EV3');
2828
goog.require('cwc.soy.ev3.Blocks');
2929

@@ -32,32 +32,32 @@ goog.require('cwc.soy.ev3.Blocks');
3232
* @constructor
3333
* @param {!cwc.utils.Helper} helper
3434
*/
35-
cwc.mode.ev3.blockly.Mod = function(helper) {
36-
/** @type {!cwc.mode.ev3.Connection} */
37-
this.connection = new cwc.mode.ev3.Connection(helper);
35+
cwc.mode.lego.ev3.blockly.Mod = function(helper) {
36+
/** @type {!cwc.mode.lego.ev3.Connection} */
37+
this.connection = new cwc.mode.lego.ev3.Connection(helper);
3838

3939
/** @type {!cwc.mode.default.Mod} */
4040
this.mod = new cwc.mode.default.Mod(helper);
4141

42-
/** @type {!cwc.mode.ev3.Monitor} */
43-
this.monitor = new cwc.mode.ev3.Monitor(helper, this.connection);
42+
/** @type {!cwc.mode.lego.ev3.Monitor} */
43+
this.monitor = new cwc.mode.lego.ev3.Monitor(helper, this.connection);
4444

4545
/** @type {!cwc.renderer.external.EV3} */
4646
this.renderer = new cwc.renderer.external.EV3(helper);
4747

48-
/** @type {!cwc.mode.ev3.Runner} */
49-
this.runner = new cwc.mode.ev3.Runner(helper, this.connection);
48+
/** @type {!cwc.mode.lego.ev3.Runner} */
49+
this.runner = new cwc.mode.lego.ev3.Runner(helper, this.connection);
5050

51-
/** @type {!cwc.mode.ev3.Calibration} */
52-
this.calibration = new cwc.mode.ev3.Calibration(helper, this.connection,
51+
/** @type {!cwc.mode.lego.ev3.Calibration} */
52+
this.calibration = new cwc.mode.lego.ev3.Calibration(helper, this.connection,
5353
this.runner);
5454
};
5555

5656

5757
/**
5858
* Decorates the different parts of the modification.
5959
*/
60-
cwc.mode.ev3.blockly.Mod.prototype.decorate = function() {
60+
cwc.mode.lego.ev3.blockly.Mod.prototype.decorate = function() {
6161
this.mod.enableBlockly(cwc.soy.ev3.Blocks.toolbox);
6262
this.mod.setConnection(this.connection);
6363
this.mod.setMonitor(this.monitor);
File renamed without changes.

src/mode/ev3/calibration.js renamed to src/mode/lego/ev3/calibration.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* @author [email protected] (Markus Bordihn)
1919
*/
20-
goog.provide('cwc.mode.ev3.Calibration');
20+
goog.provide('cwc.mode.lego.ev3.Calibration');
2121

2222
goog.require('cwc.protocol.lego.ev3.Robots');
2323
goog.require('cwc.soy.mode.ev3.Calibration');
@@ -29,12 +29,12 @@ goog.require('cwc.utils.Helper');
2929
/**
3030
* @constructor
3131
* @param {!cwc.utils.Helper} helper
32-
* @param {!cwc.mode.ev3.Connection} connection
33-
* @param {!cwc.mode.ev3.Runner} runner
32+
* @param {!cwc.mode.lego.ev3.Connection} connection
33+
* @param {!cwc.mode.lego.ev3.Runner} runner
3434
* @struct
3535
* @final
3636
*/
37-
cwc.mode.ev3.Calibration = function(helper, connection, runner) {
37+
cwc.mode.lego.ev3.Calibration = function(helper, connection, runner) {
3838
/** @type {string} */
3939
this.name = 'EV3 Calibration';
4040

@@ -71,13 +71,13 @@ cwc.mode.ev3.Calibration = function(helper, connection, runner) {
7171
/** @type {Element} */
7272
this.nodeRobotList = null;
7373

74-
/** @type {!cwc.mode.ev3.Connection} */
74+
/** @type {!cwc.mode.lego.ev3.Connection} */
7575
this.connection = connection;
7676

7777
/** @type {!cwc.protocol.lego.ev3.Api} */
7878
this.api = this.connection.getApi();
7979

80-
/** @type {!cwc.mode.ev3.Runner} */
80+
/** @type {!cwc.mode.lego.ev3.Runner} */
8181
this.runner = runner;
8282

8383
/** @type {boolean} */
@@ -95,7 +95,7 @@ cwc.mode.ev3.Calibration = function(helper, connection, runner) {
9595
/**
9696
* Decorates the EV3 monitor window.
9797
*/
98-
cwc.mode.ev3.Calibration.prototype.decorate = function() {
98+
cwc.mode.lego.ev3.Calibration.prototype.decorate = function() {
9999
let runnerInstance = this.helper.getInstance('runner', true);
100100
let runnerMonitor = runnerInstance.getMonitor();
101101
if (!runnerMonitor) {
@@ -154,7 +154,7 @@ cwc.mode.ev3.Calibration.prototype.decorate = function() {
154154
/**
155155
* @private
156156
*/
157-
cwc.mode.ev3.Calibration.prototype.addEventHandler_ = function() {
157+
cwc.mode.lego.ev3.Calibration.prototype.addEventHandler_ = function() {
158158
let detectSensors = goog.dom.getElement(this.prefix + 'detect-sensors');
159159

160160
// Calibration
@@ -170,7 +170,7 @@ cwc.mode.ev3.Calibration.prototype.addEventHandler_ = function() {
170170
/**
171171
* Detects the connected EV3 devices.
172172
*/
173-
cwc.mode.ev3.Calibration.prototype.detect = function() {
173+
cwc.mode.lego.ev3.Calibration.prototype.detect = function() {
174174
this.connection.getDevices();
175175
};
176176

@@ -179,7 +179,7 @@ cwc.mode.ev3.Calibration.prototype.detect = function() {
179179
* Detects the connected EV3 devices.
180180
* @param {Event} event
181181
*/
182-
cwc.mode.ev3.Calibration.prototype.setType = function(event) {
182+
cwc.mode.lego.ev3.Calibration.prototype.setType = function(event) {
183183
let model = event.target.textContent;
184184
if (model.toLowerCase() == 'custom') {
185185
goog.style.setElementShown(this.nodeRobotCustom, true);
@@ -194,7 +194,7 @@ cwc.mode.ev3.Calibration.prototype.setType = function(event) {
194194
* Sets the EV3 robot model
195195
* @param {!string} model
196196
*/
197-
cwc.mode.ev3.Calibration.prototype.setRobotModel = function(model) {
197+
cwc.mode.lego.ev3.Calibration.prototype.setRobotModel = function(model) {
198198
console.log('Set robot model to', model);
199199
console.log('Type:', cwc.protocol.lego.ev3.Robots[model].type);
200200

@@ -222,7 +222,7 @@ cwc.mode.ev3.Calibration.prototype.setRobotModel = function(model) {
222222
* Transfers the calibration settings.
223223
* @param {Event=} opt_event
224224
*/
225-
cwc.mode.ev3.Calibration.prototype.setCalibration = function(opt_event) {
225+
cwc.mode.lego.ev3.Calibration.prototype.setCalibration = function(opt_event) {
226226
this.runner.setWheelDiameter(this.nodeWheelDiameter.value);
227227
this.runner.setWheelWidth(this.nodeWheelWidth.value);
228228
this.runner.setWheelbase(this.nodeWheelbase.value);
@@ -233,6 +233,6 @@ cwc.mode.ev3.Calibration.prototype.setCalibration = function(opt_event) {
233233
/**
234234
* Cleans up the event listener and any other modification.
235235
*/
236-
cwc.mode.ev3.Calibration.prototype.cleanUp = function() {
236+
cwc.mode.lego.ev3.Calibration.prototype.cleanUp = function() {
237237
this.events_.clear();
238238
};
File renamed without changes.

0 commit comments

Comments
 (0)