From 0a9fd4562579fb8f9b162605f83167562ff482c2 Mon Sep 17 00:00:00 2001
From: Gijs Schoonderbeek <schoonderbeek@astron.nl>
Date: Tue, 6 Dec 2022 18:08:42 +0100
Subject: [PATCH] Back to working

---
 I2C_serial_pi2.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/I2C_serial_pi2.py b/I2C_serial_pi2.py
index f85dc66..5ae5af3 100644
--- a/I2C_serial_pi2.py
+++ b/I2C_serial_pi2.py
@@ -38,6 +38,8 @@ class I2C:
         try:
             (count, rd_value) = pi.i2c_read_i2c_block_data(bus, register, bytes_to_read)
             ret_value = ''
+            if len(rd_value) < bytes_to_read:
+                return False, 999
             for cnt in range(bytes_to_read):
                 ret_value += (hex(rd_value[cnt])[2:])
             ret_ack = 1
-- 
GitLab