1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-16 04:45:17 +03:00

Bsongis/server compilation fix (#4763)

* Fix following automatic server emails

CMake options:
-DTHR_TRACE=YES -DVARIO=YES -DGAUGES=NO -DAUTOSWITCH=YES -DTRANSLATIONS=FR -DACCURAT_THROTTLE_STATS=NO -DSP22=NO -DPCB=9X -DARITHMETIC_OVERFLOW_CHECK=NO -DFONT=SQT5 -DHELI=NO -DEEPROM_PROGRESS_BAR=YES -DTEMPLATES=NO -DFRSKY_STICKS=NO -DVOICE=NO -DDBLKEYS=NO -DGRAPHICS=YES -DFAI=YES -DBATTGRAPH=YES -DTURNIGY_TRANSMITTER_FIX=NO -DPWM_BACKLIGHT=NO -DNAVIGATION=NO -DBOLD=YES -DDSM2=NO -DGVARS=NO -DAUTOSOURCE=YES -DCURVES=NO -DWS_HOW_HIGH=YES -DPPM_LIMITS_SYMETRICAL=NO -DHAPTIC=NO -DUNITS=METRIC -DPPM_UNIT=PERCENT_PREC1 -DAUDIO=YES -DGPS=NO -DPPM_CENTER_ADJUSTABLE=NO -DSPLASH=YES -DFAS_OFFSET=NO -DFLIGHT_MODES=NO -DOVERRIDE_CHANNEL_FUNCTION=YES

* Fix some missing translations for avr

* Compilation fixes
This commit is contained in:
Bertrand Songis 2017-04-08 12:39:30 +02:00 committed by GitHub
parent 76f3edb50d
commit 0359cb244e
9 changed files with 941 additions and 934 deletions

View file

@ -40,11 +40,17 @@ static const pm_uint8_t beepTab[] PROGMEM = {
void beep(uint8_t val) void beep(uint8_t val)
{ {
#if defined(HAPTIC) && !defined(AUDIO) #if defined(HAPTIC) && !defined(AUDIO)
haptic.event(val==0 ? AU_KEYPAD_UP : (val==4 ? AU_ERROR : AU_TIMER_LT10+beepAgain)); // completely untested
if (val == 0)
haptic.play(5, 0, PLAY_NOW);
else
haptic.event(AU_ERROR);
#endif #endif
#if !defined(AUDIO) #if !defined(AUDIO)
if (g_eeGeneral.alarmsFlash && val>1) flashCounter = FLASH_DURATION; if (g_eeGeneral.alarmsFlash && val>1) {
flashCounter = FLASH_DURATION;
}
#endif #endif
if (g_eeGeneral.beepMode>0 || (g_eeGeneral.beepMode==0 && val!=0) || (g_eeGeneral.beepMode==-1 && val>=3)) { if (g_eeGeneral.beepMode>0 || (g_eeGeneral.beepMode==0 && val!=0) || (g_eeGeneral.beepMode==-1 && val>=3)) {

View file

@ -104,9 +104,6 @@ inline void beep(uint8_t) { }
#define AUDIO_TIMER_MINUTE(t) #define AUDIO_TIMER_MINUTE(t)
#define AUDIO_TIMER_30() #define AUDIO_TIMER_30()
#define AUDIO_TIMER_20() #define AUDIO_TIMER_20()
#define AUDIO_KEYPAD_UP()
#define AUDIO_KEYPAD_DOWN()
#define AUDIO_MENUS()
#define AUDIO_WARNING2() #define AUDIO_WARNING2()
#define AUDIO_WARNING1() #define AUDIO_WARNING1()
#define AUDIO_ERROR() #define AUDIO_ERROR()

View file

@ -390,105 +390,6 @@ int applyCurve(int x, int8_t idx)
} }
#endif #endif
// #define EXTENDED_EXPO
// increases range of expo curve but costs about 82 bytes flash
// expo-funktion:
// ---------------
// kmplot
// f(x,k)=exp(ln(x)*k/10) ;P[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
// f(x,k)=x*x*x*k/10 + x*(1-k/10) ;P[0,1,2,3,4,5,6,7,8,9,10]
// f(x,k)=x*x*k/10 + x*(1-k/10) ;P[0,1,2,3,4,5,6,7,8,9,10]
// f(x,k)=1+(x-1)*(x-1)*(x-1)*k/10 + (x-1)*(1-k/10) ;P[0,1,2,3,4,5,6,7,8,9,10]
// don't know what this above should be, just confusing in my opinion,
// here is the real explanation
// actually the real formula is
/*
f(x) = exp( ln(x) * 10^k)
if it is 10^k or e^k or 2^k etc. just defines the max distortion of the expo curve; I think 10 is useful
this gives values from 0 to 1 for x and output; k must be between -1 and +1
we do not like to calculate with floating point. Therefore we rescale for x from 0 to 1024 and for k from -100 to +100
f(x) = 1024 * ( e^( ln(x/1024) * 10^(k/100) ) )
This would be really hard to be calculated by such a microcontroller
Therefore Thomas Husterer compared a few usual function something like x^3, x^4*something, which look similar
Actually the formula
f(x) = k*x^3+x*(1-k)
gives a similar form and should have even advantages compared to a original exp curve.
This function again expect x from 0 to 1 and k only from 0 to 1
Therefore rescaling is needed like before:
f(x) = 1024* ((k/100)*(x/1024)^3 + (x/1024)*(100-k)/100)
some mathematical tricks
f(x) = (k*x*x*x/(1024*1024) + x*(100-k)) / 100
for better rounding results we add the 50
f(x) = (k*x*x*x/(1024*1024) + x*(100-k) + 50) / 100
because we now understand the formula, we can optimize it further
--> calc100to256(k) --> eliminates /100 by replacing with /256 which is just a simple shift right 8
k is now between 0 and 256
f(x) = (k*x*x*x/(1024*1024) + x*(256-k) + 128) / 256
*/
// input parameters;
// x 0 to 1024;
// k 0 to 100;
// output between 0 and 1024
unsigned int expou(unsigned int x, unsigned int k)
{
#if defined(EXTENDED_EXPO)
bool extended;
if (k>80) {
extended=true;
}
else {
k += (k>>2); // use bigger values before extend, because the effect is anyway very very low
extended=false;
}
#endif
k = calc100to256(k);
uint32_t value = (uint32_t) x*x;
value *= (uint32_t)k;
value >>= 8;
value *= (uint32_t)x;
#if defined(EXTENDED_EXPO)
if (extended) { // for higher values do more multiplications to get a stronger expo curve
value >>= 16;
value *= (uint32_t)x;
value >>= 4;
value *= (uint32_t)x;
}
#endif
value >>= 12;
value += (uint32_t)(256-k)*x+128;
return value>>8;
}
int expo(int x, int k)
{
if (k == 0) {
return x;
}
int y;
bool neg = (x < 0);
if (neg) {
x = -x;
}
if (k < 0) {
y = RESXu - expou(RESXu-x, -k);
}
else {
y = expou(x, k);
}
return neg ? -y : y;
}
point_t getPoint(uint8_t i) point_t getPoint(uint8_t i)
{ {
point_t result = {0, 0}; point_t result = {0, 0};

View file

@ -307,7 +307,7 @@ void menuMainView(event_t event)
case EVT_KEY_BREAK(KEY_MENU): case EVT_KEY_BREAK(KEY_MENU):
if (view_base == VIEW_TIMER2) { if (view_base == VIEW_TIMER2) {
Timer2_running = !Timer2_running; Timer2_running = !Timer2_running;
AUDIO_KEYPAD_UP(); AUDIO_KEY_PRESS();
} }
break; break;
*/ */

View file

@ -46,9 +46,108 @@ int16_t channelOutputs[MAX_OUTPUT_CHANNELS] = {0};
int16_t ex_chans[MAX_OUTPUT_CHANNELS] = {0}; // Outputs (before LIMITS) of the last perMain; int16_t ex_chans[MAX_OUTPUT_CHANNELS] = {0}; // Outputs (before LIMITS) of the last perMain;
#if defined(HELI) #if defined(HELI)
int16_t cyc_anas[3] = {0}; int16_t cyc_anas[3] = {0};
#endif #endif
// #define EXTENDED_EXPO
// increases range of expo curve but costs about 82 bytes flash
// expo-funktion:
// ---------------
// kmplot
// f(x,k)=exp(ln(x)*k/10) ;P[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
// f(x,k)=x*x*x*k/10 + x*(1-k/10) ;P[0,1,2,3,4,5,6,7,8,9,10]
// f(x,k)=x*x*k/10 + x*(1-k/10) ;P[0,1,2,3,4,5,6,7,8,9,10]
// f(x,k)=1+(x-1)*(x-1)*(x-1)*k/10 + (x-1)*(1-k/10) ;P[0,1,2,3,4,5,6,7,8,9,10]
// don't know what this above should be, just confusing in my opinion,
// here is the real explanation
// actually the real formula is
/*
f(x) = exp( ln(x) * 10^k)
if it is 10^k or e^k or 2^k etc. just defines the max distortion of the expo curve; I think 10 is useful
this gives values from 0 to 1 for x and output; k must be between -1 and +1
we do not like to calculate with floating point. Therefore we rescale for x from 0 to 1024 and for k from -100 to +100
f(x) = 1024 * ( e^( ln(x/1024) * 10^(k/100) ) )
This would be really hard to be calculated by such a microcontroller
Therefore Thomas Husterer compared a few usual function something like x^3, x^4*something, which look similar
Actually the formula
f(x) = k*x^3+x*(1-k)
gives a similar form and should have even advantages compared to a original exp curve.
This function again expect x from 0 to 1 and k only from 0 to 1
Therefore rescaling is needed like before:
f(x) = 1024* ((k/100)*(x/1024)^3 + (x/1024)*(100-k)/100)
some mathematical tricks
f(x) = (k*x*x*x/(1024*1024) + x*(100-k)) / 100
for better rounding results we add the 50
f(x) = (k*x*x*x/(1024*1024) + x*(100-k) + 50) / 100
because we now understand the formula, we can optimize it further
--> calc100to256(k) --> eliminates /100 by replacing with /256 which is just a simple shift right 8
k is now between 0 and 256
f(x) = (k*x*x*x/(1024*1024) + x*(256-k) + 128) / 256
*/
// input parameters;
// x 0 to 1024;
// k 0 to 100;
// output between 0 and 1024
unsigned int expou(unsigned int x, unsigned int k)
{
#if defined(EXTENDED_EXPO)
bool extended;
if (k>80) {
extended=true;
}
else {
k += (k>>2); // use bigger values before extend, because the effect is anyway very very low
extended=false;
}
#endif
k = calc100to256(k);
uint32_t value = (uint32_t) x*x;
value *= (uint32_t)k;
value >>= 8;
value *= (uint32_t)x;
#if defined(EXTENDED_EXPO)
if (extended) { // for higher values do more multiplications to get a stronger expo curve
value >>= 16;
value *= (uint32_t)x;
value >>= 4;
value *= (uint32_t)x;
}
#endif
value >>= 12;
value += (uint32_t)(256-k)*x+128;
return value>>8;
}
int expo(int x, int k)
{
if (k == 0) {
return x;
}
int y;
bool neg = (x < 0);
if (neg) {
x = -x;
}
if (k < 0) {
y = RESXu - expou(RESXu-x, -k);
}
else {
y = expou(x, k);
}
return neg ? -y : y;
}
void applyExpos(int16_t * anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS) void applyExpos(int16_t * anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
{ {
#if !defined(VIRTUAL_INPUTS) #if !defined(VIRTUAL_INPUTS)
@ -168,7 +267,6 @@ int16_t applyLimits(uint8_t channel, int32_t value)
} }
#endif #endif
int16_t ofs = LIMIT_OFS_RESX(lim); int16_t ofs = LIMIT_OFS_RESX(lim);
int16_t lim_p = LIMIT_MAX_RESX(lim); int16_t lim_p = LIMIT_MAX_RESX(lim);
int16_t lim_n = LIMIT_MIN_RESX(lim); int16_t lim_n = LIMIT_MIN_RESX(lim);
@ -1060,7 +1158,9 @@ void evalMixes(uint8_t tick10ms)
if (flightModeTransitionTime && get_tmr10ms() > flightModeTransitionTime+SWITCHES_DELAY()) { if (flightModeTransitionTime && get_tmr10ms() > flightModeTransitionTime+SWITCHES_DELAY()) {
flightModeTransitionTime = 0; flightModeTransitionTime = 0;
if (fm != flightModeTransitionLast) { if (fm != flightModeTransitionLast) {
if (flightModeTransitionLast != 255) PLAY_PHASE_OFF(flightModeTransitionLast); if (flightModeTransitionLast != 255) {
PLAY_PHASE_OFF(flightModeTransitionLast);
}
PLAY_PHASE_ON(fm); PLAY_PHASE_ON(fm);
flightModeTransitionLast = fm; flightModeTransitionLast = fm;
} }

File diff suppressed because it is too large Load diff

View file

@ -836,6 +836,7 @@
#define TR_RECEIVER INDENT "Přijímač" #define TR_RECEIVER INDENT "Přijímač"
#else #else
#define TR_RECEIVER_NUM "RX číslo" #define TR_RECEIVER_NUM "RX číslo"
#define TR_RECEIVER "RxNum"
#endif #endif
#define TR_MULTI_RFTUNE TR(INDENT "Freq tune",INDENT "RF Freq. fine tune") #define TR_MULTI_RFTUNE TR(INDENT "Freq tune",INDENT "RF Freq. fine tune")
#define TR_MULTI_TELEMETRY "Telemetry" #define TR_MULTI_TELEMETRY "Telemetry"

View file

@ -844,6 +844,7 @@
#define TR_RECEIVER INDENT "Receiver" #define TR_RECEIVER INDENT "Receiver"
#else #else
#define TR_RECEIVER_NUM "RxNum" #define TR_RECEIVER_NUM "RxNum"
#define TR_RECEIVER "RxNum"
#endif #endif
#define TR_MULTI_RFTUNE TR(INDENT "Freq tune",INDENT "RF Freq. fine tune") #define TR_MULTI_RFTUNE TR(INDENT "Freq tune",INDENT "RF Freq. fine tune")
#define TR_MULTI_TELEMETRY "Telemetry" #define TR_MULTI_TELEMETRY "Telemetry"

View file

@ -857,6 +857,7 @@
#define TR_RECEIVER INDENT "Receiver" #define TR_RECEIVER INDENT "Receiver"
#else #else
#define TR_RECEIVER_NUM "RxNum" #define TR_RECEIVER_NUM "RxNum"
#define TR_RECEIVER "RxNum"
#endif #endif
#define TR_SYNCMENU "Synk [MENU]" #define TR_SYNCMENU "Synk [MENU]"
#define TR_MULTI_RFTUNE TR(INDENT "Freq tune",INDENT "RF Freq. fine tune") #define TR_MULTI_RFTUNE TR(INDENT "Freq tune",INDENT "RF Freq. fine tune")