Merge pull request #75 from aj-ptw/master
FIX: can stream rfduino data without having to take your wifi shield …
Esse commit está contido em:
@@ -310,15 +310,26 @@ boolean OpenBCI_32bit_Library::processChar(char character) {
|
||||
if(curAccelMode == ACCEL_MODE_ON){
|
||||
enable_accel(RATE_25HZ);
|
||||
} // fire up the accelerometer if you want it
|
||||
wifi.tx = commandFromSPI;
|
||||
if (wifi.present && wifi.tx) {
|
||||
wifi.sendStringLast("Stream started");
|
||||
}
|
||||
// Reads if the command is not from the SPI port and we are not in debug mode
|
||||
if (!commandFromSPI && !iSerial1.tx) {
|
||||
// If the sample rate is higher than 250, we need to drop down to 250Hz
|
||||
// to not break the RFduino system that can't handle above 250SPS.
|
||||
if (curSampleRate != SAMPLE_RATE_250) {
|
||||
streamSafeSetSampleRate(SAMPLE_RATE_250);
|
||||
delay(50);
|
||||
}
|
||||
}
|
||||
streamStart(); // turn on the fire hose
|
||||
break;
|
||||
case OPENBCI_STREAM_STOP: // stop streaming data
|
||||
if(curAccelMode == ACCEL_MODE_ON){
|
||||
disable_accel();
|
||||
} // shut down the accelerometer if you're using it
|
||||
wifi.tx = true;
|
||||
streamStop();
|
||||
if (wifi.present && wifi.tx) {
|
||||
wifi.sendStringLast("Stream stopped");
|
||||
@@ -844,24 +855,33 @@ const char* OpenBCI_32bit_Library::getBoardMode(void) {
|
||||
void OpenBCI_32bit_Library::processIncomingSampleRate(char c) {
|
||||
if (c == OPENBCI_SAMPLE_RATE_SET) {
|
||||
printSuccess();
|
||||
printAll("Sample rate is ");
|
||||
printAll(getSampleRate());
|
||||
printAll("Hz");
|
||||
sendEOT();
|
||||
} else if (isDigit(c)) {
|
||||
uint8_t digit = c - '0';
|
||||
if (digit <= SAMPLE_RATE_250) {
|
||||
streamSafeSetSampleRate((SAMPLE_RATE)digit);
|
||||
if (!streaming) {
|
||||
setSampleRate(digit);
|
||||
printSuccess();
|
||||
printAll("Sample rate is ");
|
||||
printAll(getSampleRate());
|
||||
printAll("Hz");
|
||||
sendEOT();
|
||||
} else if (wifi.present && wifi.tx) {
|
||||
wifi.sendStringMulti("Success: Sample rate is ");
|
||||
wifi.sendStringMulti(getSampleRate());
|
||||
wifi.sendStringLast("Hz");
|
||||
}
|
||||
} else {
|
||||
if (!streaming) {
|
||||
printFailure();
|
||||
printAll("sample value out of bounds");
|
||||
sendEOT();
|
||||
} else if (wifi.present && wifi.tx) {
|
||||
wifi.sendStringMulti("Failure: sample value");
|
||||
wifi.sendStringLast(" out of bounds");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -869,6 +889,8 @@ void OpenBCI_32bit_Library::processIncomingSampleRate(char c) {
|
||||
printFailure();
|
||||
printAll("invalid sample value");
|
||||
sendEOT();
|
||||
} else if (wifi.present && wifi.tx) {
|
||||
wifi.sendStringLast("Failure: invalid sample value");
|
||||
}
|
||||
}
|
||||
endMultiCharCmdTimer();
|
||||
@@ -1745,6 +1767,27 @@ void OpenBCI_32bit_Library::streamSafeSetAllChannelsToDefault(void) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Used to set the sample rate
|
||||
* @param sr {SAMPLE_RATE} - The sample rate to set to.
|
||||
* @author AJ Keller (@pushtheworldllc)
|
||||
*/
|
||||
void OpenBCI_32bit_Library::streamSafeSetSampleRate(SAMPLE_RATE sr) {
|
||||
boolean wasStreaming = streaming;
|
||||
|
||||
// Stop streaming if you are currently streaming
|
||||
if (streaming) {
|
||||
streamStop();
|
||||
}
|
||||
|
||||
setSampleRate(sr);
|
||||
|
||||
// Restart stream if need be
|
||||
if (wasStreaming) {
|
||||
streamStart();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of gains in coded ADS form i.e. 0-6 where 6 is x24 and so on.
|
||||
* @return [description]
|
||||
|
||||
@@ -193,6 +193,7 @@ public:
|
||||
void startMultiCharCmdTimer(char);
|
||||
void streamSafeChannelDeactivate(byte);
|
||||
void streamSafeChannelActivate(byte);
|
||||
void streamSafeSetSampleRate(SAMPLE_RATE);
|
||||
void streamSafeChannelSettingsForChannel(byte, byte, byte, byte, byte, byte, byte);
|
||||
void streamSafeSetAllChannelsToDefault(void);
|
||||
void streamSafeReportAllChannelDefaults(void);
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
# v3.1.0
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Sending a start streaming command from `Serial0` when wifi was attached resulted in data flowing out over wifi, instead of flowing back to Serial0. If you had previous set your sample rate to 1000Hz to do WiFi, and then send a start stream command from Serial port, the board will ensure the sample rate is set to 250Hz.
|
||||
|
||||
# v3.0.0
|
||||
|
||||
### New Features
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
name=OpenBCI_32bit_Library
|
||||
version=3.0.0
|
||||
version=3.1.0
|
||||
author=Joel Murphy <joel@openbci.com>, Conor Russomanno <conor@openbci.com>, Leif Percifield <lpercifield@gmail.com>, AJ Keller <pushtheworldllc@gmail.com>
|
||||
maintainer=Joel Murphy <joel@openbci.com>, AJ Keller <pushtheworldllc@gmail.com>
|
||||
sentence=The library for controlling OpenBCI Cyton (32bit) boards. The Cyton is the main one.
|
||||
paragraph=The to be ran on the Pic 32. Use the DefaultBoard.ino for the firmware that ships with every Cyton order. See the examples for stipped down versions of the board. See the learning pages at openbci.com for more info!
|
||||
paragraph=This library is designed to be ran on the Pic 32. Use the DefaultBoard.ino for the firmware that ships with every Cyton order. See the examples for stipped down versions of the board. See the learning pages at openbci.com for more info!
|
||||
category=Device Control
|
||||
url=https://github.com/OpenBCI/OpenBCI_32bit_Library
|
||||
architectures=pic32
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário