Open SwooshMihu opened 2 years ago
@SwooshMihu that's because of this line:
BMDConnection.clearPairing();
Remove this line and reflash your device. This is only used when you want your stick to 'forget' your camera.
I encountered a similar situation, when the firmware is first uploaded, it looks for the camera’s bluetooth and connects to it, but after a reboot (of the camera or microcontroller) it does not connect.
I didn’t fix the error, but I understood where the reason was: BlueMagicCameraConnection.cpp address = *getCameraAddress(); - error here
Steps:
BlueMagicCameraController *BlueMagicCameraConnection::connect(uint8_t index)
{
if (_cameraControl != nullptr)
{
return _cameraControl;
Serial.println("return _cameraControl;");
}
bool ok;
bool scanned = scan(false, 5);
// Step 2 - Specify your camera code exactly
BLEAddress address = BLEAddress("CC:86:EC:67:3F:3F");
Serial.println(address.toString().c_str());
if (scanned)
{
int count = _bleScan->getResults().getCount();
if (count > 0)
{
int foundIndex = count - 1;
address = _bleScan->getResults().getDevice(foundIndex).getAddress();
ok = connectToServer(address);
// Step 1.1 - Add a code - when connecting the pointers for the first time, the address of your camera
Serial.println("if (scanned) if (count > 0)");
Serial.println(address.toString().c_str());
}
}
else
{
// Step 1.2 - comment change address
//address = *getCameraAddress();
ok = connectToServer(address);
Serial.println("if (scanned) else");
Serial.println(address.toString().c_str());
}
if (ok)
{
setAuthentication(true);
_pref->begin(_name.c_str(), false);
_pref->putString("cameraAddress", address.toString().c_str());
_pref->putBool("authenticated", getAuthentication());
_pref->end();
setCameraAddress(address);
Serial.println("if (ok)");
Serial.println(address.toString().c_str());
return _cameraControl;
}
return nullptr;
}
The M5Stick pairs without a problem with the camera(BMPCC 4k) but after power cycling them ( turning the camera or the M5Stick off and on again), they do not reconnect. Sometimes, the M5Stack says connection successful and the camera says connection failed, other times nothing happens at all.
This is my code:
After adding the BMDConnection.clearPairing(); line i had a bit more success making them talk after the power cycle but no success reconnecting them.