diff options
author | root <root@avtech.domain.avtechpulse.com> | 1970-01-01 09:47:05 +0900 |
---|---|---|
committer | root <root@avtech.domain.avtechpulse.com> | 1970-01-01 09:47:05 +0900 |
commit | 4e7eae444566b943459200232bda5e52e482cb08 (patch) | |
tree | 93a0adab952cd81299cc1b15d373cd6a34d33b38 | |
parent | e96bfa21e1e6951c0e23144321cffe29c8b2bd67 (diff) |
add support for double-external-trigger mode in KMPF
-rw-r--r-- | device-functions.c | 14 | ||||
-rw-r--r-- | flash.c | 2 | ||||
-rw-r--r-- | globals.h | 3 | ||||
-rw-r--r-- | menus.c | 21 | ||||
-rw-r--r-- | parser.c | 15 |
5 files changed, 49 insertions, 6 deletions
diff --git a/device-functions.c b/device-functions.c index b17eada..e516419 100644 --- a/device-functions.c +++ b/device-functions.c @@ -1067,12 +1067,17 @@ int Set_Trig_Source(int channel,int mode) int use_pw_ctrl_mode; int reset_freq; float use_freq; + int xtr5_val; /* abandon if high channel selected by user but not enabled by firmware */ if (channel && !globals.Flash.ChanKey_trigger_source) { return InvalidChannel; } + if (!(globals.Flash.ext2_enabled[channel]) && (mode==source_external2) ) { + return SyntaxError; + } + use_pw_ctrl_mode = globals.ChannelState[channel].pw_ctrl_mode; use_freq = globals.ChannelState[channel].frequency; reset_freq = 0; @@ -1116,6 +1121,8 @@ int Set_Trig_Source(int channel,int mode) } gate_mode = 0; + xtr5_val = BIT_LOW; + if (mode==source_internal) { /* frequency is automatically lowered if pw or delay have been changed to conflicting */ /* settings while in a non-internal mode */ @@ -1123,6 +1130,9 @@ int Set_Trig_Source(int channel,int mode) } else if (mode==source_external) { globals.ChannelState[channel].hold_setting=hold_width; set_shiftreg_bits(SR_0, POS_2, THREE_BITS, 0x3); + } else if (mode==source_external2) { + globals.ChannelState[channel].hold_setting=hold_width; + xtr5_val = BIT_HIGH; } else if (mode==source_manual) { globals.ChannelState[channel].hold_setting=hold_width; set_shiftreg_bits(SR_0, POS_2, THREE_BITS, 0x1); @@ -1134,6 +1144,10 @@ int Set_Trig_Source(int channel,int mode) set_shiftreg_bits(SR_0, POS_2, THREE_BITS, 0x7); } + if (globals.Flash.ext2_enabled[channel]) { + set_shiftreg_bits(SR_2, XTR_POS + 5, ONE_BIT, xtr5_val); + } + Main_update_shift_registers(); bus_setpin(O_GATE, gate_mode); /* change gate only after new source set */ @@ -822,6 +822,8 @@ static void initFlashValues(FlashStruct *mem) for (j=0; j<max_fixed_ampl_points; j++) { mem->fixed_ampl_points[i][j] = 0.0; } + + mem->ext2_enabled[i] = 0; } mem->relay_delay_in_sec=0.5; @@ -154,6 +154,7 @@ #define source_manual 2 #define source_hold 3 #define source_immediate 4 +#define source_external2 5 #define pulse_mode_on 0 #define sin_mode_on 1 @@ -728,6 +729,8 @@ typedef struct { float fixed_ampl_points[max_channels][max_fixed_ampl_points]; /* addr 10170, for AVR-D2, AVRQ-4 */ + char ext2_enabled[max_channels]; /* addr 10250, for KMPF */ + char flash_end; } FlashStruct; @@ -143,6 +143,7 @@ #define mode_ampl_fixed_point8 8800 #define mode_ampl_fixed_point9 8900 +#define mode_freq_ext2 9000 #define Submenu_maximum_entries 10 @@ -364,6 +365,8 @@ void Show_Main_Menu(void) show_item=Show_frequency+chan; } else if (globals.ChannelState[chan].trigger_source==source_external) { menu_string = g_string_append (menu_string, "EXT TRIG"); + } else if (globals.ChannelState[chan].trigger_source==source_external2) { + menu_string = g_string_append (menu_string, "EXT2 TRIG"); } else if (globals.ChannelState[chan].trigger_source==source_manual) { menu_string = g_string_append (menu_string, "MAN TRIG"); } else if (globals.ChannelState[chan].trigger_source==source_hold) { @@ -1250,6 +1253,13 @@ static void Submenu_Display(int change_selection) if (globals.Flash.is_func_gen[channel]) { Submenu_max_entry=0; + } else if (globals.Flash.ext2_enabled[channel]) { + Submenu_max_entry=4; + Submenu_Structure[0]=mode_freq_int; + Submenu_Structure[1]=mode_freq_ext; + Submenu_Structure[2]=mode_freq_ext2; + Submenu_Structure[3]=mode_freq_man; + Submenu_Structure[4]=mode_freq_hold; } else { Submenu_max_entry=3; Submenu_Structure[0]=mode_freq_int; @@ -1632,6 +1642,12 @@ static void Submenu_Display(int change_selection) current_operating_mode=i; } break; + case mode_freq_ext2: + mode_name = g_strdup("External2"); + if (globals.ChannelState[channel].trigger_source==source_external2) { + current_operating_mode=i; + } + break; case mode_freq_man: mode_name = g_strdup("Manual"); if (globals.ChannelState[channel].trigger_source==source_manual) { @@ -2969,6 +2985,11 @@ static int Submenu_Implement_Changes(void) return error_num; } break; + case mode_freq_ext2: + if (error_num=Set_Trig_Source(channel,source_external2)) { + return error_num; + } + break; case mode_freq_man: if (error_num=Set_Trig_Source(channel,source_manual)) { return error_num; @@ -2222,19 +2222,20 @@ static int Go_trig_source46(gchar** response, int channel, char *parameter,char switch (command_type) { case command_withparam: if (!strcmp(parameter,"int") || !strcmp(parameter,"internal")) { - Set_Trig_Source(channel,source_internal); + return Set_Trig_Source(channel,source_internal); } else if (!strcmp(parameter,"ext") || !strcmp(parameter,"external")) { - Set_Trig_Source(channel,source_external); + return Set_Trig_Source(channel,source_external); + } else if (!strcmp(parameter,"ext2") || !strcmp(parameter,"external2")) { + return Set_Trig_Source(channel,source_external2); } else if (!strcmp(parameter,"man") || !strcmp(parameter,"manual")) { - Set_Trig_Source(channel,source_manual); + return Set_Trig_Source(channel,source_manual); } else if (!strcmp(parameter,"hold")) { - Set_Trig_Source(channel,source_hold); + return Set_Trig_Source(channel,source_hold); } else if (!strcmp(parameter,"imm") || !strcmp(parameter,"immediate")) { - Set_Trig_Source(channel,source_immediate); + return Set_Trig_Source(channel,source_immediate); } else { return SyntaxError; } - return OK; break; case query_simple: @@ -2242,6 +2243,8 @@ static int Go_trig_source46(gchar** response, int channel, char *parameter,char return query_string(response, "INT"); } else if (globals.ChannelState[channel].trigger_source==source_external) { return query_string(response, "EXT"); + } else if (globals.ChannelState[channel].trigger_source==source_external2) { + return query_string(response, "EXT2"); } else if (globals.ChannelState[channel].trigger_source==source_manual) { return query_string(response, "MAN"); } else if (globals.ChannelState[channel].trigger_source==source_hold) { |