1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-04 09:48:16 +00:00

fix some CI Lint requests

This commit is contained in:
NP v/d Spek 2024-10-06 02:26:32 +02:00
parent 75b49b3702
commit fcffaa5857
2 changed files with 6 additions and 5 deletions

View File

@ -172,14 +172,14 @@ esp_err_t ESPNowComponent::del_peer(uint64_t addr) {
ESPNowDefaultProtocol *ESPNowComponent::get_default_protocol() { ESPNowDefaultProtocol *ESPNowComponent::get_default_protocol() {
if (this->protocols_[ESPNOW_MAIN_PROTOCOL_ID] == nullptr) { if (this->protocols_[ESPNOW_MAIN_PROTOCOL_ID] == nullptr) {
this->register_protocol(new ESPNowDefaultProtocol()); this->register_protocol(new ESPNowDefaultProtocol()); // NOLINT
} }
return (ESPNowDefaultProtocol *) this->protocols_[ESPNOW_MAIN_PROTOCOL_ID]; return (ESPNowDefaultProtocol *) this->protocols_[ESPNOW_MAIN_PROTOCOL_ID];
} }
ESPNowProtocol *ESPNowComponent::get_protocol_component_(uint32_t protocol) { ESPNowProtocol *ESPNowComponent::get_protocol_component_(uint32_t protocol) {
if (this->protocols_[protocol] == nullptr) { if (this->protocols_[protocol] == nullptr) {
ESP_LOGE(TAG, "Protocol for '%06lx' is not registered", protocol); ESP_LOGE(TAG, "Protocol for '%06" PRIx32 "' is not registered", protocol);
return nullptr; return nullptr;
} }
return this->protocols_[protocol]; return this->protocols_[protocol];

View File

@ -113,7 +113,7 @@ struct ESPNowPacket {
} }
protected: protected:
static uint32_t protocol_(uint8_t *protocol) { static uint32_t protocol_(const uint8_t *protocol) {
return (*(protocol + 2) << 0) + (*(protocol + 1) << 8) + (*(protocol + 0) << 16); return (*(protocol + 2) << 0) + (*(protocol + 1) << 8) + (*(protocol + 0) << 16);
} }
}; };
@ -276,10 +276,11 @@ template<typename... Ts> class SendAction : public Action<Ts...>, public Parente
} }
if (this->static_) { if (this->static_) {
this->parent_->get_default_protocol()->send(mac, this->data_static_.data(), this->data_static_.size()); this->parent_->get_default_protocol()->send(mac, this->data_static_.data(), this->data_static_.size(), command);
} else { } else {
ByteBuffer data = this->data_func_(x...); ByteBuffer data = this->data_func_(x...);
this->parent_->get_default_protocol()->send(mac, data.get_data().data(), (uint8_t) data.get_used_space()); this->parent_->get_default_protocol()->send(mac, data.get_data().data(), (uint8_t) data.get_used_space(),
command);
} }
} }