Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions VortexEngine/src/VortexConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@
// The serial connection baud rate for the editor and anything else serial
#define SERIAL_BAUD_RATE 115200

// Enable Bluetooth
//
// Turn this on to enable Bluetooth functionality
#define BLUETOOTH_ENABLE 0

// Bluetooth Broadcast Time
//
// The number of seconds after startup the Bluetooth module will broadcast
Expand Down Expand Up @@ -591,6 +596,11 @@
#undef VORTEX_SLIM
#define VORTEX_SLIM 0

// This only allows Bluetooth to be enabled on embedded platforms
#ifndef VORTEX_EMBEDDED
#undef BLUETOOTH_ENABLE
#endif

// The test framework needs brighter menu colors can't really see them on the screen
#undef RGB_MENU_RANDOMIZER
#undef RGB_MENU_MODE_SHARING
Expand Down
12 changes: 6 additions & 6 deletions VortexEngine/src/Wireless/Bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bool Bluetooth::m_bleConnected = false;
ByteStream Bluetooth::receivedData;

// We'll track whether an indication is currently in progress:
#if VORTEX_EMBEDDED == 1
#if BLUETOOTH_ENABLE == 1
static volatile bool m_isIndicationInProgress = false;

// Forward-declare the BLE objects
Expand Down Expand Up @@ -67,7 +67,7 @@ class IndicationConfirmCallbacks : public BLECharacteristicCallbacks

bool Bluetooth::init()
{
#if VORTEX_EMBEDDED == 1
#if BLUETOOTH_ENABLE == 1
BLEDevice::init(BLUETOOTH_BROADCAST_NAME);
// Request a higher MTU, but actual negotiation may differ
BLEDevice::setMTU(1024);
Expand Down Expand Up @@ -115,7 +115,7 @@ bool Bluetooth::init()

void Bluetooth::cleanup()
{
#if VORTEX_EMBEDDED == 1
#if BLUETOOTH_ENABLE == 1
if (pServer != nullptr) {
BLEDevice::deinit(true);
pServer = nullptr;
Expand All @@ -128,7 +128,7 @@ void Bluetooth::cleanup()

bool Bluetooth::isInitialized()
{
#if VORTEX_EMBEDDED == 1
#if BLUETOOTH_ENABLE == 1
if (pServer != nullptr) {
return true;
}
Expand All @@ -149,7 +149,7 @@ bool Bluetooth::checkBluetooth()
// Write a formatted string with Indicate, waiting for confirmation.
void Bluetooth::write(const char *msg, ...)
{
#if VORTEX_EMBEDDED == 1
#if BLUETOOTH_ENABLE == 1
if (!isConnected()) return;

char buffer[512];
Expand Down Expand Up @@ -177,7 +177,7 @@ void Bluetooth::write(const char *msg, ...)
// Write a ByteStream with Indicate, waiting for confirmation.
void Bluetooth::write(ByteStream &byteStream)
{
#if VORTEX_EMBEDDED == 1
#if BLUETOOTH_ENABLE == 1
if (!isConnected()) return;

byteStream.recalcCRC();
Expand Down
4 changes: 2 additions & 2 deletions VortexEngine/src/Wireless/Bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "../VortexConfig.h"

#if VORTEX_EMBEDDED == 1
#if BLUETOOTH_ENABLE == 1
#include <Arduino.h>
#include <BLEDevice.h>
#include <BLEServer.h>
Expand All @@ -30,7 +30,7 @@ class Bluetooth {

static bool dataReady();

#if VORTEX_EMBEDDED == 1
#if BLUETOOTH_ENABLE == 1
static BLEServer* pServer;
static BLECharacteristic* writeChar;
static BLECharacteristic* notifyChar;
Expand Down