uavcannode updates and px4_fmu-v4_cannode example

- drivers/uavcannode add baro, mag, gps publications
 - delete old px4_cannode-v1 board
 - add stripped down simple rcS for CAN nodes
This commit is contained in:
Daniel Agar
2020-02-16 12:11:54 -05:00
committed by GitHub
parent 342e0da796
commit d7c3e1066a
54 changed files with 1137 additions and 3184 deletions

View File

@@ -59,13 +59,8 @@
#include <perf/perf_counter.h>
#include <systemlib/uthash/utarray.h>
//#define PARAM_NO_ORB ///< if defined, avoid uorb dependency. This disables publication of parameter_update on param change
//#define PARAM_NO_AUTOSAVE ///< if defined, do not autosave (avoids LP work queue dependency)
#if !defined(PARAM_NO_ORB)
# include "uORB/uORB.h"
# include "uORB/topics/parameter_update.h"
#endif
#include "uORB/uORB.h"
#include "uORB/topics/parameter_update.h"
#if defined(FLASH_BASED_PARAMS)
#include "flashparams/flashparams.h"
@@ -90,14 +85,12 @@ static char *param_user_file = nullptr;
#endif
#define PARAM_CLOSE close
#ifndef PARAM_NO_AUTOSAVE
#include <px4_platform_common/workqueue.h>
/* autosaving variables */
static hrt_abstime last_autosave_timestamp = 0;
static struct work_s autosave_work;
static bool autosave_scheduled = false;
static bool autosave_disabled = false;
#endif /* PARAM_NO_AUTOSAVE */
/**
* Array of static parameter info.
@@ -156,11 +149,8 @@ UT_array *param_values{nullptr};
/** array info for the modified parameters array */
const UT_icd param_icd = {sizeof(param_wbuf_s), nullptr, nullptr, nullptr};
#if !defined(PARAM_NO_ORB)
/** parameter update topic handle */
static orb_advert_t param_topic = nullptr;
static unsigned int param_instance = 0;
#endif
static void param_set_used_internal(param_t param);
@@ -330,7 +320,6 @@ param_find_changed(param_t param)
static void
_param_notify_changes()
{
#if !defined(PARAM_NO_ORB)
parameter_update_s pup = {};
pup.timestamp = hrt_absolute_time();
pup.instance = param_instance++;
@@ -345,8 +334,6 @@ _param_notify_changes()
} else {
orb_publish(ORB_ID(parameter_update), param_topic, &pup);
}
#endif
}
void
@@ -663,7 +650,6 @@ param_get(param_t param, void *val)
return result;
}
#ifndef PARAM_NO_AUTOSAVE
/**
* worker callback method to save the parameters
* @param arg unused
@@ -690,7 +676,6 @@ autosave_worker(void *arg)
PX4_ERR("param save failed (%i)", ret);
}
}
#endif /* PARAM_NO_AUTOSAVE */
/**
* Automatically save the parameters after a timeout and limited rate.
@@ -701,8 +686,6 @@ autosave_worker(void *arg)
static void
param_autosave()
{
#ifndef PARAM_NO_AUTOSAVE
if (autosave_scheduled || autosave_disabled) {
return;
}
@@ -722,13 +705,11 @@ param_autosave()
autosave_scheduled = true;
work_queue(LPWORK, &autosave_work, (worker_t)&autosave_worker, nullptr, USEC2TICK(delay));
#endif /* PARAM_NO_AUTOSAVE */
}
void
param_control_autosave(bool enable)
{
#ifndef PARAM_NO_AUTOSAVE
param_lock_writer();
if (!enable && autosave_scheduled) {
@@ -738,7 +719,6 @@ param_control_autosave(bool enable)
autosave_disabled = !enable;
param_unlock_writer();
#endif /* PARAM_NO_AUTOSAVE */
}
static int
@@ -1497,15 +1477,12 @@ void param_print_status()
utarray_len(param_values), param_values->n, param_values->n * sizeof(UT_icd));
}
#ifndef PARAM_NO_AUTOSAVE
PX4_INFO("auto save: %s", autosave_disabled ? "off" : "on");
if (!autosave_disabled && (last_autosave_timestamp > 0)) {
PX4_INFO("last auto save: %.3f seconds ago", hrt_elapsed_time(&last_autosave_timestamp) * 1e-6);
}
#endif /* PARAM_NO_AUTOSAVE */
perf_print_counter(param_export_perf);
perf_print_counter(param_find_perf);
perf_print_counter(param_get_perf);