diff --git a/BF_companion b/BF_companion index b49a9b2..447fb56 100755 Binary files a/BF_companion and b/BF_companion differ diff --git a/main.c b/main.c index 4178004..5d38048 100644 --- a/main.c +++ b/main.c @@ -851,6 +851,12 @@ uint32_t X502_FlushRcv_buff(t_x502_hnd hnd){ 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){ FILE* logfile_ptr = fopen(logfilename, "a"); @@ -1213,6 +1219,8 @@ int main(int argc, char** argv) { uint32_t recv_Err_code = 0; + insert_marker_to_file(logfilename, "start transparent"); + printf("\nStart transparent mode\n"); 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"); // BF_exec_cmd_simple(hnd, 0x800B, 2, 1); //start SEMITRANSPARENT - + insert_marker_to_file(logfilename, "start AVG"); printf("\nStart AVG mode\n"); 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; 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: "); //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: "); -// BF_exec_cmd_simple(hnd, 0x800A, 10, 1); - receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words, DUMP_TO_FILE); -// printf("\n dbg value: "); -// BF_exec_cmd_simple(hnd, 0x800A, 10, 1); + insert_marker_to_file(logfilename, "enable FFT"); + printf("\nEnabled FFT\n"); + BF_exec_cmd_simple(hnd, 0x8011, 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); + + 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"); BF_exec_cmd_simple(hnd, 0x8007, 2, 1); //start transparent X502_StreamsStop(hnd); diff --git a/plotter.py b/plotter.py index 3576cad..7d46f1c 100755 --- a/plotter.py +++ b/plotter.py @@ -26,7 +26,7 @@ if __name__ == "__main__": main() else: f = open(argv[1], "rt") - data = {} + data = {"markers":{"N":[], "text":[]}} values_N = 0 for line in f: #print(line) @@ -66,6 +66,10 @@ if __name__ == "__main__": chan_mode = int(line_splt[3][:-1]) 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]} + elif line_splt[0] == "marker": + data["markers"]["N"].append(values_N) + data["markers"]["text"].append(line) + else: print("strange line:") print(line) @@ -89,10 +93,12 @@ if __name__ == "__main__": print(ADC_settings_str) chart = go.Figure() chart.update_layout(title=argv[1] + "
" + 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(): - if (key.count("_N") + key.count("_hex")) == 0: - #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+markers", text=data[key+"_hex"])) + if key != "markers": + if (key.count("_N") + key.count("_hex")) == 0: + #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+markers", text=data[key+"_hex"])) chart.show()