/trunk/fc.c |
---|
1311,10 → 1311,18 |
if(MesswertGier < -MAX_SENSOR) MesswertGier = -MAX_SENSOR; |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// all BL-Ctrl connected? |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
if(MissingMotor) if(modell_fliegt > 1 && modell_fliegt < 50 && GasMischanteil > 0) |
{ |
modell_fliegt = 1; |
GasMischanteil = MIN_GAS; |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Höhenregelung |
// Die Höhenregelung schwächt lediglich das Gas ab, erhöht es allerdings nicht |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
GasMischanteil *= STICK_GAIN; |
if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung |
{ |
/trunk/main.c |
---|
284,10 → 284,13 |
ExternStickGier = 0; |
} |
if(SenderOkay) SenderOkay--; |
if(!I2CTimeout) |
if(!--I2CTimeout || MissingMotor) |
{ |
I2CTimeout = 5; |
i2c_reset(); |
if(!I2CTimeout) |
{ |
i2c_reset(); |
I2CTimeout = 5; |
} |
if((BeepMuster == 0xffff) && MotorenEin) |
{ |
beeptime = 10000; |
296,7 → 299,6 |
} |
else |
{ |
I2CTimeout--; |
ROT_OFF; |
} |
if(SIO_DEBUG && (!UpdateMotor || !MotorenEin)) |
/trunk/makefile |
---|
5,7 → 5,7 |
#------------------------------------------------------------------- |
VERSION_MAJOR = 0 |
VERSION_MINOR = 73 |
VERSION_PATCH = 0 |
VERSION_PATCH = 1 |
VERSION_SERIAL_MAJOR = 10 # Serial Protocol |
VERSION_SERIAL_MINOR = 0 # Serial Protocol |
/trunk/menu.c |
---|
12,7 → 12,7 |
char DisplayBuff[80] = "Hallo Welt"; |
unsigned char DispPtr = 0; |
unsigned char MaxMenue = 11; |
unsigned char MaxMenue = 12; |
unsigned char MenuePunkt = 0; |
unsigned char RemoteKeys = 0; |
45,13 → 45,12 |
{ |
case 0: |
LCD_printfxy(0,0,"+ MikroKopter +"); |
#ifndef QUADRO |
LCD_printfxy(0,1,"HWV%d.%d SW%d.%d%c OCTO",PlatinenVersion/10,PlatinenVersion%10, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH +'a'); |
#else |
LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",PlatinenVersion/10,PlatinenVersion%10, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH +'a'); |
#endif |
LCD_printfxy(0,2,"Setting: %d ",GetActiveParamSetNumber()); |
LCD_printfxy(0,3,"(c) Holger Buss"); |
LCD_printfxy(0,2,"Setting:%d %s",GetActiveParamSetNumber(),Mixer.Name); |
if(I2CTimeout < 6) LCD_printfxy(0,3,"I2C ERROR!!!") |
else |
if(MissingMotor) LCD_printfxy(0,3,"Missing BL-Ctrl:%d!!",MissingMotor) |
else LCD_printfxy(0,3,"(c) Holger Buss"); |
// if(RemoteTasten & KEY3) TestInt--; |
// if(RemoteTasten & KEY4) TestInt++; |
break; |
146,6 → 145,16 |
LCD_printfxy(0,2,"Gs:%4i Gi:%4i ",ExternControl.Gas,ExternControl.Gier); |
LCD_printfxy(0,3,"Hi:%4i Cf:%4i ",ExternControl.Hight,ExternControl.Config); |
break; |
case 12: |
LCD_printfxy(0,0,"BL-Ctrl found " ); |
LCD_printfxy(0,1," %c %c %c %c ",MotorPresent[0] + '-',MotorPresent[1] + '-',MotorPresent[2] + '-',MotorPresent[3] + '-'); |
LCD_printfxy(0,2," %c %c %c %c ",MotorPresent[4] + '-',MotorPresent[5] + '-',MotorPresent[6] + '-',MotorPresent[7] + '-'); |
LCD_printfxy(0,3," %c - - -",MotorPresent[8] + '-'); |
if(MotorPresent[9]) LCD_printfxy(4,3,"10"); |
if(MotorPresent[10]) LCD_printfxy(8,3,"11"); |
if(MotorPresent[11]) LCD_printfxy(12,3,"12"); |
break; |
default: MaxMenue = MenuePunkt - 1; |
MenuePunkt = 0; |
break; |
/trunk/twimaster.c |
---|
5,8 → 5,9 |
volatile unsigned char twi_state = 0; |
unsigned char motor = 0; |
unsigned char motorread = 0; |
unsigned char motorread = 0,MissingMotor = 0; |
unsigned char motor_rx[16],motor_rx2[16]; |
unsigned char MotorPresent[MAX_MOTORS]; |
//############################################################################ |
//Initzialisieren der I2C (TWI) Schnittstelle |
94,12 → 95,20 |
SIGNAL (TWI_vect) |
//############################################################################ |
{ |
switch (twi_state++) |
static unsigned char missing_motor,cnt_motor; |
switch(twi_state++) |
{ |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Writing the Data |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
case 0: |
J3High; |
while(Mixer.Motor[motor][0] <= 0 && motor < MAX_MOTORS-1) motor++; // skip if not used |
if(motor == MAX_MOTORS) { motor = 0; twi_state = 3; i2c_start(); } // writing finished -> now read |
while(Mixer.Motor[motor][0] <= 0 && motor < MAX_MOTORS) motor++; // skip if not used |
if(motor == MAX_MOTORS) // writing finished -> now read |
{ |
motor = 0; |
twi_state = 3; |
i2c_write_byte(0x53+(motorread*2)); |
} |
else i2c_write_byte(0x52+(motor*2)); |
break; |
case 1: |
106,33 → 115,48 |
i2c_write_byte(Motor[motor++]); |
break; |
case 2: |
if(TWSR == 0x30) { if(!missing_motor) missing_motor = motor; } |
i2c_stop(); |
I2CTimeout = 10; |
twi_state = 0; |
i2c_start(); |
break; |
//Liest Daten von Motor |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Reading Data |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
case 3: |
J5High; |
while(Mixer.Motor[motorread][0] <= 0 && MAX_MOTORS-1) motorread++; |
if(motorread >= MAX_MOTORS) {motorread = 0;J4High;} |
else i2c_write_byte(0x53+(motorread*2)); |
break; |
case 4: |
//Transmit 1st byte for reading |
if(TWSR != 0x40) // Error? |
{ |
MotorPresent[motorread] = 0; |
motorread++; |
if(motorread >= MAX_MOTORS) motorread = 0; |
i2c_stop(); |
twi_state = 0; |
} |
else |
{ |
MotorPresent[motorread] = ('1' - '-') + motorread; |
} |
MissingMotor = missing_motor; |
I2C_ReceiveByte(); |
break; |
case 5: //Read 1st byte and transmit 2nd Byte |
case 4: //Read 1st byte and transmit 2nd Byte |
motor_rx[motorread] = TWDR; |
I2C_ReceiveLastByte(); //nack |
break; |
case 6: |
case 5: |
//Read 2nd byte |
motor_rx2[motorread++] = TWDR; |
i2c_stop(); |
twi_state = 0; |
I2CTimeout = 10; |
missing_motor = 0; |
break; |
case 8: // Gyro-Offset |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// writing Gyro-Offset |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
case 8: |
i2c_write_byte(0x98); // Address of the DAC |
break; |
case 9: |
187,9 → 211,6 |
break; |
} |
TWCR |= 0x80; |
J3Low; |
J4Low; |
J5Low; |
} |
/* |
//############################################################################ |
/trunk/twimaster.h |
---|
19,9 → 19,10 |
//############################################################################ |
extern volatile unsigned char twi_state; |
extern unsigned char motor; |
extern unsigned char motor,MissingMotor; |
extern unsigned char motorread; |
extern unsigned char motor_rx[16]; |
extern unsigned char motor_rx[]; |
extern unsigned char MotorPresent[]; |
void i2c_reset(void); |
extern void i2c_init (void); // I2C initialisieren |
/trunk/version.txt |
---|
241,4 → 241,5 |
0.73a: H.Buss 12.03.2009 |
- MixerTabelle implementiert |
0.73b: H.Buss 14.03.2009 |
- Es wird geprüft, ob alle notwendigen BL-Regler angeschlossen sind |