File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed
Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 11if (ESP_PLATFORM)
22 # set component requirements for ESP32
3- set (COMPONENT_REQUIRES "format esp_timer" )
3+ set (COMPONENT_REQUIRES "format esp_timer log " )
44else ()
55 # set component requirements for generic
66 set (COMPONENT_REQUIRES "format" )
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ set(EXTRA_COMPONENT_DIRS
1212
1313set (
1414 COMPONENTS
15- "main esptool_py logger"
15+ "main esptool_py logger esp_vfs_console "
1616 CACHE STRING
1717 "List of components to include"
1818 )
Original file line number Diff line number Diff line change 77#include < string_view>
88
99#if defined(ESP_PLATFORM)
10- # include < esp_timer.h >
10+ // include sdkconfig before the rest
1111#include < sdkconfig.h>
12+
13+ // esp-idf includes
14+ #include < esp_log_timestamp.h>
15+ #include < esp_timer.h>
1216#endif
1317
1418#include " format.hpp"
@@ -419,10 +423,10 @@ rate limit. @note Only calls that have _rate_limited suffixed will be rate limit
419423 */
420424 static std::string get_time () {
421425#if defined(ESP_PLATFORM)
422- // use esp_timer_get_time to get the time in microseconds
423- uint64_t time = esp_timer_get_time ();
424- uint64_t seconds = time / 1e6f ;
425- uint64_t milliseconds = (time % 1000000 ) / 1e3f ;
426+ // use esp_log_timestamp to get the time in milliseconds
427+ uint64_t time = esp_log_timestamp ();
428+ uint64_t seconds = time / 1e3f ;
429+ uint64_t milliseconds = (time % 1'000 ) ;
426430 return fmt::format (" {}.{:03}" , seconds, milliseconds);
427431#else
428432 // get the elapsed time since the start of the logging system as floating
You can’t perform that action at this time.
0 commit comments