MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / _getTemperatureData

Function _getTemperatureData

src/astroprint/api/printer.py:426–448  ·  view source on GitHub ↗
(filter)

Source from the content-addressed store, hash-verified

424
425
426def _getTemperatureData(filter):
427 pm = printerManager()
428
429 if not pm.isOperational():
430 return make_response("Printer is not operational", 409)
431
432 tempData = pm.getCurrentTemperatures()
433
434 if "history" in request.values.keys() and request.values["history"] in valid_boolean_trues:
435 tempHistory = pm.getTemperatureHistory()
436
437 limit = 300
438 if "limit" in request.values.keys() and unicode(request.values["limit"]).isnumeric():
439 limit = int(request.values["limit"])
440
441 history = list(tempHistory)
442 limit = min(limit, len(history))
443
444 tempData.update({
445 "history": map(lambda x: filter(x), history[-limit:])
446 })
447
448 return filter(tempData)
449
450##~~ Comms
451

Callers 3

printerStateFunction · 0.85
printerToolStateFunction · 0.85
printerBedStateFunction · 0.85

Calls 5

printerManagerFunction · 0.90
getTemperatureHistoryMethod · 0.80
updateMethod · 0.80
isOperationalMethod · 0.45

Tested by

no test coverage detected