diff options
author | Mike <mjc@avtechpulse.com> | 2000-01-01 00:53:59 +0900 |
---|---|---|
committer | Mike <mjc@avtechpulse.com> | 2000-01-01 00:53:59 +0900 |
commit | 82db18314efe170471f1675d40fbf1416fbb95e8 (patch) | |
tree | fa6c44d7281ed08f3745d548bde2bf3a68b9719c | |
parent | dfed10ba9ceb7380948ce2d966fac5f267097e5f (diff) |
+/- button not working as expected first press after turn-on, fixed. Better debugging messages.
-rw-r--r-- | device-functions.c | 9 | ||||
-rw-r--r-- | globals.h | 2 | ||||
-rw-r--r-- | menus.c | 13 |
3 files changed, 20 insertions, 4 deletions
diff --git a/device-functions.c b/device-functions.c index 333d9cb..d9f4664 100644 --- a/device-functions.c +++ b/device-functions.c @@ -252,7 +252,7 @@ static int attenuator_count (int channel) int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int word_override,int range_override,int aux_override, - int switch_range_only,int channel,float new_ampl,int called_from_set_pw) + int switch_range_only,int channel,float requested_ampl,int called_from_set_pw) { int word_out, word_out_aux; /* what is sent to the DAC */ int relay_range,atten_range,old_range,old_actual_pol; /* selects relay range */ @@ -261,6 +261,10 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w int entry; int actual_pol; + float new_ampl; + + new_ampl = requested_ampl; + if (!globals.Flash.voltage_enabled[channel] && !globals.Flash.current_enabled[channel]) { return Unrecognized; } @@ -447,7 +451,8 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w globals.Flags.force_output_fully_off=YES; } - g_print_debug("chan %d, ampl %e, range %d, word %d\n", channel, new_ampl, relay_range, word_out); + g_print_debug("%ld - chan %d, requested ampl %e, set ampl %e, polarity %d, range %d, word %d\n", + sec_timer(), channel, requested_ampl, new_ampl, actual_pol, relay_range, word_out); globals.Changes.update_amp=YES; @@ -10,7 +10,7 @@ #define DEBUG_ON - uncomment this to have debug messages #ifdef DEBUG_ON -#define g_print_debug(...) g_print(__VA_ARGS__) +#define g_print_debug(...) g_print("%ld - ", sec_timer()); g_print(__VA_ARGS__) #else #define g_print_debug(...) {} #endif @@ -2168,7 +2168,18 @@ static int Submenu_Mult_Value(float mult_by) channel=Submenu_Numeric_Parameter%100; - new_value = Submenu_Value * mult_by; + if (fabs(Submenu_Value) < smallest_allowed_number) { + printf ("small\n"); + if (Submenu_Value < 0.0) { + new_value = -smallest_allowed_number * mult_by; + } else { + new_value = smallest_allowed_number * mult_by; + } + } else { + new_value = Submenu_Value * mult_by; + } + + g_print_debug("chan %d, Submenu_Value %e, mult_by %e, new_value %e\n", channel, Submenu_Value, mult_by, new_value); switch (Submenu_Numeric_Parameter-channel) { case Show_frequency: |