[pipsolar] clang-tidy fixes for #7822 (#7855)

This commit is contained in:
Keith Burzinski 2024-11-26 04:00:40 -06:00 committed by GitHub
parent bdc6302ea1
commit 4c383906c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -790,7 +790,7 @@ uint8_t Pipsolar::check_incoming_crc_() {
// send next command used
uint8_t Pipsolar::send_next_command_() {
uint16_t crc16;
if (this->command_queue_[this->command_queue_position_].length() != 0) {
if (!this->command_queue_[this->command_queue_position_].empty()) {
const char *command = this->command_queue_[this->command_queue_position_].c_str();
uint8_t byte_command[16];
uint8_t length = this->command_queue_[this->command_queue_position_].length();
@ -846,7 +846,7 @@ void Pipsolar::queue_command_(const char *command, uint8_t length) {
uint8_t next_position = command_queue_position_;
for (uint8_t i = 0; i < COMMAND_QUEUE_LENGTH; i++) {
uint8_t testposition = (next_position + i) % COMMAND_QUEUE_LENGTH;
if (command_queue_[testposition].length() == 0) {
if (command_queue_[testposition].empty()) {
command_queue_[testposition] = command;
ESP_LOGD(TAG, "Command queued successfully: %s with length %u at position %d", command,
command_queue_[testposition].length(), testposition);

View file

@ -10,11 +10,11 @@ static const char *const TAG = "pipsolar.switch";
void PipsolarSwitch::dump_config() { LOG_SWITCH("", "Pipsolar Switch", this); }
void PipsolarSwitch::write_state(bool state) {
if (state) {
if (this->on_command_.length() > 0) {
if (!this->on_command_.empty()) {
this->parent_->switch_command(this->on_command_);
}
} else {
if (this->off_command_.length() > 0) {
if (!this->off_command_.empty()) {
this->parent_->switch_command(this->off_command_);
}
}