Compare commits

..

No commits in common. "a84fcf98d771aa86851cbe39835210737f61bafb" and "8208747a638a0c4ffb9da1d6315dc8a09250a89f" have entirely different histories.

8 changed files with 22 additions and 70 deletions

View file

@ -4,6 +4,6 @@
- ATtiny404 - ATtiny404
- WRL-10534 LPD433 Radio transmitter - WRL-10534 LPD433 Radio transmitter
![Schematics](turbo_sch.png) ![Schematics](/SiB64/turbo_weather/raw/branch/master/turbo_sch.png)
![Layout](gerber/turbo.png) ![Layout](/SiB64/turbo_weather/raw/branch/master/gerber/turbo.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before After
Before After

View file

@ -1,8 +0,0 @@
#! /bin/bash -v
date --utc +"Turbo reboot at %FT%TZ"
SRC=~stephan/turbo_weather/src
[ -d "$SRC" ] || exit 0
mount /data/blaulicht
[ -d /data/blaulicht/temperature ] || exit 0
sudo -inu stephan screen -S turbo -d -m $SRC/turbo.sh

View file

@ -1,6 +0,0 @@
#! /usr/bin/python3
import time
t = int(time.time())
t = "".join([f"{(t>>b)&0xff:02x}" for b in range(0,32,8)])
print(f"\nK {t}")

View file

@ -50,6 +50,6 @@ function emit() {
Vbat = A["BAT/1V"] Vbat = A["BAT/1V"]
Vdd = A["VDD/1V"] Vdd = A["VDD/1V"]
Vrf = A["RFP/2.5V"] Vrf = A["RFP/2.5V"]
printf "%.0f %.1f %.1f %.6f %.2f %.2f %.2f %.2f %.2f %.4f %.4f %.4f\n", \ printf "%.0f %.1f %.1f %.3f %.2f %.2f %.2f %.2f %.2f %.4f %.4f %.4f\n", \
tT, tU, tF, dt, p, Tp, Tc, Tn, Tb, Vbat, Vdd, Vrf tT, tU, tF, dt, p, Tp, Tc, Tn, Tb, Vbat, Vdd, Vrf
} }

View file

@ -11,6 +11,7 @@ set grid x
set format x "" time set format x "" time
set ytics nomirror set ytics nomirror
set y2tics set y2tics
set xrange [*:*] writeback
# set margin 12,12,0,0 # set margin 12,12,0,0
set multiplot title fn noenh layout 3,1 margin char 12,13,5,2 spacing char 1 set multiplot title fn noenh layout 3,1 margin char 12,13,5,2 spacing char 1
@ -18,22 +19,20 @@ set multiplot title fn noenh layout 3,1 margin char 12,13,5,2 spacing char 1
set ylab "Δt [s]" set ylab "Δt [s]"
set y2lab "dt/dt_{UTC}" set y2lab "dt/dt_{UTC}"
set y2ra [0.98<*:*<1.02] set y2ra [0.98<*:*<1.02]
set yra [*:*]
plot fn u 2:($1-$2) t "clock offset" w l, \ plot fn u 2:($1-$2) t "clock offset" w l, \
"" u 2:($3-$2) t "clock offset fit" w l, \ "" u 2:($3-$2) t "clock offset fit" w l, \
"" u 2:4 axis x1y2 t "clock speed" w l "" u 2:4 axis x1y2 t "clock speed" w l
set yra [*:*]
set y2ra [*:*] set y2ra [*:*]
set xrange restore set xrange restore
set ylab "p [mbar]" set ylab "p [mbar]"
set y2lab "T [°C]" set y2lab "T [°C]"
plot fn u 2:7 axis x1y2 t "T_{CPU}" w l, \ plot fn u 2:5 t "pressure" w l lw 2, \
"" u 2:6 axis x1y2 t "T_{SENSOR}" w l lw 2, \
"" u 2:7 axis x1y2 t "T_{CPU}" w l, \
"" u 2:8 axis x1y2 t "T_{NTC}" w l, \ "" u 2:8 axis x1y2 t "T_{NTC}" w l, \
"" u 2:9 axis x1y2 t "T_{BRIDGE}" w l lt 7, \ "" u 2:9 axis x1y2 t "T_{BRIDGE}" w l lt 7
"" u 2:5 t "pressure" w l lw 2, \
"" u 2:6 axis x1y2 t "T_{SENSOR}" w l lw 2
set format x "%H:%M\n%d. %b\n%Y" time set format x "%H:%M\n%d. %b\n%Y" time

View file

