Telliskivi 2 2014
Dependencies: DoubleCoilGun 4DGL-uLCD-SE ExternalIn HumanInterfaceT14 LedOut MCP3021 MODSERIAL Motor1Pwm1Dir PCA9555 PinDetect QED RgbLedPCA9555 WDT_K64F mbed-src
Fork of Telliskivi2plus by
Diff: main.cpp
- Revision:
- 2:a3e6eceed838
- Parent:
- 1:79ac4e293661
- Child:
- 3:4ec313b1b314
diff -r 79ac4e293661 -r a3e6eceed838 main.cpp --- a/main.cpp Thu Sep 19 13:18:02 2013 +0000 +++ b/main.cpp Thu Sep 19 14:30:15 2013 +0000 @@ -42,7 +42,6 @@ int failSafeCount = 0; int failSafeLimit = 60; -bool isCharged = false; //has charge been sent after discharge void executeCommand(short *cmd); void executeCommandOld(char *buffer); @@ -267,9 +266,8 @@ motor4.setSpeed(0); motor5.setSpeed(0); coilgun.discharge(); - isCharged = false; } - if (!isCharged) { + if (!coilgun.isCharged) { //int charCount = sprintf(sendBuffer, "<speeds:%d:%d:%d:%d:%d>"); server.sendTo(client, "<discharged>", 12); } @@ -427,11 +425,9 @@ } else if (strncmp(cmd, "charge", 6) == 0) { pc.printf("charge\n"); coilgun.charge(); - isCharged = true; } else if (strncmp(cmd, "discharge", 9) == 0) { pc.printf("discharge\n"); coilgun.discharge(); - isCharged = false; } else if (strncmp(cmd, "k", 1) == 0) { pc.printf("kick\n"); int length = atoi(strtok(NULL, ":")); @@ -440,14 +436,12 @@ pc.printf("charge\n"); if (atoi(strtok(NULL, ":")) == 1) { coilgun.charge(); - isCharged = true; } else { coilgun.chargeEnd(); } } else if (strncmp(cmd, "d", 1) == 0) { pc.printf("discharge\n"); coilgun.discharge(); - isCharged = false; } else if (strncmp(cmd, "fs", 2) == 0) { failSafeEnabled = (bool)atoi(strtok(NULL, ":")); } else if (strncmp(cmd, "target", 6) == 0) {