From 254d2d772e4bb29d3706c4fec045c47e73dcacf0 Mon Sep 17 00:00:00 2001 From: AJ Keller Date: Mon, 16 Oct 2017 09:45:05 -0400 Subject: [PATCH] FIX: Daisy sample rate was not being set --- OpenBCI_32bit_Library.cpp | 9 ++++++--- changelog.md | 3 +++ examples/BoardWithWifi/BoardWithWifi.ino | 3 --- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/OpenBCI_32bit_Library.cpp b/OpenBCI_32bit_Library.cpp index 51244c8..66aed44 100644 --- a/OpenBCI_32bit_Library.cpp +++ b/OpenBCI_32bit_Library.cpp @@ -312,6 +312,7 @@ boolean OpenBCI_32bit_Library::processChar(char character) { wifi.tx = commandFromSPI; if (wifi.present && wifi.tx) { wifi.sendStringLast("Stream started"); + iSerial0.tx = false; } // Reads if the command is not from the SPI port and we are not in debug mode if (!commandFromSPI && !iSerial1.tx) { @@ -579,7 +580,7 @@ void OpenBCI_32bit_Library::boardBeginADSInterrupt(void) { * @author: AJ Keller (@pushtheworldllc) */ boolean OpenBCI_32bit_Library::boardBeginDebug(void) { - boardBeginDebug(OPENBCI_BAUD_RATE); + boardBeginDebug(iSerial1.baudRate); } /** @@ -590,7 +591,7 @@ boolean OpenBCI_32bit_Library::boardBeginDebug(void) { boolean OpenBCI_32bit_Library::boardBeginDebug(int baudRate) { beginPinsDebug(); beginSerial0(); - beginSerial1(); + beginSerial1(baudRate); curBoardMode = BOARD_MODE_DEBUG; curDebugMode = DEBUG_MODE_ON; @@ -1694,10 +1695,12 @@ void OpenBCI_32bit_Library::initialize_ads(){ delay(10); daisyPresent = smellDaisy(); // check to see if daisy module is present if(!daisyPresent){ - WREG(CONFIG1,(ADS1299_CONFIG1_DAISY_NOT | curSampleRate),BOARD_ADS); // turn off clk output if no daisy present + WREG(CONFIG1, (ADS1299_CONFIG1_DAISY_NOT | curSampleRate), BOARD_ADS); // turn off clk output if no daisy present numChannels = 8; // expect up to 8 ADS channels }else{ numChannels = 16; // expect up to 16 ADS channels + WREG(CONFIG1, (ADS1299_CONFIG1_DAISY_NOT | curSampleRate), DAISY_ADS); // tell on-board ADS to output its clk, set the data rate to 250SPS + delay(40); } // DEFAULT CHANNEL SETTINGS FOR ADS diff --git a/changelog.md b/changelog.md index b617e8c..871dfaf 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,9 @@ ### 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. +* Example for BoardWithWifi.ino did not compile +* Custom sample rate for debug port was broken and not accepting sample rates. +* Daisy sample rate was not being set, so sample rate was always at 250Hz # v3.0.0 diff --git a/examples/BoardWithWifi/BoardWithWifi.ino b/examples/BoardWithWifi/BoardWithWifi.ino index d86cba8..1ad2e81 100644 --- a/examples/BoardWithWifi/BoardWithWifi.ino +++ b/examples/BoardWithWifi/BoardWithWifi.ino @@ -34,9 +34,6 @@ void loop() { // Read one char from the wifi shield char newChar = wifi.getChar(); - // Send to the sd library for processing - sdProcessChar(newChar); - // Send to the board library board.processCharWifi(newChar); }