diff --git a/csaxs_bec/device_configs/ptycho_flomni.yaml b/csaxs_bec/device_configs/ptycho_flomni.yaml index f840e47e..00344e9e 100644 --- a/csaxs_bec/device_configs/ptycho_flomni.yaml +++ b/csaxs_bec/device_configs/ptycho_flomni.yaml @@ -648,15 +648,22 @@ calculated_signal: ############################################################ # Mode A (legacy per-gate aggregate acquisition) and Mode B (continuous free-running # raw-sample acquisition, see docs/developer/panda_box_free_running_setup.md) need different -# PandA hardware layouts and can't run simultaneously (see that doc's "Open question"), so -# only one of the two devices below should have enabled: true at a time, matching whichever -# layout is currently loaded on the PandA. A disabled device is an inert placeholder - BEC's -# device server never opens a connection to it (device_server/devices/devicemanager.py) - so -# both stay uncommented for easy switching instead of commenting/uncommenting blocks. +# PandA hardware layouts and can't run simultaneously (see that doc's "Open question"). Only +# one of the two devices below should be active at a time, matching whichever layout is +# currently loaded on the PandA. # -# Currently: Mode A enabled, Mode B disabled (switched back 2026-09-15 for A/B comparison -# testing after confirming Mode B works end-to-end; Mode B speed testing beyond 100 Hz is -# still TODO). +# NOTE 2026-09-15: setting enabled: false on omny_panda_continuous was not sufficient by +# itself to stop it being active in the running BEC session (both devices ended up +# connected/active simultaneously against the same physical PandA at once) - a device that +# was already connected apparently doesn't get disconnected just by disabling it in a config +# reload. Commenting the block out is the reliable way to guarantee it's not loaded; do the +# same for omny_panda when switching to Mode B, and don't rely on enabled: false alone +# without also confirming (e.g. restarting the device server) that the other device has +# actually dropped its connection. +# +# Currently: Mode A active, Mode B commented out (switched back 2026-09-15 for A/B +# comparison testing after confirming Mode B works end-to-end; Mode B speed testing beyond +# 100 Hz is still TODO). omny_panda: readoutPriority: async deviceClass: csaxs_bec.devices.panda_box.panda_box_omny.PandaBoxOMNY @@ -688,30 +695,30 @@ omny_panda: deviceTags: - ptycho_flomni -omny_panda_continuous: - readoutPriority: async - deviceClass: csaxs_bec.devices.panda_box.panda_box_omny.PandaBoxOMNY - deviceConfig: - host: omny-panda.psi.ch - raw_stream_mode: true - signal_alias: - FMC_IN.VAL1.Value: cap_voltage_fzp_y - FMC_IN.VAL2.Value: cap_voltage_fzp_x - INENC1.VAL.Value: interf_st_fzp_y - INENC2.VAL.Value: interf_st_fzp_x - INENC3.VAL.Value: interf_st_rotz - INENC4.VAL.Value: interf_st_rotx - PCAP.GATE_DURATION.Value: pcap_gate_duration_value - # TTLIN1 (detector trigger) feeds both blocks below - confirmed 2026-09-15 against the - # omny-panda hardware, see docs/developer/panda_box_free_running_setup.md. PCAP.BITS0 - # is a shared 32-bit word; PandaBoxOMNY masks it to bit 0 (TTLIN1.VAL) before - # publishing gate_detector_active. COUNTER1 counts TTLIN1's falling edge, i.e. one - # increment per completed exposure; it also doubles as the on_complete signal. Confirmed - # working end-to-end 2026-09-15; speed testing beyond the initial 100 Hz is still TODO. - PCAP.BITS0.Value: gate_detector_active - COUNTER1.OUT.Value: frame_counter - enabled: false - readOnly: false - softwareTrigger: false - deviceTags: - - ptycho_flomni +# omny_panda_continuous: +# readoutPriority: async +# deviceClass: csaxs_bec.devices.panda_box.panda_box_omny.PandaBoxOMNY +# deviceConfig: +# host: omny-panda.psi.ch +# raw_stream_mode: true +# signal_alias: +# FMC_IN.VAL1.Value: cap_voltage_fzp_y +# FMC_IN.VAL2.Value: cap_voltage_fzp_x +# INENC1.VAL.Value: interf_st_fzp_y +# INENC2.VAL.Value: interf_st_fzp_x +# INENC3.VAL.Value: interf_st_rotz +# INENC4.VAL.Value: interf_st_rotx +# PCAP.GATE_DURATION.Value: pcap_gate_duration_value +# # TTLIN1 (detector trigger) feeds both blocks below - confirmed 2026-09-15 against the +# # omny-panda hardware, see docs/developer/panda_box_free_running_setup.md. PCAP.BITS0 +# # is a shared 32-bit word; PandaBoxOMNY masks it to bit 0 (TTLIN1.VAL) before +# # publishing gate_detector_active. COUNTER1 counts TTLIN1's falling edge, i.e. one +# # increment per completed exposure; it also doubles as the on_complete signal. Confirmed +# # working end-to-end 2026-09-15; speed testing beyond the initial 100 Hz is still TODO. +# PCAP.BITS0.Value: gate_detector_active +# COUNTER1.OUT.Value: frame_counter +# enabled: true +# readOnly: false +# softwareTrigger: false +# deviceTags: +# - ptycho_flomni diff --git a/docs/developer/panda_box_free_running_setup.md b/docs/developer/panda_box_free_running_setup.md index defb17ad..34154c10 100644 --- a/docs/developer/panda_box_free_running_setup.md +++ b/docs/developer/panda_box_free_running_setup.md @@ -147,16 +147,27 @@ dataset) is documented separately in ## Switching between modes -`omny_panda` (Mode A) and `omny_panda_continuous` (Mode B) are both defined in -`ptycho_flomni.yaml` at all times; exactly one should have `enabled: true`, matching -whichever layout is currently loaded on the PandA (see "Open question" below for why they -can't both be enabled at once). A disabled device is an inert placeholder — BEC's device -server never opens a connection to it (`bec_server/device_server/devices/devicemanager.py`, -`connect_device` is only called when `enabled`) — so switching is just flipping the -`enabled` flag on both entries and reloading the device config; no need to comment/uncomment -blocks. Confirmed end-to-end 2026-09-15: Mode B tested working (correct per-channel values, -masked `gate_detector_active`, `frame_counter`-based completion), then switched back to -Mode A for A/B comparison testing. +`omny_panda` (Mode A) and `omny_panda_continuous` (Mode B) need different PandA hardware +layouts and can't run simultaneously (see "Open question" below), so exactly one should be +active in `ptycho_flomni.yaml` at a time, matching whichever layout is currently loaded on +the PandA — **comment out the other one's block entirely**, don't rely on `enabled: false` +alone. + +That's a correction from earlier in this project: `enabled: false` on a device BEC has never +connected to is an inert placeholder — `connect_device` in +`bec_server/device_server/devices/devicemanager.py` is only called when `enabled` — so the +theory was that both entries could stay uncommented and switching would just be flipping the +flag. In practice (2026-09-15), disabling `omny_panda_continuous` this way was **not** +sufficient once it had already been connected in the running session: both devices ended up +active simultaneously against the same physical PandA. A device that's already connected +doesn't appear to get disconnected just because a later config reload marks it disabled. +Commenting the block out (so BEC never even constructs the device object) is the reliable +way to guarantee it's gone; if in doubt, confirm the other device has actually dropped its +connection (e.g. via a device server restart) rather than trusting `enabled: false` alone. + +Confirmed end-to-end 2026-09-15: Mode B tested working (correct per-channel values, masked +`gate_detector_active`, `frame_counter`-based completion), then switched back to Mode A +(commented out) for A/B comparison testing. ## Open question, now partially resolved