Mercurial > hg > fxanalyse
diff FXAnalyse.c @ 136:7b9cf3d4346e
Code cleanup
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Wed, 22 Jan 2014 12:29:58 +0100 |
parents | 77539f2597b1 |
children | e04123ab79ef |
line wrap: on
line diff
--- a/FXAnalyse.c Wed Jan 22 12:29:38 2014 +0100 +++ b/FXAnalyse.c Wed Jan 22 12:29:58 2014 +0100 @@ -77,7 +77,7 @@ } -int adev_toggle(struct adev *adev) +static int adev_toggle(struct adev *adev) { if (adev->allan.active) Allan_ClosePanel(&(adev->allan)); @@ -88,7 +88,7 @@ } -void adev_update(struct adev *adev) +static inline void adev_update(struct adev *adev) { if (adev->allan.active) Allan_AddFrequency(&(adev->allan), *(adev->data)); @@ -129,7 +129,7 @@ } -int plot_toggle(struct plot *plot) +static int plot_toggle(struct plot *plot) { if (plot->plot.active) Plot_ClosePanel(&(plot->plot)); @@ -140,7 +140,7 @@ } -void plot_update(struct plot *plot) +static inline void plot_update(struct plot *plot) { if (plot->plot.active) Plot_AddFrequency(&(plot->plot), *(plot->data)); @@ -1353,10 +1353,7 @@ if (recenter.enabled) { if (recenter.t0 == 0.0) { - recenter.t0 = utc; - rollmean_zero(&rollmean_ch2, ROLLMEAN_N_OBS); - rollmean_zero(&rollmean_ch3, ROLLMEAN_N_OBS); - rollmean_zero(&rollmean_ch4, ROLLMEAN_N_OBS); + } rollmean_accumulate(&rollmean_ch2, Ch2); @@ -1503,12 +1500,10 @@ int CVICALLBACK CB_ChangeDDSOut (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { - double frequency ; - switch (event) { case EVENT_COMMIT: + double frequency; GetCtrlVal(MainPanel, control, &frequency); - switch (control) { case PANEL_DDS1: DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, frequency); @@ -1523,6 +1518,7 @@ DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency); break; } + break; } return 0; } @@ -1530,22 +1526,28 @@ int CVICALLBACK CB_ChangeDDSStep (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { - double Step ; - switch (event) - { + { case EVENT_COMMIT: - GetCtrlVal(MainPanel, control, &Step); - if (control==PANEL_DDS1STEP) { SetCtrlAttribute(panel, PANEL_DDS1, ATTR_INCR_VALUE, Step); } - if (control==PANEL_DDS2STEP) { SetCtrlAttribute(panel, PANEL_DDS2, ATTR_INCR_VALUE, Step); } - if (control==PANEL_DDS3STEP) { SetCtrlAttribute(panel, PANEL_DDS3, ATTR_INCR_VALUE, Step); } - if (control==PANEL_DDS4STEP) { SetCtrlAttribute(panel, PANEL_DDS4, ATTR_INCR_VALUE, Step); } + double step; + GetCtrlVal(panel, control, &step); + switch (control) + { + case PANEL_DDS1STEP: + SetCtrlAttribute(panel, PANEL_DDS1, ATTR_INCR_VALUE, step); + break; + case PANEL_DDS2STEP: + SetCtrlAttribute(panel, PANEL_DDS2, ATTR_INCR_VALUE, step); + break; + case PANEL_DDS3STEP: + SetCtrlAttribute(panel, PANEL_DDS3, ATTR_INCR_VALUE, step); + break; + case PANEL_DDS4STEP: + SetCtrlAttribute(panel, PANEL_DDS4, ATTR_INCR_VALUE, step); + break; + } break; - case EVENT_RIGHT_CLICK: - - break; - - } + } return 0; } @@ -1589,13 +1591,22 @@ { switch (event) - { + { case EVENT_COMMIT: - if (control==PANEL_N1CHOICE) GetCtrlVal(MainPanel, control, &N1) ; - if (control==PANEL_N2CHOICE) GetCtrlVal(MainPanel, control, &N2) ; - if (control==PANEL_N3CHOICE) GetCtrlVal(MainPanel, control, &N3) ; + switch (control) + { + case PANEL_N1CHOICE: + GetCtrlVal(panel, control, &N1); + break; + case PANEL_N2CHOICE: + GetCtrlVal(panel, control, &N2); + break; + case PANEL_N3CHOICE: + GetCtrlVal(panel, control, &N3); + break; + } break; - } + } return 0; } @@ -1987,17 +1998,10 @@ { case EVENT_COMMIT: switch (control) { - - case PANEL_CHECKBOX_CORRFREQU: - // enable frequency correction - // GetCtrlVal(MainPanel, PANEL_CHECKBOX_CORRFREQU, &FrequCorrec); - break; - case PANEL_CHECKBOX_KEEP: // keep current dedrifting frequency when dedrifting is disabled GetCtrlVal(MainPanel, PANEL_CHECKBOX_KEEP, &dedrift.keep_freq); break; - case PANEL_CHECKBOX_KEEPSLOPE: // keep current dedrifting slope when dedrifting is disabled GetCtrlVal(MainPanel, PANEL_CHECKBOX_KEEPSLOPE, &dedrift.keep_slope); @@ -2017,7 +2021,10 @@ { case EVENT_COMMIT: GetCtrlVal(panel, control, &recenter.enabled); - recenter.t0 = 0.0; + recenter.t0 = utc; + rollmean_zero(&rollmean_ch2, ROLLMEAN_N_OBS); + rollmean_zero(&rollmean_ch3, ROLLMEAN_N_OBS); + rollmean_zero(&rollmean_ch4, ROLLMEAN_N_OBS); break; } return 0; @@ -2065,9 +2072,8 @@ { case PANEL_ESTIMATE_N3: GetPanelAttribute(EstimateN3Panel, ATTR_VISIBLE , &visible); - if (! visible) { + if (! visible) DisplayPanel(EstimateN3Panel); - } // set current frep SetCtrlVal(EstimateN3Panel, ESTIMATEN3_FREP, 250e6 + Math1); // default wavelenght for Sr cavity