summaryrefslogtreecommitdiff
path: root/device-functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'device-functions.c')
-rw-r--r--device-functions.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/device-functions.c b/device-functions.c
index 6faff3e..a0db6d9 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -847,9 +847,9 @@ void Set_Mux(int channel)
mux_out=4;
} else if (globals.ChannelState[channel].func_mode==dc_mode_on && globals.ChannelState[channel].polarity!=pol_norm) {
mux_out=5;
- } else if (globals.ChannelState[channel].pw_ctrl_mode==pw_normal && globals.ChannelState[channel].polarity==pol_norm) {
+ } else if (globals.ChannelState[channel].pw_ctrl_mode!=pw_in_out && globals.ChannelState[channel].polarity==pol_norm) {
mux_out=2;
- } else if (globals.ChannelState[channel].pw_ctrl_mode==pw_normal && globals.ChannelState[channel].polarity!=pol_norm) {
+ } else if (globals.ChannelState[channel].pw_ctrl_mode!=pw_in_out && globals.ChannelState[channel].polarity!=pol_norm) {
mux_out=3;
} else if (globals.ChannelState[channel].polarity==pol_norm) {
mux_out=0;
@@ -1049,7 +1049,10 @@ int Set_Trig_Source(int channel,int mode)
if ((globals.ChannelState[channel].trigger_source != source_hold) && (mode != source_hold)) {
reset_freq = 1;
use_freq = globals.Flash.min_freq[channel];
- use_pw_ctrl_mode = pw_normal;
+ // turn ab mode off when switching trigger source
+ if (use_pw_ctrl_mode == pw_in_out) {
+ use_pw_ctrl_mode = pw_normal;
+ }
}
TestState[channel].pw_ctrl_mode = use_pw_ctrl_mode;
@@ -1309,10 +1312,10 @@ int Set_EA(int channel,int mode)
if (!channel) {
ea_bit = 16;
- ea_reg = 3;
+ ea_reg = SR_3;
} else {
ea_bit = globals.Flash.ea_xtra_rly[channel] + XTR_POS;
- ea_reg = 2;
+ ea_reg = SR_2;
}
if (mode==amp_mode_ea) {
@@ -1380,7 +1383,14 @@ int Set_Pwmode(int channel,int mode)
globals.ChannelState[channel].pw_ctrl_mode=mode;
- // TODO: implement pw_ew_ext here!
+ if (globals.Flash.ew_enabled[channel]) {
+ if (mode==pw_ew_ext) {
+ set_shiftreg_bits(SR_2, globals.Flash.ew_xtra_rly[channel] + XTR_POS, ONE_BIT, BIT_HIGH);
+ } else {
+ set_shiftreg_bits(SR_2, globals.Flash.ew_xtra_rly[channel] + XTR_POS, ONE_BIT, BIT_LOW);
+ }
+ }
+
Set_Mux(0);
Set_Update_Chans();