Some RAM saved in getADC functions (port from er9x). Reverse throttle issue 14 solved. Bug in mixer delays. PPM frame length configurable.
This commit is contained in:
+47
-31
@@ -49,6 +49,24 @@
|
||||
#include "gruvin9x.h"
|
||||
#include "templates.h"
|
||||
|
||||
const char stn1[] APM = "Simple 4-CH";
|
||||
const char stn2[] APM = "T-Cut";
|
||||
const char stn3[] APM = "V-Tail";
|
||||
const char stn4[] APM = "Elevon\\Delta";
|
||||
const char stn5[] APM = "eCCPM";
|
||||
const char stn6[] APM = "Heli Setup";
|
||||
const char stn7[] APM = "Servo Test";
|
||||
const prog_char* n_Templates[] =
|
||||
{
|
||||
stn1,
|
||||
stn2,
|
||||
stn3,
|
||||
stn4,
|
||||
stn5,
|
||||
stn6,
|
||||
stn7
|
||||
};
|
||||
|
||||
MixData* setDest(uint8_t dch)
|
||||
{
|
||||
uint8_t i = 0;
|
||||
@@ -74,12 +92,12 @@ void clearCurves()
|
||||
memset(g_model.curves9,0,sizeof(g_model.curves9)); //clear all curves
|
||||
}
|
||||
|
||||
void setCurve(uint8_t c, int8_t ar[])
|
||||
void setCurve(uint8_t c, const prog_int8_t ar[])
|
||||
{
|
||||
if(c<MAX_CURVE5) //5 pt curve
|
||||
for(uint8_t i=0; i<5; i++) g_model.curves5[c][i] = ar[i];
|
||||
for(uint8_t i=0; i<5; i++) g_model.curves5[c][i] = pgm_read_byte(&ar[i]);
|
||||
else //9 pt curve
|
||||
for(uint8_t i=0; i<9; i++) g_model.curves9[c-MAX_CURVE5][i] = ar[i];
|
||||
for(uint8_t i=0; i<9; i++) g_model.curves9[c-MAX_CURVE5][i] = pgm_read_byte(&ar[i]);
|
||||
}
|
||||
|
||||
void setSwitch(uint8_t idx, uint8_t func, int8_t v1, int8_t v2)
|
||||
@@ -89,15 +107,13 @@ void setSwitch(uint8_t idx, uint8_t func, int8_t v1, int8_t v2)
|
||||
g_model.customSw[idx-1].v2 = v2;
|
||||
}
|
||||
|
||||
const prog_int8_t APM heli_ar1[] = {-100, 20, 50, 70, 90};
|
||||
const prog_int8_t APM heli_ar2[] = {90, 70, 50, 70, 90};
|
||||
const prog_int8_t APM heli_ar3[] = {-20, -20, 0, 60, 100};
|
||||
const prog_int8_t APM heli_ar4[] = {-100, -60, 0, 60, 100};
|
||||
const prog_int8_t APM heli_ar5[] = {-100, 0, 0, 0, 100};
|
||||
void applyTemplate(uint8_t idx)
|
||||
{
|
||||
int8_t heli_ar1[] = {-100, 20, 50, 70, 90};
|
||||
int8_t heli_ar2[] = {90, 70, 50, 70, 90};
|
||||
int8_t heli_ar3[] = {-20, -20, 0, 60, 100};
|
||||
int8_t heli_ar4[] = {-100, -60, 0, 60, 100};
|
||||
int8_t heli_ar5[] = {-100, 0, 0, 0, 100};
|
||||
|
||||
|
||||
MixData *md = &g_model.mixData[0];
|
||||
|
||||
//CC(STK) -> vSTK
|
||||
@@ -107,39 +123,39 @@ void applyTemplate(uint8_t idx)
|
||||
for(uint8_t i=1; i<=4; i++) //generate inverse array
|
||||
for(uint8_t j=1; j<=4; j++) if(CC(i)==j) icc[j-1]=i;
|
||||
|
||||
|
||||
switch (idx){
|
||||
//Simple 4-Ch
|
||||
case (0):
|
||||
// Simple 4-Ch
|
||||
case (0):
|
||||
clearMixes();
|
||||
md=setDest(ICC(STK_RUD)); md->srcRaw=CM(STK_RUD); md->weight=100;
|
||||
md=setDest(ICC(STK_ELE)); md->srcRaw=CM(STK_ELE); md->weight=100;
|
||||
md=setDest(ICC(STK_THR)); md->srcRaw=CM(STK_THR); md->weight=100;
|
||||
md=setDest(ICC(STK_AIL)); md->srcRaw=CM(STK_AIL); md->weight=100;
|
||||
break;
|
||||
|
||||
//T-Cut
|
||||
case (1):
|
||||
// T-Cut
|
||||
case (1):
|
||||
md=setDest(ICC(STK_THR)); md->srcRaw=MIX_MAX; md->weight=-100; md->swtch=DSW_THR; md->mltpx=MLTPX_REP;
|
||||
break;
|
||||
|
||||
//V-Tail
|
||||
case (2):
|
||||
// V-Tail
|
||||
case (2):
|
||||
md=setDest(ICC(STK_RUD)); md->srcRaw=CM(STK_RUD); md->weight= 100;
|
||||
md=setDest(ICC(STK_RUD)); md->srcRaw=CM(STK_ELE); md->weight=-100;
|
||||
md=setDest(ICC(STK_ELE)); md->srcRaw=CM(STK_RUD); md->weight= 100;
|
||||
md=setDest(ICC(STK_ELE)); md->srcRaw=CM(STK_ELE); md->weight= 100;
|
||||
break;
|
||||
|
||||
//Elevon\\Delta
|
||||
case (3):
|
||||
// Elevon\\Delta
|
||||
case (3):
|
||||
md=setDest(ICC(STK_ELE)); md->srcRaw=CM(STK_ELE); md->weight= 100;
|
||||
md=setDest(ICC(STK_ELE)); md->srcRaw=CM(STK_AIL); md->weight= 100;
|
||||
md=setDest(ICC(STK_AIL)); md->srcRaw=CM(STK_ELE); md->weight= 100;
|
||||
md=setDest(ICC(STK_AIL)); md->srcRaw=CM(STK_AIL); md->weight=-100;
|
||||
break;
|
||||
|
||||
//eCCPM
|
||||
case (4):
|
||||
// eCCPM
|
||||
case (4):
|
||||
md=setDest(ICC(STK_ELE)); md->srcRaw=CM(STK_ELE); md->weight= 72;
|
||||
md=setDest(ICC(STK_ELE)); md->srcRaw=CM(STK_THR); md->weight= 55;
|
||||
md=setDest(ICC(STK_AIL)); md->srcRaw=CM(STK_ELE); md->weight=-36;
|
||||
@@ -150,8 +166,8 @@ void applyTemplate(uint8_t idx)
|
||||
md=setDest(6); md->srcRaw=CM(STK_THR); md->weight= 55;
|
||||
break;
|
||||
|
||||
//Heli Setup
|
||||
case (5):
|
||||
// Heli Setup
|
||||
case (5):
|
||||
clearMixes(); //This time we want a clean slate
|
||||
clearCurves();
|
||||
|
||||
@@ -186,15 +202,15 @@ void applyTemplate(uint8_t idx)
|
||||
md=setDest(11); md->srcRaw=CM(STK_THR); md->weight=100; md->swtch=DSW_THR; md->curve=CV(5); md->carryTrim=TRIM_OFF; md->mltpx=MLTPX_REP;
|
||||
|
||||
//Set up Curves
|
||||
setCurve(CURVE5(1),heli_ar1);
|
||||
setCurve(CURVE5(2),heli_ar2);
|
||||
setCurve(CURVE5(3),heli_ar3);
|
||||
setCurve(CURVE5(4),heli_ar4);
|
||||
setCurve(CURVE5(5),heli_ar5);
|
||||
setCurve(CURVE5(1), heli_ar1);
|
||||
setCurve(CURVE5(2), heli_ar2);
|
||||
setCurve(CURVE5(3), heli_ar3);
|
||||
setCurve(CURVE5(4), heli_ar4);
|
||||
setCurve(CURVE5(5), heli_ar5);
|
||||
break;
|
||||
|
||||
//Servo Test
|
||||
case (6):
|
||||
// Servo Test
|
||||
case (6):
|
||||
md=setDest(15); md->srcRaw=CH(16); md->weight= 100; md->speedUp = 8; md->speedDown = 8;
|
||||
md=setDest(16); md->srcRaw=MIX_FULL; md->weight= 110; md->swtch=DSW_SW1;
|
||||
md=setDest(16); md->srcRaw=MIX_MAX; md->weight=-110; md->swtch=DSW_SW2; md->mltpx=MLTPX_REP;
|
||||
@@ -210,6 +226,6 @@ void applyTemplate(uint8_t idx)
|
||||
break;
|
||||
|
||||
}
|
||||
STORE_MODELVARS;
|
||||
|
||||
STORE_MODELVARS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user