From c8b4959c63e793fcf3c1f99b1277e98355fd6c0f Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Thu, 20 Apr 2023 11:27:51 +0200 Subject: [PATCH] Rename uart0 to uart_0 (#37) --- .github/workflows/ci.yaml | 2 ++ components/esp32_ble_client/ble_client_base.cpp | 8 ++++---- components/esp32_ble_client/ble_client_base.h | 9 +++++---- esp8266-charger-example-debug.yaml | 2 +- esp8266-charger-example.yaml | 4 ++-- esp8266-charging-converter-example-debug.yaml | 2 +- esp8266-charging-converter-example.yaml | 4 ++-- esp8266-smart-shunt-example-debug.yaml | 2 +- esp8266-smart-shunt-example.yaml | 4 ++-- esp8266-solar-charger-example-debug.yaml | 2 +- esp8266-solar-charger-example.yaml | 4 ++-- 11 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 67182ab..9b5f842 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -125,6 +125,8 @@ jobs: git commit -a -m "Add external component" working-directory: ${{ env.esphome_directory }} + - name: Add missing requirements + run: pip3 install setuptools wheel - name: Set up python environment run: VIRTUAL_ENV=false script/setup working-directory: ${{ env.esphome_directory }} diff --git a/components/esp32_ble_client/ble_client_base.cpp b/components/esp32_ble_client/ble_client_base.cpp index 4c689b3..4efa847 100644 --- a/components/esp32_ble_client/ble_client_base.cpp +++ b/components/esp32_ble_client/ble_client_base.cpp @@ -337,18 +337,18 @@ float BLEClientBase::parse_char_value(uint8_t *value, uint16_t length) { case 0xD: // int12. case 0xE: // int16. if (length > 2) { - return (float) ((int16_t)(value[1] << 8) + (int16_t) value[2]); + return (float) ((int16_t) (value[1] << 8) + (int16_t) value[2]); } // fall through case 0xF: // int24. if (length > 3) { - return (float) ((int32_t)(value[1] << 16) + (int32_t)(value[2] << 8) + (int32_t)(value[3])); + return (float) ((int32_t) (value[1] << 16) + (int32_t) (value[2] << 8) + (int32_t) (value[3])); } // fall through case 0x10: // int32. if (length > 4) { - return (float) ((int32_t)(value[1] << 24) + (int32_t)(value[2] << 16) + (int32_t)(value[3] << 8) + - (int32_t)(value[4])); + return (float) ((int32_t) (value[1] << 24) + (int32_t) (value[2] << 16) + (int32_t) (value[3] << 8) + + (int32_t) (value[4])); } } ESP_LOGW(TAG, "[%d] [%s] Cannot parse characteristic value of type 0x%x length %d", this->connection_index_, diff --git a/components/esp32_ble_client/ble_client_base.h b/components/esp32_ble_client/ble_client_base.h index 98c7086..2317796 100644 --- a/components/esp32_ble_client/ble_client_base.h +++ b/components/esp32_ble_client/ble_client_base.h @@ -44,10 +44,11 @@ class BLEClientBase : public espbt::ESPBTClient, public Component { memset(this->remote_bda_, 0, sizeof(this->remote_bda_)); this->address_str_ = ""; } else { - this->address_str_ = str_snprintf("%02X:%02X:%02X:%02X:%02X:%02X", 17, (uint8_t)(this->address_ >> 40) & 0xff, - (uint8_t)(this->address_ >> 32) & 0xff, (uint8_t)(this->address_ >> 24) & 0xff, - (uint8_t)(this->address_ >> 16) & 0xff, (uint8_t)(this->address_ >> 8) & 0xff, - (uint8_t)(this->address_ >> 0) & 0xff); + this->address_str_ = + str_snprintf("%02X:%02X:%02X:%02X:%02X:%02X", 17, (uint8_t) (this->address_ >> 40) & 0xff, + (uint8_t) (this->address_ >> 32) & 0xff, (uint8_t) (this->address_ >> 24) & 0xff, + (uint8_t) (this->address_ >> 16) & 0xff, (uint8_t) (this->address_ >> 8) & 0xff, + (uint8_t) (this->address_ >> 0) & 0xff); } } void set_pin_code(uint32_t pin_code) { pin_code_ = pin_code; } diff --git a/esp8266-charger-example-debug.yaml b/esp8266-charger-example-debug.yaml index b17f80d..fa32067 100644 --- a/esp8266-charger-example-debug.yaml +++ b/esp8266-charger-example-debug.yaml @@ -18,7 +18,7 @@ logger: api: INFO uart: - - id: uart0 + - id: uart_0 baud_rate: 1000 tx_pin: ${tx_pin} rx_pin: ${rx_pin} diff --git a/esp8266-charger-example.yaml b/esp8266-charger-example.yaml index 13b2790..88c2c89 100644 --- a/esp8266-charger-example.yaml +++ b/esp8266-charger-example.yaml @@ -40,14 +40,14 @@ mqtt: # api: uart: - - id: uart0 + - id: uart_0 baud_rate: 1000 tx_pin: ${tx_pin} rx_pin: ${rx_pin} votronic: - id: votronic0 - uart_id: uart0 + uart_id: uart_0 rx_timeout: ${rx_timeout} throttle: 2s diff --git a/esp8266-charging-converter-example-debug.yaml b/esp8266-charging-converter-example-debug.yaml index b46b05d..4bf0444 100644 --- a/esp8266-charging-converter-example-debug.yaml +++ b/esp8266-charging-converter-example-debug.yaml @@ -18,7 +18,7 @@ logger: api: INFO uart: - - id: uart0 + - id: uart_0 baud_rate: 1000 tx_pin: ${tx_pin} rx_pin: ${rx_pin} diff --git a/esp8266-charging-converter-example.yaml b/esp8266-charging-converter-example.yaml index 13b2790..88c2c89 100644 --- a/esp8266-charging-converter-example.yaml +++ b/esp8266-charging-converter-example.yaml @@ -40,14 +40,14 @@ mqtt: # api: uart: - - id: uart0 + - id: uart_0 baud_rate: 1000 tx_pin: ${tx_pin} rx_pin: ${rx_pin} votronic: - id: votronic0 - uart_id: uart0 + uart_id: uart_0 rx_timeout: ${rx_timeout} throttle: 2s diff --git a/esp8266-smart-shunt-example-debug.yaml b/esp8266-smart-shunt-example-debug.yaml index 447eb49..c926660 100644 --- a/esp8266-smart-shunt-example-debug.yaml +++ b/esp8266-smart-shunt-example-debug.yaml @@ -18,7 +18,7 @@ logger: api: INFO uart: - - id: uart0 + - id: uart_0 baud_rate: 1000 tx_pin: ${tx_pin} rx_pin: ${rx_pin} diff --git a/esp8266-smart-shunt-example.yaml b/esp8266-smart-shunt-example.yaml index dce4838..849157e 100644 --- a/esp8266-smart-shunt-example.yaml +++ b/esp8266-smart-shunt-example.yaml @@ -37,14 +37,14 @@ mqtt: id: mqtt_client uart: - - id: uart0 + - id: uart_0 baud_rate: 1000 tx_pin: ${tx_pin} rx_pin: ${rx_pin} votronic: - id: votronic0 - uart_id: uart0 + uart_id: uart_0 rx_timeout: ${rx_timeout} throttle: 2s diff --git a/esp8266-solar-charger-example-debug.yaml b/esp8266-solar-charger-example-debug.yaml index 494b65a..2adff55 100644 --- a/esp8266-solar-charger-example-debug.yaml +++ b/esp8266-solar-charger-example-debug.yaml @@ -18,7 +18,7 @@ logger: api: INFO uart: - - id: uart0 + - id: uart_0 baud_rate: 1000 tx_pin: ${tx_pin} rx_pin: ${rx_pin} diff --git a/esp8266-solar-charger-example.yaml b/esp8266-solar-charger-example.yaml index a68af45..7092ce9 100644 --- a/esp8266-solar-charger-example.yaml +++ b/esp8266-solar-charger-example.yaml @@ -40,14 +40,14 @@ mqtt: # api: uart: - - id: uart0 + - id: uart_0 baud_rate: 1000 tx_pin: ${tx_pin} rx_pin: ${rx_pin} votronic: - id: votronic0 - uart_id: uart0 + uart_id: uart_0 rx_timeout: ${rx_timeout} throttle: 2s