93 [](
const Command& c) { return c.sValue ==
"GPWSPredictiveWind" || c.sValue ==
"GPWSReactive" || c.sValue ==
"GPWSAltitude" || c.sValue ==
"GPWSTerrain" || c.sValue ==
"GPWSTestAudio"; }),
bus->
commandStream.end());
96 if (!std::isfinite(fElapsed) || fElapsed <= 0)
108 const bool motionValid = radioValid && !(
bus->
GPWS.
faults&2);
111 const bool goAround = !reset && airborne && radioValid &&
bus->
RadioAltitudeKm < .074676f &&
113 if (reset || !airborne || !motionValid)
125 [](
const Command& c) { return c.sValue ==
"GPWSPredictiveWind" || c.sValue ==
"GPWSReactive" || c.sValue ==
"GPWSAltitude" || c.sValue ==
"GPWSTerrain"; }),
bus->
commandStream.end());
127 if (liftedOff || goAround)
152 bool frontCourse = ilsValid;
156 frontCourse = ilsValid && runway.ils == 127 && runway.heading >= 0 && runway.heading <= 360 &&
162 bool nearDestination =
false;
169 nearDestination = destination.type == 2 && destination.length > 0 &&
170 destination.heading >= 0 && destination.heading <= 360 &&
172 std::fabs(
playerships[0].mslKm-destination.elevationKm) <= 1.0668f;
174 const bool mode2b = landingFlaps || centeredIls ||
takeoffSeconds < 60 || nearDestination;
176 float penetration = 0;
179 if (airborne && motionValid)
186 penetration = cautionDescent/(std::max)(.008f,(
bus->
RadioAltitudeKm-.009f)*.02306f+.008f);
319 const float gsUpperKm = .1524f+.1524f*(std::clamp)(-
bus->
VerticalSpeedKms/.00254f,0.f,1.f);
348 const float heights[] = {.003048f,.006096f,.009144f,.012192f,.01524f,.03048f,.06096f,.1524f,.3048f};
352 bool selected =
false;
353 for (
unsigned i = 0; i < 9; ++i)
486 commands.erase(std::remove_if(commands.begin(), commands.end(), [&](
const Command& command) {
487 if (command.sValue ==
"GPWSPredictiveWind") return !bus->GPWS.predictiveWindshear.caution ||
488 bus->GPWS.Alert != Bus::Gpws::Predictive_Windshear_Caution || command.ivalues[1] != playerships[0].vehicleId;
489 if (command.sValue ==
"GPWSReactive") return !airborne || command.ivalues[0] != bus->GPWS.Alert;
490 return command.sValue ==
"GPWSTerrain" && (!bus->GPWS.IsTerrainAlert() ||
491 command.ivalues[0] != bus->GPWS.Alert ||
492 unsigned(command.ivalues[1]) != bus->GPWS.terrainRevision);
523 newCommand.
name = initialTerrainVoice ?
"GPWSTerrainTerrain" :
"GPWSPullUp";
530 newCommand.
name = initialTerrainVoice ?
"GPWSObstacleObstacle" :
"GPWSPullUp";
537 newCommand.
name =
"GPWSCautionTerrain";
544 newCommand.
name =
"GPWSCautionObstacle";
551 newCommand.
name =
"GPWSGlideslope"; newCommand.
priority = 118;
567 newCommand.
name =
"GPWSPullUp";
575 newCommand.
name =
"GPWSTerrainTerrain";
587 newCommand.
name =
"GPWSTooLowTerrain"; newCommand.
priority = 111;
594 if (repeatPenetration)
597 newCommand.
name =
"GPWSTooLowTerrain";
602 if (repeatPenetration)
605 newCommand.
name =
"GPWSTooLowGear";
610 if (repeatPenetration)
613 newCommand.
name =
"GPWSTooLowFlaps";
618 if (repeatPenetration)
621 newCommand.
name =
"GPWSSinkRate";
629 newCommand.
name =
"GPWSBankAngle"; newCommand.
priority = 120;
637 newCommand.
name =
"GPWSMode6Retard";
641 newCommand.
name =
"GPWSMode6Ten";
644 newCommand.
name =
"GPWSMode6Twenty";
647 newCommand.
name =
"GPWSMode6Thirty";
650 newCommand.
name =
"GPWSMode6Forty";
653 newCommand.
name =
"GPWSMode6Fifty";
654 newCommand.
ttl = 0.443f;
657 newCommand.
name =
"GPWSMode6OneHundred";
660 newCommand.
name =
"GPWSMode6TwoHundred";
663 newCommand.
name =
"GPWSMode6Minimums";
667 newCommand.
name =
"GPWSMode6PositiveRate";
670 newCommand.
name =
"GPWSMode6FiveHundred";
673 newCommand.
name =
"GPWSMode6OneThousand";
676 newCommand.
name =
"GPWSMode6Rotate";
682 newCommand.
name =
"GPWSMode3DontSink"; newCommand.
priority = 117;
689 newCommand.
name =
"GPWSMode7WindshearWarning";
695 { newCommand.
name =
"GPWSPredictiveWindshear"; newCommand.
priority = 121; }
700 newCommand.
name =
"GPWSMode7WindshearCaution";
706 if (!newCommand.
name.empty())
712 if (std::none_of(commands.begin(),commands.end(),[](
const Command& c) { return c.sValue ==
"GPWSPredictiveWind"; }))
713 commands.insert(std::find_if(commands.begin(),commands.end(),[&](
const Command& c) {
714 return c.priority > newCommand.priority;
720 if (std::any_of(commands.begin(), commands.end(), [](
const Command& command) {
721 return command.sValue ==
"GPWSTerrain";
724 newCommand.
sValue =
"GPWSTerrain";
728 const auto position = std::find_if(commands.begin(), commands.end(), [&](
const Command& command) {
729 return command.priority > newCommand.priority;
731 commands.insert(position, newCommand);
741 commands.erase(std::remove_if(commands.begin(),commands.end(),[](
const Command& c) {
742 return c.sValue ==
"GPWSAltitude";
751 if (std::none_of(commands.begin(),commands.end(),[&](
const Command& c) { return c.name == newCommand.name; }))
752 commands.insert(std::find_if(commands.begin(),commands.end(),[&](
const Command& c) {
753 return c.priority > newCommand.priority;
float Update(float dt, float radioKm, float limitKm)