summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bus.c6
-rw-r--r--device-functions.c36
-rw-r--r--globals.c2
-rw-r--r--globals.h7
4 files changed, 36 insertions, 15 deletions
diff --git a/bus.c b/bus.c
index ee0f8cb..72e93d5 100644
--- a/bus.c
+++ b/bus.c
@@ -418,6 +418,12 @@ void bus_setpin(int pin, int value)
if (globals.HWDetect.has_gpio) {
gpio_writevalue(gpio_pins[pin], value & 0x1);
}
+
+ if ((pin != out_CLOCK_LINE) &&
+ (pin != out_STROBE_LINE) &&
+ (pin != out_DATA_LINE)) {
+ g_print_debug ("GPIO pin %d, val %d (some pins excl)\n\r",pin,value);
+ }
}
void bus_writebyte(uint8_t address, uint8_t data)
diff --git a/device-functions.c b/device-functions.c
index d32c933..b54e14b 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -435,13 +435,9 @@ 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] != atten_ctl)) {
-
- globals.Registers.last_relay_driver_settings[3] = atten_ctl;
-
- if (globals.ChannelState[channel].output_state==output_on) {
- globals.Flags.force_output_fully_off=YES;
- }
+ if ( (globals.Registers.last_relay_driver_settings[3+channel] != atten_ctl)) {
+ globals.Registers.last_relay_driver_settings[3+channel] = atten_ctl;
+ globals.Flags.force_output_fully_off=YES;
}
g_print_debug("ampl range %d, word %d\n",relay_range,word_out);
@@ -451,7 +447,7 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w
globals.ChannelState[channel].amplitude=new_ampl;
Set_Update_Chans();
- if ((relay_range!=old_range) && (globals.ChannelState[channel].output_state==output_on)) {
+ if (relay_range!=old_range) {
globals.Flags.force_output_fully_off=YES;
}
@@ -703,7 +699,7 @@ int Set_Offset(int check_possible_only,int override_on,int word_override,int ran
globals.ChannelState[channel].offset=new_offset;
Set_Update_Chans();
- if ((relay_range!=old_range) && (globals.ChannelState[channel].output_state==output_on)) {
+ if (relay_range!=old_range) {
globals.Flags.force_output_fully_off=YES;
}
@@ -795,7 +791,7 @@ int Set_frequency(int check_possible_only,int word_override,int range_override,i
set_shiftreg_bits(SR_2, XTR_POS + 1, THREE_BITS, relay_range);
- if ((relay_range!=old_range) && (globals.ChannelState[channel].output_state==output_on)) {
+ if (relay_range!=old_range) {
globals.Flags.force_output_fully_off=YES;
}
}
@@ -3909,8 +3905,6 @@ int Set_rise_time(int check_possible_only,int word_override,int range_override,i
}
}
-
-
if (globals.Registers.last_rise_time_relay_setting != range_control) {
/* update range hardware */
if (globals.ChannelState[channel].trigger_source!=source_hold) {
@@ -4611,8 +4605,20 @@ void Main_update_shift_registers()
}
- /* physically turn off output for amplitude range changes */
- /* i.e., short output in 155's */
+ /* physically turn off output for amplitude range changes
+ but don't bother if all outputs are off */
+
+ int outputs_on;
+ outputs_on = 0;
+ for (i = 0; i < max_channels; i++) {
+ if (globals.ChannelState[i].output_state==output_on) {
+ ++outputs_on;
+ }
+ }
+ if (outputs_on == 0) {
+ globals.Flags.force_output_fully_off=NO;
+ }
+
if (globals.Flags.force_output_fully_off==YES)
for (i=0; i<(globals.Flash.ChanKey_frequency?globals.Flash.channels:1); ++i) {
temp_output_state[i]=globals.ChannelState[i].output_state;
@@ -4623,7 +4629,9 @@ void Main_update_shift_registers()
bus_setpin(out_CLOCK_LINE, 1);
bus_setpin(out_STROBE_LINE, 0);
+ g_print_debug ("\n\r-----------\n\r");
for (i=(num_out_SRs-1); i>=0; --i) {
+ g_print_debug ("SR %d = %lx hex\n\r",i,globals.Registers.shift_reg_out[i]);
switch (i) {
case 0:
case 1:
diff --git a/globals.c b/globals.c
index d2a5eea..5948a79 100644
--- a/globals.c
+++ b/globals.c
@@ -14,6 +14,8 @@ GlobalStruct globals = {
.Registers.last_relay_driver_settings[0] = -1,
.Registers.last_relay_driver_settings[1] = -1,
.Registers.last_relay_driver_settings[2] = -1,
+ .Registers.last_relay_driver_settings[3] = -1,
+ .Registers.last_relay_driver_settings[4] = -1,
.Registers.gpib_input_buffer[0] = 0,
.Registers.pending_output_message = NULL,
diff --git a/globals.h b/globals.h
index e753067..534a9bc 100644
--- a/globals.h
+++ b/globals.h
@@ -306,7 +306,12 @@ unsigned long long ms_timer (void);
typedef struct {
int parallel_DAC_reg[max_dacs];
long shift_reg_out[num_out_SRs];
- long last_relay_driver_settings[4];
+ long last_relay_driver_settings[5]; /* 0 = SR2
+ 1 = SR3
+ 2 = CH1 -BR
+ 3 = CH1 atten settings
+ 4 = CH2 atten settings */
+
int oper_enable_register; /* for stat:enable command */
int ques_enable_register; /* for stat:enable command */
int avrq_reg;