Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1680 → Rev 1681

/beta/Code Redesign killagreg/led.c
102,6 → 102,7
J17Bitmask = ParamSet.J17Bitmask;
}
 
 
if(!J16Warn)
{
if( (ParamSet.Config1 & CFG1_MOTOR_BLINK) && !(FCFlags & FCFLAG_MOTOR_RUN))
156,12 → 157,12
if(J17Mask == 1) J17Mask = 128; else J17Mask /= 2;
if(J17Mask & J17Bitmask) J17_ON; else J17_OFF;
}
else if(!J17Blinkcount--)
{
J17Blinkcount = 10-1;
if(J17Mask == 1) J17Mask = 128; else J17Mask /= 2;
if(J17Mask & ParamSet.J17Bitmask_Warning) J17_ON; else J17_OFF;
}
}
else if(!J17Blinkcount--)
{
J17Blinkcount = 10-1;
if(J17Mask == 1) J17Mask = 128; else J17Mask /= 2;
if(J17Mask & ParamSet.J17Bitmask_Warning) J17_ON; else J17_OFF;
}
}
}
/beta/Code Redesign killagreg/libfc1284.a
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/beta/Code Redesign killagreg/makefile
6,7 → 6,7
#-------------------------------------------------------------------
VERSION_MAJOR = 0
VERSION_MINOR = 79
VERSION_PATCH = 5
VERSION_PATCH = 9
 
VERSION_SERIAL_MAJOR = 11 # Serial Protocol Major Version
VERSION_SERIAL_MINOR = 0 # Serial Protocol Minor Version
/beta/Code Redesign killagreg/spektrum.c
6,6 → 6,9
#include "eeprom.h"
#include "timer0.h"
 
