From 29009c4d686b67a96e763dd8743a103fa1175136 Mon Sep 17 00:00:00 2001 From: Bryan Godbolt Date: Tue, 14 Sep 2010 14:09:13 -0600 Subject: [PATCH] changed output of norm rc values --- src/comm/OpalLink.cc | 16 ++++++++++++++-- src/comm/OpalLink.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/comm/OpalLink.cc b/src/comm/OpalLink.cc index 5551c091c..eb8e1fe09 100644 --- a/src/comm/OpalLink.cc +++ b/src/comm/OpalLink.cc @@ -258,6 +258,15 @@ void OpalLink::getSignals() duty2PulseMicros(values[OpalRT::RAW_CHANNEL_6]), duty2PulseMicros(values[OpalRT::RAW_CHANNEL_7]), duty2PulseMicros(values[OpalRT::RAW_CHANNEL_8]), + rescaleNorm(values[OpalRT::NORM_CHANNEL_1]), + rescaleNorm(values[OpalRT::NORM_CHANNEL_2]), + rescaleNorm(values[OpalRT::NORM_CHANNEL_3]), + rescaleNorm(values[OpalRT::NORM_CHANNEL_4]), + rescaleNorm(values[OpalRT::NORM_CHANNEL_5]), + rescaleNorm(values[OpalRT::NORM_CHANNEL_6]), + rescaleNorm(values[OpalRT::NORM_CHANNEL_7]), + rescaleNorm(values[OpalRT::NORM_CHANNEL_8]), + /* static_cast(values[OpalRT::NORM_CHANNEL_1]*255), static_cast(values[OpalRT::NORM_CHANNEL_2]*255), static_cast(values[OpalRT::NORM_CHANNEL_3]*255), @@ -265,7 +274,7 @@ void OpalLink::getSignals() static_cast(values[OpalRT::NORM_CHANNEL_5]*255), static_cast(values[OpalRT::NORM_CHANNEL_6]*255), static_cast(values[OpalRT::NORM_CHANNEL_7]*255), - static_cast(values[OpalRT::NORM_CHANNEL_8]*255), + static_cast(values[OpalRT::NORM_CHANNEL_8]*255),*/ 0 //rssi unused ); receiveMessage(rc); @@ -323,7 +332,10 @@ uint16_t OpalLink::duty2PulseMicros(double duty) return static_cast(duty/70*1000000); } - +uint8_t OpalLink::rescaleNorm(double norm) +{ + return static_cast((norm+1)/2*255); +} bool OpalLink::connect() diff --git a/src/comm/OpalLink.h b/src/comm/OpalLink.h index f72ba9d23..e921054e4 100644 --- a/src/comm/OpalLink.h +++ b/src/comm/OpalLink.h @@ -153,6 +153,7 @@ protected: unsigned short opalInstID; uint16_t duty2PulseMicros(double duty); + uint8_t rescaleNorm(double norm); }; #endif // OPALLINK_H -- 2.22.0