changeset 140:e6c265bf5a6d

fc-tmsh: save-rf-table-raw command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 26 Feb 2017 23:26:30 +0000
parents b5e3899b1265
children 6b01d4ef85c3
files rvinterf/tmsh/saverftab.c rvinterf/tmsh/usercmd.c
diffstat 2 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/tmsh/saverftab.c	Sun Feb 26 23:13:52 2017 +0000
+++ b/rvinterf/tmsh/saverftab.c	Sun Feb 26 23:26:30 2017 +0000
@@ -79,3 +79,36 @@
 	fclose(outf);
 	return(0);
 }
+
+cmd_save_rf_table_raw(argc, argv)
+	char **argv;
+{
+	FILE *outf;
+	int off, l, j;
+
+	if (!rftr_table_size) {
+		printf("error: no RF table has been received\n");
+		return(ERROR_TARGET);
+	}
+	outf = fopen(argv[1], "w");
+	if (!outf) {
+		perror(argv[1]);
+		return(ERROR_UNIX);
+	}
+	fputs("rf_table raw\n\n", outf);
+	for (off = 0; off < rftr_table_size; ) {
+		l = rftr_table_size - off;
+		if (l > 16)
+			l = 16;
+		for (j = 0; j < l; j++) {
+			if (j)
+				putc(' ', outf);
+			if (j == 8)
+				putc(' ', outf);
+			fprintf(outf, "%02X", rftr_table_data[off++]);
+		}
+		putc('\n', outf);
+	}
+	fclose(outf);
+	return(0);
+}
--- a/rvinterf/tmsh/usercmd.c	Sun Feb 26 23:13:52 2017 +0000
+++ b/rvinterf/tmsh/usercmd.c	Sun Feb 26 23:26:30 2017 +0000
@@ -34,6 +34,7 @@
 extern int cmd_rxpr();
 extern int cmd_rxpw();
 extern int cmd_save_rf_table();
+extern int cmd_save_rf_table_raw();
 extern int cmd_scr();
 extern int cmd_scw();
 extern int cmd_sr();
@@ -88,6 +89,7 @@
 	{"rxpr", 1, 1, cmd_rxpr},
 	{"rxpw", 2, 2, cmd_rxpw},
 	{"save-rf-table", 1, 1, cmd_save_rf_table},
+	{"save-rf-table-raw", 1, 1, cmd_save_rf_table_raw},
 	{"scr", 1, 1, cmd_scr},
 	{"scw", 2, 2, cmd_scw},
 	{"sr", 2, 2, cmd_sr},