Alternative test code for subtrim behavior, see first lines of open9x.cpp
This commit is contained in:
+11
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user