Skip to content

Commit

Permalink
Merge pull request #1041 from indy91/MPTInit
Browse files Browse the repository at this point in the history
New method to initialize the MPT
  • Loading branch information
indy91 committed Aug 1, 2023
2 parents 24c5592 + bb42c86 commit 908d8b2
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 51 deletions.
59 changes: 31 additions & 28 deletions Orbitersdk/samples/ProjectApollo/src_rtccmfd/ApolloRTCCMFD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ void ApolloRTCCMFD::menuSetMPTInitPage()

GC->mptInitError = 0;
marker = 0;
markermax = 7;
markermax = 5;
}

void ApolloRTCCMFD::menuSetDescPlanTablePage()
Expand Down Expand Up @@ -3748,32 +3748,35 @@ void ApolloRTCCMFD::menuTransferPoweredDescentToMPT()
G->TransferPoweredDescentToMPT();
}

void ApolloRTCCMFD::menuCycleMPTTable()
{
if (GC->rtcc->med_m49.Table == RTCC_MPT_CSM)
{
GC->rtcc->med_m49.Table = GC->rtcc->med_m50.Table = GC->rtcc->med_m51.Table = GC->rtcc->med_m55.Table = RTCC_MPT_LM;
}
else
{
GC->rtcc->med_m49.Table = GC->rtcc->med_m50.Table = GC->rtcc->med_m51.Table = GC->rtcc->med_m55.Table = RTCC_MPT_CSM;
}
}

void ApolloRTCCMFD::menuCycleMPTMED()
{
if (G->mptinitmode < 3)
{
G->mptinitmode++;
}
else
{
G->mptinitmode = 0;
}
}

void ApolloRTCCMFD::menuSetMPTInitInput()
{
switch (marker)
{
case 0:
//MED
if (G->mptinitmode < 3)
{
G->mptinitmode++;
}
else
{
G->mptinitmode = 0;
}
break;
case 1: //MPT
if (GC->rtcc->med_m49.Table == RTCC_MPT_CSM)
{
GC->rtcc->med_m49.Table = GC->rtcc->med_m50.Table = GC->rtcc->med_m51.Table = GC->rtcc->med_m55.Table = RTCC_MPT_LM;
}
else
{
GC->rtcc->med_m49.Table = GC->rtcc->med_m50.Table = GC->rtcc->med_m51.Table = GC->rtcc->med_m55.Table = RTCC_MPT_CSM;
}
break;
case 2: //Second option on MED
case 0: //Second option on MED
switch (G->mptinitmode)
{
case 0: //M49: SPS Fuel Remaining
Expand All @@ -3793,7 +3796,7 @@ void ApolloRTCCMFD::menuSetMPTInitInput()
break;
}
break;
case 3: //Third option on MED
case 1: //Third option on MED
switch (G->mptinitmode)
{
case 0: //M49: CSM RCS Fuel Remaining
Expand All @@ -3810,7 +3813,7 @@ void ApolloRTCCMFD::menuSetMPTInitInput()
break;
}
break;
case 4: //Fourth option on MED
case 2: //Fourth option on MED
switch (G->mptinitmode)
{
case 0: //M49: S-IVB Fuel Remaining
Expand All @@ -3827,7 +3830,7 @@ void ApolloRTCCMFD::menuSetMPTInitInput()
break;
}
break;
case 5: //Fifth option on MED
case 3: //Fifth option on MED
switch (G->mptinitmode)
{
case 0: //M49: LM APS Fuel Remaining
Expand All @@ -3841,7 +3844,7 @@ void ApolloRTCCMFD::menuSetMPTInitInput()
break;
}
break;
case 6: //Sixth option on MED
case 4: //Sixth option on MED
switch (G->mptinitmode)
{
case 0: //M49: LM RCS Fuel Remaining
Expand All @@ -3855,7 +3858,7 @@ void ApolloRTCCMFD::menuSetMPTInitInput()
break;
}
break;
case 7: //Seventh option on MED
case 5: //Seventh option on MED
switch (G->mptinitmode)
{
case 0: //M49: LM DPS Fuel Remaining
Expand Down
2 changes: 2 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_rtccmfd/ApolloRTCCMFD.h
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ class ApolloRTCCMFD: public MFD2 {
void menuTransferPoweredAscentToMPT();
void menuTransferPoweredDescentToMPT();
void CheckoutMonitorCalc();
void menuCycleMPTTable();
void menuCycleMPTMED();
void menuSetMPTInitInput();
void set_MPTInitM55Config(char *cfg);
void menuMPTUpdate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5317,21 +5317,21 @@ bool ApolloRTCCMFD::Update(oapi::Sketchpad *skp)

skp->SetTextAlign(oapi::Sketchpad::LEFT);

skp->Text(1 * W / 16, (marker + 4) * H / 16, "*", 1);
skp->Text(1 * W / 16, (marker + 6) * H / 16, "*", 1);

skp->Text(10 * W / 16, 5 * H / 16, "MPT:", 4);

if (G->mptinitmode == 0)
{
skp->Text(2 * W / 16, 4 * H / 16, "MED M49: Fuel Remaining", 23);
skp->Text(2 * W / 16, 4 * H / 14, "MED M49: Fuel Remaining", 23);

if (GC->rtcc->med_m49.Table == RTCC_MPT_LM)
{
skp->Text(2 * W / 16, 5 * H / 16, "Table: LM", 9);
skp->Text(2 * W / 16, 2 * H / 14, "Table: LM", 9);
}
else
{
skp->Text(2 * W / 16, 5 * H / 16, "Table: CSM", 10);
skp->Text(2 * W / 16, 2 * H / 14, "Table: CSM", 10);
}

if (GC->rtcc->med_m49.SPSFuelRemaining >= 0)
Expand Down Expand Up @@ -5411,15 +5411,15 @@ bool ApolloRTCCMFD::Update(oapi::Sketchpad *skp)
}
else if (G->mptinitmode == 1)
{
skp->Text(2 * W / 16, 4 * H / 16, "MED M50: Weights", 16);
skp->Text(2 * W / 16, 4 * H / 14, "MED M50: Weights", 16);

if (GC->rtcc->med_m50.Table == RTCC_MPT_LM)
{
skp->Text(2 * W / 16, 5 * H / 16, "Table: LM", 9);
skp->Text(2 * W / 16, 2 * H / 14, "Table: LM", 9);
}
else
{
skp->Text(2 * W / 16, 5 * H / 16, "Table: CSM", 10);
skp->Text(2 * W / 16, 2 * H / 14, "Table: CSM", 10);
}

if (GC->rtcc->med_m50.CSMWT >= 0)
Expand Down Expand Up @@ -5481,15 +5481,15 @@ bool ApolloRTCCMFD::Update(oapi::Sketchpad *skp)
}
else if (G->mptinitmode == 2)
{
skp->Text(2 * W / 16, 4 * H / 16, "MED M51: Areas", 14);
skp->Text(2 * W / 16, 4 * H / 14, "MED M51: Areas", 14);

if (GC->rtcc->med_m51.Table == RTCC_MPT_LM)
{
skp->Text(2 * W / 16, 5 * H / 16, "Table: LM", 9);
skp->Text(2 * W / 16, 2 * H / 14, "Table: LM", 9);
}
else
{
skp->Text(2 * W / 16, 5 * H / 16, "Table: CSM", 10);
skp->Text(2 * W / 16, 2 * H / 14, "Table: CSM", 10);
}

sprintf(Buffer, "CSM %.2f sq ft", GC->rtcc->med_m51.CSMArea / 0.3048 / 0.3048);
Expand Down Expand Up @@ -5521,15 +5521,15 @@ bool ApolloRTCCMFD::Update(oapi::Sketchpad *skp)
}
else
{
skp->Text(2 * W / 16, 4 * H / 16, "MED M55: Configuration", 22);
skp->Text(2 * W / 16, 4 * H / 14, "MED M55: Configuration", 22);

if (GC->rtcc->med_m55.Table == RTCC_MPT_LM)
{
skp->Text(2 * W / 16, 5 * H / 16, "Table: LM", 9);
skp->Text(2 * W / 16, 2 * H / 14, "Table: LM", 9);
}
else
{
skp->Text(2 * W / 16, 5 * H / 16, "Table: CSM", 10);
skp->Text(2 * W / 16, 2 * H / 14, "Table: CSM", 10);
}

if (GC->rtcc->med_m55.ConfigCode == "")
Expand Down
20 changes: 10 additions & 10 deletions Orbitersdk/samples/ProjectApollo/src_rtccmfd/ApollomfdButtons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2011,33 +2011,33 @@ ApolloRTCCMFDButtons::ApolloRTCCMFDButtons()

static const MFDBUTTONMENU mnu59[] =
{
{ "Set input", 0, 'S' },
{ "Choose Table", 0, 'T' },
{ "Choose MED", 0, 'E' },
{ "Update MPT", 0, 'M' },
{ "Previous Item", 0, 'P' },
{ "Next Item", 0, 'N' },
{ "", 0, ' ' },
{ "", 0, ' ' },
{ "", 0, ' ' },
{ "Set input", 0, 'S' },

{ "Select vehicle", 0, 'D' },
{ "Auto update of parameters", 0, 'U' },
{ "Update MPT", 0, 'M' },
{ "", 0, ' ' },
{ "", 0, ' ' },
{ "Vector Panel Summary", 0, 'P' },
{ "Back to menu", 0, 'B' },
};

RegisterPage(mnu59, sizeof(mnu59) / sizeof(MFDBUTTONMENU));

RegisterFunction("SET", OAPI_KEY_S, &ApolloRTCCMFD::menuSetMPTInitInput);
RegisterFunction("TAB", OAPI_KEY_A, &ApolloRTCCMFD::menuCycleMPTTable);
RegisterFunction("MED", OAPI_KEY_E, &ApolloRTCCMFD::menuCycleMPTMED);
RegisterFunction("UPD", OAPI_KEY_M, &ApolloRTCCMFD::menuMPTUpdate);
RegisterFunction("<<", OAPI_KEY_P, &ApolloRTCCMFD::menuCycleMarkerDown);
RegisterFunction(">>", OAPI_KEY_N, &ApolloRTCCMFD::menuCycleMarkerUp);
RegisterFunction("", OAPI_KEY_A, &ApolloRTCCMFD::menuVoid);
RegisterFunction("", OAPI_KEY_C, &ApolloRTCCMFD::menuVoid);
RegisterFunction("", OAPI_KEY_E, &ApolloRTCCMFD::menuVoid);
RegisterFunction("SET", OAPI_KEY_S, &ApolloRTCCMFD::menuSetMPTInitInput);

RegisterFunction("TGT", OAPI_KEY_D, &ApolloRTCCMFD::menuMPTInitM50M55Vehicle);
RegisterFunction("AUT", OAPI_KEY_U, &ApolloRTCCMFD::menuMPTInitAutoUpdate);
RegisterFunction("UPD", OAPI_KEY_M, &ApolloRTCCMFD::menuMPTUpdate);
RegisterFunction("", OAPI_KEY_C, &ApolloRTCCMFD::menuVoid);
RegisterFunction("", OAPI_KEY_N, &ApolloRTCCMFD::menuVoid);
RegisterFunction("VPS", OAPI_KEY_P, &ApolloRTCCMFD::menuVectorPanelSummaryPage);
RegisterFunction("BCK", OAPI_KEY_B, &ApolloRTCCMFD::menuSetMPTPage);
Expand Down

0 comments on commit 908d8b2

Please sign in to comment.