Compare commits

...

4 commits

Author SHA1 Message Date
Stephan I. Böttcher
de178db0a1 DORN.RC: avoid overflow in banana coeff 2025-07-30 12:17:14 +02:00
Stephan I. Böttcher
eb2c92e0e9 armlib: add class Keep_Alive_Schedule 2025-07-30 12:16:17 +02:00
Stephan I. Böttcher
ac271696f5 armlib: add class Keep_Alive_Schedule 2025-07-30 12:15:46 +02:00
Stephan I. Böttcher
7678ba7845 AHEPAM: .SETH same order as .seth_hist 2025-07-30 12:14:24 +02:00
5 changed files with 52 additions and 46 deletions

View file

@ -132,18 +132,15 @@ function isSETH() {
}
function doSETH() {
printf "%.0f %g %g %g %g %d %g %d %g\n", TE0+EPOCH, \
EBGO0, EBGO1, EHETB, EHETA, \
iTRIG0, ETRIG0, iTRIG1, ETRIG1
for (i in cBGO) printf " %g", EE[i]
for (i in cBGO) printf " %g", EE[i+24]
printf "\n"
printf "%.0f %d %d %g %g %g %g %g %g\n", TE0+EPOCH, \
iTRIG0, iTRIG1, ETRIG0, ETRIG1, \
EHETB, EHETA, EBGO0, EBGO
}
function doSETHBGO() {
printf "%.0f %g %g %g %g %d %g %d %g", TE0+EPOCH, \
EBGO0, EBGO1, EHETB, EHETA, \
iTRIG0, ETRIG0, iTRIG1, ETRIG1
printf "%.0f %d %d %g %g %g %g %g %g", TE0+EPOCH, \
iTRIG0, iTRIG1, ETRIG0, ETRIG1, \
EHETB, EHETA, EBGO0, EBGO
for (i in cBGO) printf " %g", EE[i]
for (i in cBGO) printf " %g", EE[i+24]
printf "\n"

View file

@ -601,6 +601,42 @@ class irena_ifc(object):
except EOFError:
pass
class Keep_Alive_Schedule:
interval = 30
ioffset = 1
cmd = "e/in 'staying alive'"
clock_interval = 900
clock_args = {"fudge": True}
def __init__(self, cmd=None, interval=None):
if cmd:
self.cmd = cmd
if interval:
self.interval = interval
pass
def __call__(self):
t0 = time.time()
try:
while True:
sys.stderr.write(" \r")
print(_ifc.cmd(self.cmd))
sys.stderr.write(f"Pinging every {self.interval:.3g} seconds, type Ctrl-C to end\r")
t = time.time()
tping = self.interval - t % self.interval + self.ioffset
tclock = self.clock_interval - t % self.clock_interval
if tclock < tping:
time.sleep(tclock)
_ifc.set_clock(**self.clock_args)
tping -= tclock
if tping > 0.1:
time.sleep(tping)
except KeyboardInterrupt:
pass
def init_irena(scope, name="xRENA", prod=None, options="", long_options=[]):
global _ifc, _ifc_uart, _opt
_ifc = None

View file

@ -11,7 +11,7 @@
@dorn/l3 [0,4,0] -4404
@dorn/l3 [0,4,1] 10830
@dorn/l3 [0,4,2] -23912
@dorn/l3 [0,4,3] 45271
@dorn/l3 [0,4,3] 0x7fff (overflow: 45271)
@dorn/fifo/enable/inj 0xdb3
@s/for 2: dorn/enable[i]/samples/inj 0
@v $T = 0x101808

View file

@ -84,42 +84,7 @@ def CHAOS_NAMES():
{ "any": 0x100, "read": 0x3ffff }, # DL
]
class Keep_Alive_Schedule:
interval = 30
ioffset = 1
cmd = "e/in 'staying alive'"
clock_interval = 900
clock_args = {"fudge": True}
def __init__(self, cmd=None, interval=None):
if cmd:
self.cmd = cmd
if interval:
self.interval = interval
pass
def __call__(self):
t0 = time.time()
try:
while True:
sys.stderr.write(" \r")
print(cmd(self.cmd))
sys.stderr.write(f"Pinging every {self.interval:.3g} seconds, type Ctrl-C to end\r")
t = time.time()
tping = self.interval - t % self.interval + self.ioffset
tclock = self.clock_interval - t % self.clock_interval
if tclock < tping:
time.sleep(tclock)
ifc.set_clock(**self.clock_args)
tping -= tclock
if tping > 0.1:
time.sleep(tping)
except KeyboardInterrupt:
pass
Keep_Alive = Keep_Alive_Schedule(
Keep_Alive = armlib.Keep_Alive_Schedule(
cmd = "e/in"
" '%u.%u %u.%u mbar %d %d °C F=%u H=%u',"
" pre/10, pre%10, pre[1]/10, pre[1]%10,"

View file

@ -66,6 +66,14 @@ def adisable():
cmd("s/cron/none")
disable()
Keep_alive = armlib.Keep_Alive_Schedule(
cmd="e/in"
" '%u.%u mbar %d.%d °C F=%u',"
" pre/10, pre%10,"
" (te-2731)/10, (te-2731)%10,"
" F"
)
if __name__=="__main__":
ifc,_oo = armlib.init_irena(scope = globals(), name = "AHEPAM", prod = (0xee0c,),
long_options=["seth", "ahbgo"])