diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2018-05-07 10:13:41 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2018-05-07 10:13:41 -0400 |
commit | afe0eaf02c8577bf6f54339e391041acedb1c71e (patch) | |
tree | 941f1e1edef64c2b30a587496edb13334133abd8 /parser.c | |
parent | 14670765128b8f098486690c582ce29ecfa6b0fb (diff) |
add ability to just copy old-style ampl and os initial config data to new 32-ranges
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 105 |
1 files changed, 105 insertions, 0 deletions
@@ -117,6 +117,8 @@ static int Go_cal_interval_101(gchar** response, int channel, char *parameter,ch static int Go_eprom_reset_102(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_atten_103(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_eprom_resize_105(gchar** response, int channel, char *parameter,char *units,int command_type); +static int Go_eprom_resize_ampl_106(gchar** response, int channel, char *parameter,char *units,int command_type); +static int Go_eprom_resize_offset_107(gchar** response, int channel, char *parameter,char *units,int command_type); static int Parser_id_word(char *id_me, int *channel, int *with_id_code) { @@ -486,6 +488,8 @@ static int Parser_find_commands(int commands[], int command_depth) {23,109,16|optional}, /* diag:attenuator:state - 103 */ {23,32,110,88,93}, /* diag:ampl:distort:calib:point - 104 */ {23,57,111}, /* diag:eprom:resize - 105 */ + {23,57,111,32}, /* diag:eprom:resize:ampl - 106 */ + {23,57,111,33} /* diag:eprom:resize:offset - 107 */ }; @@ -1060,6 +1064,12 @@ void Parser_main (char *raw_in, int interactive_terminal, void(*cbfunc)(gpointer case 105: error_num=Go_eprom_resize_105(&response,channel,parameter,units,command_type); break; + case 106: + error_num=Go_eprom_resize_ampl_106(&response,channel,parameter,units,command_type); + break; + case 107: + error_num=Go_eprom_resize_offset_107(&response,channel,parameter,units,command_type); + break; case 9999: // was only whitespace, ignore @@ -4179,3 +4189,98 @@ static int Go_eprom_resize_105(gchar** response, int channel, char *parameter,ch return ThisShouldntHappen; } + +static int Go_eprom_resize_ampl_106(gchar** response, int channel, char *parameter,char *units,int command_type) +{ + /* copies data from old ten-point-ranges into new-style (May 2018) 32-point ranges */ + + int i, j, k, l; + + if (channel) { + return InvalidChannel; + } + + switch (command_type) { + case command_simple: + + for (i=0;i<max_channels;i++) { + for (l=0;l<old_range_size_ten;l++) { + for (j=0;j<ampl_ranges;j++) { + for (k=0;k<ampl_polarities;k++) { + globals.Flash.ampl_dacval[i][j][k][l] = globals.Flash.obs_ampl_dacval[i][j][k][l]; + globals.Flash.ampl_pwl[i][j][k][l] = globals.Flash.obs_ampl_pwl[i][j][k][l]; + } + } + } + + for (l=old_range_size_ten;l<std_range_size;l++) { + for (j=0;j<ampl_ranges;j++) { + for (k=0;k<ampl_polarities;k++) { + globals.Flash.ampl_dacval[i][j][k][l] = 0; + globals.Flash.ampl_pwl[i][j][k][l] = 0; + } + } + } + } + + writeUserBlock(&globals.Flash,0,sizeof(globals.Flash)); + + Main_Rst(); + return OK; + break; + + default: + return SyntaxError; + break; + } + + return ThisShouldntHappen; +} + + +static int Go_eprom_resize_offset_107(gchar** response, int channel, char *parameter,char *units,int command_type) +{ + /* copies data from old ten-point-ranges into new-style (May 2018) 32-point ranges */ + + int i, j, k, l; + + if (channel) { + return InvalidChannel; + } + + switch (command_type) { + case command_simple: + + for (i=0;i<max_channels;i++) { + for (l=0;l<old_range_size_ten;l++) { + for (j=0;j<os_ranges;j++) { + for (k=0;k<os_polarities;k++) { + globals.Flash.os_dacval[i][j][k][l] = globals.Flash.obs_os_dacval[i][j][k][l]; + globals.Flash.os_pwl[i][j][k][l] = globals.Flash.obs_os_pwl[i][j][k][l]; + } + } + } + + for (l=old_range_size_ten;l<std_range_size;l++) { + for (j=0;j<os_ranges;j++) { + for (k=0;k<os_polarities;k++) { + globals.Flash.os_dacval[i][j][k][l] = 0; + globals.Flash.os_pwl[i][j][k][l] = 0; + } + } + } + } + + writeUserBlock(&globals.Flash,0,sizeof(globals.Flash)); + + Main_Rst(); + return OK; + break; + + default: + return SyntaxError; + break; + } + + return ThisShouldntHappen; +} |