mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 00:18:11 +01:00
* Fix build failures for logger component on host platform * Add climits header * Restore logger functionality on host * Install libsodium in ci
This commit is contained in:
parent
90f416bd0d
commit
0bc645ded7
8 changed files with 33 additions and 0 deletions
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
|
@ -433,6 +433,9 @@ jobs:
|
|||
matrix:
|
||||
file: ${{ fromJson(needs.list-components.outputs.matrix) }}
|
||||
steps:
|
||||
- name: Install libsodium
|
||||
run: sudo apt-get install libsodium-dev
|
||||
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
- name: Restore Python
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/version.h"
|
||||
#include <cinttypes>
|
||||
#include <climits>
|
||||
|
||||
#ifdef USE_ESP32
|
||||
|
||||
|
@ -49,6 +50,8 @@ static uint32_t get_free_heap() {
|
|||
return rp2040.getFreeHeap();
|
||||
#elif defined(USE_LIBRETINY)
|
||||
return lt_heap_get_free();
|
||||
#elif defined(USE_HOST)
|
||||
return INT_MAX;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -144,6 +144,8 @@ def uart_selection(value):
|
|||
component = get_libretiny_component()
|
||||
if component in UART_SELECTION_LIBRETINY:
|
||||
return cv.one_of(*UART_SELECTION_LIBRETINY[component], upper=True)(value)
|
||||
if CORE.is_host:
|
||||
raise cv.Invalid("Uart selection not valid for host platform")
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
|
|
|
@ -146,8 +146,10 @@ const char *const LOG_LEVELS[] = {"NONE", "ERROR", "WARN", "INFO", "CONFIG", "DE
|
|||
void Logger::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Logger:");
|
||||
ESP_LOGCONFIG(TAG, " Level: %s", LOG_LEVELS[ESPHOME_LOG_LEVEL]);
|
||||
#ifndef USE_HOST
|
||||
ESP_LOGCONFIG(TAG, " Log Baud Rate: %" PRIu32, this->baud_rate_);
|
||||
ESP_LOGCONFIG(TAG, " Hardware UART: %s", get_uart_selection_());
|
||||
#endif
|
||||
|
||||
for (auto &it : this->log_levels_) {
|
||||
ESP_LOGCONFIG(TAG, " Level for '%s': %s", it.tag.c_str(), LOG_LEVELS[it.level]);
|
||||
|
|
|
@ -137,7 +137,9 @@ class Logger : public Component {
|
|||
va_end(arg);
|
||||
}
|
||||
|
||||
#ifndef USE_HOST
|
||||
const char *get_uart_selection_();
|
||||
#endif
|
||||
|
||||
uint32_t baud_rate_;
|
||||
char *tx_buffer_{nullptr};
|
||||
|
|
|
@ -16,6 +16,8 @@ void HOT Logger::write_msg_(const char *msg) {
|
|||
puts(msg);
|
||||
}
|
||||
|
||||
void Logger::pre_setup() { global_logger = this; }
|
||||
|
||||
} // namespace logger
|
||||
} // namespace esphome
|
||||
|
||||
|
|
1
tests/components/debug/test.host.yaml
Normal file
1
tests/components/debug/test.host.yaml
Normal file
|
@ -0,0 +1 @@
|
|||
debug:
|
18
tests/test_build_components/build_components_base.host.yaml
Normal file
18
tests/test_build_components/build_components_base.host.yaml
Normal file
|
@ -0,0 +1,18 @@
|
|||
esphome:
|
||||
name: componenttesthost
|
||||
friendly_name: $component_name
|
||||
|
||||
host:
|
||||
mac_address: "62:23:45:AF:B3:DD"
|
||||
|
||||
logger:
|
||||
level: VERY_VERBOSE
|
||||
|
||||
packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_name: $component_name
|
||||
test_name: $test_name
|
||||
target_platform: $target_platform
|
||||
component_test_file: $component_test_file
|
Loading…
Reference in a new issue