Skip to content

Commit

Permalink
Adjust connection parameters to increase communication range. (#117)
Browse files Browse the repository at this point in the history
Increase the latency to 1 (from default 0).
Double the supervision timeout (so disconnection isn't as sensitive).
  • Loading branch information
gkoh authored Aug 16, 2024
1 parent d95e8f1 commit d728312
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/furble/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace Furble {

bool Camera::connect(esp_power_level_t power, progressFunc pFunc, void *pCtx) {
// try extending range by adjusting connection parameters
m_Client->updateConnParams(m_MinInterval, m_MaxInterval, m_Latency, m_Timeout);
bool connected = this->connect(pFunc, pCtx);
if (connected) {
// Set BLE transmit power after connection is established.
Expand Down
6 changes: 6 additions & 0 deletions lib/furble/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ class Camera {
void updateProgress(progressFunc pFunc, void *ctx, float value);

private:
const uint16_t m_MinInterval = BLE_GAP_INITIAL_CONN_ITVL_MIN;
const uint16_t m_MaxInterval = BLE_GAP_INITIAL_CONN_ITVL_MAX;
// allow a packet to skip
const uint16_t m_Latency = 1;
// double the disconnect timeout
const uint16_t m_Timeout = (2 * BLE_GAP_INITIAL_SUPERVISION_TIMEOUT);
};
} // namespace Furble

Expand Down

0 comments on commit d728312

Please sign in to comment.