Skip to content

Commit

Permalink
Add current task name to debug_x output
Browse files Browse the repository at this point in the history
  • Loading branch information
mikee47 committed Nov 20, 2024
1 parent 6d94935 commit e1ea578
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sming/Arch/Esp32/Components/esp32/src/include/esp_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ unsigned long os_random(void);

int os_get_random(unsigned char* buf, size_t len);

const char* os_get_task_name();

#ifdef __cplusplus
}
#endif
5 changes: 5 additions & 0 deletions Sming/Arch/Esp32/Components/esp32/src/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,8 @@ int WEAK_ATTR os_get_random(unsigned char* buf, size_t len)
esp_fill_random(buf, len);
return 0;
}

const char* os_get_task_name()
{
return pcTaskGetName(xTaskGetCurrentTaskHandle());
}
8 changes: 8 additions & 0 deletions Sming/System/include/debug_progmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
extern "C" {
#endif

extern const char* os_get_task_name();

//This enables or disables logging
//Can be overridden in Makefile
#ifndef DEBUG_BUILD
Expand Down Expand Up @@ -73,6 +75,12 @@ extern uint32_t system_get_time();
PSTR_ARRAY(fmtbuf, "[" MACROQUOTE(CUST_FILE_BASE) ":%d] " fmt "\r\n"); \
m_printf(fmtbuf, __LINE__, ##__VA_ARGS__); \
}))
#elif defined(ARCH_ESP32)
#define debug_e(fmt, ...) \
(__extension__({ \
PSTR_ARRAY(fmtbuf, "%u %s " fmt "\r\n"); \
m_printf(fmtbuf, system_get_time(), os_get_task_name(), ##__VA_ARGS__); \
}))
#else
#define debug_e(fmt, ...) \
(__extension__({ \
Expand Down

0 comments on commit e1ea578

Please sign in to comment.