save trace and marker data

This commit is contained in:
TT 2016-11-05 03:37:11 +09:00
parent 38d6a50047
commit f0eaa108ad
4 changed files with 29 additions and 8 deletions

View file

@ -111,10 +111,8 @@ caldata_recall(int id)
if (checksum(src, sizeof(config_t)) != 0) if (checksum(src, sizeof(config_t)) != 0)
return -1; return -1;
#if 0
memcpy(dst, src, sizeof(config_t)); memcpy(dst, src, sizeof(config_t));
#else
active = src; active = src;
#endif
return 0; return 0;
} }

10
main.c
View file

@ -348,6 +348,16 @@ config_t current_config = {
/* cal_status */ 0, /* cal_status */ 0,
/* frequencies */ {}, /* frequencies */ {},
/* cal_data */ {}, /* cal_data */ {},
/* trace[4] */ {
{ 1, TRC_LOGMAG, 0, 1.0, RGB565(0,255,255), 0 },
{ 1, TRC_LOGMAG, 1, 1.0, RGB565(255,0,40), 0 },
{ 1, TRC_SMITH, 0, 1.0, RGB565(0,0,255), 1 },
{ 1, TRC_PHASE, 1, 1.0, RGB565(50,255,0), 1 }
},
/* markers[4] */ {
{ 1, 30 }, { 0, 40 }, { 0, 60 }, { 0, 80 }
},
/* active_marker */ 0,
/* checksum */ 0 /* checksum */ 0
}; };
config_t *active = &current_config; config_t *active = &current_config;

View file

@ -104,7 +104,8 @@ typedef struct {
uint8_t polar; uint8_t polar;
} trace_t; } trace_t;
extern trace_t trace[TRACES_MAX]; //extern trace_t trace[TRACES_MAX];
extern float measured[2][101][2]; extern float measured[2][101][2];
void trace_get_info(int t, char *buf, int len); void trace_get_info(int t, char *buf, int len);
@ -115,8 +116,8 @@ typedef struct {
int index; int index;
} marker_t; } marker_t;
extern marker_t markers[4]; //extern marker_t markers[4];
extern int active_marker; //extern int active_marker;
#define CAL_LOAD 0 #define CAL_LOAD 0
#define CAL_OPEN 1 #define CAL_OPEN 1
@ -168,6 +169,11 @@ typedef struct {
uint32_t _frequencies[101]; uint32_t _frequencies[101];
float _cal_data[5][101][2]; float _cal_data[5][101][2];
trace_t _trace[TRACES_MAX];
marker_t _markers[4];
int _active_marker;
int32_t checksum; int32_t checksum;
} config_t; } config_t;
@ -183,6 +189,11 @@ extern config_t current_config;
#define frequencies active->_frequencies #define frequencies active->_frequencies
#define cal_data active->_cal_data #define cal_data active->_cal_data
#define trace current_config._trace
#define markers current_config._markers
#define active_marker current_config._active_marker
int caldata_save(int id); int caldata_save(int id);
int caldata_recall(int id); int caldata_recall(int id);

6
plot.c
View file

@ -16,13 +16,14 @@ void markmap_all_markers(void);
//#define GRID_COLOR 0x0863 //#define GRID_COLOR 0x0863
uint16_t grid_color = 0x1084; uint16_t grid_color = 0x1084;
#if 0
trace_t trace[TRACES_MAX] = { trace_t trace[TRACES_MAX] = {
{ 1, TRC_LOGMAG, 0, 1.0, RGB565(0,255,255), 0 }, { 1, TRC_LOGMAG, 0, 1.0, RGB565(0,255,255), 0 },
{ 1, TRC_LOGMAG, 1, 1.0, RGB565(255,0,40), 0 }, { 1, TRC_LOGMAG, 1, 1.0, RGB565(255,0,40), 0 },
{ 1, TRC_SMITH, 0, 1.0, RGB565(0,0,255), 1 }, { 1, TRC_SMITH, 0, 1.0, RGB565(0,0,255), 1 },
{ 1, TRC_PHASE, 1, 1.0, RGB565(50,255,0), 1 } { 1, TRC_PHASE, 1, 1.0, RGB565(50,255,0), 1 }
}; };
#endif
#define CELLWIDTH 32 #define CELLWIDTH 32
#define CELLHEIGHT 32 #define CELLHEIGHT 32
@ -54,12 +55,13 @@ uint16_t markmap[2][8];
uint16_t current_mappage = 0; uint16_t current_mappage = 0;
#if 0
marker_t markers[4] = { marker_t markers[4] = {
{ 1, 30 }, { 0, 40 }, { 0, 60 }, { 0, 80 } { 1, 30 }, { 0, 40 }, { 0, 60 }, { 0, 80 }
}; };
int active_marker = 0; int active_marker = 0;
#endif
int32_t fstart = 0; int32_t fstart = 0;