{"action":"opened","issue":{"url":"https://api.github.com/repos/PX4/Firmware/issues/3160","labels_url":"https://api.github.com/repos/PX4/Firmware/issues/3160/labels{/name}","comments_url":"https://api.github.com/repos/PX4/Firmware/issues/3160/comments","events_url":"https://api.github.com/repos/PX4/Firmware/issues/3160/events","html_url":"https://github.com/PX4/Firmware/issues/3160","id":115865946,"number":3160,"title":"Parameter saving logic in UAVCAN bridge is flawed","user":{"login":"pavel-kirienko","id":3298404,"avatar_url":"https://avatars.githubusercontent.com/u/3298404?v=3","gravatar_id":"","url":"https://api.github.com/users/pavel-kirienko","html_url":"https://github.com/pavel-kirienko","followers_url":"https://api.github.com/users/pavel-kirienko/followers","following_url":"https://api.github.com/users/pavel-kirienko/following{/other_user}","gists_url":"https://api.github.com/users/pavel-kirienko/gists{/gist_id}","starred_url":"https://api.github.com/users/pavel-kirienko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavel-kirienko/subscriptions","organizations_url":"https://api.github.com/users/pavel-kirienko/orgs","repos_url":"https://api.github.com/users/pavel-kirienko/repos","events_url":"https://api.github.com/users/pavel-kirienko/events{/privacy}","received_events_url":"https://api.github.com/users/pavel-kirienko/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PX4/Firmware/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-09T12:16:33Z","updated_at":"2015-11-09T12:16:33Z","closed_at":null,"body":"@bendyer Check this out: https://github.com/PX4/Firmware/blob/master/src/modules/uavcan/uavcan_servers.cpp#L524-L527:\r\n\r\n```c++\r\n\t\t\t\tswitch (command_id) {\r\n\t\t\t\tcase 1: {\r\n\t\t\t\t\t\t// Param save request\r\n\t\t\t\t\t\t_param_save_opcode = uavcan::protocol::param::ExecuteOpcode::Request::OPCODE_SAVE;\r\n\t\t\t\t\t\tparam_opcode(get_next_dirty_node_id(1));\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\tcase 2: {\r\n\t\t\t\t\t\t// Command is a param erase request -- apply it to all active nodes by setting the dirty bit\r\n\t\t\t\t\t\t_param_save_opcode = uavcan::protocol::param::ExecuteOpcode::Request::OPCODE_ERASE;\r\n\t\t\t\t\t\tfor (int i = 1; i < 128; i = get_next_active_node_id(i)) {\r\n\t\t\t\t\t\t\tset_node_params_dirty(i);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tparam_opcode(get_next_dirty_node_id(1));\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n```\r\n\r\nIn the case 1, the call to `param_opcode()` will fail with an error report to CLI if there's no dirty nodes present. The error report looks like this:\r\n\r\n```\r\nuavcan fw srv: UAVCAN command bridge: couldn't send ExecuteOpcode: -2\r\n```\r\n\r\nError code -2 means [`ErrInvalidParam`](https://github.com/UAVCAN/libuavcan/blob/master/libuavcan/include/uavcan/error.hpp#L26), since the server is trying to call the service on node ID 128, which is not valid."}}