Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 7 additions & 6 deletions components/ble_elm327/ble_elm327.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ void BleElm327Component::loop() {
void BleElm327Component::dump_config() {
ESP_LOGCONFIG(TAG, "BLE ELM327:");
ESP_LOGCONFIG(TAG, " MAC address : %s", this->parent_->address_str());
ESP_LOGCONFIG(TAG, " Service UUID : %s", service_uuid_.to_string().c_str());
ESP_LOGCONFIG(TAG, " RX Char UUID : %s", rx_char_uuid_.to_string().c_str());
ESP_LOGCONFIG(TAG, " TX Char UUID : %s", tx_char_uuid_.to_string().c_str());
ESP_LOGCONFIG(TAG, " TX delay : %ums", tx_delay_ms_);
ESP_LOGCONFIG(TAG, " Service UUID : %s", service_uuid_.to_str().c_str());
ESP_LOGCONFIG(TAG, " RX Char UUID : %s", rx_char_uuid_.to_str().c_str());
ESP_LOGCONFIG(TAG, " TX Char UUID : %s", tx_char_uuid_.to_str().c_str());
ESP_LOGCONFIG(TAG, " TX delay : %lums", (unsigned long) tx_delay_ms_);
ESP_LOGCONFIG(TAG, " Base init commands : ATZ, ATE0, ATL0, ATS0, ATH0, ATSP0");
ESP_LOGCONFIG(TAG, " Extra init commands: %u", (unsigned)extra_init_commands_.size());
ESP_LOGCONFIG(TAG, " Devices : %u", (unsigned)devices_.size());
Expand Down Expand Up @@ -172,7 +172,7 @@ void BleElm327Component::gattc_event_handler(esp_gattc_cb_event_t event, esp_gat

ESP_LOGI(TAG, "RX handle=%d TX handle=%d — registering notify", rx_char_handle_, tx_char_handle_);
auto status = esp_ble_gattc_register_for_notify(gattc_if_, remote_bda_, rx_char_handle_);
if (status != ESP_GATT_OK) ESP_LOGW(TAG, "Register notify failed: %d", status);
if (status != ESP_GATT_OK) { ESP_LOGW(TAG, "Register notify failed: %d", status); }
break;
}

Expand Down Expand Up @@ -200,8 +200,9 @@ void BleElm327Component::gattc_event_handler(esp_gattc_cb_event_t event, esp_gat
break;

case ESP_GATTC_WRITE_CHAR_EVT:
if (param->write.status != ESP_GATT_OK)
if (param->write.status != ESP_GATT_OK) {
ESP_LOGW(TAG, "Write failed, status=%d", param->write.status);
}
break;

default:
Expand Down
24 changes: 14 additions & 10 deletions components/divoom/divoom_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ void DivoomDisplay::dump_config()
LOG_DISPLAY("", "divoom", this);
ESP_LOGCONFIG(TAG, " Width: %d, Height: %d", this->width_, this->height_);
ESP_LOGCONFIG(TAG, " MAC address : %s", this->parent_->address_str().c_str());
ESP_LOGCONFIG(TAG, " Service UUID : %s", this->service_uuid_.to_string().c_str());
ESP_LOGCONFIG(TAG, " Characteristic UUID: %s", this->char_uuid_.to_string().c_str());
ESP_LOGCONFIG(TAG, " Service UUID : %s", this->service_uuid_.to_str().c_str());
ESP_LOGCONFIG(TAG, " Characteristic UUID: %s", this->char_uuid_.to_str().c_str());
ESP_LOGCONFIG(TAG, " Update Interval: %u ms", this->get_update_interval());
}

Expand Down Expand Up @@ -64,33 +64,37 @@ void DivoomDisplay::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
connected_ = true;
if (this->bt_connected_) this->bt_connected_->publish_state(connected_);
this->client_state_ = espbt::ClientState::ESTABLISHED;
ESP_LOGW(TAG, "[%s] Connected successfully!", this->char_uuid_.to_string().c_str());
ESP_LOGW(TAG, "[%s] Connected successfully!", this->char_uuid_.to_str().c_str());
break;
case ESP_GATTC_DISCONNECT_EVT:
connected_ = false;
synced_time_ = false;
old_image_buffer_.clear();
if (this->bt_connected_) this->bt_connected_->publish_state(connected_);
ESP_LOGW(TAG, "[%s] Disconnected", this->char_uuid_.to_string().c_str());
ESP_LOGW(TAG, "[%s] Disconnected", this->char_uuid_.to_str().c_str());
this->client_state_ = espbt::ClientState::IDLE;
break;
case ESP_GATTC_WRITE_CHAR_EVT:
case ESP_GATTC_WRITE_CHAR_EVT:
{
if (param->write.status == 0)
{
break;
}
auto *chr = this->parent()->get_characteristic(this->service_uuid_, this->char_uuid_);
if (chr == nullptr)
if (chr == nullptr)
{
ESP_LOGW(TAG, "[%s] Characteristic not found.", this->char_uuid_.to_string().c_str());
ESP_LOGW(TAG, "[%s] Characteristic not found.", this->char_uuid_.to_str().c_str());
break;
}
if (param->write.handle == chr->handle)
{
ESP_LOGW(TAG, "[%s] Write error, status=%d", this->char_uuid_.to_string().c_str(), param->write.status);
ESP_LOGW(TAG, "[%s] Write error, status=%d", this->char_uuid_.to_str().c_str(), param->write.status);
}
break;
}
default:
break;
}
}

