From 24c36f3184d635ebf3342f3578210f57e7e61eed Mon Sep 17 00:00:00 2001 From: bsongis Date: Tue, 14 Aug 2012 17:41:20 +0000 Subject: [PATCH] Code cleaning around KILRAH_OFS / FRANCK #define for one of the next code change. Now we need to decide: - a compile option? - a per model option? - a per channel option? The per channel option is ok, we have one bit left per channel in limits (we even will save 8bits for each channel if this is the chosen option) --- src/open9x.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/open9x.cpp b/src/open9x.cpp index 077669e78..5da380d3f 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -31,7 +31,6 @@ * */ -// Here Franck you write this line "#define FRANCK" (without the "") // KILRAH: or "#define KILRAH_OFS" for what I think is the right thing we discussed this weekend! #if defined(PCBARM) && !defined(SIMU) @@ -481,17 +480,11 @@ int16_t applyLimits(uint8_t channel, int32_t value) if (ofs > lim_p) ofs = lim_p; if (ofs < lim_n) ofs = lim_n; -#if (!defined(FRANCK) && !defined(KILRAH_OFS)) || (defined(FRANCK) && defined(KILRAH_OFS)) +#if !defined(KILRAH_OFS) if (value) value = (value > 0) ? value * ((int32_t) lim_p - ofs) / 100000 : -value * ((int32_t) lim_n - ofs) / 100000; //div by 100000 -> output = -1024..1024 -#endif - -#if defined(FRANCK) && !defined(KILRAH_OFS) - value /= 100; -#endif - -#if defined(KILRAH_OFS) && !defined(FRANCK) +#else if (value) value = (value > 0) ? value * ((int32_t) lim_p) / 100000 : -value * ((int32_t) lim_n) / 100000; //div by 100000 -> output = -1024..1024