Mercurial > hg > fxanalyse
diff FXAnalyse.c @ 139:e04123ab79ef
Fix recenter
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Wed, 22 Jan 2014 14:45:22 +0100 |
parents | 7b9cf3d4346e |
children | 3f7eef731ccc |
line wrap: on
line diff
--- a/FXAnalyse.c Wed Jan 22 14:45:07 2014 +0100 +++ b/FXAnalyse.c Wed Jan 22 14:45:22 2014 +0100 @@ -1352,10 +1352,6 @@ // recenter if (recenter.enabled) { - if (recenter.t0 == 0.0) { - - } - rollmean_accumulate(&rollmean_ch2, Ch2); rollmean_accumulate(&rollmean_ch3, Ch3); rollmean_accumulate(&rollmean_ch4, Ch4); @@ -1365,31 +1361,37 @@ if (recenter.Lo) { // adjust DDS2 frequency to keep Ch4 reading at 275 kHz double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); - freq = freq + 275000.0 - rollmean_ch4.mean; + double adj = 275000.0 - rollmean_ch4.mean; + freq = freq + adj; SetCtrlVal(MainPanel, PANEL_DDS2, freq); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, freq); + logmsg("recenter ch4 to 275 kHz: DDS2 adjustment=%5e", adj); } if (recenter.Hg) { // adjust DDS3 frequency to keep Ch2 reading at 10 kHz double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); - freq = freq + 10000 - rollmean_ch2.mean; + double adj = 10000 - rollmean_ch2.mean; + freq = freq + adj; SetCtrlVal(MainPanel, PANEL_DDS3, freq); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, freq); + logmsg("recenter Hg beatnote (ch2) to 10 kHz: DDS3 adjustment=%5e", adj); } if (recenter.Sr) { // adjust DDS3 frequency to keep Ch3 reading at 10 kHz double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); - freq = freq + 10000 - rollmean_ch3.mean; + double adj = 10000 - rollmean_ch3.mean; + freq = freq + adj; SetCtrlVal(MainPanel, PANEL_DDS3, freq); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, freq); + logmsg("recenter Hg beatnote (ch3) to 10 kHz: DDS3 adjustment=%5e", adj); } 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_zero(&rollmean_ch2); + rollmean_zero(&rollmean_ch3); + rollmean_zero(&rollmean_ch4); } } @@ -2014,7 +2016,7 @@ -int CVICALLBACK CB_OnReCentering (int panel, int control, int event, +int CVICALLBACK CB_RecenterEnable (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) @@ -2022,9 +2024,9 @@ case EVENT_COMMIT: GetCtrlVal(panel, control, &recenter.enabled); 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_zero(&rollmean_ch2); + rollmean_zero(&rollmean_ch3); + rollmean_zero(&rollmean_ch4); break; } return 0; @@ -2234,6 +2236,40 @@ return 0; } +int CVICALLBACK CB_RecenterInterval (int panel, int control, int event, + void *callbackData, int eventData1, int eventData2) +{ + switch (event) + { + case EVENT_COMMIT: + GetCtrlVal(panel, control, &recenter.interval); + break; + } + return 0; +} + +int CVICALLBACK CB_RecenterChannel (int panel, int control, int event, + void *callbackData, int eventData1, int eventData2) +{ + switch (event) + { + case EVENT_COMMIT: + switch (control) + { + case PANEL_RECENTER_LO: + GetCtrlVal(panel, control, &recenter.Lo); + break; + case PANEL_RECENTER_HG: + GetCtrlVal(panel, control, &recenter.Hg); + break; + case PANEL_RECENTER_SR: + GetCtrlVal(panel, control, &recenter.Sr); + break; + } + break; + } + return 0; +} int CVICALLBACK CB_DedriftDDSFreq (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) {