Edit player 2. vibration when connect.

This commit is contained in:
Vojtěch Pour 2022-11-18 09:53:02 +01:00
parent d428129cef
commit 89efe6340a

View file

@ -14,8 +14,8 @@
BluetoothSerial SerialBT; BluetoothSerial SerialBT;
#define BT_DISCOVER_TIME 10000 #define BT_DISCOVER_TIME 10000
esp_spp_sec_t sec_mask=ESP_SPP_SEC_NONE; // or ESP_SPP_SEC_ENCRYPT|ESP_SPP_SEC_AUTHENTICATE to request pincode confirmation esp_spp_sec_t sec_mask=ESP_SPP_SEC_NONE;
esp_spp_role_t role=ESP_SPP_ROLE_SLAVE; // or ESP_SPP_ROLE_MASTER esp_spp_role_t role=ESP_SPP_ROLE_SLAVE;
@ -36,15 +36,11 @@ void setup() {
Serial.println("========== serialBT failed!"); Serial.println("========== serialBT failed!");
abort(); abort();
} }
// SerialBT.setPin("1234"); // doesn't seem to change anything
// SerialBT.enableSSP(); // doesn't seem to change anything
Serial.println("Starting discoverAsync..."); Serial.println("Starting discoverAsync...");
BTScanResults* btDeviceList = SerialBT.getScanResults(); // maybe accessing from different threads! BTScanResults* btDeviceList = SerialBT.getScanResults(); // maybe accessing from different threads!
if (SerialBT.discoverAsync([](BTAdvertisedDevice* pDevice) { if (SerialBT.discoverAsync([](BTAdvertisedDevice* pDevice) {
// BTAdvertisedDeviceSet*set = reinterpret_cast<BTAdvertisedDeviceSet*>(pDevice);
// btDeviceList[pDevice->getAddress()] = * set;
Serial.printf(">>>>>>>>>>>Found a new device asynchronously: %s\n", pDevice->toString().c_str()); Serial.printf(">>>>>>>>>>>Found a new device asynchronously: %s\n", pDevice->toString().c_str());
} ) } )
) { ) {
@ -72,6 +68,9 @@ void setup() {
} }
if(addr) { if(addr) {
Serial.printf("connecting to %s - %d\n", addr.toString().c_str(), channel); Serial.printf("connecting to %s - %d\n", addr.toString().c_str(), channel);
M5.Axp.SetLDOEnable(3, true);
delay(500);
M5.Axp.SetLDOEnable(3, false);
SerialBT.connect(addr, channel, sec_mask, role); SerialBT.connect(addr, channel, sec_mask, role);
} }
} else { } else {
@ -313,4 +312,4 @@ void loop() {
} }
} }
} }
} }