Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1760 → Rev 1761

/trunk/eeprom.c
192,9 → 192,9
EE_Parameter.UnterspannungsWarnung = 33; // Wert : 0-247 ( Automatische Zellenerkennung bei < 50)
EE_Parameter.NotGas = 45; // Wert : 0-247 // Gaswert bei Empangsverlust
EE_Parameter.NotGasZeit = 90; // Wert : 0-247 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen
EE_Parameter.MotorSafetySwitch = 0;
EE_Parameter.MotorSafetySwitch = 0;
EE_Parameter.ServoManualControlSpeed = 20;
EE_Parameter.CamOrientation = 0;
EE_Parameter.CamOrientation = 0;
}
 
void ParamSet_DefaultSet1(void) // sport
507,6 → 507,45
}
 
/***************************************************/
/* Set default parameter set */
/***************************************************/
void SetDefaultParameter(uint8_t set, uint8_t restore_channels)
{
 
if(set > 5) set = 5;
else if(set < 1) set = 1;
 
switch(set)
{
case 1:
ParamSet_DefaultSet1(); // Fill ParamSet Structure to default parameter set 1 (Sport)
break;
case 2:
ParamSet_DefaultSet2(); // Kamera
break;
case 3:
ParamSet_DefaultSet3(); // Beginner
break;
default:
ParamSet_DefaultSet3(); // Beginner
break;
}
if(restore_channels)
{
uint8_t crc;
// 1st check for a valid channel backup in eeprom
crc = EEProm_Checksum(EEPROM_ADR_CHANNELS, sizeof(EE_Parameter.Kanalbelegung));
if(crc == eeprom_read_byte((uint8_t*)(EEPROM_ADR_CHANNELS + sizeof(EE_Parameter.Kanalbelegung))) )
{
eeprom_read_block((void *)EE_Parameter.Kanalbelegung, (void*)(EEPROM_ADR_CHANNELS), sizeof(EE_Parameter.Kanalbelegung));
}
else ParamSet_DefaultStickMapping();
}
else ParamSet_DefaultStickMapping();
ParamSet_WriteToEEProm(set);
}
 
/***************************************************/
/* Initialize EEPROM Parameter Sets */
/***************************************************/
void ParamSet_Init(void)
/trunk/eeprom.h
155,8 → 155,8
unsigned char ServoRollMax; // Wert : 0-250
//---
unsigned char ServoNickRefresh; // Speed of the Servo
unsigned char ServoManualControlSpeed;//
unsigned char CamOrientation; //
unsigned char ServoManualControlSpeed;//
unsigned char CamOrientation; //
unsigned char Servo3; // Value or mapping of the Servo Output
unsigned char Servo4; // Value or mapping of the Servo Output
unsigned char Servo5; // Value or mapping of the Servo Output
204,8 → 204,8
unsigned char ExternalControl; // for serial Control
//---CareFree---------------------------------------------
unsigned char OrientationAngle; // Where is the front-direction?
unsigned char OrientationModeControl; // switch for CareFree
unsigned char MotorSafetySwitch;
unsigned char OrientationModeControl; // switch for CareFree
unsigned char MotorSafetySwitch;
//------------------------------------------------
unsigned char BitConfig; // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
unsigned char ServoCompInvert; // // 0x01 = Nick, 0x02 = Roll 0 oder 1 // WICHTIG!!! am Ende lassen
221,6 → 221,7
extern uint8_t RAM_Checksum(uint8_t* pBuffer, uint16_t len);
 
extern void ParamSet_Init(void);
extern void SetDefaultParameter(uint8_t set, uint8_t restore_channels);
 
extern uint8_t ParamSet_ReadFromEEProm(uint8_t setnumber);
extern uint8_t ParamSet_WriteToEEProm(uint8_t setnumber);
/trunk/uart.c
108,7 → 108,7
"26 ",
"27 ",
"I2C-Error ",
"BL Limit ",
"BL Limit ",
"GPS_Nick ", //30
"GPS_Roll "
};
372,15 → 372,32
 
case 'q':// "Get"-Anforderung für Settings
// Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen
if(pRxData[0] == 0xFF)
if((10 <= pRxData[0]) && (pRxData[0] < 20))
{
pRxData[0] = GetActiveParamSet();
tempchar1 = pRxData[0] - 10;
if(tempchar1< 1) tempchar1 = 1; // limit to 1
else if(tempchar1 > 5) tempchar1 = 5; // limit to 5
SetDefaultParameter(tempchar1, 1);
}
// limit settings range
if(pRxData[0] < 1) pRxData[0] = 1; // limit to 5
else if(pRxData[0] > 5) pRxData[0] = 5; // limit to 5
// load requested parameter set
ParamSet_ReadFromEEProm(pRxData[0]);
else if((20 <= pRxData[0]) && (pRxData[0] < 30))
{
tempchar1 = pRxData[0] - 20;
if(tempchar1< 1) tempchar1 = 1; // limit to 1
else if(tempchar1 > 5) tempchar1 = 5; // limit to 5
SetDefaultParameter(tempchar1, 0);
}
else
{
tempchar1 = pRxData[0];
if(tempchar1 == 0xFF)
{
tempchar1 = GetActiveParamSet();
}
if(tempchar1< 1) tempchar1 = 1; // limit to 1
else if(tempchar1 > 5) tempchar1 = 5; // limit to 5
// load requested parameter set
ParamSet_ReadFromEEProm(tempchar1);
}
tempchar1 = pRxData[0];
while(!UebertragungAbgeschlossen);
SendOutData('Q', FC_ADDRESS, 2, &tempchar1, sizeof(tempchar1), (unsigned char *) &EE_Parameter, sizeof(EE_Parameter) - 1);