Skip to content
Snippets Groups Projects
Commit 99ce9cc2 authored by bresch's avatar bresch Committed by Roman Bapst
Browse files

Airmode - Add support for UAVCAN

parent 6976232a
No related branches found
No related tags found
No related merge requests found
......@@ -417,6 +417,20 @@ int UavcanNode::get_param(int remote_node_id, const char *name)
return rv;
}
void UavcanNode::update_params()
{
param_t param_handle;
// multicopter air-mode
param_handle = param_find("MC_AIRMODE");
if (param_handle != PARAM_INVALID) {
int val;
param_get(param_handle, &val);
_airmode = val > 0;
}
}
int UavcanNode::start_fw_server()
{
int rv = -1;
......@@ -821,6 +835,8 @@ int UavcanNode::run()
while (!_task_should_exit) {
update_params();
switch (_fw_server_action) {
case Start:
_fw_server_status = start_fw_server();
......@@ -908,6 +924,8 @@ int UavcanNode::run()
// but this driver could well serve multiple groups.
unsigned num_outputs_max = 8;
_mixers->set_airmode(_airmode);
// Do mixing
_outputs.noutputs = _mixers->mix(&_outputs.output[0], num_outputs_max);
......
......@@ -152,6 +152,7 @@ private:
int request_fw_check();
int print_params(uavcan::protocol::param::GetSet::Response &resp);
int get_set_param(int nodeid, const char *name, uavcan::protocol::param::GetSet::Request &req);
void update_params();
void set_setget_response(uavcan::protocol::param::GetSet::Response *resp)
{
_setget_response = resp;
......@@ -207,6 +208,8 @@ private:
actuator_outputs_s _outputs = {};
bool _airmode = false;
// index into _poll_fds for each _control_subs handle
uint8_t _poll_ids[NUM_ACTUATOR_CONTROL_GROUPS_UAVCAN];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment