From 66168781d2d74deb31305492c6b87a433877e33e Mon Sep 17 00:00:00 2001
From: Gijs Schoonderbeek <schoonderbeek@astron.nl>
Date: Tue, 11 May 2021 10:41:43 +0200
Subject: [PATCH] Update rd_unb2c.py and UniBoard_I2C.py after testing on
 hardware

---
 UniBoard2_I2C.py |  2 +-
 rd_unb2c.py      | 14 ++++----------
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/UniBoard2_I2C.py b/UniBoard2_I2C.py
index 27efb65..3c7011d 100644
--- a/UniBoard2_I2C.py
+++ b/UniBoard2_I2C.py
@@ -46,7 +46,7 @@ CTRL_POWER        = 0x10
 # Front panel LED
 ################
 LED_DRIVER        = 0x41
-LED_COLORS = {"red": 0x01, "blue": 0x02, "green" : 0x04, "magenta": 0x03, "yellow": 0x06, "cyaan": 0x05}
+LED_COLORS = {"red": 0x06, "blue": 0x05, "green" : 0x03, "magenta": 0x04, "yellow": 0x02, "cyaan": 0x01, "white": 0x00, "black" :0x07}
 
 ################
 # Node I2C switch
diff --git a/rd_unb2c.py b/rd_unb2c.py
index db0a2df..bd59ab9 100644
--- a/rd_unb2c.py
+++ b/rd_unb2c.py
@@ -44,13 +44,7 @@ def front_led(collor):
             print("Front LED driver not found")
         else:
             front.write_bytes(0x01, collor)
-            sleep(0.5)
-            for cnt in range(6):
-                front.write_bytes(0x01, (1 << cnt%3)^0xff)
-                sleep(0.2)
-            front.write_bytes(0x01, 0)
-            sleep(0.2)
-            front.write_bytes(0x01, 0xf)
+            sleep(1.5)
 
 def read_pol(node_nr, i2c_addr):
     if node_nr >= 0:
@@ -81,8 +75,6 @@ def read_pol(node_nr, i2c_addr):
     if ret_ack < 1:
         print("no device found")
     else:
-    #   pr_stri = "Found device at address 0x{:02x}".format(LOC_PWR.I2C_Address)
-    #   print(pr_stri)
         ret_ack, vout_mod = LOC_PWR.read_bytes(LP_VOUT_MODE, 1)
         ret_ack, raw_value = LOC_PWR.read_bytes(LP_VOUT, 2)
         vout_mod = int(vout_mod,16)
@@ -170,7 +162,9 @@ def read_qsfp(node_nr = 0, module=0):
 
 if 1:
     rw_eeprom(0xCD)
-    front_led(LED_COLORS["green"])
+    for color in list(LED_COLORS.keys()):
+        print(color)
+        front_led(LED_COLORS[color])
     for node_cnt in range(4):
         for module_cnt in range(2):
             read_ddr(node_nr=node_cnt,module=module_cnt)
-- 
GitLab