summaryrefslogtreecommitdiff
path: root/device-functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'device-functions.c')
-rw-r--r--device-functions.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/device-functions.c b/device-functions.c
index 37ad978..5fd8a98 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -439,9 +439,14 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w
I2C_Write(PCF8574+Octal_Relay_Driver, atten_ctl);
}
- if ( (globals.Registers.last_relay_driver_settings[3+channel] != atten_ctl)) {
- globals.Registers.last_relay_driver_settings[3+channel] = atten_ctl;
+ if ( (globals.Registers.last_relay_driver_settings[3+channel] != pwl_struct[parameter][channel].atten_range)) {
+ // allow cap banks time to discharge if switching attenuators
globals.Flags.force_output_fully_off=YES;
+ if (pwl_struct[parameter][channel].atten_range < globals.Registers.last_relay_driver_settings[3+channel]) {
+ // allow time for HV cap banks to fall
+ globals.Timers.Relay_Switching_Delay_in_Milliseconds=(long) (1000L * globals.Flash.extended_relay_delay_in_sec);
+ }
+ globals.Registers.last_relay_driver_settings[3+channel] = pwl_struct[parameter][channel].atten_range;
}
debug_new_parameter (channel, parameter, requested_ampl);
@@ -4741,7 +4746,7 @@ void Main_update_shift_registers()
I2C_Write(PCF8574+Extra_DACs_Addr_Port, addr + 8); // latch into AD7839
}
- /* keep trigger suppressed for a time (normally 5ms) after a relay update */
+ /* 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) {