From 9b3247cc4ac1d731d6221bef448064d14bfddc74 Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Thu, 8 Aug 2013 15:42:47 -0400 Subject: added basic parser support for EW mode, and added ew_enabled to flash --- device-functions.c | 5 +++++ flash.c | 1 + globals.h | 4 ++++ parser.c | 16 +++++++++++++--- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/device-functions.c b/device-functions.c index 4e7e54f..6faff3e 100644 --- a/device-functions.c +++ b/device-functions.c @@ -1370,12 +1370,17 @@ int Set_Pwmode(int channel,int mode) return SyntaxError; } + if (!(globals.Flash.ew_enabled[channel]) && (mode==pw_ew_ext)) { + return SyntaxError; + } + if ((mode==pw_in_out) && (globals.ChannelState[channel].trigger_source!=source_external)) { return AB_Mode_Error; } globals.ChannelState[channel].pw_ctrl_mode=mode; + // TODO: implement pw_ew_ext here! Set_Mux(0); Set_Update_Chans(); diff --git a/flash.c b/flash.c index d219054..311881c 100644 --- a/flash.c +++ b/flash.c @@ -698,6 +698,7 @@ static void initFlashValues(FlashStruct *mem) mem->double_pulse_allowed[i]=1; mem->invert_allowed[i]=1; mem->ea_enabled[i]=1; + mem->ew_enabled[i]=0; mem->switchable_load[i]=1; mem->monitor_enabled[i]=0; mem->use_pos_ampl_data_only[i]=0; diff --git a/globals.h b/globals.h index 7a02879..370facb 100644 --- a/globals.h +++ b/globals.h @@ -137,6 +137,7 @@ #define to_Delay 1 #define pw_in_out 0 #define pw_normal 1 +#define pw_ew_ext 2 #define double_on 1 #define double_off 0 #define pol_norm 0 @@ -711,6 +712,9 @@ typedef struct { // don't use higher ampls in AVPs, // where PW shifts near max ampl + + char ew_enabled[max_channels]; /* addr 10142 */ + char spare_end; char flash_end; diff --git a/parser.c b/parser.c index 0147e69..2f6f46c 100644 --- a/parser.c +++ b/parser.c @@ -1763,6 +1763,8 @@ static int Go_pw_36(gchar** response, int channel, char *parameter,char *units,i case command_withparam: if (!strcmp(parameter,"in")) { return Set_Pwmode(channel,pw_in_out); + } else if (!strcmp(parameter,"ext")) { + return Set_Pwmode(channel,pw_ew_ext); } else if (status = process_float_param (parameter, &new_pw, globals.Constraints.err_min_pw[channel], globals.Constraints.err_max_pw[channel], NORMAL_ZERO)) { return status; } @@ -1774,11 +1776,19 @@ static int Go_pw_36(gchar** response, int channel, char *parameter,char *units,i break; case query_simple: - if (globals.ChannelState[channel].pw_ctrl_mode==pw_normal) { + switch (globals.ChannelState[channel].pw_ctrl_mode) { + case pw_in_out: + return query_string(response, "IN"); + break; + case pw_ew_ext: + return query_string(response, "EXT"); + break; + default: + case pw_normal: return query_float(response, globals.ChannelState[channel].pw); - } else { - return query_string(response, "The output pulse width is equal to the input pulse width."); + break; } + break; case query_param: -- cgit