Adding variable declarations and syntax error

master
hopkira 2020-06-01 11:40:59 +01:00
parent 6aad4d8f93
commit 26d0fd3279
1 changed files with 16 additions and 10 deletions

View File

@ -1,6 +1,6 @@
/* /*
========================================================== ==========================================================
Simple event based robot controller that enables robot Simple event based robot controller that enables robot
to switch into automatic or manual control modes. Behaviours to switch into automatic or manual control modes. Behaviours
are controlled via a simple finite state machine. are controlled via a simple finite state machine.
In automatic mode the In automatic mode the
@ -19,7 +19,7 @@ bottom_btn = false;
msgNum = 0; // message number msgNum = 0; // message number
/* /*
CONFIGURATION AREA - STATE VARIABLES CONFIGURATION AREA - STATE VARIABLES
declare global variables for the toggle button declare global variables for the toggle button
statuses; if you add an additional toggle button statuses; if you add an additional toggle button
@ -28,6 +28,12 @@ you should declare it and initiase it here */
var status_auto = {value: false}; var status_auto = {value: false};
var status_mic = {value: true}; var status_mic = {value: true};
var status_spk = {value: true}; var status_spk = {value: true};
var status_face = {value: true};
var status_chess = {value: false};
var status_iris_light = {value: false};
var status_iris = {value: false};
var status_wake = {value: false};
var status_hover = {value: false};
/* trsnsmit message /* trsnsmit message
where where
@ -415,7 +421,7 @@ const speakScreen = {
const irisScreen = { const irisScreen = {
left: irisBtn, left: irisBtn,
right: irisBirisLightBtn, right: irisLightBtn,
btn3: "back" btn3: "back"
}; };
@ -431,9 +437,9 @@ const chessScreen = {
btn3: "back" btn3: "back"
}; };
/* base state definition /* base state definition
Each of the screens correspond to a state; Each of the screens correspond to a state;
this class provides a constuctor for each this class provides a constuctor for each
of the states of the states
*/ */
class State { class State {
@ -605,7 +611,7 @@ const Iris = new State({
} }
transmit(this.state, event.object, event.status); transmit(this.state, event.object, event.status);
return this; return this;
} }
}); });
const Lights = new State({ const Lights = new State({
@ -627,7 +633,7 @@ const Lights = new State({
} }
transmit(this.state, event.object, event.status); transmit(this.state, event.object, event.status);
return this; return this;
} }
}); });
@ -676,7 +682,7 @@ const onOff= status => status ? "on" : "off";
/* create watching functions that will change the global /* create watching functions that will change the global
button status when pressed or released button status when pressed or released
This is actuslly the hesrt of the program. When a button This is actuslly the hesrt of the program. When a button
is not being pressed, nothing is happening (no loops). is not being pressed, nothing is happening (no loops).
This makes the progrsm more battery efficient. This makes the progrsm more battery efficient.
@ -684,7 +690,7 @@ When a setWatch event is raised, the custom callbacks defined
here will be called. These then fired as events to the current here will be called. These then fired as events to the current
state/screen of the state mschine. state/screen of the state mschine.
Some events, will result in the stste of the state machine Some events, will result in the stste of the state machine
chsnging, which is why the screen is redrswn after each chsnging, which is why the screen is redrswn after each
button press. button press.
*/ */
const setMyWatch = (params) => { const setMyWatch = (params) => {
@ -742,4 +748,4 @@ const drawScreen = (params) => {
machine = Home; // instantiate the state machine at Home machine = Home; // instantiate the state machine at Home
Bangle.drawWidgets(); // draw active widgets Bangle.drawWidgets(); // draw active widgets
drawScreen(machine.screen); // draw the screen drawScreen(machine.screen); // draw the screen