From 93e4d90269c7132d67c5f563918eff199dbb6a07 Mon Sep 17 00:00:00 2001 From: Brendan Date: Mon, 16 Mar 2015 18:06:01 -0600 Subject: [PATCH] working DSM2 library and DSM2tester --- CopterController/DSM2.cpp | 13 ++++++++++--- CopterController/DSM2.h | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CopterController/DSM2.cpp b/CopterController/DSM2.cpp index 4899ea7..1f0231c 100644 --- a/CopterController/DSM2.cpp +++ b/CopterController/DSM2.cpp @@ -5,14 +5,21 @@ #define VALUE_MASK 0x3FF -DSM2::DSM2( int mode ) +DSM2::DSM2() { std::cout << "opening serial port..." << std::flush; fd = serialOpen( "/dev/ttyAMA0", 115200 ); - std::cout << "SUCCESS " << fd << std::endl; + if( fd < 0 ) + { + std::cout << "FAILURE" << std::endl; + } + else + { + std::cout << "SUCCESS " << fd << std::endl; + } std::cout << "flushing serial..." << std::flush; serialFlush(fd); - std::cout << "SUCCESS" << std::endl; + std::cout << "DONE" << std::endl; } void DSM2::update() diff --git a/CopterController/DSM2.h b/CopterController/DSM2.h index ef91bbf..123c964 100644 --- a/CopterController/DSM2.h +++ b/CopterController/DSM2.h @@ -4,7 +4,7 @@ class DSM2 { public: - DSM2( int mode = 1024 ); + DSM2(); void update(); int values[7];