Skip to content
Snippets Groups Projects
Commit 2f153006 authored by Paul Beuchat's avatar Paul Beuchat
Browse files

Small changes to CS1 GUI to reset zoom levels

parent e3768e44
No related branches found
No related tags found
No related merge requests found
...@@ -168,6 +168,8 @@ private: ...@@ -168,6 +168,8 @@ private:
bool m_shouldPerformStep = false; bool m_shouldPerformStep = false;
// > Flag for whether to store data for plotting // > Flag for whether to store data for plotting
bool m_shouldStoreData_for_plotting = false; bool m_shouldStoreData_for_plotting = false;
// > Flag for reseting the zoom level
bool m_shouldResetZoom = false;
// > Time (as a float) for the horizontal axis // > Time (as a float) for the horizontal axis
float m_time_for_step = 0.0f; float m_time_for_step = 0.0f;
// > The duration for which to record the step // > The duration for which to record the step
......
...@@ -218,6 +218,9 @@ void CsoneControllerTab::on_perform_step_button_clicked() ...@@ -218,6 +218,9 @@ void CsoneControllerTab::on_perform_step_button_clicked()
// Set the flag that a step should be performed // Set the flag that a step should be performed
m_shouldPerformStep = true; m_shouldPerformStep = true;
// Set the flag that the zoom levels should be reset
m_shouldResetZoom = true;
// Set the time back to be less than zero // Set the time back to be less than zero
m_time_for_step = -1.0; m_time_for_step = -1.0;
...@@ -283,6 +286,9 @@ void CsoneControllerTab::on_log_data_button_clicked() ...@@ -283,6 +286,9 @@ void CsoneControllerTab::on_log_data_button_clicked()
// Set the flag that a step should be performed // Set the flag that a step should be performed
m_shouldPerformStep = false; m_shouldPerformStep = false;
// Set the flag that the zoom levels should be reset
m_shouldResetZoom = true;
// Set the time back to zero // Set the time back to zero
m_time_for_step = 0.0; m_time_for_step = 0.0;
...@@ -544,7 +550,7 @@ void CsoneControllerTab::newDataForPerformingStepAndPlotting(float x, float pitc ...@@ -544,7 +550,7 @@ void CsoneControllerTab::newDataForPerformingStepAndPlotting(float x, float pitc
static float max_x_value_plotted = 0.01; static float max_x_value_plotted = 0.01;
static float min_pitch_value_plotted = -0.01; static float min_pitch_value_plotted = -0.01;
static float max_pitch_value_plotted = 0.01; static float max_pitch_value_plotted = 0.01;
static float next_rezoom_at_time = 2.00; static float next_rezoom_at_time = 0.50;
// Initialise a bool for whether the step response should be analsysed // Initialise a bool for whether the step response should be analsysed
bool shouldAnalyseStepResponse = false; bool shouldAnalyseStepResponse = false;
...@@ -552,6 +558,18 @@ void CsoneControllerTab::newDataForPerformingStepAndPlotting(float x, float pitc ...@@ -552,6 +558,18 @@ void CsoneControllerTab::newDataForPerformingStepAndPlotting(float x, float pitc
// Lock the mutex // Lock the mutex
m_chart_mutex.lock(); m_chart_mutex.lock();
// Reset the min, max, and rezoom time if requested
if (m_shouldResetZoom)
{
min_x_value_plotted = -0.01;
max_x_value_plotted = 0.01;
min_pitch_value_plotted = -0.01;
max_pitch_value_plotted = 0.01;
next_rezoom_at_time = 0.50;
// Set the flag to false
m_shouldResetZoom = false;
}
// Only do something if the flag indicates to do so // Only do something if the flag indicates to do so
if (m_shouldStoreData_for_plotting) if (m_shouldStoreData_for_plotting)
{ {
...@@ -565,17 +583,6 @@ void CsoneControllerTab::newDataForPerformingStepAndPlotting(float x, float pitc ...@@ -565,17 +583,6 @@ void CsoneControllerTab::newDataForPerformingStepAndPlotting(float x, float pitc
//m_lineSeries_for_setpoint_pitch->append(m_time_for_step, ... ); //m_lineSeries_for_setpoint_pitch->append(m_time_for_step, ... );
m_lineSeries_for_measured_pitch->append(m_time_for_step, pitch ); m_lineSeries_for_measured_pitch->append(m_time_for_step, pitch );
// Reset the min, max, and rezoom time at the start of performing the step
if (m_time_for_step <= -0.998)
{
min_x_value_plotted = -0.01;
max_x_value_plotted = 0.01;
min_pitch_value_plotted = -0.01;
max_pitch_value_plotted = 0.01;
next_rezoom_at_time = 2.00;
}
// Update the min and max values // Update the min and max values
min_x_value_plotted = std::min( min_x_value_plotted , std::min(temp_x_setpoint,x) ); min_x_value_plotted = std::min( min_x_value_plotted , std::min(temp_x_setpoint,x) );
max_x_value_plotted = std::max( max_x_value_plotted , std::max(temp_x_setpoint,x) ); max_x_value_plotted = std::max( max_x_value_plotted , std::max(temp_x_setpoint,x) );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment