From 6fc8439399d48c5308bdb6ecc6a692a843865b33 Mon Sep 17 00:00:00 2001 From: Chris Ballance Date: Thu, 2 Aug 2018 12:29:43 +0100 Subject: [PATCH] tweak moninj to allow old dashboard with new firmware --- artiq/coredevice/comm_moninj.py | 6 +++--- artiq/firmware/libproto_artiq/moninj_proto.rs | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/artiq/coredevice/comm_moninj.py b/artiq/coredevice/comm_moninj.py index 9397c97e5..08cbcc779 100644 --- a/artiq/coredevice/comm_moninj.py +++ b/artiq/coredevice/comm_moninj.py @@ -56,15 +56,15 @@ class CommMonInj: self._writer.write(packet) def monitor_injection(self, enable, channel, overrd): - packet = struct.pack(">bblb", 1, enable, channel, overrd) + packet = struct.pack(">bblb", 3, enable, channel, overrd) self._writer.write(packet) def inject(self, channel, override, value): - packet = struct.pack(">blbb", 2, channel, override, value) + packet = struct.pack(">blbb", 1, channel, override, value) self._writer.write(packet) def get_injection_status(self, channel, override): - packet = struct.pack(">blb", 3, channel, override) + packet = struct.pack(">blb", 2, channel, override) self._writer.write(packet) async def _receive_cr(self): diff --git a/artiq/firmware/libproto_artiq/moninj_proto.rs b/artiq/firmware/libproto_artiq/moninj_proto.rs index 283ecb0f3..dba2f84bc 100644 --- a/artiq/firmware/libproto_artiq/moninj_proto.rs +++ b/artiq/firmware/libproto_artiq/moninj_proto.rs @@ -54,17 +54,17 @@ impl HostMessage { channel: reader.read_u32()?, probe: reader.read_u8()? }, - 1 => HostMessage::MonitorInjection { - enable: if reader.read_u8()? == 0 { false } else { true }, - channel: reader.read_u32()?, - overrd: reader.read_u8()? - }, - 2 => HostMessage::Inject { + 1 => HostMessage::Inject { channel: reader.read_u32()?, overrd: reader.read_u8()?, value: reader.read_u8()? }, - 3 => HostMessage::GetInjectionStatus { + 2 => HostMessage::GetInjectionStatus { + channel: reader.read_u32()?, + overrd: reader.read_u8()? + }, + 3 => HostMessage::MonitorInjection { + enable: if reader.read_u8()? == 0 { false } else { true }, channel: reader.read_u32()?, overrd: reader.read_u8()? },