/trunk/capacity.c |
---|
58,7 → 58,7 |
#include "analog.h" |
//#define CAPACITY_UPDATE_INTERVAL 10 // 10 ms |
#define CAPACITY_UPDATE_INTERVAL 50 // 50 ms |
#define CAPACITY_UPDATE_INTERVAL 50 // 50 ms = 20Hz |
#define FC_OFFSET_CURRENT 5 // calculate with a current of 0.5A |
#define BL_OFFSET_CURRENT 2 // calculate with a current of 0.2A |
125,7 → 125,6 |
} |
} |
Capacity.MinOfMaxPWM = MinOfMaxPWM; |
if(SetSum == 0) // if all setpoints are 0 |
{ // determine offsets of motor currents |
#define CURRENT_AVERAGE 8 // 8bit = 256 * 10 ms = 2.56s average time |
/trunk/eeprom.c |
---|
250,8 → 250,11 |
EE_Parameter.FailsafeChannel = 0; |
EE_Parameter.ServoFilterNick = 0; |
EE_Parameter.ServoFilterRoll = 0; |
EE_Parameter.Servo3OnValue = 140; |
EE_Parameter.Servo3OffValue = 70; |
EE_Parameter.Servo4OnValue = 140; |
EE_Parameter.Servo4OffValue = 70; |
EE_Parameter.CompassOffset = 0; |
EE_Parameter.UnterspannungsWarnung = 32; // Wert : 0-247 ( Automatische Zellenerkennung bei < 50) |
EE_Parameter.ComingHomeVoltage = 31; |
EE_Parameter.AutoLandingVoltage = 30; |
/trunk/eeprom.h |
---|
4,7 → 4,7 |
#include <inttypes.h> |
#include "twimaster.h" |
#define EEPARAM_REVISION 100 // is count up, if paramater stucture has changed (compatibility) |
#define EEPARAM_REVISION 101 // is count up, if paramater stucture has changed (compatibility) |
#define EEMIXER_REVISION 1 // is count up, if mixer stucture has changed (compatibility) |
#define EEPROM_ADR_PARAM_BEGIN 0 |
244,6 → 244,10 |
unsigned char FailsafeChannel; // if the value of this channel is > 100, the MK reports "RC-Lost" |
unsigned char ServoFilterNick; |
unsigned char ServoFilterRoll; |
unsigned char Servo3OnValue; |
unsigned char Servo3OffValue; |
unsigned char Servo4OnValue; |
unsigned char Servo4OffValue; |
unsigned char StartLandChannel; |
unsigned char LandingSpeed; |
unsigned char CompassOffset; |
/trunk/fc.c |
---|
674,12 → 674,12 |
CHK_POTI_MM(Parameter_J16Timing,EE_Parameter.J16Timing,5,255); |
CHK_POTI_MM(Parameter_J17Timing,EE_Parameter.J17Timing,5,255); |
if(EE_Parameter.Servo3 == 247) { if(PORTC & (1<<PORTC2)) Parameter_Servo3 = 140; else Parameter_Servo3 = 70;} // Out1 (J16) |
else if(EE_Parameter.Servo3 == 246) { if(PORTC & (1<<PORTC3)) Parameter_Servo3 = 140; else Parameter_Servo3 = 70;} |
if(EE_Parameter.Servo3 == 247) { if(PORTC & (1<<PORTC2)) Parameter_Servo3 = EE_Parameter.Servo3OnValue; else Parameter_Servo3 = EE_Parameter.Servo3OffValue;} // Out1 (J16) |
else if(EE_Parameter.Servo3 == 246) { if(PORTC & (1<<PORTC3)) Parameter_Servo3 = EE_Parameter.Servo3OnValue; else Parameter_Servo3 = EE_Parameter.Servo3OffValue;} |
else CHK_POTI_MM(Parameter_Servo3,EE_Parameter.Servo3, 24, 255); |
if(EE_Parameter.Servo4 == 247) { if(PORTC & (1<<PORTC2)) Parameter_Servo4 = 140; else Parameter_Servo4 = 70;} |
else if(EE_Parameter.Servo4 == 246) { if(PORTC & (1<<PORTC3)) Parameter_Servo4 = 140; else Parameter_Servo4 = 70;} // Out2 (J17) |
if(EE_Parameter.Servo4 == 247) { if(PORTC & (1<<PORTC2)) Parameter_Servo4 = EE_Parameter.Servo4OnValue; else Parameter_Servo4 = EE_Parameter.Servo4OffValue;} |
else if(EE_Parameter.Servo4 == 246) { if(PORTC & (1<<PORTC3)) Parameter_Servo4 = EE_Parameter.Servo4OnValue; else Parameter_Servo4 = EE_Parameter.Servo4OffValue;} // Out2 (J17) |
else CHK_POTI_MM(Parameter_Servo4,EE_Parameter.Servo4, 24, 255); |
CHK_POTI_MM(Parameter_Servo5,EE_Parameter.Servo5, 24, 255); |
2253,7 → 2253,7 |
tmp_int = 2 * tmp_int - tmp_motorwert[i]; // original MotorSmoothing |
} |
else // 1 means tmp_int = tmp_int; |
if(EE_Parameter.MotorSmooth > 1) |
if(EE_Parameter.MotorSmooth > 1) |
{ |
// If >= 2 then allow >= 50% of the intended step down to rapidly reach the intended value. |
tmp_int = tmp_int + ((tmp_motorwert[i] - tmp_int) / EE_Parameter.MotorSmooth); |
/trunk/libfc1284.a |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/makefile |
---|
6,10 → 6,10 |
#------------------------------------------------------------------- |
VERSION_MAJOR = 2 |
VERSION_MINOR = 05 |
VERSION_PATCH = 4 |
VERSION_PATCH = 5 |
VERSION_SERIAL_MAJOR = 11 # Serial Protocol to KopterTool -> do not change! |
VERSION_SERIAL_MINOR = 0 # Serial Protocol |
NC_SPI_COMPATIBLE = 65 # Navi-Kompatibilität |
NC_SPI_COMPATIBLE = 66 # Navi-Kompatibilität |
LIB_FC_COMPATIBLE = 6 # Library |
#------------------------------------------------------------------- |
# ATMEGA644: 63487 is maximum |
/trunk/spi.c |
---|
179,15 → 179,17 |
break; |
case SPI_FCCMD_BL_ACCU: |
ToNaviCtrl.Param.Int[0] = Capacity.ActualCurrent; // 0.1A |
ToNaviCtrl.Param.Int[1] = Capacity.UsedCapacity; // mAh |
ToNaviCtrl.Param.Byte[2] = motorindex; |
ToNaviCtrl.Param.Byte[3] = Capacity.MinOfMaxPWM; |
ToNaviCtrl.Param.Byte[4] = GetChannelValue(EE_Parameter.NaviGpsModeChannel); // GPS-Mode control |
ToNaviCtrl.Param.Byte[5] = VarioCharacter; |
ToNaviCtrl.Param.Byte[6] = motorindex; |
ToNaviCtrl.Param.Byte[6] = Motor[motorindex].NotReadyCnt; |
ToNaviCtrl.Param.Byte[7] = Motor[motorindex].Version; |
ToNaviCtrl.Param.Byte[8] = Motor[motorindex].MaxPWM; |
ToNaviCtrl.Param.Byte[9] = Motor[motorindex].State; |
ToNaviCtrl.Param.Byte[10] = Motor[motorindex].Temperature; |
ToNaviCtrl.Param.Byte[11] = Motor[motorindex].Current; |
if(Mixer.Motor[++motorindex][0] <= 0) // next motor is not used ? |
while(Mixer.Motor[motorindex][0] <= 0 && motorindex) motorindex = (motorindex + 1) % 13; |
break; |
285,18 → 287,19 |
ToNaviCtrl.Param.Byte[11] = EE_Parameter.GlobalConfig3; |
break; |
case SPI_FCCMD_SERVOS: |
ToNaviCtrl.Param.Byte[0] = EE_Parameter.ServoNickRefresh; // Parameters for the Servo Control |
ToNaviCtrl.Param.Byte[1] = EE_Parameter.ServoCompInvert; |
ToNaviCtrl.Param.Int[0] = Capacity.UsedCapacity; // mAh |
ToNaviCtrl.Param.Byte[2] = Parameter_ServoNickControl; |
ToNaviCtrl.Param.Byte[3] = EE_Parameter.ServoNickComp; |
ToNaviCtrl.Param.Byte[4] = EE_Parameter.ServoNickMin; |
ToNaviCtrl.Param.Byte[5] = EE_Parameter.ServoNickMax; |
ToNaviCtrl.Param.Byte[6] = Parameter_ServoRollControl; |
ToNaviCtrl.Param.Byte[7] = EE_Parameter.ServoRollComp; |
ToNaviCtrl.Param.Byte[8] = EE_Parameter.ServoRollMin; |
ToNaviCtrl.Param.Byte[9] = EE_Parameter.ServoRollMax; |
ToNaviCtrl.Param.Byte[10] = Capacity.MinOfMaxPWM; |
ToNaviCtrl.Param.Byte[11] = DebugOut.Analog[28]; // I2C-Error counter |
ToNaviCtrl.Param.Byte[3] = Parameter_ServoRollControl; |
ToNaviCtrl.Param.Byte[4] = DebugOut.Analog[28]; // I2C-Error counter |
ToNaviCtrl.Param.Byte[5] = RedundanceBlOperation; |
/* |
ToNaviCtrl.Param.Byte[6] = 0; |
ToNaviCtrl.Param.Byte[7] = 0; |
ToNaviCtrl.Param.Byte[8] = 0; |
ToNaviCtrl.Param.Byte[9] = 0; |
ToNaviCtrl.Param.Byte[10] = 0; |
ToNaviCtrl.Param.Byte[11] = 0; |
*/ |
break; |
} |
/trunk/twimaster.c |
---|
60,6 → 60,7 |
#include "analog.h" |
#include "uart.h" |
#include "timer0.h" |
#include "main.h" |
volatile uint8_t twi_state = TWI_STATE_MOTOR_TX; |
volatile uint8_t dac_channel = 0; |
130,6 → 131,7 |
Motor[i].Current = 0; |
Motor[i].MaxPWM = 0; |
Motor[i].Temperature = 0; |
Motor[i].NotReadyCnt = 0; |
} |
sei(); |
SREG = sreg; |
288,7 → 290,7 |
break; |
case 6: // receive bytes |
*pBuff = TWDR; |
pBuff++; |
pBuff++; // set Pointer to next element : Motor[].Current,Motor[].Temperature |
BuffLen--; |
if(BuffLen>1) |
{ |
298,12 → 300,10 |
{ |
I2C_ReceiveLastByte(); // read last byte |
} |
else // nothing left |
else // nothing left -> ready |
{ |
if(BLFlags & BLFLAG_READ_VERSION) |
{ |
// if(!(FC_StatusFlags & FC_STATUS_MOTOR_RUN) && ((Motor[motor_read].MaxPWM & 252) == 248)) Motor[motor_read].Version |= MOTOR_STATE_NEW_PROTOCOL_MASK; |
// else Motor[motor_read].Version = 0; |
if(!(FC_StatusFlags & FC_STATUS_MOTOR_RUN)) |
{ |
if((Motor[motor_read].MaxPWM & 252) == 248) Motor[motor_read].Version |= MOTOR_STATE_NEW_PROTOCOL_MASK; |
313,6 → 313,21 |
if(Motor[motor_read].MaxPWM == 249) Motor[motor_read].Version |= MOTOR_STATE_BL30; |
} |
} |
if(FC_StatusFlags & FC_STATUS_FLY) |
{ |
// Starting -> 40 |
// I2C-Setpoint is zero -> 250 |
// 255 -> Running and no Redundancy |
// 254 -> Running and active Redundancy |
if(Motor[motor_read].MaxPWM < 254) |
{ |
Motor[motor_read].NotReadyCnt++; |
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
SpeakHoTT = SPEAK_ERR_MOTOR; |
#endif |
} |
} |
if(++motor_read >= MAX_MOTORS) |
{ |
motor_read = 0; // restart from beginning |
/trunk/twimaster.h |
---|
43,6 → 43,7 |
uint8_t Current; // in 0.1 A steps, read back from BL |
uint8_t MaxPWM; // read back from BL -> is less than 255 if BL is in current limit, not running (250) or starting (40) |
int8_t Temperature; // old BL-Ctrl will return a 255 here, the new version the temp. in °C |
uint8_t NotReadyCnt; // Counts up is the Motor is not ready during flight -> MotorRestart etc. |
} __attribute__((packed)) MotorData_t; |
extern MotorData_t Motor[MAX_MOTORS]; |
/trunk/uart.c |
---|
226,6 → 226,7 |
RxdBuffer[buf_ptr] = SioTmp; |
if(buf_ptr < MAX_EMPFANGS_BUFF) buf_ptr++; |
else UartState = 0; |
//if(DebugOut.Analog[] < buf_ptr) DebugOut.Analog[] = buf_ptr; |
crc += SioTmp; |
break; |
default: |
/trunk/version.txt |
---|
702,9 → 702,16 |
2.05e |
- Voltage warning set to 3,2V, because the Voltage measurement was lower than before |
- new Parameter: SinglePoint Speed |
2.05f |
- Counter for Motor-Restarts for each single motor |
- Servo-Signals can be configured if mapped to output |
- Speak "Error_Motor" as soon as one Motor reports a restart |