590,11 → 590,10 |
} |
if(MotorTest_Active) MotorTest_Active--; |
} |
|
DebugOut.Analog[12] = Motor[0].SetPoint; // Front |
DebugOut.Analog[13] = Motor[1].SetPoint; // Rear |
DebugOut.Analog[14] = Motor[3].SetPoint; // Left |
DebugOut.Analog[15] = Motor[2].SetPoint; // Right |
DebugOut.Analog[14] = Motor[2].SetPoint; // Left |
DebugOut.Analog[15] = Motor[3].SetPoint; // Right |
//Start I2C Interrupt Mode |
I2C_Start(TWI_STATE_MOTOR_TX); |
} |
895,55 → 894,60 |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
if(PPM_in[ParamSet.ChannelAssignment[CH_GAS]] < -85) |
{ |
if(PPM_in[ParamSet.ChannelAssignment[CH_YAW]] < -75) |
if(!(FCFlags&FCFLAG_MOTOR_RUN)) // motors are not running |
{ |
// gas/yaw joystick is bottom right |
// _________ |
// | | |
// | | |
// | | |
// | | |
// | x| |
// ¯¯¯¯¯¯¯¯¯ |
// Start Motors |
if(++delay_startmotors > 200) // not immediately (wait 200 loops = 200 * 2ms = 0.4 s) |
if(PPM_in[ParamSet.ChannelAssignment[CH_YAW]] < -75) |
{ |
delay_startmotors = 200; // do not repeat if once executed |
ModelIsFlying = 1; |
FCFlags |= (FCFLAG_MOTOR_RUN|FCFLAG_START); // set flag RUN and START |
SetPointYaw = 0; |
ReadingIntegralGyroYaw = 0; |
ReadingIntegralGyroNick = ParamSet.GyroAccFactor * (int32_t)AccNick; |
ReadingIntegralGyroRoll = ParamSet.GyroAccFactor * (int32_t)AccRoll; |
ReadingIntegralGyroNick2 = IntegralGyroNick; |
ReadingIntegralGyroRoll2 = IntegralGyroRoll; |
IPartNick = 0; |
IPartRoll = 0; |
// gas/yaw joystick is bottom right |
// _________ |
// | | |
// | | |
// | | |
// | | |
// | x| |
// ¯¯¯¯¯¯¯¯¯ |
// Start Motors |
if(++delay_startmotors > 200) // not immediately (wait 200 loops = 200 * 2ms = 0.4 s) |
{ |
delay_startmotors = 0; |
ModelIsFlying = 1; |
FCFlags |= (FCFLAG_MOTOR_RUN|FCFLAG_START); // set flag RUN and START |
SetPointYaw = 0; |
ReadingIntegralGyroYaw = 0; |
ReadingIntegralGyroNick = ParamSet.GyroAccFactor * (int32_t)AccNick; |
ReadingIntegralGyroRoll = ParamSet.GyroAccFactor * (int32_t)AccRoll; |
ReadingIntegralGyroNick2 = IntegralGyroNick; |
ReadingIntegralGyroRoll2 = IntegralGyroRoll; |
IPartNick = 0; |
IPartRoll = 0; |
} |
} |
else delay_startmotors = 0; // reset delay timer if sticks are not in this position |
} |
else delay_startmotors = 0; // reset delay timer if sticks are not in this position |
|
if(PPM_in[ParamSet.ChannelAssignment[CH_YAW]] > 75) |
else // motors are running |
{ |
// gas/yaw joystick is bottom left |
// _________ |
// | | |
// | | |
// | | |
// | | |
// |x | |
// ¯¯¯¯¯¯¯¯¯ |
// Stop Motors |
if(++delay_stopmotors > 200) // not immediately (wait 200 loops = 200 * 2ms = 0.4 s) |
if(PPM_in[ParamSet.ChannelAssignment[CH_YAW]] > 75) |
{ |
delay_stopmotors = 200; // do not repeat if once executed |
ModelIsFlying = 0; |
FCFlags &= ~(FCFLAG_MOTOR_RUN); |
// gas/yaw joystick is bottom left |
// _________ |
// | | |
// | | |
// | | |
// | | |
// |x | |
// ¯¯¯¯¯¯¯¯¯ |
// Stop Motors |
if(++delay_stopmotors > 200) // not immediately (wait 200 loops = 200 * 2ms = 0.4 s) |
{ |
delay_stopmotors = 0; |
ModelIsFlying = 0; |
FCFlags &= ~(FCFLAG_MOTOR_RUN); |
} |
} |
else delay_stopmotors = 0; // reset delay timer if sticks are not in this position |
} |
else delay_stopmotors = 0; // reset delay timer if sticks are not in this position |
} |
// remapping of paameters only if the signal rc-sigbnal conditions are good |
// remapping of parameters only if the signal rc-signal conditions are good |
} // eof RC_Quality > 150 |
|
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |