Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug BLE connection of the Heltec balancer #386

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions components/heltec_balancer_ble/heltec_balancer_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,14 @@ void HeltecBalancerBle::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt
break;
}
case ESP_GATTC_NOTIFY_EVT: {
if (param->notify.handle != this->char_handle_)
if (param->notify.handle != this->char_handle_) {
ESP_LOGVV(TAG, "Unhandled notification received (handle 0x%02X): %s", param->notify.handle,
format_hex_pretty(param->notify.value, param->notify.value_len).c_str());
break;
}

ESP_LOGVV(TAG, "Notification received (handle 0x%02X): %s", param->notify.handle,
format_hex_pretty(param->notify.value, param->notify.value_len).c_str());

this->assemble_(param->notify.value, param->notify.value_len);

Expand Down Expand Up @@ -814,7 +820,8 @@ bool HeltecBalancerBle::send_command(uint8_t function, uint8_t command, uint8_t
frame[18] = checksum_xor(frame, sizeof(frame) - 2);
frame[19] = END_OF_FRAME; // End sequence

ESP_LOGD(TAG, "Write register: %s", format_hex_pretty(frame, sizeof(frame)).c_str());
ESP_LOGD(TAG, "Send command (handle 0x%02X): %s", this->char_handle_,
format_hex_pretty(frame, sizeof(frame)).c_str());
auto status =
esp_ble_gattc_write_char(this->parent_->get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
sizeof(frame), frame, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);
Expand Down
Loading