Alternative test code for subtrim behavior, see first lines of open9x.cpp

This commit is contained in:
bernet.andre@gmail.com
2012-08-13 09:48:06 +00:00
parent 961fa24faa
commit 9186bfa3af
+11 -2
View File
@@ -32,6 +32,7 @@
*/
// 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)
extern "C" {
@@ -480,14 +481,22 @@ int16_t applyLimits(uint8_t channel, int32_t value)
if (ofs > lim_p) ofs = lim_p;
if (ofs < lim_n) ofs = lim_n;
#ifndef FRANCK
#if (!defined(FRANCK) && !defined(KILRAH_OFS)) || (defined(FRANCK) && 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
#else
#endif
#if defined(FRANCK) && !defined(KILRAH_OFS)
value /= 100;
#endif
#if defined(KILRAH_OFS) && !defined(FRANCK)
if (value) value =
(value > 0) ? value * ((int32_t) lim_p) / 100000 :
-value * ((int32_t) lim_n) / 100000; //div by 100000 -> output = -1024..1024
#endif
value += calc1000toRESX(ofs);
lim_p = calc1000toRESX(lim_p);
lim_n = calc1000toRESX(lim_n);