Skip to content

Commit 1501cfd

Browse files
committed
Added setting for RFL below inital CFL check
Disabled by default, can be toggled using new `.delhel rflblw` command
1 parent a17ae5f commit 1501cfd

File tree

3 files changed

+46
-10
lines changed

3 files changed

+46
-10
lines changed

DelHel/CDelHel.cpp

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ CDelHel::CDelHel() : EuroScopePlugIn::CPlugIn(
2727
this->updateCheck = false;
2828
this->assignNap = false;
2929
this->autoProcess = false;
30+
this->warnRFLBelowCFL = false;
3031

3132
this->LoadSettings();
3233

@@ -127,6 +128,18 @@ bool CDelHel::OnCompileCommand(const char* sCommandLine)
127128
this->airports.clear();
128129
this->ReadAirportConfig();
129130

131+
return true;
132+
}
133+
else if (args[1] == "rflblw") {
134+
if (this->warnRFLBelowCFL) {
135+
this->LogMessage("No longer displaying warnings for RFLs below inital CFLs for SIDs", "Config");
136+
}
137+
else {
138+
this->LogMessage("Displaying warnings for RFLs below inital CFLs for SIDs", "Config");
139+
}
140+
141+
this->warnRFLBelowCFL = !this->warnRFLBelowCFL;
142+
130143
return true;
131144
}
132145
}
@@ -221,7 +234,7 @@ void CDelHel::LoadSettings()
221234
if (settings) {
222235
std::vector<std::string> splitSettings = split(settings, SETTINGS_DELIMITER);
223236

224-
if (splitSettings.size() < 3) {
237+
if (splitSettings.size() < 4) {
225238
this->LogMessage("Invalid saved settings found, reverting to default.");
226239

227240
this->SaveSettings();
@@ -232,6 +245,7 @@ void CDelHel::LoadSettings()
232245
std::istringstream(splitSettings[0]) >> this->debug;
233246
std::istringstream(splitSettings[1]) >> this->updateCheck;
234247
std::istringstream(splitSettings[2]) >> this->assignNap;
248+
std::istringstream(splitSettings[3]) >> this->warnRFLBelowCFL;
235249

236250
this->LogDebugMessage("Successfully loaded settings.");
237251
}
@@ -482,18 +496,25 @@ validation CDelHel::ProcessFlightPlan(const EuroScopePlugIn::CFlightPlan& fp, bo
482496
}
483497

484498
if (validateOnly) {
485-
if (fp.GetFinalAltitude() < sid.cfl) {
499+
if (this->warnRFLBelowCFL && fp.GetFinalAltitude() < sid.cfl) {
486500
res.tag = "RFL";
487501
res.color = TAG_COLOR_ORANGE;
488502

489503
return res;
490504
}
491505

492-
// If CFL == RFL, EuroScope returns a CFL of 0. Additionally, CFL 1 and 2 indicate ILS and visual approach clearances respectively.
493-
// If the RFL is not adapted or confirmed by the controller, cad.GetFinalAltitude() will also return 0.
494-
// To ensure the CFL is actually set, we need to check all three values or check the actual CFL if > 0
495-
if ((cad.GetClearedAltitude() == 0 && fp.GetFinalAltitude() != sid.cfl && cad.GetFinalAltitude() != sid.cfl) ||
496-
(cad.GetClearedAltitude() > 0 && cad.GetClearedAltitude() != sid.cfl)) {
506+
int cfl = cad.GetClearedAltitude();
507+
// If CFL == RFL, EuroScope returns a CFL of 0 and the RFL value should be consulted. Additionally, CFL 1 and 2 indicate ILS and visual approach clearances respectively.
508+
if (cfl < 3) {
509+
// If the RFL is not adapted or confirmed by the controller, cad.GetFinalAltitude() will also return 0. As a last source of CFL info, we need to consider the filed RFL.
510+
cfl = cad.GetFinalAltitude();
511+
if (cfl < 3) {
512+
cfl = fp.GetFinalAltitude();
513+
}
514+
}
515+
516+
// Display a warning if the CFL does not match the initial CFL assigned to the SID. No warning is shown if the RFL is below the CFL for the SID as pilots might request a lower initial climb.
517+
if (cfl != sid.cfl && (cfl != fp.GetFinalAltitude() || fp.GetFinalAltitude() >= sid.cfl)) {
497518
res.valid = false;
498519
res.tag = "CFL";
499520

@@ -561,9 +582,6 @@ validation CDelHel::ProcessFlightPlan(const EuroScopePlugIn::CFlightPlan& fp, bo
561582
this->LogDebugMessage("Flightplan has RFL below initial CFL for SID, setting RFL", cs);
562583

563584
cfl = fp.GetFinalAltitude();
564-
565-
res.tag = "RFL";
566-
res.color = TAG_COLOR_ORANGE;
567585
}
568586

569587
if (!cad.SetClearedAltitude(cfl)) {

DelHel/CDelHel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class CDelHel : public EuroScopePlugIn::CPlugIn
4040
bool updateCheck;
4141
bool assignNap;
4242
bool autoProcess;
43+
bool warnRFLBelowCFL;
4344
std::future<std::string> latestVersion;
4445
std::map<std::string, airport> airports;
4546
std::vector<std::string> processed;

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ The plugin did not find the departure airport of the aircraft in its [airport co
8080
Info, no/default color.
8181
Indicates the current CFL set does not equal the initial CFL defined for the SID assigned. This most likely indicates the flightplan has not been processed yet or the aircraft was assigned a cleared flight level that deviates from the default.
8282

83+
##### `RFL`
84+
85+
Caution, orange color.
86+
Indicates the RFL filed in the FPL is below the initial CFL defined for the SID assigned. While this does not always indicate an error, caution is advised so minimum altitudes or other restrictions are not violated.
87+
This warning is disabled by default and can be toggled using the [Toggle RFL below inital CFL](#toggle-rfl-below-initial-cfl-check) chat command.
88+
8389
##### `RWY`
8490

8591
Info, no/default color.
@@ -210,6 +216,17 @@ If enabled, `DelHel` will check this repository for newer releases of the plugin
210216

211217
This setting will be saved to the EuroScope settings upon exit.
212218

219+
#### Toggle RFL below initial CFL check
220+
221+
`.delhel rflblw`
222+
223+
Toggles the flightplan check for RFLs below the initial CFL for SIDs.
224+
225+
If enabled, `DelHel` will check the RFL of a flightplan and display a [caution](#rfl) if the filed final level is below the initial CFL for the SID assigned.
226+
If disabled (default setting), `DelHel` will display no indication and silently assign the lower RFL as the CFL while processing.
227+
228+
This setting will be saved to the EuroScope settings upon exit.
229+
213230
### Airport config
214231

215232
`DelHel` uses its airport config, stored in the `airports.json` file in the same directory as the `DelHel.dll` plugin DLL, to retrieve most of its configuration for validations and flightplan processing.

0 commit comments

Comments
 (0)