Skip to content

Commit

Permalink
Fixes, clean-up, linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kbx81 committed Oct 18, 2023
1 parent 3292b1e commit 71e77d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions esphome/components/improv_serial/improv_serial_component.cpp
Expand Up @@ -71,8 +71,7 @@ optional<uint8_t> ImprovSerialComponent::read_byte_() {
#endif // USE_ESP32_VARIANT_ESP32S2 || USE_ESP32_VARIANT_ESP32S3
#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32C6) || defined(USE_ESP32_VARIANT_ESP32S3)
case logger::UART_SELECTION_USB_SERIAL_JTAG: {
auto len = usb_serial_jtag_read_bytes((char *) &data, 1, 20 / portTICK_PERIOD_MS);
if (len) {
if (usb_serial_jtag_read_bytes((char *) &data, 1, 20 / portTICK_PERIOD_MS)) {
byte = data;
}
break;
Expand Down Expand Up @@ -119,8 +118,7 @@ void ImprovSerialComponent::write_data_(std::vector<uint8_t> &data) {
}

void ImprovSerialComponent::loop() {
const uint32_t now = millis();
if (this->last_read_byte_ && (now - this->last_read_byte_ > IMPROV_SERIAL_TIMEOUT)) {
if (this->last_read_byte_ && (millis() - this->last_read_byte_ > IMPROV_SERIAL_TIMEOUT)) {
this->last_read_byte_ = 0;
this->rx_buffer_.clear();
ESP_LOGV(TAG, "Improv Serial timeout");
Expand All @@ -129,8 +127,9 @@ void ImprovSerialComponent::loop() {
auto byte = this->read_byte_();
while (byte.has_value()) {
if (this->parse_improv_serial_byte_(byte.value())) {
this->last_read_byte_ = now;
this->last_read_byte_ = millis();
} else {
this->last_read_byte_ = 0;
this->rx_buffer_.clear();
}
byte = this->read_byte_();
Expand Down
4 changes: 2 additions & 2 deletions esphome/components/logger/logger.cpp
Expand Up @@ -10,8 +10,8 @@
#include "freertos/FreeRTOS.h"
#include "esp_idf_version.h"

#include <stdint.h>
#include <stdio.h>
#include <cstdint>
#include <cstdio>
#include <fcntl.h>

#endif // USE_ESP_IDF
Expand Down

0 comments on commit 71e77d9

Please sign in to comment.