background daemon now disables heartbeat for itself
This commit is contained in:
parent
a81fd4204b
commit
bb4483b141
2 changed files with 12 additions and 4 deletions
|
@ -10,6 +10,7 @@ SPI_BUS = 1
|
|||
SPI_DEVICE = 2
|
||||
SPI_SPEED = 1000000
|
||||
SPI_BUFFER_SIZE = 32
|
||||
SPI_HEALTH = True
|
||||
|
||||
spi = spidev.SpiDev()
|
||||
spi.open(SPI_BUS, SPI_DEVICE)
|
||||
|
@ -179,8 +180,13 @@ class Spi(object):
|
|||
health_check_thread.setDaemon(True)
|
||||
health_check_thread.start()
|
||||
|
||||
@staticmethod
|
||||
def disable_health_check():
|
||||
global SPI_HEALTH
|
||||
SPI_HEALTH = False
|
||||
|
||||
@staticmethod
|
||||
def health_check_loop():
|
||||
while True:
|
||||
while SPI_HEALTH:
|
||||
Spi.health_check()
|
||||
time.sleep(0.5)
|
||||
|
|
Reference in a new issue