forked from M-Labs/artiq
1
0
Fork 0

tweak moninj to allow old dashboard with new firmware

This commit is contained in:
Chris Ballance 2018-08-02 12:29:43 +01:00 committed by Sébastien Bourdeauducq
parent 04cbc3237b
commit 6fc8439399
2 changed files with 10 additions and 10 deletions

View File

@ -56,15 +56,15 @@ class CommMonInj:
self._writer.write(packet) self._writer.write(packet)
def monitor_injection(self, enable, channel, overrd): 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) self._writer.write(packet)
def inject(self, channel, override, value): 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) self._writer.write(packet)
def get_injection_status(self, channel, override): 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) self._writer.write(packet)
async def _receive_cr(self): async def _receive_cr(self):

View File

@ -54,17 +54,17 @@ impl HostMessage {
channel: reader.read_u32()?, channel: reader.read_u32()?,
probe: reader.read_u8()? probe: reader.read_u8()?
}, },
1 => HostMessage::MonitorInjection { 1 => HostMessage::Inject {
enable: if reader.read_u8()? == 0 { false } else { true },
channel: reader.read_u32()?,
overrd: reader.read_u8()?
},
2 => HostMessage::Inject {
channel: reader.read_u32()?, channel: reader.read_u32()?,
overrd: reader.read_u8()?, overrd: reader.read_u8()?,
value: 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()?, channel: reader.read_u32()?,
overrd: reader.read_u8()? overrd: reader.read_u8()?
}, },