diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2023-11-10 15:35:52 -0500 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2023-11-10 15:35:52 -0500 |
commit | 0a35518a74e55a03481fa20050ec20865bc35aea (patch) | |
tree | e25463c3f226d5b21c5708e22b582a1f95174fe7 | |
parent | f6c4baf7a1d013ac7e72b8488be05611a6d0fb1b (diff) |
add an amplitude settling time for SN 14256 repair and future units
-rw-r--r-- | device-functions.c | 27 | ||||
-rw-r--r-- | flash.c | 1 | ||||
-rw-r--r-- | globals.h | 4 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 28 insertions, 6 deletions
diff --git a/device-functions.c b/device-functions.c index 86cffec..9c79d5e 100644 --- a/device-functions.c +++ b/device-functions.c @@ -451,8 +451,11 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w debug_new_parameter (channel, parameter, requested_ampl); - globals.Changes.update_amp=YES; - globals.ChannelState[channel].amplitude=new_ampl; + globals.Changes.update_amp = YES; + if (globals.ChannelState[channel].amplitude != new_ampl) { + globals.ChannelState[channel].amplitude = new_ampl; + globals.Flags.need_ampl_settling_time = YES; + } Set_Update_Chans(); if (pwl_struct[parameter][channel].range!=old_range) { @@ -1551,7 +1554,8 @@ int Set_EA(int channel,int mode) if (globals.ChannelState[channel].amp_mode!=mode) { - globals.Changes.update_amp=YES; + globals.Changes.update_amp = YES; + globals.Flags.need_ampl_settling_time = YES; } globals.ChannelState[channel].amp_mode=mode; @@ -4755,13 +4759,27 @@ void Main_update_shift_registers() I2C_Write(PCF8574+Extra_DACs_Addr_Port, addr + 8); // latch into AD7839 } + + long sleep_us = 0; + /* keep trigger suppressed for a time (normally 0.5s) after a relay update */ if ( globals.Registers.last_relay_driver_settings[0]!=globals.Registers.shift_reg_out[2] || globals.Registers.last_relay_driver_settings[1]!=globals.Registers.shift_reg_out[3] || globals.Flags.force_output_fully_off==YES) { - g_usleep (1e3 * globals.Timers.Relay_Switching_Delay_in_Milliseconds); + sleep_us = 1e3 * globals.Timers.Relay_Switching_Delay_in_Milliseconds; + } + + /* amplitude settling time after a change */ + if (globals.Flags.need_ampl_settling_time = YES) { + sleep_us = MAX(sleep_us, 1e6 * globals.Flash.amplitude_settling_time); + } + + if ((sleep_us < 0) || (sleep_us > 10e6)) { + sleep_us = 0; } + /* relay change and/or ampl settling time */ + g_usleep (sleep_us); /* restore output if required */ if (globals.Flags.force_output_fully_off==YES) @@ -4783,6 +4801,7 @@ void Main_update_shift_registers() // reset update sensors globals.Changes.update_os = 0; globals.Changes.update_amp = 0; + globals.Flags.need_ampl_settling_time = 0; globals.Changes.update_zout = 0; globals.Changes.update_load = 0; @@ -895,6 +895,7 @@ static void initFlashValues(FlashStruct *mem) mem->relay_delay_in_sec=0.5; mem->extended_relay_delay_in_sec=0.5; + mem->amplitude_settling_time=0.3; strcpy(mem->aux_error_message,"PRF too high! Output disabled."); strcpy(mem->ot_error_message,"Over-heating problem. Output off."); @@ -712,7 +712,8 @@ typedef struct { char zout_relay_high_for_max[max_channels]; /* addr 8700 */ char load_type_dac[max_channels]; /* addr 8702 */ - float sparex1[max_channels]; /* addr 8704 */ + float amplitude_settling_time; /* addr 8704 */ + float sparex1; /* addr 8708 */ float sparex2[max_channels]; /* addr 8712 */ float rcl_sparex3[max_channels][max_stored_settings]; /* addr 8720 */ @@ -905,6 +906,7 @@ typedef struct { int do_check_settings; int flash_writes_suspended; int force_output_fully_off; + int need_ampl_settling_time; int attenuators_enabled; } FlagStruct; @@ -1,2 +1,2 @@ -#define FW_VERSION "6.4.32" +#define FW_VERSION "6.4.33" #define SCPI_version "1996.0" |