diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2018-05-03 09:59:22 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2018-05-03 09:59:22 -0400 |
commit | 201bfbfb5a6242b3cfc534c6b7015eb0be623c5e (patch) | |
tree | 4c624ef4d921d13e4a62235a28b44ef52bb567a1 | |
parent | 2c0cdd908ae12df17c2148ca5b9f6c421e0c86f1 (diff) |
use new variables and range sizes (but not initialized correctly yet)
-rw-r--r-- | device-functions.c | 36 | ||||
-rw-r--r-- | flash.c | 17 | ||||
-rw-r--r-- | globals.h | 86 |
3 files changed, 62 insertions, 77 deletions
diff --git a/device-functions.c b/device-functions.c index 8847d92..7671e1d 100644 --- a/device-functions.c +++ b/device-functions.c @@ -1705,7 +1705,7 @@ int Set_Amp_Calib(int channel,float meas_ampl) return CalibrationPercentError; } - for (i=0; i<10; ++i) + for (i=0; i<std_range_size; ++i) globals.Flash.ampl_pwl[channel][relay_range][UseNegData][i]= globals.Flash.ampl_pwl[channel][relay_range][UseNegData][i]*change_ratio; @@ -1715,7 +1715,7 @@ int Set_Amp_Calib(int channel,float meas_ampl) if (status) { /* revert to original calibration */ - for (i=0; i<10; ++i) + for (i=0; i<std_range_size; ++i) globals.Flash.ampl_pwl[channel][relay_range][UseNegData][i]= globals.Flash.ampl_pwl[channel][relay_range][UseNegData][i]/change_ratio; } @@ -1806,7 +1806,7 @@ int Set_OS_Calib(int channel,float meas_ampl) return CalibrationPercentError; } - for (i=0; i<10; ++i) { + for (i=0; i<std_range_size; ++i) { globals.Flash.os_pwl[channel][0][0][i]=globals.Flash.os_pwl[channel][0][0][i]*change_ratio; } @@ -1816,7 +1816,7 @@ int Set_OS_Calib(int channel,float meas_ampl) if (status) { /* revert to original calibration */ - for (i=0; i<10; ++i) { + for (i=0; i<std_range_size; ++i) { globals.Flash.os_pwl[channel][0][0][i]=globals.Flash.os_pwl[channel][0][0][i]/change_ratio; } } @@ -2311,7 +2311,7 @@ int Set_VI_Cal_Pnt(int parameter,int channel,int calibration_point_number,float pwl = 0; pwl_distort = 0; - max_points=old_range_size_ten; + max_points=std_range_size; switch (parameter) { case (pwl_ampl_values): max_polarity=ampl_polarities; @@ -2499,7 +2499,7 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number) true_channel=channel; - max_points=old_range_size_ten; + max_points=std_range_size; pointer_short2=0; switch (parameter) { @@ -2605,10 +2605,10 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number) } } - *(float *)(&pointer_float1[index+old_range_size_ten-1])=0.0; - *(short *)(&pointer_short1[index+old_range_size_ten-1])=0; + *(float *)(&pointer_float1[index+std_range_size-1])=0.0; + *(short *)(&pointer_short1[index+std_range_size-1])=0; if (pointer_short2) { - *(short *)(&pointer_short2[index+old_range_size_ten-1])=0; + *(short *)(&pointer_short2[index+std_range_size-1])=0; } /* see if new point prevents min/max from being obtained */ @@ -2710,7 +2710,7 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int top_range_only=0; starting_range=0; - max_points=old_range_size_ten; + max_points=std_range_size; reciprocal_relationship=NO; decreasing_values_allowed=NO; min_os_in_range=max_os_in_range=0.0; @@ -3006,7 +3006,7 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int *point_found=1; if ((parameter==pwl_ampl_values) && globals.Flash.ampl_os_ranges_related[channel]) { - for (i=0; i<old_range_size_ten; i++) { + for (i=0; i<std_range_size; i++) { if (max_os_in_range<globals.Flash.os_pwl[channel][range_i][0][i]) { max_os_in_range=globals.Flash.os_pwl[channel][range_i][0][i]; } @@ -3020,7 +3020,7 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int } if ((parameter==pwl_os_values) && globals.Flash.ampl_os_ranges_related[channel]) { - for (i=0; i<old_range_size_ten; i++) { + for (i=0; i<std_range_size; i++) { if (max_ampl_in_range<globals.Flash.ampl_pwl[channel][range_i][*UseNegData][i]) { max_ampl_in_range=globals.Flash.ampl_pwl[channel][range_i][*UseNegData][i]; } @@ -3141,10 +3141,10 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) float abs_cal_point; int max_points,max_polarity,max_ranges; - float temp_y_float1[old_range_size_ten+1]; - float temp_x_float1[old_range_size_ten+1]; /* float copy of short, for calculations */ - int temp_x_short1[old_range_size_ten+1]; - int temp_x_short2[old_range_size_ten+1]; + float temp_y_float1[std_range_size+1]; + float temp_x_float1[std_range_size+1]; /* float copy of short, for calculations */ + int temp_x_short1[std_range_size+1]; + int temp_x_short2[std_range_size+1]; int index,actual_pol; float *pointer_y_float1; @@ -3159,7 +3159,7 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) range=polarity=0; - max_points=old_range_size_ten; + max_points=std_range_size; pointer_x_short2=0; abs_cal_point=cal_point; @@ -3465,7 +3465,7 @@ int Get_VI_Rng_Info(int parameter, int channel, int calibration_point_number, in *num_in_range=0; /* determine array structure */ - max_points=old_range_size_ten; + max_points=std_range_size; switch (parameter) { case pwl_ampl_values: @@ -525,17 +525,6 @@ static void initFlashValues(FlashStruct *mem) mem->enable_avrq_extra_ampls=0; - for (i=0; i<old_range_size_ten; i++) { - mem->vcc1_dacval[0][0][0][i]=0; - mem->vcc1_pwl[0][0][0][i]=0.0; - mem->vcc2_dacval[0][0][0][i]=0; - mem->vcc2_pwl[0][0][0][i]=0.0; - } - mem->vcc1_dacval[0][0][0][1]=dac_max; - mem->vcc1_pwl[0][0][0][1]=10.0; - mem->vcc2_dacval[0][0][0][1]=dac_max; - mem->vcc2_pwl[0][0][0][1]=25; - for (i=0; i<max_channels; i++) { power_of_ten=1.0; power_of_two=24.0e-9; @@ -675,8 +664,6 @@ static void initFlashValues(FlashStruct *mem) mem->rcl_route_secondary[i][j]=1; mem->rcl_slew[i][j]=100e6; mem->rcl_load[i][j]=50.0; - mem->rcl_vcc1[i][j]=0.0; - mem->rcl_vcc2[i][j]=0.0; mem->rcl_vlogic[i][j]=0.0; } @@ -868,10 +855,6 @@ static void initFlashValues(FlashStruct *mem) mem->max_pw_pol[i][0]=0.0; mem->max_pw_pol[i][1]=0.0; - mem->vcc1_max[i]=5.1; - mem->vcc2_max[i]=24.4; - mem->vcc2_min[i]=3.0; - mem->use_high_ampl_ranges_for_high_pw_ranges[i]=0; mem->couple_first_N_pw_ranges_to_ampl_ranges[i]=0; @@ -484,8 +484,8 @@ typedef struct { /* so that per-channel section starts at 256 */ /* [chan][range 0-4][polarity][interpolation point 0-9] */ - short ampl_dacval[max_channels][ampl_ranges][ampl_polarities][old_range_size_ten]; - float ampl_pwl[max_channels][ampl_ranges][ampl_polarities][old_range_size_ten]; + short obs_ampl_dacval[max_channels][ampl_ranges][ampl_polarities][old_range_size_ten]; + float obs_ampl_pwl[max_channels][ampl_ranges][ampl_polarities][old_range_size_ten]; float rcl_frequency[max_channels][max_stored_settings]; float rcl_delay[max_channels][max_stored_settings]; @@ -538,8 +538,8 @@ typedef struct { Use fixed_ampl_points instead */ short zout_min[max_channels]; /* addr 1912 */ - short os_dacval[max_channels][os_ranges][os_polarities][old_range_size_ten]; /* addr 1916 */ - float os_pwl[max_channels][os_ranges][os_polarities][old_range_size_ten]; /* addr 2116 */ + short obs_os_dacval[max_channels][os_ranges][os_polarities][old_range_size_ten]; /* addr 1916 */ + float obs_os_pwl[max_channels][os_ranges][os_polarities][old_range_size_ten]; /* addr 2116 */ short ampl_DAC[max_channels]; /* addr 2516 */ short os_DAC[max_channels]; /* addr 2520 */ @@ -550,21 +550,21 @@ typedef struct { char ext_amplify_enabled[max_channels]; /* addr 2532 */ char volt_ctrl_delay[max_channels]; /* addr 2534 */ - float rise_time_pwl[max_channels][ampl_ranges][ampl_polarities][old_range_size_ten]; /* addr 2536 */ + float obs_rise_time_pwl[max_channels][ampl_ranges][ampl_polarities][old_range_size_ten]; /* addr 2536 */ short ext_amplify_xtra_rly[max_channels]; /* addr 3336 */ short ea_xtra_rly[max_channels]; /* addr 3340 */ short rcl_misc2[max_channels][max_stored_settings]; /* addr 3344 */ - short pw_dacval[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* addr 3360 */ - float pw_pwl[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* addr 3680 */ + short obs_pw_dacval[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* addr 3360 */ + float obs_pw_pwl[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* addr 3680 */ - short delay_dacval[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* addr 4320 */ - float delay_pwl[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; + short obs_delay_dacval[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* addr 4320 */ + float obs_delay_pwl[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; - short period_dacval[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* addr 5280 */ - float period_pwl[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; + short obs_period_dacval[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* addr 5280 */ + float obs_period_pwl[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; float distort_X[max_channels]; /* distortion = Z + X / (Ampl + Y). */ @@ -591,8 +591,8 @@ typedef struct { char is_monocycle[max_channels]; /* 6332 - generate control voltage for monocycle spacing, using CH2 PW calibration */ char monocycle_dac[max_channels]; /* 6334 */ - short burst_dacval[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* 6336 */ - float burst_pwl[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* 6656 */ + short obs_burst_dacval[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* 6336 */ + float obs_burst_pwl[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* 6656 */ float pulse_width_pol_tweak[max_channels][ampl_polarities]; /* 7296 - allow for PW shift with polarity */ @@ -614,12 +614,13 @@ typedef struct { short pw_dac[max_channels]; /* 7402 - for voltage-controlled PW only */ float rcl_rise_time[max_channels][max_stored_settings]; /* 7406 - rcl/sav data for rise time */ - short rise_time_dacval[max_channels][ampl_ranges][ampl_polarities][old_range_size_ten]; /* 7438 */ + short obs_rise_time_dacval[max_channels][ampl_ranges][ampl_polarities][old_range_size_ten]; /* 7438 */ + + short obs_vcc1_dacval[1][1][1][old_range_size_ten]; /* no longer used */ + float obs_vcc1_pwl[1][1][1][old_range_size_ten]; /* no longer used */ + short obs_vcc2_dacval[1][1][1][old_range_size_ten]; /* no longer used */ + float obs_vcc2_pwl[1][1][1][old_range_size_ten]; /* no longer used */ - short vcc1_dacval[1][1][1][old_range_size_ten]; /* no longer used */ - float vcc1_pwl[1][1][1][old_range_size_ten]; /* no longer used */ - short vcc2_dacval[1][1][1][old_range_size_ten]; /* no longer used */ - float vcc2_pwl[1][1][1][old_range_size_ten]; /* no longer used */ float rcl_vcc1[max_channels][max_stored_settings]; /* no longer used */ float rcl_vcc2[max_channels][max_stored_settings]; /* no longer used */ float rcl_vlogic[max_channels][max_stored_settings]; /* no longer used */ @@ -676,8 +677,9 @@ typedef struct { float sparex1[max_channels]; /* addr 8704 */ float sparex2[max_channels]; /* addr 8712 */ float rcl_sparex3[max_channels][max_stored_settings]; /* addr 8720 */ - short load_type_dacval[max_channels][load_type_ranges][load_type_polarities][old_range_size_ten]; /* 8752 */ - float load_type_pwl[max_channels][load_type_ranges][load_type_polarities][old_range_size_ten]; /* 8792 */ + + short obs_load_type_dacval[max_channels][load_type_ranges][load_type_polarities][old_range_size_ten]; /* 8752 */ + float obs_load_type_pwl[max_channels][load_type_ranges][load_type_polarities][old_range_size_ten]; /* 8792 */ char pcb_203a_rise_time[max_channels]; /* addr 8872 */ @@ -703,8 +705,8 @@ typedef struct { float max_slew[max_channels]; /* addr 8974 */ float rcl_slew[max_channels][max_stored_settings]; /* addr 8982 */ - short slew_dacval[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* addr 9014 */ - float slew_pwl[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* addr 9334 */ + short obs_slew_dacval[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* addr 9014 */ + float obs_slew_pwl[max_channels][timing_ranges][timing_polarities][old_range_size_ten]; /* addr 9334 */ short fix_pw_dac_val[max_channels]; /* addr 9974 */ @@ -765,7 +767,7 @@ typedef struct { /* addr 10256, add ampl-dependent distort output, 10V full-scale */ - short distort_dacval[max_channels][ampl_ranges][ampl_polarities][old_range_size_ten]; + short obs_distort_dacval[max_channels][ampl_ranges][ampl_polarities][old_range_size_ten]; char distort_dac[max_channels]; /* addr 10656 */ char distort_enabled[max_channels]; /* addr 10658 */ @@ -779,33 +781,33 @@ typedef struct { char ov_error_message[40]; /* addr 10732 */ - short xyz_ampl_dacval[max_channels][ampl_ranges][ampl_polarities][std_range_size]; // size 1280, addr 10772 - float xyz_ampl_pwl[max_channels][ampl_ranges][ampl_polarities][std_range_size]; // size 2560, addr 12052 - short xyz_distort_dacval[max_channels][ampl_ranges][ampl_polarities][std_range_size]; // size 1280, addr 14612 + short ampl_dacval[max_channels][ampl_ranges][ampl_polarities][std_range_size]; // size 1280, addr 10772 + float ampl_pwl[max_channels][ampl_ranges][ampl_polarities][std_range_size]; // size 2560, addr 12052 + short distort_dacval[max_channels][ampl_ranges][ampl_polarities][std_range_size]; // size 1280, addr 14612 - short xyz_os_dacval[max_channels][os_ranges][os_polarities][std_range_size]; // size 640, addr 15892 - float xyz_os_pwl[max_channels][os_ranges][os_polarities][std_range_size]; // size 1280, addr 16532 + short os_dacval[max_channels][os_ranges][os_polarities][std_range_size]; // size 640, addr 15892 + float os_pwl[max_channels][os_ranges][os_polarities][std_range_size]; // size 1280, addr 16532 - short xyz_rise_time_dacval[max_channels][ampl_ranges][ampl_polarities][std_range_size]; // size 1280, addr 17812 - float xyz_rise_time_pwl[max_channels][ampl_ranges][ampl_polarities][std_range_size]; // size 2560, addr 19092 + short rise_time_dacval[max_channels][ampl_ranges][ampl_polarities][std_range_size]; // size 1280, addr 17812 + float rise_time_pwl[max_channels][ampl_ranges][ampl_polarities][std_range_size]; // size 2560, addr 19092 - short xyz_pw_dacval[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 1024, addr 21652 - float xyz_pw_pwl[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 2048, addr 22676 + short pw_dacval[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 1024, addr 21652 + float pw_pwl[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 2048, addr 22676 - short xyz_delay_dacval[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 1024, addr 24724 - float xyz_delay_pwl[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 2048, addr 25748 + short delay_dacval[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 1024, addr 24724 + float delay_pwl[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 2048, addr 25748 - short xyz_period_dacval[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 1024, addr 27796 - float xyz_period_pwl[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 2048, addr 28820 + short period_dacval[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 1024, addr 27796 + float period_pwl[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 2048, addr 28820 - short xyz_burst_dacval[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 1024, addr 30868 - float xyz_burst_pwl[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 2048, addr 31892 + short burst_dacval[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 1024, addr 30868 + float burst_pwl[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 2048, addr 31892 - short xyz_load_type_dacval[max_channels][load_type_ranges][load_type_polarities][std_range_size]; // size 128, addr 33940 - float xyz_load_type_pwl[max_channels][load_type_ranges][load_type_polarities][std_range_size]; // size 256, addr 34068 + short load_type_dacval[max_channels][load_type_ranges][load_type_polarities][std_range_size]; // size 128, addr 33940 + float load_type_pwl[max_channels][load_type_ranges][load_type_polarities][std_range_size]; // size 256, addr 34068 - short xyz_slew_dacval[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 1024, addr 34324 - float xyz_slew_pwl[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 2048, addr 35348 + short slew_dacval[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 1024, addr 34324 + float slew_pwl[max_channels][timing_ranges][timing_polarities][std_range_size]; // size 2048, addr 35348 char flash_end; // addr 37396 |