diff --git a/VortexEngine/src/VortexConfig.h b/VortexEngine/src/VortexConfig.h index 3752490f21..93ce83e655 100644 --- a/VortexEngine/src/VortexConfig.h +++ b/VortexEngine/src/VortexConfig.h @@ -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 @@ -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 diff --git a/VortexEngine/src/Wireless/Bluetooth.cpp b/VortexEngine/src/Wireless/Bluetooth.cpp index 9809bed129..22fbbe4401 100644 --- a/VortexEngine/src/Wireless/Bluetooth.cpp +++ b/VortexEngine/src/Wireless/Bluetooth.cpp @@ -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 @@ -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); @@ -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; @@ -128,7 +128,7 @@ void Bluetooth::cleanup() bool Bluetooth::isInitialized() { -#if VORTEX_EMBEDDED == 1 +#if BLUETOOTH_ENABLE == 1 if (pServer != nullptr) { return true; } @@ -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]; @@ -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(); diff --git a/VortexEngine/src/Wireless/Bluetooth.h b/VortexEngine/src/Wireless/Bluetooth.h index 353fe2b7d6..a57645ac91 100644 --- a/VortexEngine/src/Wireless/Bluetooth.h +++ b/VortexEngine/src/Wireless/Bluetooth.h @@ -3,7 +3,7 @@ #include "../VortexConfig.h" -#if VORTEX_EMBEDDED == 1 +#if BLUETOOTH_ENABLE == 1 #include #include #include @@ -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;