Merge branch 'next' of https://github.com/opentx/opentx into bsongis/Issue713_more_custom_functions

This commit is contained in:
Andre Bernet
2014-02-25 18:17:15 +01:00
208 changed files with 4928 additions and 5779 deletions
+19
View File
@@ -212,9 +212,27 @@ PACK(typedef struct {
}) ModelData_v215;
PACK(typedef struct {
uint8_t version;
uint16_t variant;
int16_t calibMid[NUM_STICKS+NUM_POTS];
int16_t calibSpanNeg[NUM_STICKS+NUM_POTS];
int16_t calibSpanPos[NUM_STICKS+NUM_POTS];
uint16_t chkSum;
}) GeneralSettings_v215;
void ConvertGeneralSettings_215_to_216(EEGeneral &settings)
{
GeneralSettings_v215 oldSettings;
memcpy(&oldSettings, &settings, sizeof(oldSettings));
settings.version = 216;
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
settings.calib[i].mid = oldSettings.calibMid[i];
settings.calib[i].spanNeg = oldSettings.calibSpanNeg[i];
settings.calib[i].spanPos = oldSettings.calibSpanPos[i];
}
settings.chkSum = evalChkSum();
}
#if defined(PCBTARANIS)
@@ -592,6 +610,7 @@ void ConvertModel_215_to_216(ModelData &model)
for (uint8_t i=0; i<9; i++) {
memcpy(&g_model.phaseData[i], &oldModel.phaseData[i], sizeof(oldModel.phaseData[i])); // the last 4 gvars will remain blank
g_model.phaseData[i].swtch = ConvertSwitch_215_to_216(oldModel.phaseData[i].swtch);
#if defined(PCBTARANIS)
for (uint8_t t=0; t<4; t++) {
int trim = oldModel.phaseData[i].trim[t];
Binary file not shown.

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 449 B

+2 -2
View File
@@ -3077,7 +3077,7 @@ void gvarWeightItem(xcoord_t x, uint8_t y, MixData *md, uint8_t attr, uint8_t ev
{
u_int8int16_t weight;
MD_WEIGHT_TO_UNION(md, weight);
weight.word = GVAR_MENU_ITEM(x, y, weight.word, -500, 500, attr, 0, event);
weight.word = GVAR_MENU_ITEM(x, y, weight.word, GV_RANGELARGE_WEIGHT_NEG, GV_RANGELARGE_WEIGHT, attr, 0, event);
MD_UNION_TO_WEIGHT(weight, md);
}
@@ -3155,7 +3155,7 @@ void menuModelMixOne(uint8_t event)
lcd_putsColumnLeft(COLUMN_X, y, NO_INDENT(STR_OFFSET));
u_int8int16_t offset;
MD_OFFSET_TO_UNION(md2, offset);
offset.word = GVAR_MENU_ITEM(COLUMN_X+MIXES_2ND_COLUMN, y, offset.word, GV_RANGELARGE_NEG, GV_RANGELARGE, attr|LEFT, 0, event);
offset.word = GVAR_MENU_ITEM(COLUMN_X+MIXES_2ND_COLUMN, y, offset.word, GV_RANGELARGE_OFFSET_NEG, GV_RANGELARGE_OFFSET, attr|LEFT, 0, event);
MD_UNION_TO_OFFSET(offset, md2);
break;
}
+3 -1
View File
@@ -318,7 +318,9 @@ void displayTopBar()
/* RTC time */
struct gtm t;
gettime(&t);
lcd_putcAtt(BAR_TIME_X+1, BAR_Y+1, ':', BLINK);
if (t.tm_sec % 2) {
lcd_putcAtt(BAR_TIME_X+1, BAR_Y+1, ':', 0);
}
lcd_outdezNAtt(BAR_TIME_X+1, BAR_Y+1, t.tm_hour, LEADING0, 2);
lcd_outdezNAtt(BAR_TIME_X+3*FWNUM-1, BAR_Y+1, t.tm_min, LEADING0, 2);
+16
View File
@@ -520,6 +520,16 @@ PACK(typedef struct t_LimitData {
#define MLTPX_REP 2
#if defined(CPUARM)
// highest bit used for small values in mix 128 --> 8 bit is enough
#define GV1_SMALL 128
// highest bit used for large values in mix 4096 --> 12 bits is used (type for weight and offset has even 16 bits)
#define GV1_LARGE 4096
// the define GV1_LARGE marks the highest bit value used for this variables
// because this would give too big numbers for ARM, we limit it further for offset and weight
// must be smaller than GV1_LARGE - RESERVE_RANGE_FOR_GVARS -1
#define GV_RANGE_WEIGHT 500
#define GV_RANGE_OFFSET 500
#define DELAY_STEP 10
#define SLOW_STEP 10
#define DELAY_MAX (25*DELAY_STEP) /* 25 seconds */
@@ -585,6 +595,12 @@ PACK( union u_int8int16_t {
// #define MD_SETOFFSET(md, val) md->offset = val
#else
// highest bit used for small values in mix 128 --> 8 bit is enough
#define GV1_SMALL 128
// highest bit used for large values in mix 256 --> 9 bits is used (8 bits + 1 extra bit from weightMode/offsetMode)
#define GV1_LARGE 256
#define DELAY_STEP 2
#define SLOW_STEP 2
#define DELAY_MAX 15 /* 7.5 seconds */
+1 -1
View File
@@ -2366,7 +2366,7 @@ void checkTHR()
}
#else
if (g_model.disableThrottleWarning) return;
getADC();
evalInputs(e_perout_mode_notrainer); // let do evalInputs do the job
int16_t v = calibratedStick[thrchn];
+15 -4
View File
@@ -906,13 +906,9 @@ void setTrimValue(uint8_t phase, uint8_t idx, int trim);
#endif
#if defined(CPUARM)
#define GV1_SMALL 128
#define GV1_LARGE 4096
#define GV_GET_GV1_VALUE(max) ( (max<=GV_RANGESMALL && min>=GV_RANGESMALL_NEG) ? GV1_SMALL : GV1_LARGE )
#define GV_INDEX_CALCULATION(x,max) ( (max<=GV_RANGESMALL && min>=GV_RANGESMALL_NEG) ? (uint8_t) x-GV1_SMALL : ((x&(GV1_LARGE*2-1))-GV1_LARGE) )
#else
#define GV1_SMALL 128
#define GV1_LARGE 256
#define GV_GET_GV1_VALUE(max) ( (max<=GV_RANGESMALL) ? GV1_SMALL : GV1_LARGE )
#define GV_INDEX_CALCULATION(x,max) ( (max<=GV1_SMALL) ? (uint8_t) x-GV1_SMALL : ((x&(GV1_LARGE*2-1))-GV1_LARGE) )
#endif
@@ -927,6 +923,21 @@ void setTrimValue(uint8_t phase, uint8_t idx, int trim);
#define GV_RANGESMALL_NEG (-GV1_SMALL + (RESERVE_RANGE_FOR_GVARS+1))
#define GV_RANGELARGE (GV1_LARGE - (RESERVE_RANGE_FOR_GVARS+1))
#define GV_RANGELARGE_NEG (-GV1_LARGE + (RESERVE_RANGE_FOR_GVARS+1))
#if defined(CPUARM)
// the define GV1_LARGE marks the highest bit value used for this variables
// because this would give too big numbers for ARM, we limit it further for
// offset and weight
#define GV_RANGELARGE_WEIGHT (GV_RANGE_WEIGHT)
#define GV_RANGELARGE_WEIGHT_NEG (-GV_RANGE_WEIGHT)
#define GV_RANGELARGE_OFFSET (GV_RANGE_OFFSET)
#define GV_RANGELARGE_OFFSET_NEG (-GV_RANGE_OFFSET)
#else
// for stock we just use as much as possible
#define GV_RANGELARGE_WEIGHT GV_RANGELARGE
#define GV_RANGELARGE_WEIGHT_NEG GV_RANGELARGE_NEG
#define GV_RANGELARGE_OFFSET GV_RANGELARGE
#define GV_RANGELARGE_OFFSET_NEG GV_RANGELARGE_NEG
#endif
extern uint16_t s_timeCumTot;
extern uint16_t s_timeCumThr;
+1 -1
View File
@@ -124,7 +124,7 @@ extern "C" void TIM3_IRQHandler()
val = (uint16_t)(capture - lastCapt) / 2 ;
lastCapt = capture;
// We prcoess g_ppmInsright here to make servo movement as smooth as possible
// We process g_ppmInsright here to make servo movement as smooth as possible
// while under trainee control
if ((val>4000) && (val < 19000)) { // G: Prioritize reset pulse. (Needed when less than 8 incoming pulses)
ppmInState = 1; // triggered