From 8bff7aa9e4f3b3e080a108e4510781cb7ea738bb Mon Sep 17 00:00:00 2001 From: podhrmic Date: Wed, 10 Aug 2016 14:12:52 -0700 Subject: [PATCH 1/4] Fix for undefined baudrates at Mac OS (see #1840) --- sw/lib/ocaml/cserial.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sw/lib/ocaml/cserial.c b/sw/lib/ocaml/cserial.c index 5905077e8ab..e782cde56d6 100644 --- a/sw/lib/ocaml/cserial.c +++ b/sw/lib/ocaml/cserial.c @@ -35,6 +35,29 @@ #include #include +/* MacOS doesn't support higher baudrates (>230400B) */ +#ifdef __APPLE__ +static int baudrates[] = { + B0, + B50, + B75, + B110, + B134, + B150, + B200, + B300, + B600, + B1200, + B1800, + B2400, + B4800, + B9600, + B19200, + B38400, + B57600, + B115200, + B230400 }; +#else /* regular Linux with higher baudrates */ static int baudrates[] = { B0, B50, @@ -58,6 +81,8 @@ static int baudrates[] = { B921600, B1500000, B3000000 }; +#endif /* ifdef __APPLE__ */ + /****************************************************************************/ From af37fa9de3cd6eb3e0c66abe3a0ab7f94347d357 Mon Sep 17 00:00:00 2001 From: podhrmic Date: Wed, 10 Aug 2016 15:04:15 -0700 Subject: [PATCH 2/4] [ocaml] Added bounds check for baudrate index --- sw/lib/ocaml/cserial.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sw/lib/ocaml/cserial.c b/sw/lib/ocaml/cserial.c index e782cde56d6..2ece9261d90 100644 --- a/sw/lib/ocaml/cserial.c +++ b/sw/lib/ocaml/cserial.c @@ -93,7 +93,11 @@ value c_init_serial(value device, value speed, value hw_flow_control) CAMLparam3 (device, speed, hw_flow_control); struct termios orig_termios, cur_termios; - int br = baudrates[Int_val(speed)]; + int br_idx = Int_val(speed); + if (br_idx >= sizeof(baudrates)){ + failwith("Baud rate not supported - are you using MacOS? (br_idx out of bounds)"); + } + int br = baudrates[br_idx]; int fd = open(String_val(device), O_RDWR|O_NOCTTY|O_NONBLOCK); From 8700b94f697fe90a52ab903c347e8e2feb16ccc1 Mon Sep 17 00:00:00 2001 From: Michal Podhradsky Date: Thu, 11 Aug 2016 10:08:41 -0700 Subject: [PATCH 3/4] [superbitrf] Removed unused code (#1837) --- sw/airborne/subsystems/datalink/superbitrf.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sw/airborne/subsystems/datalink/superbitrf.c b/sw/airborne/subsystems/datalink/superbitrf.c index 83669677984..65f9c3acd40 100644 --- a/sw/airborne/subsystems/datalink/superbitrf.c +++ b/sw/airborne/subsystems/datalink/superbitrf.c @@ -563,11 +563,6 @@ void superbitrf_event(void) case 5: superbitrf.state = 7; break; - // Start receiving - cyrf6936_multi_write(&superbitrf.cyrf6936, cyrf_start_receive, 2); - superbitrf.timer = (get_sys_time_usec() + SUPERBITRF_DATARECVB_TIME) % 0xFFFFFFFF; - superbitrf.state++; - break; case 6: // Wait for telemetry data if (superbitrf.timer < get_sys_time_usec()) { From 0f6125f7e52c0e7afb15824e11037d4a50051365 Mon Sep 17 00:00:00 2001 From: podhrmic Date: Thu, 11 Aug 2016 10:21:45 -0700 Subject: [PATCH 4/4] [chibios] Indentantion fix --- conf/Makefile.chibios | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/Makefile.chibios b/conf/Makefile.chibios index cd01fed70eb..0956171b1b5 100644 --- a/conf/Makefile.chibios +++ b/conf/Makefile.chibios @@ -80,7 +80,6 @@ ifeq (,$(findstring $(RTOS_DEBUG),0 FALSE)) else CH_OPT ?= 2 -ggdb endif - USE_OPT = -std=gnu99 -O$(CH_OPT) \ -falign-functions=16 -fomit-frame-pointer \ -W -Wall \