summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2018-05-07 10:13:41 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2018-05-07 10:13:41 -0400
commitafe0eaf02c8577bf6f54339e391041acedb1c71e (patch)
tree941f1e1edef64c2b30a587496edb13334133abd8
parent14670765128b8f098486690c582ce29ecfa6b0fb (diff)
add ability to just copy old-style ampl and os initial config data to new 32-ranges
-rw-r--r--globals.h2
-rw-r--r--parser.c105
2 files changed, 106 insertions, 1 deletions
diff --git a/globals.h b/globals.h
index 54418ef..a8fae30 100644
--- a/globals.h
+++ b/globals.h
@@ -495,7 +495,7 @@ typedef struct {
short rcl_misc[max_channels][max_stored_settings]; /* addr 1616 - another misc is stored below */
short rcl_unused[max_stored_settings]; /* addr 1632 */
- float mon_vi_ratio[max_channels][5][2]; /* addr 1640 */
+ float mon_vi_ratio[max_channels][ampl_ranges][ampl_polarities]; /* addr 1640 */
float min_ampl[max_channels]; /* addr 1720 */
float max_ampl[max_channels]; /* addr 1728 */
diff --git a/parser.c b/parser.c
index b3492f9..bcb2f46 100644
--- a/parser.c
+++ b/parser.c
@@ -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;
+}