implemented marking of desired events in logfile by void insert_marker_to_file(char* logfilename, char* marker_text). Also implemented marker correct displaying on plots
This commit is contained in:
BIN
BF_companion
BIN
BF_companion
Binary file not shown.
57
main.c
57
main.c
@ -851,6 +851,12 @@ uint32_t X502_FlushRcv_buff(t_x502_hnd hnd){
|
|||||||
return ready;
|
return ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void insert_marker_to_file(char* logfilename, char* marker_text){
|
||||||
|
printf("marker %s \n", marker_text);
|
||||||
|
FILE* logfile_ptr = fopen(logfilename, "a");
|
||||||
|
fprintf(logfile_ptr, "marker %s \n", marker_text);
|
||||||
|
fclose(logfile_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
void receive_to_file(t_x502_hnd hnd, char* logfilename, uint32_t* inp_buff, uint32_t max_total_words){
|
void receive_to_file(t_x502_hnd hnd, char* logfilename, uint32_t* inp_buff, uint32_t max_total_words){
|
||||||
FILE* logfile_ptr = fopen(logfilename, "a");
|
FILE* logfile_ptr = fopen(logfilename, "a");
|
||||||
@ -1213,6 +1219,8 @@ int main(int argc, char** argv) {
|
|||||||
uint32_t recv_Err_code = 0;
|
uint32_t recv_Err_code = 0;
|
||||||
|
|
||||||
|
|
||||||
|
insert_marker_to_file(logfilename, "start transparent");
|
||||||
|
|
||||||
printf("\nStart transparent mode\n");
|
printf("\nStart transparent mode\n");
|
||||||
BF_exec_cmd_simple(hnd, 0x8007, 10, 1); //start transparent
|
BF_exec_cmd_simple(hnd, 0x8007, 10, 1); //start transparent
|
||||||
|
|
||||||
@ -1276,7 +1284,7 @@ int main(int argc, char** argv) {
|
|||||||
// printf("\nStart SEMITRANSPARENT mode\n");
|
// printf("\nStart SEMITRANSPARENT mode\n");
|
||||||
// BF_exec_cmd_simple(hnd, 0x800B, 2, 1); //start SEMITRANSPARENT
|
// BF_exec_cmd_simple(hnd, 0x800B, 2, 1); //start SEMITRANSPARENT
|
||||||
|
|
||||||
|
insert_marker_to_file(logfilename, "start AVG");
|
||||||
printf("\nStart AVG mode\n");
|
printf("\nStart AVG mode\n");
|
||||||
BF_exec_cmd_simple(hnd, 0x8008, 2, 1); //start averaging
|
BF_exec_cmd_simple(hnd, 0x8008, 2, 1); //start averaging
|
||||||
|
|
||||||
@ -1311,8 +1319,6 @@ int main(int argc, char** argv) {
|
|||||||
data_receive_trys_counter = 100;
|
data_receive_trys_counter = 100;
|
||||||
max_total_words = 100000;
|
max_total_words = 100000;
|
||||||
|
|
||||||
// void receive_data(t_x502_hnd hnd, FILE* logfile_ptr, uint32_t* inp_buff, int data_receive_trys_counter, uint32_t max_total_words, DUMP_TO_FILE)
|
|
||||||
|
|
||||||
//printf("\n dbg value: ");
|
//printf("\n dbg value: ");
|
||||||
//BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
//BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
||||||
|
|
||||||
@ -1338,20 +1344,34 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
printf("\nStart transparent mode\n");
|
|
||||||
BF_exec_cmd_simple(hnd, 0x8007, 10, 1); //start transparent
|
|
||||||
|
|
||||||
printf("\nflush TX buff. \n Number of free TX descriptors before flushing:");
|
|
||||||
BF_exec_cmd_simple(hnd, 0x8010, 10, 1);
|
|
||||||
|
|
||||||
|
|
||||||
printf("\nFlushed from receiving buff: %d\n", X502_FlushRcv_buff(hnd));
|
|
||||||
|
|
||||||
// printf("\n dbg value: ");
|
insert_marker_to_file(logfilename, "enable FFT");
|
||||||
// BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
printf("\nEnabled FFT\n");
|
||||||
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words, DUMP_TO_FILE);
|
BF_exec_cmd_simple(hnd, 0x8011, 2, 1); //enable FFT
|
||||||
// printf("\n dbg value: ");
|
|
||||||
// BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
max_total_words = 100000;
|
||||||
|
// printf("\nflush TX buff. \n Number of free TX descriptors before flushing:");
|
||||||
|
// BF_exec_cmd_simple(hnd, 0x8010, 10, 1);
|
||||||
|
|
||||||
|
X502_StreamsStop(hnd);
|
||||||
|
X502_StreamsStart(hnd);
|
||||||
|
|
||||||
|
receive_to_file(hnd, logfilename, inp_buff, max_total_words);
|
||||||
|
|
||||||
|
insert_marker_to_file(logfilename, "enable SYNC_DETector");
|
||||||
|
printf("\nEnabled SYNC_DETector\n");
|
||||||
|
BF_exec_cmd_simple(hnd, 0x8012, 2, 1); //enable FFT
|
||||||
|
max_total_words = 100000;
|
||||||
|
|
||||||
|
// printf("\nflush TX buff. \n Number of free TX descriptors before flushing:");
|
||||||
|
// BF_exec_cmd_simple(hnd, 0x8010, 10, 1);
|
||||||
|
|
||||||
|
X502_StreamsStop(hnd);
|
||||||
|
X502_StreamsStart(hnd);
|
||||||
|
|
||||||
|
receive_to_file(hnd, logfilename, inp_buff, max_total_words);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1365,6 +1385,15 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
insert_marker_to_file(logfilename, "start transparent");
|
||||||
|
|
||||||
printf("\nStart transparent mode\n");
|
printf("\nStart transparent mode\n");
|
||||||
BF_exec_cmd_simple(hnd, 0x8007, 2, 1); //start transparent
|
BF_exec_cmd_simple(hnd, 0x8007, 2, 1); //start transparent
|
||||||
X502_StreamsStop(hnd);
|
X502_StreamsStop(hnd);
|
||||||
|
|||||||
@ -26,7 +26,7 @@ if __name__ == "__main__":
|
|||||||
main()
|
main()
|
||||||
else:
|
else:
|
||||||
f = open(argv[1], "rt")
|
f = open(argv[1], "rt")
|
||||||
data = {}
|
data = {"markers":{"N":[], "text":[]}}
|
||||||
values_N = 0
|
values_N = 0
|
||||||
for line in f:
|
for line in f:
|
||||||
#print(line)
|
#print(line)
|
||||||
@ -66,6 +66,10 @@ if __name__ == "__main__":
|
|||||||
chan_mode = int(line_splt[3][:-1])
|
chan_mode = int(line_splt[3][:-1])
|
||||||
chan_range = int(line_splt[5])
|
chan_range = int(line_splt[5])
|
||||||
ADC_settings["chans"][chan_N] = {"mode":t_x502_lch_mode[chan_mode], "range":t_x502_adc_range[chan_range]}
|
ADC_settings["chans"][chan_N] = {"mode":t_x502_lch_mode[chan_mode], "range":t_x502_adc_range[chan_range]}
|
||||||
|
elif line_splt[0] == "marker":
|
||||||
|
data["markers"]["N"].append(values_N)
|
||||||
|
data["markers"]["text"].append(line)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("strange line:")
|
print("strange line:")
|
||||||
print(line)
|
print(line)
|
||||||
@ -89,7 +93,9 @@ if __name__ == "__main__":
|
|||||||
print(ADC_settings_str)
|
print(ADC_settings_str)
|
||||||
chart = go.Figure()
|
chart = go.Figure()
|
||||||
chart.update_layout(title=argv[1] + "<br>" + ADC_settings_str)
|
chart.update_layout(title=argv[1] + "<br>" + ADC_settings_str)
|
||||||
|
chart.add_trace(go.Scattergl(x=data["markers"]["N"], y=[i for i in range(len(data["markers"]["N"]))], name="markers", mode="markers", text=data["markers"]["text"]))
|
||||||
for key, val in data.items():
|
for key, val in data.items():
|
||||||
|
if key != "markers":
|
||||||
if (key.count("_N") + key.count("_hex")) == 0:
|
if (key.count("_N") + key.count("_hex")) == 0:
|
||||||
#print(key+"_hex :", data[key+"_hex"])
|
#print(key+"_hex :", data[key+"_hex"])
|
||||||
chart.add_trace(go.Scattergl(x=data[key+"_N"], y=data[key], name=key, mode="lines", text=data[key+"_hex"]))
|
chart.add_trace(go.Scattergl(x=data[key+"_N"], y=data[key], name=key, mode="lines", text=data[key+"_hex"]))
|
||||||
|
|||||||
Reference in New Issue
Block a user