From 4b42cfaa6c0e19443dfe56359b8f750c20ac74bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Tue, 31 Jul 2018 11:51:15 +0200 Subject: [PATCH] simulator_mavlink: improve error output --- src/modules/simulator/simulator_mavlink.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/simulator/simulator_mavlink.cpp b/src/modules/simulator/simulator_mavlink.cpp index 0ecf4c08d2..105109842e 100644 --- a/src/modules/simulator/simulator_mavlink.cpp +++ b/src/modules/simulator/simulator_mavlink.cpp @@ -670,7 +670,7 @@ void Simulator::pollForMAVLinkMessages(bool publish, int udp_port) struct sockaddr_in _myaddr; if (udp_port < 1) { - int prt; + int32_t prt; param_get(param_find("SITL_UDP_PRT"), &prt); udp_port = prt; } @@ -682,12 +682,12 @@ void Simulator::pollForMAVLinkMessages(bool publish, int udp_port) _myaddr.sin_port = htons(udp_port); if ((_fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - PX4_WARN("create socket failed\n"); + PX4_ERR("create socket failed (%i)", errno); return; } if (bind(_fd, (struct sockaddr *)&_myaddr, sizeof(_myaddr)) < 0) { - PX4_WARN("bind failed\n"); + PX4_ERR("bind for UDP port %i failed (%i)", udp_port, errno); return; }