Skip to content

Commit a38ffd8

Browse files
author
AJ Keller
authored
Merge pull request #89 from aj-ptw/spi-wifi-fix
FIX: Add delay after multipacket spi messages for WiFi
2 parents a59623e + b1690db commit a38ffd8

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

OpenBCI_32bit_Library.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ boolean OpenBCI_32bit_Library::processChar(char character) {
420420
sendEOT();
421421
break;
422422
case OPENBCI_GET_VERSION:
423-
printAll("v3.1.0");
423+
printAll("v3.1.1");
424424
sendEOT();
425425
break;
426426
default:
@@ -711,7 +711,7 @@ void OpenBCI_32bit_Library::boardReset(void) {
711711
printAll("On Daisy ADS1299 Device ID: 0x"); printlnHex(ADS_getDeviceID(ON_DAISY));
712712
}
713713
printAll("LIS3DH Device ID: 0x"); printlnHex(LIS3DH_getDeviceID());
714-
printlnAll("Firmware: v3.1.0");
714+
printlnAll("Firmware: v3.1.1");
715715
sendEOT();
716716
delay(5);
717717
wifi.reset();
@@ -880,7 +880,9 @@ void OpenBCI_32bit_Library::processIncomingSampleRate(char c) {
880880
sendEOT();
881881
} else if (wifi.present && wifi.tx) {
882882
wifi.sendStringMulti("Success: Sample rate is ");
883+
delay(1);
883884
wifi.sendStringMulti(getSampleRate());
885+
delay(1);
884886
wifi.sendStringLast("Hz");
885887
}
886888
} else {
@@ -889,7 +891,7 @@ void OpenBCI_32bit_Library::processIncomingSampleRate(char c) {
889891
printAll("sample value out of bounds");
890892
sendEOT();
891893
} else if (wifi.present && wifi.tx) {
892-
wifi.sendStringMulti("Failure: sample value");
894+
wifi.sendStringMulti("Failure: sample value"); delay(1);
893895
wifi.sendStringLast(" out of bounds");
894896
}
895897
}
@@ -899,7 +901,7 @@ void OpenBCI_32bit_Library::processIncomingSampleRate(char c) {
899901
printAll("invalid sample value");
900902
sendEOT();
901903
} else if (wifi.present && wifi.tx) {
902-
wifi.sendStringLast("Failure: invalid sample value");
904+
wifi.sendStringLast("Failure: invalid sample value"); delay(1);
903905
}
904906
}
905907
endMultiCharCmdTimer();
@@ -1014,7 +1016,7 @@ void OpenBCI_32bit_Library::processIncomingChannelSettings(char character) {
10141016
sendEOT();
10151017
} else if (wifi.present && wifi.tx) {
10161018
char buf[3];
1017-
wifi.sendStringMulti("Success: Channel set for ");
1019+
wifi.sendStringMulti("Success: Channel set for "); delay(1);
10181020
wifi.sendStringLast(itoa(currentChannelSetting + 1, buf, 10));
10191021
}
10201022

@@ -1120,7 +1122,7 @@ void OpenBCI_32bit_Library::processIncomingLeadOffSettings(char character) {
11201122
sendEOT();
11211123
} else if (wifi.present && wifi.tx) {
11221124
char buf[3];
1123-
wifi.sendStringMulti("Success: Lead off set for ");
1125+
wifi.sendStringMulti("Success: Lead off set for "); delay(1);
11241126
wifi.sendStringLast(itoa(currentChannelSetting + 1, buf, 10));
11251127
}
11261128

@@ -3528,28 +3530,33 @@ void OpenBCI_32bit_Library::printAll(char c) {
35283530
printSerial(c);
35293531
if (wifi.present && wifi.tx) {
35303532
wifi.sendStringMulti(c);
3533+
delay(1);
35313534
}
35323535
}
35333536

35343537
void OpenBCI_32bit_Library::printAll(const char *arr) {
35353538
printSerial(arr);
35363539
if (wifi.present && wifi.tx) {
35373540
wifi.sendStringMulti(arr);
3541+
delay(1);
35383542
}
35393543
}
35403544

35413545
void OpenBCI_32bit_Library::printlnAll(const char *arr) {
35423546
printlnSerial(arr);
35433547
if (wifi.present && wifi.tx) {
35443548
wifi.sendStringMulti(arr);
3549+
delay(1);
35453550
wifi.sendStringMulti("\n");
3551+
delay(1);
35463552
}
35473553
}
35483554

35493555
void OpenBCI_32bit_Library::printlnAll(void) {
35503556
printlnSerial();
35513557
if (wifi.present && wifi.tx) {
35523558
wifi.sendStringMulti("\n");
3559+
delay(1);
35533560
}
35543561
}
35553562

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# v3.1.1
2+
3+
### Bug Fixes
4+
5+
* Adding a delay after sending multipacket spi messages improves reliability! Some messages like sample rate got chopped up :rocket:
6+
17
# v3.1.0
28

39
### New Features

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=OpenBCI_32bit_Library
2-
version=3.1.0
2+
version=3.1.1
33
author=Joel Murphy <joel@openbci.com>, Conor Russomanno <conor@openbci.com>, Leif Percifield <lpercifield@gmail.com>, AJ Keller <pushtheworldllc@gmail.com>
44
maintainer=Joel Murphy <joel@openbci.com>, AJ Keller <pushtheworldllc@gmail.com>
55
sentence=The library for controlling OpenBCI Cyton (32bit) boards. The Cyton is the main one.

0 commit comments

Comments
 (0)