Safety switches screen removed. Replaced by Function switches.

This commit is contained in:
bsongis
2012-02-03 22:28:56 +00:00
parent 51ef48b03e
commit d399f9f9c4
12 changed files with 89 additions and 43 deletions
+2 -2
View File
@@ -752,9 +752,9 @@ FOXLIB=-L/usr/local/lib \
-Wl,-rpath,$(FOXPATH)/src/.libs
LBITS := $(shell getconf LONG_BIT)
OS := @$(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
OS := $(shell uname -o)
ifeq ($(LBITS),64)
ifneq ($(OS),linux)
ifneq ($(OS),GNU/Linux)
ARCH=-arch x86_64
endif
else
+2 -1
View File
@@ -72,7 +72,8 @@ enum AUDIO_SOUNDS {
AU_FRSKY_TICK,
AU_FRSKY_HAPTIC1,
AU_FRSKY_HAPTIC2,
AU_FRSKY_HAPTIC3
AU_FRSKY_HAPTIC3,
AU_FRSKY_LAST,
};
class audioQueue
+5 -1
View File
@@ -94,8 +94,12 @@ uint8_t frskyGetUserData(char *buffer, uint8_t bufSize)
#ifdef FRSKY_HUB
int8_t parseTelemHubIndex(uint8_t index)
{
if (index > 0x26)
if (index > 0x3b)
index = 0; // invalid index
if (index > 0x39)
index -= 17;
if (index > 0x27)
index -= 1;
if (index > 0x21)
index -= 5;
if (index > 0x0f)
+9
View File
@@ -48,13 +48,16 @@ struct FrskyData {
#if defined(FRSKY_HUB)
struct FrskyHubData {
// 1 spare
int16_t gpsAltitude_bp; // before punct
int16_t temperature1; // -20 .. 250 deg. celcius
uint16_t rpm; // 0..60,000 revs. per minute
uint16_t fuelLevel; // 0, 25, 50, 75, 100 percent
int16_t temperature2; // -20 .. 250 deg. celcius
uint16_t volts; // 1/500V increments (0..4.2V)
// 2 spares
int16_t gpsAltitude_ap; // after punct
// 6 spares
uint16_t baroAltitude; // 0..9,999 meters
uint16_t gpsSpeed_bp; // before punct
uint16_t gpsLongitude_bp; // before punct
@@ -70,11 +73,17 @@ struct FrskyHubData {
uint16_t gpsLongitude_ap;
uint16_t gpsLatitude_ap;
uint16_t gpsCourse_ap;
// 5 spares
uint16_t gpsLongitudeEW; // East/West
uint16_t gpsLatitudeNS; // North/South
int16_t accelX; // 1/256th gram (-8g ~ +8g)
int16_t accelY; // 1/256th gram (-8g ~ +8g)
int16_t accelZ; // 1/256th gram (-8g ~ +8g)
// 1 spare
uint16_t current;
// 17 spares
uint16_t volts_bp;
uint16_t volts_ap;
};
#elif defined(WS_HOW_HIGH)
+4 -8
View File
@@ -142,13 +142,16 @@ void lcd_putsnAtt(uint8_t x,uint8_t y,const pm_char * s,uint8_t len,uint8_t mode
c = pgm_read_byte(s);
break;
}
if (!c) break;
lcd_putcAtt(x,y,c,mode);
x+=FW;
if (mode&DBLSIZE) x+=FW-1;
s++;
len--;
}
lcd_lastPos = x;
}
void lcd_putsn_P(uint8_t x,uint8_t y,const pm_char * s,uint8_t len)
{
lcd_putsnAtt(x, y, s, len, 0);
@@ -156,14 +159,7 @@ void lcd_putsn_P(uint8_t x,uint8_t y,const pm_char * s,uint8_t len)
void lcd_putsAtt(uint8_t x,uint8_t y,const pm_char * s,uint8_t mode)
{
while(1) {
char c = (mode & BSS) ? *s++ : pgm_read_byte(s++);
if(!c) break;
lcd_putcAtt(x,y,c,mode);
x+=FW;
if(mode&DBLSIZE) x+=FW;
}
lcd_lastPos = x;
lcd_putsnAtt(x, y, s, 255, mode);
}
void lcd_puts_P(uint8_t x,uint8_t y,const pm_char * s)
+39 -7
View File
@@ -39,7 +39,6 @@ enum EnumTabModel {
e_CurvesAll,
e_CustomSwitches,
e_FunctionSwitches,
e_SafetySwitches,
#ifdef FRSKY
e_Telemetry,
#endif
@@ -60,7 +59,6 @@ void menuProcLimits(uint8_t event);
void menuProcCurvesAll(uint8_t event);
void menuProcCustomSwitches(uint8_t event);
void menuProcFunctionSwitches(uint8_t event);
void menuProcSafetySwitches(uint8_t event);
#ifdef FRSKY
void menuProcTelemetry(uint8_t event);
#endif
@@ -82,7 +80,6 @@ const MenuFuncP_PROGMEM menuTabModel[] PROGMEM = {
menuProcCurvesAll,
menuProcCustomSwitches,
menuProcFunctionSwitches,
menuProcSafetySwitches,
#ifdef FRSKY
menuProcTelemetry,
#endif
@@ -1743,7 +1740,19 @@ void menuProcFunctionSwitches(uint8_t event)
break;
case 1:
if (sd->swtch) {
lcd_putsnAtt(5*FW, y, STR_VFSWFUNC+LEN_VFSWFUNC*sd->func, LEN_VFSWFUNC, attr);
uint8_t func_displayed;
if (sd->func < NUM_CHNOUT) {
func_displayed = 0;
putsChnRaw(14*FW-2, y, NUM_STICKS+NUM_POTS+2+3+NUM_PPM+sd->func+1, attr);
}
else if (sd->func < NUM_CHNOUT + NUM_STICKS + 1) {
func_displayed = 1;
if (sd->func != FUNC_TRAINER)
putsChnRaw(13*FW-2, y, sd->func-FUNC_TRAINER, attr);
}
else
func_displayed = 2 + sd->func - NUM_CHNOUT - NUM_STICKS - 1;
lcd_putsnAtt(5*FW-2, y, STR_VFSWFUNC+LEN_VFSWFUNC*func_displayed, LEN_VFSWFUNC, attr);
if (active) {
CHECK_INCDEC_MODELVAR( event, sd->func, 0, FUNC_MAX-1);
}
@@ -1753,10 +1762,31 @@ void menuProcFunctionSwitches(uint8_t event)
}
break;
case 2:
if (sd->swtch && sd->func == FUNC_PLAY_SOUND) {
lcd_outdezAtt(19*FW, y, sd->param, attr);
if (sd->swtch) {
int16_t val_displayed;
int8_t val_min;
int8_t val_max;
if (sd->func == FUNC_PLAY_SOUND) {
val_displayed = sd->param;
#ifdef AUDIO
val_min = 0;
val_max = AU_FRSKY_LAST-AU_FRSKY_FIRST-1;
#else
break;
#endif
}
else if (sd->func <= FUNC_SAFETY_CH16) {
val_displayed = (int8_t)sd->param;
val_min = -125;
val_max = 125;
}
else {
break;
}
lcd_outdezAtt(21*FW, y, val_displayed, attr);
if (active) {
CHECK_INCDEC_MODELVAR( event, sd->param, 0, 15);
CHECK_INCDEC_MODELVAR(event, sd->param, val_min, val_max);
}
}
else if (attr) {
@@ -1768,6 +1798,7 @@ void menuProcFunctionSwitches(uint8_t event)
}
}
#if 0
void menuProcSafetySwitches(uint8_t event)
{
MENU(STR_MENUSAFETYSWITCHES, menuTabModel, e_SafetySwitches, NUM_CHNOUT+1, {0, 1/*repeated*/});
@@ -1802,6 +1833,7 @@ void menuProcSafetySwitches(uint8_t event)
}
}
}
#endif
#ifdef FRSKY
void menuProcTelemetry(uint8_t event)
+7 -12
View File
@@ -154,13 +154,9 @@ PACK(typedef struct t_CustomSwData { // Custom Switches data
uint8_t func;
}) CustomSwData;
PACK(typedef struct t_SafetySwData { // Safety Switches data
int8_t swtch;
int8_t val;
}) SafetySwData;
enum Functions {
FUNC_NONE,
FUNC_SAFETY_CH1,
FUNC_SAFETY_CH16=FUNC_SAFETY_CH1+15,
FUNC_TRAINER,
FUNC_TRAINER_RUD,
FUNC_TRAINER_ELE,
@@ -177,8 +173,8 @@ enum Functions {
PACK(typedef struct t_FuncSwData { // Function Switches data
int8_t swtch; //input
uint8_t func:4;
uint8_t param:4;
uint8_t func;
uint8_t param;
}) FuncSwData;
PACK(typedef struct t_FrSkyChannelData {
@@ -239,7 +235,7 @@ PACK(typedef struct t_PhaseData {
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16
#define NUM_CSW 12 // number of custom switches
#define NUM_FSW 12 // number of functions assigned to switches
#define NUM_FSW 16 // number of functions assigned to switches
#define TMRMODE_NONE 0
#define TMRMODE_ABS 1
@@ -277,9 +273,8 @@ PACK(typedef struct t_ModelData {
ExpoData expoData[MAX_EXPOS];
int8_t curves5[MAX_CURVE5][5];
int8_t curves9[MAX_CURVE9][9];
CustomSwData customSw[NUM_CSW];
SafetySwData safetySw[NUM_CHNOUT];
FuncSwData funcSw[NUM_FSW];
CustomSwData customSw[NUM_CSW];
FuncSwData funcSw[NUM_FSW];
SwashRingData swashR;
PhaseData phaseData[MAX_PHASES];
FrSkyData frsky;
+16 -8
View File
@@ -52,6 +52,8 @@ audioQueue audio;
uint8_t heartbeat;
int8_t safetyCh[NUM_CHNOUT];
const pm_char s_charTab[] PROGMEM = "_-.,";
//R=1
@@ -1045,19 +1047,25 @@ uint16_t active_functions = 0; // current max = 16 functions
void evalFunctions()
{
assert(sizeof(active_functions)*8 > FUNC_MAX);
assert(sizeof(active_functions)*8 > FUNC_MAX-NUM_CHNOUT);
for (uint8_t i=0; i<NUM_CHNOUT; i++)
safetyCh[i] = -128; // not defined
for (uint8_t i=0; i<NUM_FSW; i++) {
FuncSwData *sd = &g_model.funcSw[i];
if (sd->swtch && sd->func) {
uint16_t mask = (1 << (sd->func-1));
if (sd->swtch) {
uint16_t mask = (sd->func >= FUNC_TRAINER ? (1 << (sd->func-FUNC_TRAINER)) : 0);
if (getSwitch(sd->swtch, 0)) {
if (sd->func == FUNC_PLAY_SOUND && (~active_functions & mask)) {
if (sd->func < FUNC_TRAINER) {
safetyCh[sd->func] = (int8_t)sd->param;
}
if (sd->func == FUNC_PLAY_SOUND/* && (~active_functions & mask)*/) {
#if defined(AUDIO)
audioDefevent(sd->param);
audioDefevent(AU_FRSKY_FIRST+sd->param);
#else
if (g_eeGeneral.beeperVal>0) {
_beep(min(1, sd->param*10));
_beep(10);
}
#endif
}
@@ -1336,8 +1344,8 @@ void perOut(int16_t *chanOut, uint8_t phase)
if(q<lim_n) q = lim_n;
if(g_model.limitData[i].revert) q=-q;// finally do the reverse.
if(g_model.safetySw[i].swtch) //if safety sw available for channel check and replace val if needed
if(getSwitch(g_model.safetySw[i].swtch,0)) q = calc100toRESX(g_model.safetySw[i].val);
if (safetyCh[i] != -128) // if safety channel available for channel check and replace val if needed
q = calc100toRESX(safetyCh[i]);
chanOut[i] = q; //copy consistent word to int-level
}
+2 -1
View File
@@ -475,6 +475,7 @@ extern uint16_t s_timeCum16ThrP; //gewichtete laufzeit in 1/16 sec
extern uint8_t s_timerState[2];
extern int16_t s_timerVal[2];
extern uint8_t s_timerVal_10ms[2];
extern int8_t safetyCh[NUM_CHNOUT];
extern uint8_t trimsCheckTimer;
@@ -700,7 +701,7 @@ extern void moveTrimsToOffsets(); // move state of 3 primary trims to offsets
extern uint16_t active_functions;
inline bool isFunctionActive(uint8_t func)
{
return active_functions & (1 << (func-1));
return active_functions & (1 << (func-FUNC_TRAINER));
}
#ifdef DISPLAY_USER_DATA
+1 -1
View File
@@ -110,7 +110,7 @@ void eeLoadModel(uint8_t id)
}
#endif
if (sz < 730/*sizeof(last compatible eeprom)*/) {
if (sz == 0) {
// alert("Error Loading Model");
modelDefault(id);
eeCheck(true);
+1 -1
View File
@@ -65,7 +65,7 @@
#else
#define TR_SDCLOGGS
#endif
#define TR_VFSWFUNC "---- ""Trainer ""Trainer RUD ""Trainer ELE ""Trainer THR ""Trainer AIL ""Instant Trim ""Trims2Offsets""Play sound " TR_SDCLOGGS
#define TR_VFSWFUNC "Security \0 ""Trainer \0 ""Instant Trim ""Trims2Offsets""Play sound " TR_SDCLOGGS
#define LEN_VTELEMUNIT 1
#define TR_VTELEMUNIT "v""-"
+1 -1
View File
@@ -65,7 +65,7 @@
#else
#define TR_SDCLOGGS
#endif
#define TR_VFSWFUNC "---- ""Ecolage ""Ecolage DIR ""Ecolage PRF ""Ecolage GAZ ""Ecolage AIL ""Trim instant ""Trims2Offsets""Jouer son " TR_SDCLOGGS
#define TR_VFSWFUNC "Securite \0 ""Ecolage \0 ""Trim instant ""Trims2Offsets""Jouer son " TR_SDCLOGGS
#define LEN_VTELEMUNIT 1
#define TR_VTELEMUNIT "v""-"