From f4aec9a5ea2e8cf5181b7631adc7c1d05088aa30 Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 1 Jan 2000 00:39:55 +0900 Subject: reduce ampl_zero_equiv by a factor of 10 in -LV attenuator mode --- CMakeLists.txt | 2 +- device-functions.c | 27 ++++++++++++++++++++++----- device-functions.h | 2 ++ error_utils.c | 10 +++++----- menus.c | 19 +++++++++---------- 5 files changed, 39 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 489d476..f9eb8e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ add_definitions(${LIBUSER_CFLAGS}) #add_definitions(${PAM_INCLUDE_DIR}) include_directories(${GLIB_PKG_INCLUDE_DIRS}) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -funsigned-char -Wall -Wno-parentheses") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -funsigned-char -Wall -Wno-parentheses -Wno-deprecated-declarations") add_executable(instr-daemon instr-daemon.c signalobject.c response.c diff --git a/device-functions.c b/device-functions.c index 5fd8a98..c864791 100644 --- a/device-functions.c +++ b/device-functions.c @@ -1719,7 +1719,7 @@ int Set_Amp_Calib(int channel,float meas_ampl) /* use for all channels */ - if (fabs(globals.ChannelState[channel].amplitude) globals.Flash.ampl_zero_equiv[channel]) { + if ( (-globals.Flash.distort_Y[channel]) > get_ampl_zero_equiv(channel)) { return PW_Distort_Error; } @@ -4975,7 +4975,7 @@ float rst_ampl_value (int channel) // For AVRQ -AHV, -XHV options, where valids ampls may be // 1.0 to 1.5 kV, positive or negative - return globals.Flash.ampl_zero_equiv[channel]; + return get_ampl_zero_equiv(channel); } else if (max == 0) { @@ -5058,3 +5058,20 @@ void get_min_max_fixed_ampls (int channel, float *min_ampl, float *max_ampl) { if (use_ampl < *min_ampl) *min_ampl = use_ampl; } } + + +float get_ampl_zero_equiv(int channel) +{ + float result; + result = globals.Flash.ampl_zero_equiv[channel]; + + if (globals.Flash.switchable_zout[channel] + && attenuator_count(channel) + && (globals.ChannelState[channel].zout==globals.Flash.zout_max[channel]) ) { + + // lower min equiv ampl if attenuators are in use in -LV units */ + result /= 10.0; + } + + return result; +} diff --git a/device-functions.h b/device-functions.h index ade757a..14100f4 100644 --- a/device-functions.h +++ b/device-functions.h @@ -80,4 +80,6 @@ gboolean fixed_ampl_ok (int channel, float use_ampl); void get_min_max_fixed_ampls (int channel, float *min_ampl, float *max_ampl); gboolean non_zero_first_ampl_point (int channel); +float get_ampl_zero_equiv(int channel); + #endif diff --git a/error_utils.c b/error_utils.c index ccd9837..bf6168d 100644 --- a/error_utils.c +++ b/error_utils.c @@ -845,7 +845,7 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) break; } - if (fabs(globals.Flash.ampl_zero_equiv[i] > 2000.0)) { + if (fabs(get_ampl_zero_equiv(i) > 2000.0)) { report_error = config_too_large; } @@ -853,7 +853,7 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) report_error = config_too_large; } - if ( (globals.Flash.ampl_zero_equiv[i] < 0.0) || + if ( (get_ampl_zero_equiv(i) < 0.0) || (globals.Flash.os_zero_equiv[i] < 0.0) || (globals.Flash.hvps_avg_curr_limit[i] < 0.0) || (globals.Flash.max_avg_power[i] < 0.0) ) { @@ -1098,7 +1098,7 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) /* --- check gaps in ampl range, AVRQ -AHV/-XHV ---- */ if (non_zero_first_ampl_point(i)) { - if (fabs(ChannelStateToTest[i].amplitude) < globals.Flash.ampl_zero_equiv[i]) { + if (fabs(ChannelStateToTest[i].amplitude) < get_ampl_zero_equiv(i)) { report_error=amplitude_gap; } } @@ -1212,7 +1212,7 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) /* 1011 models: high level of PG-P output must remain positive */ // FIXME use new check_ functions? if (globals.Flash.ampl_coupled_to_os[i]) { - if (ChannelStateToTest[i].amplitude>globals.Flash.ampl_zero_equiv[i]) { + if (ChannelStateToTest[i].amplitude>get_ampl_zero_equiv(i)) { temp=-ChannelStateToTest[i].amplitude; if (temp>globals.Constraints.err_min_offset[i]) { globals.Constraints.err_min_offset[i]=temp; @@ -1247,7 +1247,7 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) /* 1011 models: low level of PG-N output must remain negative */ if (globals.Flash.ampl_coupled_to_os[i]) { - if (ChannelStateToTest[i].amplitude<-globals.Flash.ampl_zero_equiv[i]) { + if (ChannelStateToTest[i].amplitude<-get_ampl_zero_equiv(i)) { temp=-ChannelStateToTest[i].amplitude; if (temp1.0) { - if (new_value<0.0 || globals.Flash.max_ampl[channel]1.0) { + if (new_value<0.0 || globals.Flash.max_ampl[channel]