diff --git a/BF_companion b/BF_companion
index e121159..2d24aaa 100755
Binary files a/BF_companion and b/BF_companion differ
diff --git a/do b/do
new file mode 100755
index 0000000..d12f1b1
--- /dev/null
+++ b/do
@@ -0,0 +1,2 @@
+#!/usr/bin/bash
+./plotter.py "$(./BF_companion 2>&1 1>/dev/tty)"
diff --git a/main.c b/main.c
index 1677383..a8ef4c7 100644
--- a/main.c
+++ b/main.c
@@ -154,7 +154,7 @@ static uint32_t f_channels[ADC_LCH_CNT] = {0, 0, 1, 0};
// режимы измерения для каналов //
static uint32_t f_ch_modes[ADC_LCH_CNT] = {X502_LCH_MODE_COMM, X502_LCH_MODE_COMM,X502_LCH_MODE_COMM,X502_LCH_MODE_COMM};
// диапазоны измерения для каналов //
-static uint32_t f_ch_ranges[ADC_LCH_CNT] = {X502_ADC_RANGE_1, X502_ADC_RANGE_1,X502_ADC_RANGE_1,X502_ADC_RANGE_1};
+static uint32_t f_ch_ranges[ADC_LCH_CNT] = {X502_ADC_RANGE_5, X502_ADC_RANGE_5,X502_ADC_RANGE_5,X502_ADC_RANGE_5};
@@ -1303,6 +1303,7 @@ int main(int argc, char** argv) {
printf("\n\nreceive done. Exiting...\n\n\n");
//logfile_ptr = fopen(logfilename, "w");
printf("dumped to file: %s\n", logfilename);
+ fprintf(stderr, "%s\n", logfilename);
X502_Close(hnd);
// освобождаем описатель
diff --git a/plotter.py b/plotter.py
index 9e1feb8..3576cad 100755
--- a/plotter.py
+++ b/plotter.py
@@ -4,6 +4,15 @@ from decimal import *
from sys import argv
+t_x502_sync_mode = ["INTERNAL", "EXTERNAL_MASTER", "SYN1_RISE", "SYN1_FALL", "SYN2_RISE", "SYN2_FALL", "???"]
+t_x502_lch_mode = ["COMM", "DIFF", "ZERO", "???"]
+t_x502_adc_range = ["+-10V", "+-5V", "+-2V", "+-1V", "+-0.5V", "+-0.2V", "???"]
+
+
+
+ADC_settings = {"sync_frec_source":"???", "sync_start_source": "???", "chans":{}}
+
+
def main():
chart = go.Figure()
chart.add_trace(go.Scatter(x=[1,2,3], y=[1,2,3]))
@@ -11,6 +20,8 @@ def main():
if __name__ == "__main__":
+ print("parsing")
+ print("=======================")
if len(argv) == 1:
main()
else:
@@ -33,9 +44,33 @@ if __name__ == "__main__":
data[header] = []
data[header + "_N"] = []
data[header + "_hex"] = []
- data[header].append(int(value,16))
+ value_unsigned = int(value, 16)
+ if (value_unsigned > 0x7FFFFF):
+ value_signed = (value_unsigned) - 0xFFFFFF
+ else:
+ value_signed = value_unsigned
+ data[header].append(value_signed)
data[header + "_hex"].append(value)
data[header + "_N"].append(values_N)
+ else:
+ line_splt = line.split()
+ print(line_splt)
+ if line_splt[0] == "sync_frec_source:":
+ val = int(line_splt[1])
+ ADC_settings["sync_frec_source"] = t_x502_sync_mode[val]
+ elif line_splt[0] == "sync_start_source:":
+ val = int(line_splt[1])
+ ADC_settings["sync_start_source"] = t_x502_sync_mode[val]
+ elif line_splt[0] == "chan:":
+ chan_N = int(line_splt[1][:-1])
+ 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]}
+ else:
+ print("strange line:")
+ print(line)
+
+
except ValueError:
pass
except IndexError:
@@ -45,12 +80,19 @@ if __name__ == "__main__":
pass
f.close()
print("data samples:", values_N)
+ print(ADC_settings)
+ ADC_settings_str = ""
+ ADC_settings_str += "sync_frec_source: " + ADC_settings["sync_frec_source"] + "
"
+ ADC_settings_str += "sync_start_source: " + ADC_settings["sync_start_source"] + "
"
+ for key, val in ADC_settings["chans"].items():
+ ADC_settings_str += " chan" + str(key) + ": " + str(val)+ "
"
+ print(ADC_settings_str)
chart = go.Figure()
+ chart.update_layout(title=argv[1] + "
" + ADC_settings_str)
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"]))
- chart.update_layout(title=argv[1])
chart.show()