//#define RECEIVER_SPEKTRUM_EXP
 
 
/*
Code derived from:
 
76,6 → 79,15
 
 
#define USART1_BAUD 115200
 
 
 
#ifdef RECEIVER_SPEKTRUM_EXP
uint8_t s_excnt = 0; // Counter for Spektrum-Expander
uint8_t s_exparity = 0; // Parity Bit for Spektrum-Expander
int8_t s_exdata[11]; // Data for Spektrum-Expander
#endif
 
/****************************************************************/
/* Initialization of the USART1 */
/****************************************************************/
189,7 → 201,7
}
}
else if((Sync == 1) && !bCheckDelay)
{
{
// zweites Sync-Character ignorieren, Bedeutung unbekannt
SpektrumTimer = MAX_BYTEGAP;
Sync = 2;
196,17 → 208,17
FrameCnt++;
}
else if((Sync == 2) && !bCheckDelay)
{
{
// Datenbyte high
SpektrumTimer = MAX_BYTEGAP;
ByteHigh = c;
if (FrameCnt == 2)
{
{
// is 1st Byte of Channel-data
// Frame 1 with Channel 1-7 comming next
Frame2 = 0;
if(ByteHigh & 0x80)
{
{
// DS9: Frame 2 with Channel 8-9 comming next
Frame2 = 1;
}
215,7 → 227,7
FrameCnt ++;
}
else if((Sync == 3) && !bCheckDelay)
{
{
// Datenbyte low
// High-Byte for next channel comes next
SpektrumTimer = MAX_BYTEGAP;
257,7 → 269,12
if(index < MAX_RC_CHANNELS)
{
if(RC_Channels < index) RC_Channels = index;
// Stabiles Signal
// Stable Signal
#ifdef RECEIVER_SPEKTRUM_EXP
if (index == 2) index = 4; // Analog channel reassigment (2 <-> 4) for logical numbering (1,2,3,4)
else if (index == 4) index = 2;
#endif
 
if(abs(signal - PPM_in[index]) < 6)
{
if(RC_Quality < 200)
273,10 → 290,57
tmp = (3 * PPM_in[index] + signal)/4;
if(tmp > signal+1) tmp--;
else if(tmp < signal-1) tmp++;
 
#ifdef RECEIVER_SPEKTRUM_EXP
if(index == 6) // FLIGHT-MODE - The channel used for our data uplink
{
if (signal > 100) // SYNC received
{
if (s_exdata[s_excnt] == 125) s_exparity = ~s_exparity; // Bit = 1 -> Re-Invert parity bit
if ((s_excnt == 6 && ((s_exparity != 0 && s_exdata[s_excnt] == -125) || (s_exparity == 0 && s_exdata[s_excnt] == 125))) || (s_excnt == 9 && ((s_exparity == 0 && s_exdata[s_excnt] == -125) || (s_exparity != 0 && s_exdata[s_excnt] == 125)))) // Parity check
{
if (s_exdata[1] == 125 && s_exdata[2] == -125) PPM_in[5] = -125; // Reconstruct tripole Flight-Mode value (CH5)
else if (s_exdata[1] == -125 && s_exdata[2] == -125) PPM_in[5] = 0; // Reconstruct tripole Flight-Mode value (CH5)
else if (s_exdata[1] == -125 && s_exdata[2] == 125) PPM_in[5] = 125; // Reconstruct tripole Flight-Mode value (CH5)
PPM_in[6] = s_exdata[3]; // Elevator (CH6)
PPM_in[11] = s_exdata[4]; // Aileron (CH11)
PPM_in[12] = s_exdata[5]; // Rudder (CH12)
 
if (s_excnt == 9) // New Mode (12 Channels)
{
if (s_exdata[7] == 125) PPM_in[8] += 5; // Hover Pitch UP (CH8)
if (s_exdata[8] == 125) PPM_in[8] -= 5; // Hover Pitch DN (CH8)
if (PPM_in[8] < -125) PPM_in[8] = -125; // Range-Limit
else if (PPM_in[8] > 125) PPM_in[8] = 125; // Range-Limit
PPM_in[10] = s_exdata[6]; // AUX2 (CH10)
}
}
 
s_excnt = 0; // Reset bitcounter
s_exparity = 0; // Reset parity bit
}
 
if (signal < 10) s_exdata[++s_excnt] = -125; // Bit = 0 -> value = -125 (min)
if (s_excnt == 10) s_excnt = 0; // Overflow protection
if (signal < -100)
{
s_exdata[s_excnt] = 125; // Bit = 1 -> value = 125 (max)
s_exparity = ~s_exparity; // Bit = 1 -> Invert parity bit
}
}
#endif
 
// calculate signal difference on good signal level
if(RC_Quality >= 180) PPM_diff[index] = ((signal - PPM_in[index]) / 3) * 3;
if(RC_Quality >= 180) PPM_diff[index] = ((tmp - PPM_in[index]) / 3) * 3;
else PPM_diff[index] = 0;
PPM_in[index] = signal;
 
#ifdef RECEIVER_SPEKTRUM_EXP
if (index < 5 ) PPM_in[index] = tmp; // Update normal potis (CH1-4)
else if (index == 5) PPM_in[7] = signal; // Gear (CH7)
else if (index == 7) PPM_in[9] = signal; // Hover Throttle (CH9)
#else
PPM_in[index] = tmp;
#endif
}
else if(index > 17) ReSync = 1; // hier stimmt was nicht: neu synchronisieren
}
/beta/Code Redesign killagreg/twimaster.h
44,7 → 44,7
 
extern MotorData_t Motor[MAX_MOTORS];
 
#define BLCONFIG_REVISION 1
#define BLCONFIG_REVISION 2
 
#define MASK_SET_PWM_SCALING 0x01
#define MASK_SET_CURRENT_LIMIT 0x02
51,14 → 51,14
#define MASK_SET_TEMP_LIMIT 0x04
#define MASK_SET_CURRENT_SCALING 0x08
#define MASK_SET_BITCONFIG 0x10
#define MASK_RESET_CAPCOUNTER 0x20
#define MASK_SET_STARTPWM 0x20
#define MASK_SET_DEFAULT_PARAMS 0x40
#define MASK_SET_SAVE_EEPROM 0x80
 
#define BITCONF_REVERSE_ROTATION 0x01
#define BITCONF_RES1 0x02
#define BITCONF_RES2 0x04
#define BITCONF_RES3 0x08
#define BITCONF_STARTGAS1 0x02
#define BITCONF_STARTGAS2 0x04
#define BITCONF_STARTGAS3 0x08
#define BITCONF_RES4 0x10
#define BITCONF_RES5 0x20
#define BITCONF_RES6 0x40