Skip to content

Commit

Permalink
Fix bug that prevented track recoil from synchronizing with airsoft u…
Browse files Browse the repository at this point in the history
…nder certain conditions. Also increase airsoft running time slighlty after pellet has been fired in order to make sure we have fully passed the switch.
  • Loading branch information
OpenPanzerProject committed Apr 28, 2018
1 parent a3ea231 commit bf617b5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions OpenPanzerTCB/src/OP_Tank/OP_Tank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ void OP_Tank::Fire(void)
}
void OP_Tank::Fire_Part2(void)
{
// The main sketch will be polling to see when this gets set, so it can activate track recoil
if (_Airsoft) _AirsoftFired = true;
// If airsoft active the main sketch will be polling to see when this gets set, so it can activate track recoil
if (_Airsoft && _MechBarrelWithCannon) _AirsoftFired = true;

// Play cannon fire sound
Cannon_Sound();
Expand Down Expand Up @@ -664,8 +664,8 @@ void OP_Tank::INT6_RECOIL_ISR()
// checking, we assume it really was the switch. Note: the switch is only closed momentarily. But still this brief moment seems like a long
// time to the microcontroller.
Disable_MechRecoilInterrupt(); // These are called "MechRecoil" but it's the same plug for the airsoft motor
StopMechRecoilMotor();

TankTimer->setTimeout(300, StopMechRecoilMotor); // Keep it running just a little bit longer to be sure we have passed the firing point
// If this is part of a cannon-fire event, kick off the remaining actions
if (_MechBarrelWithCannon)
{
Expand Down

0 comments on commit bf617b5

Please sign in to comment.