Added User feedback on multi char timeout and formatting

Added User feedback on multi char timeout and formatting
Esse commit está contido em:
Gerrie van Zyl
2017-08-29 08:18:58 -04:00
commit 398932064d
2 arquivos alterados com 15 adições e 10 exclusões
+8 -3
Ver Arquivo
@@ -437,10 +437,10 @@ boolean OpenBCI_32bit_Library::processChar(char character) {
/**
* Start the timer on multi char commands
* @param cmd the command received on the serial stream. See enum MULTI_CHAR_COMMAND
* @param cmd {char} the command received on the serial stream. See enum MULTI_CHAR_COMMAND
* @returns void
*/
void OpenBCI_32bit_Library::startMultiCharCmdTimer(unsigned int cmd) {
void OpenBCI_32bit_Library::startMultiCharCmdTimer(char cmd) {
isMultiCharCmd = true;
multiCharCommand = cmd;
multiCharCmdTimeout = millis() + MULTI_CHAR_COMMAND_TIMEOUT_MS;
@@ -465,8 +465,13 @@ boolean OpenBCI_32bit_Library::checkMultiCharCmdTimer(void) {
if (isMultiCharCmd){
if (millis() < multiCharCmdTimeout)
return true;
else // the timer has timed out - reset the multi char timeout
else{ // the timer has timed out - reset the multi char timeout
endMultiCharCmdTimer();
printAll("Timeout processing multi byte");
printAll(" message - please send all");
printAll(" commands at once as of v2");
sendEOT();
}
}
return false;
}
+7 -7
Ver Arquivo
@@ -174,7 +174,7 @@ public:
void sendEOT(void);
void setSerialInfo(SerialInfo, boolean, boolean, uint32_t);
boolean smellDaisy(void);
void startMultiCharCmdTimer(unsigned int);
void startMultiCharCmdTimer(char);
void streamSafeChannelDeactivate(byte);
void streamSafeChannelActivate(byte);
void streamSafeChannelSettingsForChannel(byte, byte, byte, byte, byte, byte, byte);
@@ -277,7 +277,6 @@ private:
void initializeSerialInfo(SerialInfo);
void initializeVariables(void);
void initializeSpiInfo(SpiInfo);
boolean isMultiCharCmd; // A multi char command is in progress
byte LIS3DH_getDeviceID(void);
byte LIS3DH_read(byte); // read a register on LIS3DH
int LIS3DH_read16(byte); // read two bytes, used to get axis data
@@ -289,10 +288,6 @@ private:
void LIS3DH_writeAxisDataForAxisSerial(uint8_t);
void LIS3DH_updateAxisData(void);
void LIS3DH_zeroAxisData(void);
char markerValue;
unsigned int multiCharCommand; // The type of command
unsigned long multiCharCmdTimeout; // the timeout in millis of the current multi char command
boolean newMarkerReceived; // flag to indicate a new marker has been received
void printADSregisters(int);
void printAllRegisters(void);
void printFailure();
@@ -320,10 +315,13 @@ private:
// Variables
boolean commandFromSPI;
boolean firstDataPacket;
boolean isMultiCharCmd; // A multi char command is in progress
boolean isRunning;
boolean newMarkerReceived; // flag to indicate a new marker has been received
byte regData[24]; // array is used to mirror register data
char buffer[1];
char markerValue;
char multiCharCommand; // The type of command
char currentChannelSetting;
char optionalArgBuffer5[5];
char optionalArgBuffer6[6];
@@ -336,6 +334,8 @@ private:
int numberOfIncomingSettingsProcessedLeadOff;
int numberOfIncomingSettingsProcessedBoardType;
uint8_t optionalArgCounter;
unsigned long multiCharCmdTimeout; // the timeout in millis of the current multi char command
unsigned long timeOfLastRead;
unsigned long timeOfMultiByteMsgStart;