diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-08-23 07:53:04 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-08-23 07:53:04 -0400 |
commit | a453d3b91e5d947f4706c2c355948eda7a8f15d2 (patch) | |
tree | 19d34bde5d6eadfa7521ff179d3147bc875480c0 /device-functions.c | |
parent | 923edbae71bfe8bb465f017de119e2a3f1fbd1e2 (diff) |
initial addition of Main_Rst
Diffstat (limited to 'device-functions.c')
-rw-r--r-- | device-functions.c | 114 |
1 files changed, 103 insertions, 11 deletions
diff --git a/device-functions.c b/device-functions.c index 048241a..63d1429 100644 --- a/device-functions.c +++ b/device-functions.c @@ -1,17 +1,6 @@ #include "device-functions.h" #include "globals.h" -/* START FUNCTION DESCRIPTION ******************************************** -Set_frequency <DEVFUNC.LIB> - -SYNTAX: Set_frequency(int check_possible_only,int word_override,int range_override,int channel,float set_freq) - -KEYWORDS: - -DESCRIPTION: sets the offset DAC. - -RETURN VALUE: error code (zero = OK). -END DESCRIPTION **********************************************************/ /*----------------------------------------------------------------------------------------------------------*/ int Set_frequency(int check_possible_only,int word_override,int range_override,int channel,float set_freq) @@ -38,3 +27,106 @@ int Set_frequency(int check_possible_only,int word_override,int range_override,i return OK; } + +void Main_Rst (void) +{ + int i; + + globals.extended_ampl_min_max=NO; + + // go backwards, so channel 0 overrides everything + for (i=globals.Flash.channels-1; i>=0; --i) { + + globals.ChannelState[i].route_primary=1; + globals.ChannelState[i].route_secondary=1; + globals.ChannelState[i].frequency=globals.Flash.min_freq[i]; + globals.ChannelState[i].delay=globals.Flash.min_delay[i]; + + if (globals.Flash.min_pw[i] > 0.0) { + globals.ChannelState[i].pw=globals.Flash.min_pw[i]; + } else { + globals.ChannelState[i].pw=0.0; + } + + if (globals.Flash.ampl_min_max_only[i] || (globals.Flash.min_ampl[i] > 0.0)) { + globals.ChannelState[i].amplitude = globals.Flash.min_ampl[i]; + } else { + globals.ChannelState[i].amplitude=0.0; + } + globals.ChannelState[i].offset=0.0; + + globals.ChannelState[i].zout=globals.Flash.zout_min[i]; + globals.ChannelState[i].hold_setting = hold_width; + globals.ChannelState[i].double_pulse = double_off; + globals.ChannelState[i].ab_mode = pw_normal; + globals.ChannelState[i].func_mode = pulse_mode_on; + globals.ChannelState[i].polarity = globals.Flash.invert_by_default[i]; + globals.ChannelState[i].output_state = output_off; + globals.ChannelState[i].gate_type = gate_sync; + globals.ChannelState[i].trigger_source = source_internal; + globals.ChannelState[i].amp_mode = amp_mode_normal; + globals.ChannelState[i].os_mode = os_mode_normal; + globals.ChannelState[i].gate_level = gate_low; + globals.ChannelState[i].load_type= globals.Flash.low_load_type[i]; + globals.ChannelState[i].test_delay_mode = NO; + globals.ChannelState[i].logic_level = logic_ttl; + globals.ChannelState[i].burst_count = 1 && !globals.Flash.burst_func[i]; + globals.ChannelState[i].burst_time = globals.Constraints.composite_min_burst_time[i]; + globals.ChannelState[i].rise_time = globals.Flash.min_rise_time[i]; + globals.ChannelState[i].soft_current_limit = globals.Flash.max_soft_current_limit[i]; + globals.ChannelState[i].vcc1 = 0.0; + globals.ChannelState[i].vcc2 = globals.Flash.vcc2_min[i]; + globals.ChannelState[i].vlogic = 0.0; + globals.ChannelState[i].slew = globals.Flash.min_slew[i]; + + globals.do_check_settings=NO; /* don't check for conflicting settings */ +/* FIXME + Set_Pw(0,0,0,i,globals.ChannelState[i].pw,0); + + Set_Route(i,ROUTE_PRIMARY,globals.ChannelState[i].route_primary); + Set_Route(i,ROUTE_SECONDARY,globals.ChannelState[i].route_secondary); + + Set_frequency(0,0,0,i,globals.ChannelState[i].frequency); + Set_Delay(0,0,0,i,globals.ChannelState[i].delay); + Set_Double(i,globals.ChannelState[i].double_pulse); + Set_Pwmode(i,globals.ChannelState[i].ab_mode); + Set_Func(i,globals.ChannelState[i].func_mode); + Set_Pol(i,globals.ChannelState[i].polarity); + Set_Gate_Sync(i,globals.ChannelState[i].gate_type); + Set_Gate_Level(i,globals.ChannelState[i].gate_level); + Set_EA(i,globals.ChannelState[i].amp_mode); + Set_EO(i,globals.ChannelState[i].os_mode); + if (globals.Flash.switchable_zout[i]) { + Set_zout(i,globals.ChannelState[i].zout,1); + } + + Set_Load(i,globals.ChannelState[i].load_type); + Set_Logic_Level(i,globals.ChannelState[i].logic_level); + Set_rise_time(0,0,0,i,globals.ChannelState[i].rise_time); + Set_slew(0,0,0,i,globals.ChannelState[i].slew); + Set_current_limit(0,i,globals.ChannelState[i].soft_current_limit); + + if (globals.Flash.max_burst_count[i]>1) { + Set_Burst_Count(i,globals.ChannelState[i].burst_count,globals.ChannelState[i].burst_time); + } + + Set_Trig_Source(i,globals.ChannelState[i].trigger_source); + + Set_Amplitude(0,0,0,0,0,0,i,globals.ChannelState[i].amplitude,0); + Set_Offset(0,0,0,0,i,globals.ChannelState[i].offset); + Set_Output_State(i,globals.ChannelState[i].output_state); + + Set_current_limit(0,i,globals.ChannelState[i].soft_current_limit); + + Set_avrq_ampl(0,0,0,2,globals.ChannelState[i].vcc1); + Set_avrq_ampl(0,0,0,3,globals.ChannelState[i].vcc2); + Set_avrq_ampl(0,0,0,4,globals.ChannelState[i].vlogic); +*/ globals.do_check_settings=YES; /* check for conflicting settings */ + } + + +// Error_check(globals.ChannelState); /* establishes min/max values for queries, but reports no errors */ +// update_whole_main_menu=YES; +// Ctrl_PRF_Limiter(1); +// Menu_Clear_Buttons(); +} |