unsigned long DivoomDisplay::elapsed_time(const unsigned long timer)
Expand Down Expand Up @@ -280,13 +284,13 @@ bool DivoomDisplay::write_data(std::vector<uint8_t> &data)
{
if (this->client_state_ != espbt::ClientState::ESTABLISHED)
{
ESP_LOGW(TAG, "[%s] Not connected to BLE client. State update can not be written.", this->char_uuid_.to_string().c_str());
ESP_LOGW(TAG, "[%s] Not connected to BLE client. State update can not be written.", this->char_uuid_.to_str().c_str());
return false;
}
auto *chr = this->parent()->get_characteristic(this->service_uuid_, this->char_uuid_);
if (chr == nullptr)
{
ESP_LOGW(TAG, "[%s] Characteristic not found. State update can not be written.", this->char_uuid_.to_string().c_str());
ESP_LOGW(TAG, "[%s] Characteristic not found. State update can not be written.", this->char_uuid_.to_str().c_str());
return false;
}
if (this->require_response_)
Expand Down
4 changes: 4 additions & 0 deletions components/uartex/lock/uartex_lock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ void UARTExLock::control(const lock::LockCall& call)
break;
case lock::LOCK_STATE_JAMMED:
break;
case lock::LOCK_STATE_OPEN:
break;
case lock::LOCK_STATE_OPENING:
break;
}
publish_state(this->state);
}
Expand Down
9 changes: 9 additions & 0 deletions components/uartex/media_player/uartex_media_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ void UARTExMediaPlayer::control(const media_player::MediaPlayerCall &call)
case media_player::MEDIA_PLAYER_COMMAND_CLEAR_PLAYLIST :
enqueue_tx_cmd(get_command_clear_playlist());
break;
case media_player::MEDIA_PLAYER_COMMAND_TURN_ON:
case media_player::MEDIA_PLAYER_COMMAND_TURN_OFF:
case media_player::MEDIA_PLAYER_COMMAND_NEXT:
case media_player::MEDIA_PLAYER_COMMAND_PREVIOUS:
case media_player::MEDIA_PLAYER_COMMAND_REPEAT_ALL:
case media_player::MEDIA_PLAYER_COMMAND_SHUFFLE:
case media_player::MEDIA_PLAYER_COMMAND_UNSHUFFLE:
case media_player::MEDIA_PLAYER_COMMAND_GROUP_JOIN:
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion components/uartex/select/uartex_select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void UARTExSelect::setup()
size_t index = this->initial_option_index_;
if (this->restore_value_)
{
this->pref_ = this->pref_ = this->make_entity_preference<size_t>();
this->pref_ = this->make_entity_preference<size_t>();
size_t restored_index;
if (this->pref_.load(&restored_index) && this->has_index(restored_index))
{
Expand Down
2 changes: 1 addition & 1 deletion components/uartex/uartex_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ void log_config(const char* tag, const char* title, const state_t* state)
{
if (state == nullptr) return;
ESP_LOGCONFIG(tag, "%s: %s, offset: %d, inverted: %s", title, to_hex_string(state->data).c_str(), state->offset, YESNO(state->inverted));
if (!state->mask.empty()) ESP_LOGCONFIG(tag, "%s mask: %s", title, to_hex_string(state->mask).c_str());
if (!state->mask.empty()) { ESP_LOGCONFIG(tag, "%s mask: %s", title, to_hex_string(state->mask).c_str()); }
}

void log_config(const char* tag, const char* title, const state_num_t* state_num)
Expand Down
Loading