forked from Archive/PX4-Autopilot
POSIX: Fixed orb_advertise failure
There were an insufficient number of devmap entries allocated and when they ran out, new orb_advertise requests would fail. Also added a new logging macro for the Linux build to show the calling pthread if enabled. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
parent
2d22e8325d
commit
f1f562a94d
|
@ -64,7 +64,7 @@ private:
|
||||||
px4_dev_t() {}
|
px4_dev_t() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PX4_MAX_DEV 30
|
#define PX4_MAX_DEV 50
|
||||||
static px4_dev_t *devmap[PX4_MAX_DEV];
|
static px4_dev_t *devmap[PX4_MAX_DEV];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -99,7 +99,7 @@ VDev::~VDev()
|
||||||
int
|
int
|
||||||
VDev::register_class_devname(const char *class_devname)
|
VDev::register_class_devname(const char *class_devname)
|
||||||
{
|
{
|
||||||
PX4_DEBUG("VDev::register_class_devname");
|
PX4_DEBUG("VDev::register_class_devname %s", class_devname);
|
||||||
if (class_devname == nullptr) {
|
if (class_devname == nullptr) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ VDev::register_class_devname(const char *class_devname)
|
||||||
int
|
int
|
||||||
VDev::register_driver(const char *name, void *data)
|
VDev::register_driver(const char *name, void *data)
|
||||||
{
|
{
|
||||||
PX4_DEBUG("VDev::register_driver");
|
PX4_DEBUG("VDev::register_driver %s", name);
|
||||||
int ret = -ENOSPC;
|
int ret = -ENOSPC;
|
||||||
|
|
||||||
if (name == NULL || data == NULL)
|
if (name == NULL || data == NULL)
|
||||||
|
@ -145,14 +145,17 @@ VDev::register_driver(const char *name, void *data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ret != PX4_OK) {
|
||||||
|
PX4_ERR("No free devmap entries - increase PX4_MAX_DEV");
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
VDev::unregister_driver(const char *name)
|
VDev::unregister_driver(const char *name)
|
||||||
{
|
{
|
||||||
PX4_DEBUG("VDev::unregister_driver");
|
PX4_DEBUG("VDev::unregister_driver %s", name);
|
||||||
int ret = -ENOSPC;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -63,6 +63,9 @@ Simulator *Simulator::getInstance()
|
||||||
|
|
||||||
bool Simulator::getMPUReport(uint8_t *buf, int len)
|
bool Simulator::getMPUReport(uint8_t *buf, int len)
|
||||||
{
|
{
|
||||||
|
// Reads are paced from reading gyrosim and if
|
||||||
|
// we don't delay here we read too fast
|
||||||
|
usleep(50000);
|
||||||
return _mpu.copyData(buf, len);
|
return _mpu.copyData(buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,10 +138,11 @@ static void work_process(FAR struct wqueue_s *wqueue, int lock_id)
|
||||||
|
|
||||||
work_unlock(lock_id);
|
work_unlock(lock_id);
|
||||||
if (!worker) {
|
if (!worker) {
|
||||||
printf("MESSED UP: worker = 0\n");
|
PX4_ERR("MESSED UP: worker = 0");
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
worker(arg);
|
worker(arg);
|
||||||
|
}
|
||||||
|
|
||||||
/* Now, unfortunately, since we re-enabled interrupts we don't
|
/* Now, unfortunately, since we re-enabled interrupts we don't
|
||||||
* know the state of the work list and we will have to start
|
* know the state of the work list and we will have to start
|
||||||
|
|
|
@ -50,19 +50,24 @@
|
||||||
printf(__VA_ARGS__);\
|
printf(__VA_ARGS__);\
|
||||||
printf(" (file %s line %d)\n", __FILE__, __LINE__);\
|
printf(" (file %s line %d)\n", __FILE__, __LINE__);\
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__PX4_QURT)
|
#if defined(__PX4_QURT)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define PX4_DEBUG(...) __px4_log_omit("DEBUG", __VA_ARGS__);
|
#define PX4_DEBUG(...) __px4_log_verbose("DEBUG", __VA_ARGS__);
|
||||||
#define PX4_INFO(...) __px4_log("INFO", __VA_ARGS__);
|
#define PX4_INFO(...) __px4_log("INFO", __VA_ARGS__);
|
||||||
#define PX4_WARN(...) __px4_log_verbose("WARN", __VA_ARGS__);
|
#define PX4_WARN(...) __px4_log_verbose("WARN", __VA_ARGS__);
|
||||||
#define PX4_ERR(...) __px4_log_verbose("ERROR", __VA_ARGS__);
|
#define PX4_ERR(...) __px4_log_verbose("ERROR", __VA_ARGS__);
|
||||||
|
|
||||||
#elif defined(__PX4_LINUX)
|
#elif defined(__PX4_LINUX)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#define __px4_log_threads(level, ...) { \
|
||||||
|
printf("%-5s %ld ", level, pthread_self());\
|
||||||
|
printf(__VA_ARGS__);\
|
||||||
|
printf(" (file %s line %d)\n", __FILE__, __LINE__);\
|
||||||
|
}
|
||||||
|
|
||||||
//#define PX4_DEBUG(...) { }
|
|
||||||
#define PX4_DEBUG(...) __px4_log_omit("DEBUG", __VA_ARGS__);
|
#define PX4_DEBUG(...) __px4_log_omit("DEBUG", __VA_ARGS__);
|
||||||
#define PX4_INFO(...) __px4_log("INFO", __VA_ARGS__);
|
#define PX4_INFO(...) __px4_log("INFO", __VA_ARGS__);
|
||||||
#define PX4_WARN(...) __px4_log_verbose("WARN", __VA_ARGS__);
|
#define PX4_WARN(...) __px4_log_verbose("WARN", __VA_ARGS__);
|
||||||
|
|
Loading…
Reference in New Issue