Compare commits

...

2 commits

Author SHA1 Message Date
Stephan I. Böttcher
54f7c7bcde Merge branch 'master' of codeberg.org:SiB64/turbo_weather 2024-10-14 14:42:35 +02:00
Stephan I. Böttcher
f6f0a3869d turbo.py: fix /VDD awk compat, fix ADC DIFF mode 2024-10-14 14:42:08 +02:00

View file

@ -168,7 +168,9 @@ def clock(line):
freq.add(t, c)
s = freq.solve()
if s is None:
return echo(line)
if t is None:
t = time.time()
return echo(line, f"{c} {t:.1f}")
return echo(line, f"{c} {t:.1f}", *("%.4g" % ss for ss in s[0]))
Data = {}
@ -177,9 +179,11 @@ def data(line):
ll = line.split()
try:
c = ll[0]
Data[c] = [int(l, 16) for l in ll[1:]]
emit_data(c)
return echo(line)
d = [int(l, 16) for l in ll[1:]]
if ll[1:]:
data[c] = d
emit_data(c)
return echo(line)
except Exception as e:
Debug(e, line)
return noise(line, "h")
@ -237,6 +241,7 @@ def emit_adc(c, cc):
if C["mode"] == turbocmd.ADC_MODE["DIFF"]:
if a & 0x8000:
a -= 0x10000
a *= 2
elif C["mode"] != turbocmd.ADC_MODE["NORM"]:
continue
REF = None
@ -292,7 +297,7 @@ def emit_adc_pretty():
if k == "RFP/2.5V":
pretty = f" Vrf {A/500:.4f} V"
if kk[1] == "VDD":
units=" Vdd"
units=". Vdd"
try:
AA, x = ADC_mV["VDD/1V"]
mV = AA*10