You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is handy for debugging other aspects of the system. Firmware is normally 1,501,618 bytes. With BT off: 888,850. With both BT and WiFi off: 454950. This helps reduce compile and upload times.
//We use a local copy of the BluetoothSerial library so that we can increase the RX buffer. See issue: https://github.com/sparkfun/SparkFun_RTK_Surveyor/issues/18
192
+
193
+
//#define COMPILE_BT 1 //Comment out to disable all Bluetooth
194
+
195
+
#ifdef COMPILE_BT
187
196
#include"src/BluetoothSerial/BluetoothSerial.h"
188
197
BluetoothSerial SerialBT;
189
198
#include"esp_bt.h"//Core access is needed for BT stop. See customBTstop() for more info.
190
199
#include"esp_gap_bt_api.h"//Needed for setting of pin. See issue: https://github.com/sparkfun/SparkFun_RTK_Surveyor/issues/5
200
+
#endif
191
201
192
202
char platformPrefix[40] = "Surveyor"; //Sets the prefix for broadcast names
Copy file name to clipboardExpand all lines: Firmware/RTK_Surveyor/System.ino
+14-1Lines changed: 14 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,8 @@
3
3
//This allows multiple units to be on at same time
4
4
boolstartBluetooth()
5
5
{
6
+
#ifdef COMPILE_BT
7
+
6
8
//Get unit MAC address
7
9
esp_read_mac(unitMACAddress, ESP_MAC_WIFI_STA);
8
10
unitMACAddress[5] += 2; //Convert MAC address to Bluetooth MAC (add 2): https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system.html#mac-address
@@ -78,6 +80,7 @@ bool startBluetooth()
78
80
//Start task for controlling Bluetooth pair LED
79
81
if (productVariant == RTK_SURVEYOR)
80
82
btLEDTask.attach(btLEDTaskPace, updateBTled); //Rate in seconds, callback
83
+
#endif
81
84
82
85
return (true);
83
86
}
@@ -98,9 +101,11 @@ void endBluetooth()
98
101
F9PSerialWriteTaskHandle = NULL;
99
102
}
100
103
104
+
#ifdef COMPILE_BT
101
105
SerialBT.flush(); //Complete any transfers
102
106
SerialBT.disconnect(); //Drop any clients
103
107
SerialBT.end(); //SerialBT.end() will release significant RAM (~100k!) but a SerialBT.start will crash.
108
+
#endif
104
109
105
110
//The following code releases the BT hardware so that it can be restarted with a SerialBT.begin
106
111
customBTstop();
@@ -113,7 +118,7 @@ void endBluetooth()
113
118
//To work around the bug without modifying the core we create our own btStop() function with
114
119
//the patch from github
115
120
boolcustomBTstop() {
116
-
121
+
#ifdef COMPILE_BT
117
122
if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE) {
118
123
returntrue;
119
124
}
@@ -137,18 +142,21 @@ bool customBTstop() {
137
142
returntrue;
138
143
}
139
144
log_e("BT Stop failed");
145
+
#endif
140
146
returnfalse;
141
147
}
142
148
143
149
//Start WiFi assuming it was previously fully released
0 commit comments