forked from Archive/PX4-Autopilot
require MODULE_NAME
This commit is contained in:
parent
8d15da379b
commit
246b879aea
|
@ -212,7 +212,10 @@ function(px4_add_module)
|
|||
if(INCLUDES)
|
||||
target_include_directories(${MODULE}_original PRIVATE ${INCLUDES})
|
||||
endif()
|
||||
target_compile_definitions(${MODULE}_original PRIVATE PX4_MAIN=${MAIN}_app_main)
|
||||
target_compile_definitions(${MODULE}_original PRIVATE MODULE_NAME="${MAIN}_original")
|
||||
|
||||
# unity build
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp
|
||||
COMMAND cat ${SRCS} > ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp
|
||||
DEPENDS ${MODULE}_original ${DEPENDS} ${SRCS}
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace px4
|
|||
|
||||
void init(int argc, char *argv[], const char *process_name)
|
||||
{
|
||||
PX4_WARN("process: %s", process_name);
|
||||
printf("process: %s\n", process_name);
|
||||
}
|
||||
|
||||
uint64_t get_time_micros()
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
#include "px4_daemon/server.h"
|
||||
#include "px4_daemon/pxh.h"
|
||||
|
||||
#define MODULE_NAME "px4"
|
||||
|
||||
static const char *LOCK_FILE_PATH = "/tmp/px4_lock";
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ add_library(px4_layer
|
|||
drv_hrt.c
|
||||
${SHMEM_SRCS}
|
||||
)
|
||||
target_compile_definitions(px4_layer PRIVATE MODULE_NAME="px4")
|
||||
target_link_libraries(px4_layer PRIVATE work_queue)
|
||||
target_link_libraries(px4_layer PRIVATE px4_daemon)
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ hrt_tim_init(void)
|
|||
ret = sam_tc_clockselect(frequency, &cmr, &actual);
|
||||
|
||||
if (ret < 0) {
|
||||
PX4_PANIC("ERROR: Failed no divisor can be found (%d),for timer channel %d\n", ret, HRT_TIMER_CHANNEL);
|
||||
printf("ERROR: Failed no divisor can be found (%d),for timer channel %d\n", ret, HRT_TIMER_CHANNEL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ hrt_tim_init(void)
|
|||
hrt_tch = sam_tc_allocate(HRT_TIMER_CHANNEL, cmr);
|
||||
|
||||
if (!hrt_tch) {
|
||||
PX4_PANIC("ERROR: Failed to allocate timer channel %d\n", HRT_TIMER_CHANNEL);
|
||||
printf("ERROR: Failed to allocate timer channel %d\n", HRT_TIMER_CHANNEL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,11 +37,9 @@
|
|||
* Programmable multi-channel mixer library.
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
#include "mixer_load.h"
|
||||
|
||||
|
@ -54,7 +52,7 @@ int load_mixer_file(const char *fname, char *buf, unsigned maxlen)
|
|||
fp = fopen(fname, "r");
|
||||
|
||||
if (fp == NULL) {
|
||||
warnx("file not found");
|
||||
printf("file not found\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -100,7 +98,7 @@ int load_mixer_file(const char *fname, char *buf, unsigned maxlen)
|
|||
|
||||
/* if the line is too long to fit in the buffer, bail */
|
||||
if ((strlen(line) + strlen(buf) + 1) >= maxlen) {
|
||||
warnx("line too long");
|
||||
printf("line too long\n");
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include <cstdlib>
|
||||
|
||||
#define MODULE_NAME "px4"
|
||||
|
||||
extern "C" {
|
||||
|
||||
${builtin_apps_decl_string}
|
||||
|
|
|
@ -50,6 +50,7 @@ if (NOT "${OS}" MATCHES "nuttx")
|
|||
work_queue.c
|
||||
work_thread.c
|
||||
)
|
||||
target_compile_definitions(work_queue PRIVATE MODULE_NAME="work_queue")
|
||||
add_dependencies(work_queue prebuild_targets)
|
||||
|
||||
endif()
|
||||
|
|
|
@ -168,11 +168,6 @@ __END_DECLS
|
|||
#define __px4__log_printcond(cond, ...) if (cond) printf(__VA_ARGS__)
|
||||
#define __px4__log_printline(level, ...) printf(__VA_ARGS__)
|
||||
|
||||
|
||||
#ifndef MODULE_NAME
|
||||
#define MODULE_NAME "Unknown"
|
||||
#endif
|
||||
|
||||
#define __px4__log_timestamp_fmt "%-10" PRIu64 " "
|
||||
#define __px4__log_timestamp_arg ,hrt_absolute_time()
|
||||
#define __px4__log_level_fmt "%-5s "
|
||||
|
|
Loading…
Reference in New Issue