Cleaned up log messages
This commit is contained in:
parent
4d4c0c30d9
commit
f06a5f84df
@ -71,10 +71,10 @@ def trapsignal(signalnum, frame):
|
|||||||
|
|
||||||
|
|
||||||
def getData():
|
def getData():
|
||||||
info(f"requesting data from {octoprint}...")
|
debug(f"requesting data from {octoprint}...")
|
||||||
jsondata=requests.get(fullurl, verify=False).json()
|
jsondata=requests.get(fullurl, verify=False).json()
|
||||||
jsondatatwo=requests.get(fullurltwo, verify=False).json()
|
jsondatatwo=requests.get(fullurltwo, verify=False).json()
|
||||||
info(f"Data received. Porgcessing.")
|
info(f"Received data from {octoprint}")
|
||||||
state=""
|
state=""
|
||||||
if jsondatatwo["state"]["flags"]["paused"]:
|
if jsondatatwo["state"]["flags"]["paused"]:
|
||||||
state="paused"
|
state="paused"
|
||||||
@ -105,7 +105,7 @@ def getData():
|
|||||||
return (jobdata,datetime.datetime.now())
|
return (jobdata,datetime.datetime.now())
|
||||||
|
|
||||||
def drawData(jobdata,lastupdate):
|
def drawData(jobdata,lastupdate):
|
||||||
info(f"Loading fonts and images")
|
debug(f"Loading fonts and images")
|
||||||
font14 = ImageFont.truetype(os.path.join(imgdir, 'Font.ttc'), 14)
|
font14 = ImageFont.truetype(os.path.join(imgdir, 'Font.ttc'), 14)
|
||||||
font16 = ImageFont.truetype(os.path.join(imgdir, 'Font.ttc'), 16)
|
font16 = ImageFont.truetype(os.path.join(imgdir, 'Font.ttc'), 16)
|
||||||
font18 = ImageFont.truetype(os.path.join(imgdir, 'Font.ttc'), 18)
|
font18 = ImageFont.truetype(os.path.join(imgdir, 'Font.ttc'), 18)
|
||||||
@ -113,7 +113,7 @@ def drawData(jobdata,lastupdate):
|
|||||||
font24 = ImageFont.truetype(os.path.join(imgdir, 'Font.ttc'), 24)
|
font24 = ImageFont.truetype(os.path.join(imgdir, 'Font.ttc'), 24)
|
||||||
# LOAD OUR BACKGROUND
|
# LOAD OUR BACKGROUND
|
||||||
bg = Image.open(os.path.join(imgdir, 'backgroundv2.bmp'))
|
bg = Image.open(os.path.join(imgdir, 'backgroundv2.bmp'))
|
||||||
info(f"Initializing ePaper display")
|
debug(f"Initializing ePaper display")
|
||||||
epd.init()
|
epd.init()
|
||||||
paper = Image.new('1', (epd.width, epd.height), 255) # Blank canvas
|
paper = Image.new('1', (epd.width, epd.height), 255) # Blank canvas
|
||||||
draw = ImageDraw.Draw(paper)
|
draw = ImageDraw.Draw(paper)
|
||||||
@ -127,7 +127,7 @@ def drawData(jobdata,lastupdate):
|
|||||||
# lastlayer (125,162) lastlayertime
|
# lastlayer (125,162) lastlayertime
|
||||||
# lastupdate (117,250)
|
# lastupdate (117,250)
|
||||||
# lastrefresh (117,278)
|
# lastrefresh (117,278)
|
||||||
info(f"Preparing job data on canvas...")
|
debug(f"Preparing job data on canvas...")
|
||||||
if len(jobdata['file']) < 20:
|
if len(jobdata['file']) < 20:
|
||||||
draw.text((60, 6), jobdata['file'], font = font18, fill = 0)
|
draw.text((60, 6), jobdata['file'], font = font18, fill = 0)
|
||||||
else:
|
else:
|
||||||
@ -159,7 +159,6 @@ try:
|
|||||||
info("Octopi print monitor starting...")
|
info("Octopi print monitor starting...")
|
||||||
# INIT
|
# INIT
|
||||||
epd = epd4in2.EPD()
|
epd = epd4in2.EPD()
|
||||||
info("init and Clear")
|
|
||||||
epd.init()
|
epd.init()
|
||||||
epd.Clear()
|
epd.Clear()
|
||||||
|
|
||||||
@ -168,7 +167,7 @@ try:
|
|||||||
(jobdata,lastupdate)=getData()
|
(jobdata,lastupdate)=getData()
|
||||||
drawData(jobdata,lastupdate)
|
drawData(jobdata,lastupdate)
|
||||||
if jobdata['percent'] == "100" or jobdata['bedtarget'] == jobdata['target']:
|
if jobdata['percent'] == "100" or jobdata['bedtarget'] == jobdata['target']:
|
||||||
info("Jobs idle - sleeping for 5 minutes")
|
info("Printer idle - sleeping for 5 minutes")
|
||||||
delay=10
|
delay=10
|
||||||
while delay>0:
|
while delay>0:
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
@ -180,14 +179,14 @@ try:
|
|||||||
else:
|
else:
|
||||||
debug(f"30s sleep loop hupped: {hupped}")
|
debug(f"30s sleep loop hupped: {hupped}")
|
||||||
else:
|
else:
|
||||||
info("Print in progress - sleeping for 30 seconds")
|
info("Printer active - sleeping for 30 seconds")
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
|
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
error(e)
|
error(e)
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
critical("ctrl + c:")
|
critical("Caught interrupt - cleanly exiting")
|
||||||
epd.init()
|
epd.init()
|
||||||
epd4in2.epdconfig.module_exit()
|
epd4in2.epdconfig.module_exit()
|
||||||
exit()
|
exit()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user