From a5e5a4d637a4b6fc50c136c61ac2a46d6d79fac8 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Fri, 15 Apr 2022 10:32:34 +0200
Subject: [PATCH] L2SS-731: Fix reading of a devices's own attributes

---
 tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py | 2 +-
 tangostationcontrol/tangostationcontrol/devices/sdp/sst.py | 2 +-
 tangostationcontrol/tangostationcontrol/devices/sdp/xst.py | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py b/tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py
index 574fede48..914c84441 100644
--- a/tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py
+++ b/tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py
@@ -191,7 +191,7 @@ class SDP(opcua_device):
     def read_FPGA_processing_error_R(self):
         return self.read_attribute("TR_fpga_mask_R") & (
                  ~self.read_attribute("FPGA_processing_enable_R")
-               | (self.read_attribute("FPGA_boot_image_R") == 0)
+               | (self.read_attribute("FPGA_boot_image_R") <= 0)
                )
 
     def read_FPGA_input_error_R(self):
diff --git a/tangostationcontrol/tangostationcontrol/devices/sdp/sst.py b/tangostationcontrol/tangostationcontrol/devices/sdp/sst.py
index a1771325f..2ce9d18a7 100644
--- a/tangostationcontrol/tangostationcontrol/devices/sdp/sst.py
+++ b/tangostationcontrol/tangostationcontrol/devices/sdp/sst.py
@@ -115,7 +115,7 @@ class SST(Statistics):
 
     def read_FPGA_processing_error_R(self):
         return self.sdp_proxy.TR_fpga_mask_RW & (
-                 ~self.proxy.FPGA_sst_offload_enable_R
+                 ~self.read_attribute("FPGA_sst_offload_enable_R")
                )
 
     # --------
diff --git a/tangostationcontrol/tangostationcontrol/devices/sdp/xst.py b/tangostationcontrol/tangostationcontrol/devices/sdp/xst.py
index 173d33ecb..443012ced 100644
--- a/tangostationcontrol/tangostationcontrol/devices/sdp/xst.py
+++ b/tangostationcontrol/tangostationcontrol/devices/sdp/xst.py
@@ -239,7 +239,8 @@ class XST(Statistics):
 
     def read_FPGA_processing_error_R(self):
         return self.sdp_proxy.TR_fpga_mask_RW & (
-                 ~self.proxy.FPGA_xst_offload_enable_R
+                 ~self.read_attribute("FPGA_xst_offload_enable_R")
+               | ~self.read_attribute("FPGA_xst_processing_enable_R")
                )
 
     # --------
-- 
GitLab