Mercurial > hg > fxanalyse
comparison FXAnalyse.c @ 179:75e37ba8c417
Fix real DDS frequency display
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Fri, 21 Feb 2014 18:38:45 +0100 |
parents | 03dcca7e5ba4 |
children | 8faada7e4faf |
comparison
equal
deleted
inserted
replaced
178:03dcca7e5ba4 | 179:75e37ba8c417 |
---|---|
688 case N_MEASUREMENT_INIT: | 688 case N_MEASUREMENT_INIT: |
689 // initialization step | 689 // initialization step |
690 | 690 |
691 // set DDS1 to nominal frequency | 691 // set DDS1 to nominal frequency |
692 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); | 692 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); |
693 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
693 | 694 |
694 // record current DDS frequencies | 695 // record current DDS frequencies |
695 f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); | 696 f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); |
696 | 697 |
697 t1 = utc; | 698 t1 = utc; |
712 if ((utc - t1) > SlopeTime1) { | 713 if ((utc - t1) > SlopeTime1) { |
713 f_rep_slope = stat_math1.slope; | 714 f_rep_slope = stat_math1.slope; |
714 | 715 |
715 // frep positive step | 716 // frep positive step |
716 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + delta_f_lock_1, FREP_STEP_SIZE); | 717 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + delta_f_lock_1, FREP_STEP_SIZE); |
718 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
717 | 719 |
718 // allow counter to settle | 720 // allow counter to settle |
719 settling = 3; | 721 settling = 3; |
720 | 722 |
721 // next step | 723 // next step |
730 if (settling-- > 0) | 732 if (settling-- > 0) |
731 break; | 733 break; |
732 | 734 |
733 double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); | 735 double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); |
734 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2 + 275000 - Ch4); | 736 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2 + 275000 - Ch4); |
737 SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); | |
735 | 738 |
736 // allow counter to settle | 739 // allow counter to settle |
737 settling = 3; | 740 settling = 3; |
738 | 741 |
739 // next step | 742 // next step |
756 f_rep_plus = f_rep_plus / nobs; | 759 f_rep_plus = f_rep_plus / nobs; |
757 nobs = 0; | 760 nobs = 0; |
758 | 761 |
759 // frep negative step | 762 // frep negative step |
760 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - delta_f_lock_1, FREP_STEP_SIZE); | 763 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - delta_f_lock_1, FREP_STEP_SIZE); |
764 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
761 | 765 |
762 // allow counter to settle | 766 // allow counter to settle |
763 settling = 3; | 767 settling = 3; |
764 | 768 |
765 // next step | 769 // next step |
789 SetCtrlVal(CalcNPanel, CALCN_N, N_measured); | 793 SetCtrlVal(CalcNPanel, CALCN_N, N_measured); |
790 | 794 |
791 // back to nominal frep | 795 // back to nominal frep |
792 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); | 796 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); |
793 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); | 797 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); |
798 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
799 SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); | |
794 | 800 |
795 // done | 801 // done |
796 Measuring_1 = N_MEASUREMENT_NONE; | 802 Measuring_1 = N_MEASUREMENT_NONE; |
797 } | 803 } |
798 break; | 804 break; |
807 case N_MEASUREMENT_INIT: | 813 case N_MEASUREMENT_INIT: |
808 // initialization step | 814 // initialization step |
809 | 815 |
810 // set DDS1 to nominal frequency | 816 // set DDS1 to nominal frequency |
811 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); | 817 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); |
818 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
812 | 819 |
813 // record current DDS frequencies | 820 // record current DDS frequencies |
814 f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); | 821 f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); |
815 f0_DDS3 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); | 822 f0_DDS3 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); |
816 | 823 |
836 f_rep_slope = stat_math1.slope; | 843 f_rep_slope = stat_math1.slope; |
837 f_beat_slope = stat_ch2.slope; | 844 f_beat_slope = stat_ch2.slope; |
838 | 845 |
839 // frep positive step | 846 // frep positive step |
840 double fDDS1 = f0_DDS1 + delta_f_lock_2; | 847 double fDDS1 = f0_DDS1 + delta_f_lock_2; |
841 DDS4xAD9912_RampFrequency(&DDS4xAD9912,1, fDDS1, FREP_STEP_SIZE); | 848 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, fDDS1, FREP_STEP_SIZE); |
849 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
842 | 850 |
843 // adjust DDS3 to keep beatnote within the bandpass filter. prediction | 851 // adjust DDS3 to keep beatnote within the bandpass filter. prediction |
844 double fDDS3 = f0_DDS3 + Sign1 * Sign2 * N2/N1 * Ndiv * delta_f_lock_2; | 852 double fDDS3 = f0_DDS3 + Sign1 * Sign2 * N2/N1 * Ndiv * delta_f_lock_2; |
845 df_DDS3 = fDDS3 - DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); | 853 df_DDS3 = fDDS3 - DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); |
846 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); | 854 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); |
855 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); | |
847 | 856 |
848 // allow counter to settle | 857 // allow counter to settle |
849 settling = 3; | 858 settling = 3; |
850 | 859 |
851 // next step | 860 // next step |
860 if (settling-- > 0) | 869 if (settling-- > 0) |
861 break; | 870 break; |
862 | 871 |
863 double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4; | 872 double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4; |
864 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2); | 873 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2); |
874 SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); | |
865 | 875 |
866 double fDDS3 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3) + 10000 - Ch2; | 876 double fDDS3 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3) + 10000 - Ch2; |
867 df_DDS3 = df_DDS3 + 10000 - Ch2; | 877 df_DDS3 = df_DDS3 + 10000 - Ch2; |
868 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); | 878 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); |
879 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); | |
869 | 880 |
870 // allow counter to settle | 881 // allow counter to settle |
871 settling = 3; | 882 settling = 3; |
872 | 883 |
873 // next step | 884 // next step |
893 nobs = 0; | 904 nobs = 0; |
894 | 905 |
895 // negative frequency step | 906 // negative frequency step |
896 double fDDS1 = f0_DDS1 - delta_f_lock_2; | 907 double fDDS1 = f0_DDS1 - delta_f_lock_2; |
897 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, fDDS1, FREP_STEP_SIZE); | 908 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, fDDS1, FREP_STEP_SIZE); |
909 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
898 | 910 |
899 // adjust DDS3 to keep beatnote within the bandpass filter. prediction | 911 // adjust DDS3 to keep beatnote within the bandpass filter. prediction |
900 double fDDS3 = f0_DDS3 - Sign1 * Sign2 * N2/N1 * Ndiv * delta_f_lock_2; | 912 double fDDS3 = f0_DDS3 - Sign1 * Sign2 * N2/N1 * Ndiv * delta_f_lock_2; |
901 df_DDS3 = fDDS3 - DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); | 913 df_DDS3 = fDDS3 - DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); |
902 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); | 914 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); |
915 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); | |
903 | 916 |
904 // allow counter to settle | 917 // allow counter to settle |
905 settling = 3; | 918 settling = 3; |
906 | 919 |
907 // next step | 920 // next step |
939 | 952 |
940 // back to nominal frequency | 953 // back to nominal frequency |
941 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); | 954 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); |
942 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); | 955 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); |
943 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3); | 956 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3); |
957 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
958 SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); | |
959 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); | |
944 | 960 |
945 // done | 961 // done |
946 Measuring_2 = N_MEASUREMENT_NONE; | 962 Measuring_2 = N_MEASUREMENT_NONE; |
947 } | 963 } |
948 break; | 964 break; |
957 case N_MEASUREMENT_INIT: | 973 case N_MEASUREMENT_INIT: |
958 // init | 974 // init |
959 | 975 |
960 // set DDS1 to nominal frequency | 976 // set DDS1 to nominal frequency |
961 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); | 977 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); |
978 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
962 | 979 |
963 // record current DDS frequencies | 980 // record current DDS frequencies |
964 f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); | 981 f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); |
965 f0_DDS3 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); | 982 f0_DDS3 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); |
966 | 983 |
993 logmsg("f_rep_slope=%e Hz/s", f_rep_slope); | 1010 logmsg("f_rep_slope=%e Hz/s", f_rep_slope); |
994 logmsg("f_beat_slope=%e Hz/s", f_rep_slope); | 1011 logmsg("f_beat_slope=%e Hz/s", f_rep_slope); |
995 | 1012 |
996 // frep positive step | 1013 // frep positive step |
997 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + delta_f_lock_3, FREP_STEP_SIZE); | 1014 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + delta_f_lock_3, FREP_STEP_SIZE); |
1015 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
998 | 1016 |
999 // adjust DDS3 to keep beatnote within the bandpass filter | 1017 // adjust DDS3 to keep beatnote within the bandpass filter |
1000 double fDDS3 = f0_DDS3 + Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3; | 1018 double fDDS3 = f0_DDS3 + Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3; |
1001 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); | 1019 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); |
1020 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); | |
1002 | 1021 |
1003 // allow counter to settle | 1022 // allow counter to settle |
1004 settling = 3; | 1023 settling = 3; |
1005 | 1024 |
1006 // next step | 1025 // next step |
1016 break; | 1035 break; |
1017 | 1036 |
1018 // adjust DDS frequency to keep 55 MHz tracker oscillator locked | 1037 // adjust DDS frequency to keep 55 MHz tracker oscillator locked |
1019 double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4; | 1038 double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4; |
1020 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2); | 1039 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2); |
1040 SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); | |
1021 | 1041 |
1022 // allow counter to settle | 1042 // allow counter to settle |
1023 settling = 3; | 1043 settling = 3; |
1024 | 1044 |
1025 // next step | 1045 // next step |
1044 f_beat_plus = f_beat_plus / nobs; | 1064 f_beat_plus = f_beat_plus / nobs; |
1045 nobs = 0; | 1065 nobs = 0; |
1046 | 1066 |
1047 // frep negative step | 1067 // frep negative step |
1048 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - delta_f_lock_3, FREP_STEP_SIZE); | 1068 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - delta_f_lock_3, FREP_STEP_SIZE); |
1069 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
1049 | 1070 |
1050 // adjust DDS3 to keep beatnote within the bandpass filter | 1071 // adjust DDS3 to keep beatnote within the bandpass filter |
1051 double fDDS3 = f0_DDS3 - Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3; | 1072 double fDDS3 = f0_DDS3 - Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3; |
1052 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); | 1073 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); |
1074 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); | |
1053 | 1075 |
1054 // allow counter to settle | 1076 // allow counter to settle |
1055 settling = 3; | 1077 settling = 3; |
1056 | 1078 |
1057 // next step | 1079 // next step |
1101 | 1123 |
1102 // back to nominal frep | 1124 // back to nominal frep |
1103 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); | 1125 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); |
1104 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); | 1126 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); |
1105 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3); | 1127 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3); |
1128 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
1129 SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); | |
1130 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); | |
1106 | 1131 |
1107 // done | 1132 // done |
1108 Measuring_3 = N_MEASUREMENT_NONE; | 1133 Measuring_3 = N_MEASUREMENT_NONE; |
1109 } | 1134 } |
1110 break; | 1135 break; |
1229 // adjust DDS2 frequency to keep Ch4 reading at 275 kHz | 1254 // adjust DDS2 frequency to keep Ch4 reading at 275 kHz |
1230 double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); | 1255 double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); |
1231 double adj = 275000.0 - rollmean_ch4.mean; | 1256 double adj = 275000.0 - rollmean_ch4.mean; |
1232 freq = freq + adj; | 1257 freq = freq + adj; |
1233 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, freq); | 1258 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, freq); |
1259 SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); | |
1234 logmsg("recenter ch4 to 275 kHz: DDS2 adjustment=%+3e", adj); | 1260 logmsg("recenter ch4 to 275 kHz: DDS2 adjustment=%+3e", adj); |
1235 } | 1261 } |
1236 | 1262 |
1237 if (recenter.hg) { | 1263 if (recenter.hg) { |
1238 // adjust DDS3 frequency to keep Ch2 reading at 10 kHz | 1264 // adjust DDS3 frequency to keep Ch2 reading at 10 kHz |
1239 double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); | 1265 double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); |
1240 double adj = 10000 - rollmean_ch2.mean; | 1266 double adj = 10000 - rollmean_ch2.mean; |
1241 freq = freq + adj; | 1267 freq = freq + adj; |
1242 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, freq); | 1268 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, freq); |
1269 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); | |
1243 logmsg("recenter Hg beatnote (ch2) to 10 kHz: DDS3 adjustment=%+3e", adj); | 1270 logmsg("recenter Hg beatnote (ch2) to 10 kHz: DDS3 adjustment=%+3e", adj); |
1244 } | 1271 } |
1245 | 1272 |
1246 if (recenter.sr) { | 1273 if (recenter.sr) { |
1247 // adjust DDS3 frequency to keep Ch3 reading at 10 kHz | 1274 // adjust DDS3 frequency to keep Ch3 reading at 10 kHz |
1248 double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); | 1275 double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); |
1249 double adj = 10000 - rollmean_ch3.mean; | 1276 double adj = 10000 - rollmean_ch3.mean; |
1250 freq = freq + adj; | 1277 freq = freq + adj; |
1251 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, freq); | 1278 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, freq); |
1279 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); | |
1252 logmsg("recenter Sr beatnote (ch3) to 10 kHz: DDS3 adjustment=%+3e", adj); | 1280 logmsg("recenter Sr beatnote (ch3) to 10 kHz: DDS3 adjustment=%+3e", adj); |
1253 } | 1281 } |
1254 | 1282 |
1255 recenter.t0 = utc; | 1283 recenter.t0 = utc; |
1256 rollmean_zero(&rollmean_ch2); | 1284 rollmean_zero(&rollmean_ch2); |
1257 rollmean_zero(&rollmean_ch3); | 1285 rollmean_zero(&rollmean_ch3); |
1258 rollmean_zero(&rollmean_ch4); | 1286 rollmean_zero(&rollmean_ch4); |
1259 } | 1287 } |
1260 } | 1288 } |
1261 | 1289 |
1262 // update DDS frequencies display | |
1263 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
1264 SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); | |
1265 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); | |
1266 SetCtrlVal(MainPanel, PANEL_DDS4, DDS4xAD9912.frequency[3]); | |
1267 | |
1268 // local time | 1290 // local time |
1269 struct tm *ltime = localtime(&event.time.tv_sec); | 1291 struct tm *ltime = localtime(&event.time.tv_sec); |
1270 // round to milliseconds | 1292 // round to milliseconds |
1271 int msec = round(event.time.tv_usec / 1000.0); | 1293 int msec = round(event.time.tv_usec / 1000.0); |
1272 while (msec >= 1000) { | 1294 while (msec >= 1000) { |
1333 double frequency; | 1355 double frequency; |
1334 GetCtrlVal(MainPanel, control, &frequency); | 1356 GetCtrlVal(MainPanel, control, &frequency); |
1335 switch (control) { | 1357 switch (control) { |
1336 case PANEL_DDS1: | 1358 case PANEL_DDS1: |
1337 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, frequency); | 1359 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, frequency); |
1360 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
1338 break; | 1361 break; |
1339 case PANEL_DDS2: | 1362 case PANEL_DDS2: |
1340 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, frequency); | 1363 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, frequency); |
1364 SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); | |
1341 break; | 1365 break; |
1342 case PANEL_DDS3: | 1366 case PANEL_DDS3: |
1343 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency); | 1367 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency); |
1368 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); | |
1344 break; | 1369 break; |
1345 case PANEL_DDS4: | 1370 case PANEL_DDS4: |
1346 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency); | 1371 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency); |
1372 SetCtrlVal(MainPanel, PANEL_DDS4, DDS4xAD9912.frequency[3]); | |
1347 break; | 1373 break; |
1348 } | 1374 } |
1349 break; | 1375 break; |
1350 } | 1376 } |
1351 return 0; | 1377 return 0; |
1721 { | 1747 { |
1722 case EVENT_COMMIT: | 1748 case EVENT_COMMIT: |
1723 switch (control) | 1749 switch (control) |
1724 { | 1750 { |
1725 case PANEL_FIND275K2: | 1751 case PANEL_FIND275K2: |
1726 GetCtrlVal(MainPanel, PANEL_DDS2, &frequency); | 1752 frequency = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4; |
1727 frequency = frequency + 275000 - Ch4; | |
1728 SetCtrlVal(MainPanel, PANEL_DDS2, frequency) ; | |
1729 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, frequency); | 1753 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, frequency); |
1730 break; | 1754 SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); |
1731 | 1755 break; |
1732 case PANEL_FIND10K3: | 1756 case PANEL_FIND10K3: |
1733 GetCtrlVal(MainPanel, PANEL_DDS3, &frequency); | 1757 frequency = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3) + 10000 - Ch2; |
1734 frequency = frequency + 10000 - Ch2; | |
1735 SetCtrlVal(MainPanel, PANEL_DDS3, frequency); | |
1736 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency); | 1758 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency); |
1759 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); | |
1737 break; | 1760 break; |
1738 } | 1761 } |
1739 break; | 1762 break; |
1740 } | 1763 } |
1741 return 0; | 1764 return 0; |
1747 switch (event) | 1770 switch (event) |
1748 { | 1771 { |
1749 case EVENT_COMMIT: | 1772 case EVENT_COMMIT: |
1750 GetCtrlVal(MainPanel, PANEL_CHANGENDIV, &Ndiv); | 1773 GetCtrlVal(MainPanel, PANEL_CHANGENDIV, &Ndiv); |
1751 f0_DDS1 = 880000000.0 / Ndiv; | 1774 f0_DDS1 = 880000000.0 / Ndiv; |
1752 SetCtrlVal(MainPanel, PANEL_DDS1, f0_DDS1); | |
1753 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); | 1775 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); |
1776 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); | |
1754 break; | 1777 break; |
1755 } | 1778 } |
1756 return 0; | 1779 return 0; |
1757 } | 1780 } |
1758 | 1781 |