diff --git a/compLib/IRSensor.py b/compLib/IRSensor.py index 01b3abe..8f2cf3a 100644 --- a/compLib/IRSensor.py +++ b/compLib/IRSensor.py @@ -33,12 +33,12 @@ class IRSensor(object): raise IndexError("Invalid sensor specified!") if sensor == 1: - Spi.write(Register.IR_1_LED, on) + Spi.write(Register.IR_1_LED, 1, on) elif sensor == 2: - Spi.write(Register.IR_2_LED, on) + Spi.write(Register.IR_2_LED, 1, on) elif sensor == 3: - Spi.write(Register.IR_3_LED, on) + Spi.write(Register.IR_3_LED, 1, on) elif sensor == 4: - Spi.write(Register.IR_4_LED, on) + Spi.write(Register.IR_4_LED, 1, on) elif sensor == 5: - Spi.write(Register.IR_5_LED, on) \ No newline at end of file + Spi.write(Register.IR_5_LED, 1, on) \ No newline at end of file diff --git a/compLib/Spi.py b/compLib/Spi.py index 0e53dd2..cab8ad9 100644 --- a/compLib/Spi.py +++ b/compLib/Spi.py @@ -2,8 +2,9 @@ import spidev from threading import Thread, Lock from enum import IntEnum import time +import sys -from compLib.LogstashLogging import logstash_logger +from compLib.LogstashLogging import Logging SPI_BUS = 1 SPI_DEVICE = 2 @@ -100,7 +101,7 @@ class Spi(object): rx_buffer = spi.xfer([0] * 32) if rx_buffer[1] != write_reg: - logstash_logger.error(f"SPI error during read/write of register {write_reg}!") + Logging.get_logger().error(f"SPI error during read/write of register {write_reg}!") return rx_buffer @@ -159,8 +160,9 @@ class Spi(object): @staticmethod def health_check(): if Spi.read(Register.IDENTIFICATION_MODEL_ID, 1) != 3: - logstash_logger.error(f"Unable to read Version! Make sure the mainboard is connected!") - quit() + Logging.get_logger().error(f"Unable to read Version! Make sure the mainboard is connected!") + print("Unable to read Version! Make sure the mainboard is connected!") + sys.exit() @staticmethod def health_check_loop():