@ -59,16 +59,17 @@ for o,v in options:
if not out: if not out:
out = sys.stdout out = sys.stdout
if tty and files:
raise ValueError("cannot do tty and files")
if len(files)==1: if len(files)==1:
if "/dev/tty" in files[0]: if "/dev/tty" in files[0]:
tty = files[0] tty = files[0]
files = []
inp = []
if tty: if tty:
inp = [serial.Serial(port=tty, baudrate=baud)] inp = serial.Serial(port=tty, baudrate=baud)
if files or not inp: else:
inp[0:0] = [fileinput.input(files, mode="rb")] inp = fileinput.input(files, mode="rb")
checksum = 0 checksum = 0
@ -157,12 +158,12 @@ def clock(line):
return noise(line, "t") return noise(line, "t")
s = None s = None
t = None t = None
if do_clock:
t = time.time()
try: try:
t = float(ll[3]) t = float(ll[3])
except: except:
pass pass
if do_clock:
t = time.time()
if t is not None: if t is not None:
freq.add(t, c) freq.add(t, c)
s = freq.solve() s = freq.solve()
@ -170,7 +171,7 @@ def clock(line):
if t is None: if t is None:
t = time.time() t = time.time()
return echo(line, f"{c} {t:.1f}") return echo(line, f"{c} {t:.1f}")
return echo(ll[0]+b' '+ll[1], f"{c} {t:.1f}", *("%.6g" % ss for ss in s[0])) return echo(line, f"{c} {t:.1f}", *("%.4g" % ss for ss in s[0]))
Data = {} Data = {}
@ -180,7 +181,7 @@ def data(line):
c = ll[0] c = ll[0]
d = [int(l, 16) for l in ll[1:]] d = [int(l, 16) for l in ll[1:]]
if ll[1:]: if ll[1:]:
Data[c] = d data[c] = d
emit_data(c) emit_data(c)
return echo(line) return echo(line)
except Exception as e: except Exception as e:
@ -233,7 +234,6 @@ ADC_mV = {}
def emit_adc(c, cc): def emit_adc(c, cc):
if len(cc) > 8: if len(cc) > 8:
return return
ADC_mV.clear()
for n, a in enumerate(cc): for n, a in enumerate(cc):
C = ADC_CONFIG[n] C = ADC_CONFIG[n]
if C is None: if C is None:
@ -456,11 +456,6 @@ processes = {
b'X': echo, b'X': echo,
} }
splits = {
b'Q': 1,
b'T': 2,
}
class batecmd(cmdsocket.cmd_receiver): class batecmd(cmdsocket.cmd_receiver):
def msg(self, m): def msg(self, m):
echo(b'r '+m) echo(b'r '+m)
@ -472,22 +467,19 @@ if socket:
raise ValueError("cannot have socket without tty") raise ValueError("cannot have socket without tty")
cmd.open(socket, force=True) cmd.open(socket, force=True)
while inp: while True:
try: try:
line = inp[0].readline() line = inp.readline()
except KeyboardInterrupt: except KeyboardInterrupt:
break break
if not line: if not line:
inp[:1] = [] break
continue
line_key = line[0:1] line_key = line[0:1]
is_noise = line_key not in processes is_noise = line_key not in processes
if not is_noise and min(line.strip()) < 32: if not is_noise and min(line.strip()) < 32:
is_noise = True is_noise = True
if line_key in b"apcufse":
continue
if is_noise: if is_noise:
if do_noise: if do_noise:
noise(line) noise(line)
@ -495,8 +487,6 @@ while inp:
continue continue
if processes[line_key](line): if processes[line_key](line):
if line_key in splits:
line = b" ".join(line.split()[:splits[line_key]])+b"\n"
add_checksum(line) add_checksum(line)
if tty: if tty:

View file

@ -1,23 +0,0 @@
#! /bin/bash
TTY=/dev/ttyUSB0,1200
DATA=/data/blaulicht/temperature
NEWDATA=$(date --utc +$DATA/turbo-%FT%TZ.txt)
OLDDATA=$(ls -1 $DATA/turbo-????-??-??*.txt | tail -1)
LINKDATA=$DATA/turbo.txt
SRC=~/turbo_weather/src
[ -e $NEWDATA ] && exit
if [ "$(stat -c %h $LINKDATA)" -eq "2" ]
then
rm -vf $LINKDATA
touch $NEWDATA || exit 0
ln -v $NEWDATA $LINKDATA
fi
echo $NEWDATA
echo $OLDDATA
$SRC/turbo.py --tty="$TTY" $OLDDATA | tee --append "$NEWDATA"