fix poweroff if mode.on
This commit is contained in:
parent
baec50d4b6
commit
1810f5e46f
|
@ -326,6 +326,7 @@ void handleModeChange() {
|
||||||
digitalWrite(PIN_RELAISFRONT,HIGH); //simulate hoverboard power button press
|
digitalWrite(PIN_RELAISFRONT,HIGH); //simulate hoverboard power button press
|
||||||
state_modechange++;
|
state_modechange++;
|
||||||
state_modechange_time=loopmillis; //set to current time
|
state_modechange_time=loopmillis; //set to current time
|
||||||
|
Serial.println("PIN_RELAISFRONT,HIGH");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -333,6 +334,7 @@ void handleModeChange() {
|
||||||
digitalWrite(PIN_RELAISFRONT,LOW); //release simulated button
|
digitalWrite(PIN_RELAISFRONT,LOW); //release simulated button
|
||||||
state_modechange++;
|
state_modechange++;
|
||||||
state_modechange_time=loopmillis; //set to current time
|
state_modechange_time=loopmillis; //set to current time
|
||||||
|
Serial.println("PIN_RELAISFRONT,LOW");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -340,6 +342,7 @@ void handleModeChange() {
|
||||||
digitalWrite(PIN_RELAISREAR,HIGH); //simulate hoverboard power button press
|
digitalWrite(PIN_RELAISREAR,HIGH); //simulate hoverboard power button press
|
||||||
state_modechange++;
|
state_modechange++;
|
||||||
state_modechange_time=loopmillis; //set to current time
|
state_modechange_time=loopmillis; //set to current time
|
||||||
|
Serial.println("PIN_RELAISREAR,HIGH");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -347,9 +350,17 @@ void handleModeChange() {
|
||||||
digitalWrite(PIN_RELAISREAR,LOW); //release simulated button
|
digitalWrite(PIN_RELAISREAR,LOW); //release simulated button
|
||||||
state_modechange++;
|
state_modechange++;
|
||||||
state_modechange_time=loopmillis; //set to current time
|
state_modechange_time=loopmillis; //set to current time
|
||||||
|
Serial.println("PIN_RELAISREAR,LOW");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
if (loopmillis - state_modechange_time > 1000) { //wait some time after turning on/off
|
||||||
|
state_modechange++;
|
||||||
|
state_modechange_time=loopmillis; //set to current time
|
||||||
|
Serial.println("Waiting finished");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
// ### Request On ###
|
// ### Request On ###
|
||||||
if (requestmode==on) {//wait for both boards to send feedback
|
if (requestmode==on) {//wait for both boards to send feedback
|
||||||
state_modechange++;
|
state_modechange++;
|
||||||
|
@ -360,6 +371,7 @@ void handleModeChange() {
|
||||||
state_modechange++;
|
state_modechange++;
|
||||||
board1Enabled=false; //assume board is offline
|
board1Enabled=false; //assume board is offline
|
||||||
board2Enabled=false; //assume board is offline
|
board2Enabled=false; //assume board is offline
|
||||||
|
Serial.println("finished");
|
||||||
}else{ //if changed off from error mode
|
}else{ //if changed off from error mode
|
||||||
state_modechange++;
|
state_modechange++;
|
||||||
}
|
}
|
||||||
|
@ -393,7 +405,7 @@ void handleModeChange() {
|
||||||
void modeloops() {
|
void modeloops() {
|
||||||
if (loopmillis - last_looptime >= LOOPTIME) {
|
if (loopmillis - last_looptime >= LOOPTIME) {
|
||||||
last_looptime=loopmillis;
|
last_looptime=loopmillis;
|
||||||
switch (requestmode) { //mode changes
|
switch (currentmode) { //mode changes
|
||||||
case booting:
|
case booting:
|
||||||
//TODO: LED effect
|
//TODO: LED effect
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue