Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConfigRawParams: When setting a parameter changes the number of parameters, do a full refresh. and check if reboot is needed #3271

Merged
merged 3 commits into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions GCSViews/ConfigurationView/ConfigRawParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,8 @@ private void BUT_writePIDS_Click(object sender, EventArgs e)

bool enable = temp.Any(a => a.EndsWith("_ENABLE"));

if (enable)
{
CustomMessageBox.Show(
"You have changed an Enable parameter. You may need to do a full param refresh to show all params",
"Params");
}

int error = 0;
bool reboot = false;

foreach (string value in temp)
{
Expand All @@ -283,7 +277,11 @@ private void BUT_writePIDS_Click(object sender, EventArgs e)
}

MainV2.comPort.setParam(value, (double)_changes[value]);

//check if reboot required
if (ParameterMetaDataRepository.GetParameterRebootRequired(value, MainV2.comPort.MAV.cs.firmware.ToString()))
{
reboot = true;
}
try
{
// set control as well
Expand Down Expand Up @@ -326,6 +324,27 @@ private void BUT_writePIDS_Click(object sender, EventArgs e)
else
CustomMessageBox.Show("Parameters successfully saved.", "Saved");

//Check if reboot is required
if (reboot)
{
CustomMessageBox.Show("Reboot is required for some parameters to take effect.", "Reboot Required");
}

if (MainV2.comPort.MAV.param.TotalReceived != MainV2.comPort.MAV.param.TotalReported )
{
if (MainV2.comPort.MAV.cs.armed)
{
CustomMessageBox.Show("The number of available parameters changed, until full param refresh is done, some parameters will not be available.", "Params");
//Hack the number of reported params to keep params list available
MainV2.comPort.MAV.param.TotalReported = MainV2.comPort.MAV.param.TotalReceived;
}
else
{
CustomMessageBox.Show("The number of available parameters changed. A full param refresh will be done to show all params.", "Params");
//Click on refresh button
BUT_rerequestparams_Click(BUT_rerequestparams, null);
}
}
}

private void BUT_compare_Click(object sender, EventArgs e)
Expand Down
Loading