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:
parent
76f3edb50d
commit
0359cb244e
9 changed files with 941 additions and 934 deletions
|
@ -40,11 +40,17 @@ static const pm_uint8_t beepTab[] PROGMEM = {
|
|||
void beep(uint8_t val)
|
||||
{
|
||||
#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
|
||||
|
||||
#if !defined(AUDIO)
|
||||
if (g_eeGeneral.alarmsFlash && val>1) flashCounter = FLASH_DURATION;
|
||||
if (g_eeGeneral.alarmsFlash && val>1) {
|
||||
flashCounter = FLASH_DURATION;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_eeGeneral.beepMode>0 || (g_eeGeneral.beepMode==0 && val!=0) || (g_eeGeneral.beepMode==-1 && val>=3)) {
|
||||
|
|
|
@ -104,9 +104,6 @@ inline void beep(uint8_t) { }
|
|||
#define AUDIO_TIMER_MINUTE(t)
|
||||
#define AUDIO_TIMER_30()
|
||||
#define AUDIO_TIMER_20()
|
||||
#define AUDIO_KEYPAD_UP()
|
||||
#define AUDIO_KEYPAD_DOWN()
|
||||
#define AUDIO_MENUS()
|
||||
#define AUDIO_WARNING2()
|
||||
#define AUDIO_WARNING1()
|
||||
#define AUDIO_ERROR()
|
||||
|
|
|
@ -390,105 +390,6 @@ int applyCurve(int x, int8_t idx)
|
|||
}
|
||||
#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 result = {0, 0};
|
||||
|
|
|
@ -307,7 +307,7 @@ void menuMainView(event_t event)
|
|||
case EVT_KEY_BREAK(KEY_MENU):
|
||||
if (view_base == VIEW_TIMER2) {
|
||||
Timer2_running = !Timer2_running;
|
||||
AUDIO_KEYPAD_UP();
|
||||
AUDIO_KEY_PRESS();
|
||||
}
|
||||
break;
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
||||
#if defined(HELI)
|
||||
int16_t cyc_anas[3] = {0};
|
||||
int16_t cyc_anas[3] = {0};
|
||||
#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)
|
||||
{
|
||||
#if !defined(VIRTUAL_INPUTS)
|
||||
|
@ -168,7 +267,6 @@ int16_t applyLimits(uint8_t channel, int32_t value)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
int16_t ofs = LIMIT_OFS_RESX(lim);
|
||||
int16_t lim_p = LIMIT_MAX_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()) {
|
||||
flightModeTransitionTime = 0;
|
||||
if (fm != flightModeTransitionLast) {
|
||||
if (flightModeTransitionLast != 255) PLAY_PHASE_OFF(flightModeTransitionLast);
|
||||
if (flightModeTransitionLast != 255) {
|
||||
PLAY_PHASE_OFF(flightModeTransitionLast);
|
||||
}
|
||||
PLAY_PHASE_ON(fm);
|
||||
flightModeTransitionLast = fm;
|
||||
}
|
||||
|
|
|
@ -444,7 +444,7 @@ void menuViewTelemetryNMEA1(event_t event)
|
|||
|
||||
|
||||
title ('1');
|
||||
lcd_puts ( 2*FW, 1*FH, PSTR("UTC-Time Sat"));
|
||||
lcdDrawText ( 2*FW, 1*FH, PSTR("UTC-Time Sat"));
|
||||
|
||||
if (rbuf[0][0]) { // show always if data have been received
|
||||
lcdDrawChar ( 19*FW, 1*FH, sbuf[2], 0); // satellites in view
|
||||
|
@ -459,12 +459,12 @@ void menuViewTelemetryNMEA1(event_t event)
|
|||
|
||||
if ((show_timer == 1) && rbuf[0][0]) { // show the Timer when data have been received
|
||||
|
||||
lcd_puts ( 2*FW, 4*FH, PSTR("Timer")); // display "Timer"
|
||||
lcdDrawText ( 2*FW, 4*FH, PSTR("Timer")); // display "Timer"
|
||||
drawTimer ( 5*FW, 5*FH, (gpstime-gpstimer), DBLSIZE, DBLSIZE); // display difference as mm:ss
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd_puts ( 2*FW, 4*FH, PSTR("Date")); // show the UTC Date
|
||||
lcdDrawText ( 2*FW, 4*FH, PSTR("Date")); // show the UTC Date
|
||||
|
||||
if (rbuf[1][0]) {
|
||||
lcdDrawSizedText( 2*FW, 5*FH, &rbuf[1][0], 2, APSIZE); // year
|
||||
|
@ -513,12 +513,12 @@ void menuViewTelemetryNMEA2(event_t event)
|
|||
case EVT_KEY_LONG(KEY_LEFT):
|
||||
ignore_break = 1;
|
||||
beep_on=0;
|
||||
AUDIO_MENUS(); // short blip
|
||||
AUDIO_KEY_PRESS();
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_RIGHT):
|
||||
ignore_break = 1;
|
||||
beep_on=1;
|
||||
AUDIO_MENUS(); // short blip
|
||||
AUDIO_KEY_PRESS();
|
||||
break;
|
||||
|
||||
//Altitude setting
|
||||
|
@ -546,35 +546,35 @@ void menuViewTelemetryNMEA2(event_t event)
|
|||
if (save_alt==0) // wenn noch keine Home H<>he gesetzt war, wird sie es jetzt, weil sonst
|
||||
// das Umschalten keine Wirkung zeigt
|
||||
save_alt = home_alt = abs_alt; // absolute altitude
|
||||
AUDIO_MENUS(); // short blip for non negative lift
|
||||
AUDIO_KEY_PRESS();
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
ignore_break = 1;
|
||||
save_alt = home_alt = abs_alt; // Home altitude auf aktuelle absolute H<>he setzen
|
||||
AUDIO_MENUS(); // short blip for non negative lift
|
||||
AUDIO_KEY_PRESS();
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_EXIT): // Max Altitude auf 0 zur<75>cksetzen
|
||||
max_alt=0;
|
||||
AUDIO_MENUS(); // short blip for non negative lift
|
||||
AUDIO_KEY_PRESS();
|
||||
break;
|
||||
|
||||
}
|
||||
title ('2');
|
||||
|
||||
lcd_puts ( 1*FW, 1*FH, PSTR("Altitude Sat Max"));
|
||||
lcdDrawText ( 1*FW, 1*FH, PSTR("Altitude Sat Max"));
|
||||
|
||||
|
||||
lcd_puts ( 16*FW, 3*FH, PSTR("Home"));
|
||||
lcd_puts ( 2*FW, 4*FH, PSTR("Lift") );
|
||||
lcdDrawText ( 16*FW, 3*FH, PSTR("Home"));
|
||||
lcdDrawText ( 2*FW, 4*FH, PSTR("Lift") );
|
||||
|
||||
lcd_puts ( 16*FW, 5*FH, PSTR("Beep") );
|
||||
lcdDrawText ( 16*FW, 5*FH, PSTR("Beep") );
|
||||
if (beep_on==1)
|
||||
lcd_puts ( 18*FW, 6*FH, PSTR("ON") );
|
||||
lcdDrawText ( 18*FW, 6*FH, PSTR("ON") );
|
||||
|
||||
else
|
||||
lcd_puts ( 17*FW, 6*FH, PSTR("OFF") );
|
||||
lcdDrawText ( 17*FW, 6*FH, PSTR("OFF") );
|
||||
|
||||
|
||||
lcdDrawNumber( 20*FW, 4*FH, home_alt, PREC1, 6); // display home_alt, small characters
|
||||
|
@ -609,7 +609,7 @@ void menuViewTelemetryNMEA2(event_t event)
|
|||
prev_alt = rel_alt;
|
||||
|
||||
if ((lift_alt >= 0) && (sbuf[1]>0x30) && beep_on) // GGA record must have Fix> 0
|
||||
AUDIO_MENUS(); // short blip for non negative lift
|
||||
AUDIO_KEY_PRESS(); // short blip for non negative lift
|
||||
|
||||
}
|
||||
|
||||
|
@ -631,7 +631,7 @@ void menuViewTelemetryNMEA2(event_t event)
|
|||
|
||||
lcdDrawNumber( 10*FW, 5*FH, lift_alt, DBLSIZE|PREC1, 6); // lift
|
||||
lcdDrawChar ( 11*FW, 6*FH, sbuf[0], 0); // dimension [m/S]
|
||||
lcd_puts ( 12*FW, 6*FH, PSTR("/S") );
|
||||
lcdDrawText ( 12*FW, 6*FH, PSTR("/S") );
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -665,7 +665,7 @@ void menuViewTelemetryNMEA3(event_t event)
|
|||
initval (LONG_BUF(1), PACK_RMC, COG);
|
||||
initval (SHORT_BUF(2), PACK_GGA, SAT); // -> sbuf[2]
|
||||
title ('3');
|
||||
lcd_puts ( 0*FW, 1*FH, PSTR("GrndSpeed[knt] Sat"));
|
||||
lcdDrawText ( 0*FW, 1*FH, PSTR("GrndSpeed[knt] Sat"));
|
||||
if (rbuf[0][0]) // if first position is 00, buffer is empty, taken as false
|
||||
{ // any other value is true
|
||||
uint8_t i = 0;
|
||||
|
@ -685,7 +685,7 @@ void menuViewTelemetryNMEA3(event_t event)
|
|||
|
||||
lcdDrawChar ( 19*FW, 1*FH, sbuf[2], 0); // satellites in view
|
||||
|
||||
lcd_puts ( 1*FW, 4*FH, PSTR("Course over ground") );
|
||||
lcdDrawText ( 1*FW, 4*FH, PSTR("Course over ground") );
|
||||
lcdDrawText ( 2*FW, 5*FH, VALSTR(1), APSIZE); // course over ground
|
||||
}
|
||||
|
||||
|
@ -719,7 +719,7 @@ void menuViewTelemetryNMEA4(event_t event)
|
|||
initval (SHORT_BUF(2), PACK_GGA, SAT); // -> sbuf[2]
|
||||
// title of the screen
|
||||
title ('4');
|
||||
lcd_puts ( 3*FW, 1*FH, PSTR("Latitude Sat")); // line 1 column 3
|
||||
lcdDrawText ( 3*FW, 1*FH, PSTR("Latitude Sat")); // line 1 column 3
|
||||
// first buffer into line 2 column 2
|
||||
if (rbuf[0][0])
|
||||
{
|
||||
|
@ -731,7 +731,7 @@ void menuViewTelemetryNMEA4(event_t event)
|
|||
}
|
||||
else
|
||||
lcdDrawText ( 2*FW, 2*FH, val_unknown, APSIZE);
|
||||
lcd_puts ( 3*FW, 4*FH, PSTR("Longitude")); // line 4 column 5
|
||||
lcdDrawText ( 3*FW, 4*FH, PSTR("Longitude")); // line 4 column 5
|
||||
// second buffer into line 5 column 2
|
||||
if (rbuf[0][0])
|
||||
{
|
||||
|
|
|
@ -836,6 +836,7 @@
|
|||
#define TR_RECEIVER INDENT "Přijímač"
|
||||
#else
|
||||
#define TR_RECEIVER_NUM "RX číslo"
|
||||
#define TR_RECEIVER "RxNum"
|
||||
#endif
|
||||
#define TR_MULTI_RFTUNE TR(INDENT "Freq tune",INDENT "RF Freq. fine tune")
|
||||
#define TR_MULTI_TELEMETRY "Telemetry"
|
||||
|
|
|
@ -844,6 +844,7 @@
|
|||
#define TR_RECEIVER INDENT "Receiver"
|
||||
#else
|
||||
#define TR_RECEIVER_NUM "RxNum"
|
||||
#define TR_RECEIVER "RxNum"
|
||||
#endif
|
||||
#define TR_MULTI_RFTUNE TR(INDENT "Freq tune",INDENT "RF Freq. fine tune")
|
||||
#define TR_MULTI_TELEMETRY "Telemetry"
|
||||
|
|
|
@ -857,6 +857,7 @@
|
|||
#define TR_RECEIVER INDENT "Receiver"
|
||||
#else
|
||||
#define TR_RECEIVER_NUM "RxNum"
|
||||
#define TR_RECEIVER "RxNum"
|
||||
#endif
|
||||
#define TR_SYNCMENU "Synk [MENU]"
|
||||
#define TR_MULTI_RFTUNE TR(INDENT "Freq tune",INDENT "RF Freq. fine tune")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue