klippy: Replace deprecated logger.warn with logger.warning (#6385)
Replace deprecated logger.warn with logger.warning logger.warn will be removed in Python 3.13 Signed-off-by: Thijs Triemstra <info@collab.nl>
This commit is contained in:
parent
3f8f30d612
commit
4688c21c54
|
@ -172,16 +172,16 @@ class PrinterConfig:
|
||||||
autosave_data = data[pos + len(AUTOSAVE_HEADER):].strip()
|
autosave_data = data[pos + len(AUTOSAVE_HEADER):].strip()
|
||||||
# Check for errors and strip line prefixes
|
# Check for errors and strip line prefixes
|
||||||
if "\n#*# " in regular_data:
|
if "\n#*# " in regular_data:
|
||||||
logging.warn("Can't read autosave from config file"
|
logging.warning("Can't read autosave from config file"
|
||||||
" - autosave state corrupted")
|
" - autosave state corrupted")
|
||||||
return data, ""
|
return data, ""
|
||||||
out = [""]
|
out = [""]
|
||||||
for line in autosave_data.split('\n'):
|
for line in autosave_data.split('\n'):
|
||||||
if ((not line.startswith("#*#")
|
if ((not line.startswith("#*#")
|
||||||
or (len(line) >= 4 and not line.startswith("#*# ")))
|
or (len(line) >= 4 and not line.startswith("#*# ")))
|
||||||
and autosave_data):
|
and autosave_data):
|
||||||
logging.warn("Can't read autosave from config file"
|
logging.warning("Can't read autosave from config file"
|
||||||
" - modifications after header")
|
" - modifications after header")
|
||||||
return data, ""
|
return data, ""
|
||||||
out.append(line[4:])
|
out.append(line[4:])
|
||||||
out.append("")
|
out.append("")
|
||||||
|
|
|
@ -95,8 +95,8 @@ class LinearVoltage:
|
||||||
for temp, volt in params:
|
for temp, volt in params:
|
||||||
adc = (volt - voltage_offset) / adc_voltage
|
adc = (volt - voltage_offset) / adc_voltage
|
||||||
if adc < 0. or adc > 1.:
|
if adc < 0. or adc > 1.:
|
||||||
logging.warn("Ignoring adc sample %.3f/%.3f in heater %s",
|
logging.warning("Ignoring adc sample %.3f/%.3f in heater %s",
|
||||||
temp, volt, config.get_name())
|
temp, volt, config.get_name())
|
||||||
continue
|
continue
|
||||||
samples.append((adc, temp))
|
samples.append((adc, temp))
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -126,7 +126,7 @@ class HTU21D:
|
||||||
rdevId |= response[1]
|
rdevId |= response[1]
|
||||||
checksum = response[2]
|
checksum = response[2]
|
||||||
if self._chekCRC8(rdevId) != checksum:
|
if self._chekCRC8(rdevId) != checksum:
|
||||||
logging.warn("htu21d: Reading deviceId !Checksum error!")
|
logging.warning("htu21d: Reading deviceId !Checksum error!")
|
||||||
rdevId = rdevId >> 8
|
rdevId = rdevId >> 8
|
||||||
deviceId_list = list(
|
deviceId_list = list(
|
||||||
filter(
|
filter(
|
||||||
|
@ -135,10 +135,10 @@ class HTU21D:
|
||||||
if len(deviceId_list) != 0:
|
if len(deviceId_list) != 0:
|
||||||
logging.info("htu21d: Found Device Type %s" % deviceId_list[0])
|
logging.info("htu21d: Found Device Type %s" % deviceId_list[0])
|
||||||
else:
|
else:
|
||||||
logging.warn("htu21d: Unknown Device ID %#x " % rdevId)
|
logging.warning("htu21d: Unknown Device ID %#x " % rdevId)
|
||||||
|
|
||||||
if(self.deviceId != deviceId_list[0]):
|
if self.deviceId != deviceId_list[0]:
|
||||||
logging.warn(
|
logging.warning(
|
||||||
"htu21d: Found device %s. Forcing to type %s as config.",
|
"htu21d: Found device %s. Forcing to type %s as config.",
|
||||||
deviceId_list[0],self.deviceId)
|
deviceId_list[0],self.deviceId)
|
||||||
|
|
||||||
|
@ -169,7 +169,9 @@ class HTU21D:
|
||||||
rtemp = response[0] << 8
|
rtemp = response[0] << 8
|
||||||
rtemp |= response[1]
|
rtemp |= response[1]
|
||||||
if self._chekCRC8(rtemp) != response[2]:
|
if self._chekCRC8(rtemp) != response[2]:
|
||||||
logging.warn("htu21d: Checksum error on Temperature reading!")
|
logging.warning(
|
||||||
|
"htu21d: Checksum error on Temperature reading!"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
self.temp = (0.002681 * float(rtemp) - 46.85)
|
self.temp = (0.002681 * float(rtemp) - 46.85)
|
||||||
logging.debug("htu21d: Temperature %.2f " % self.temp)
|
logging.debug("htu21d: Temperature %.2f " % self.temp)
|
||||||
|
@ -190,7 +192,7 @@ class HTU21D:
|
||||||
rhumid = response[0] << 8
|
rhumid = response[0] << 8
|
||||||
rhumid|= response[1]
|
rhumid|= response[1]
|
||||||
if self._chekCRC8(rhumid) != response[2]:
|
if self._chekCRC8(rhumid) != response[2]:
|
||||||
logging.warn("htu21d: Checksum error on Humidity reading!")
|
logging.warning("htu21d: Checksum error on Humidity reading!")
|
||||||
else:
|
else:
|
||||||
#clear status bits,
|
#clear status bits,
|
||||||
# humidity always returns xxxxxx10 in the LSB field
|
# humidity always returns xxxxxx10 in the LSB field
|
||||||
|
|
|
@ -62,7 +62,7 @@ class SensorBase:
|
||||||
last_read_time = self.mcu.clock_to_print_time(last_read_clock)
|
last_read_time = self.mcu.clock_to_print_time(last_read_clock)
|
||||||
self._callback(last_read_time, temp)
|
self._callback(last_read_time, temp)
|
||||||
def report_fault(self, msg):
|
def report_fault(self, msg):
|
||||||
logging.warn(msg)
|
logging.warning(msg)
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
|
@ -33,7 +33,8 @@ class Thermistor:
|
||||||
/ (ln3_r12 - ln3_r13 * ln_r12 / ln_r13))
|
/ (ln3_r12 - ln3_r13 * ln_r12 / ln_r13))
|
||||||
if self.c3 <= 0.:
|
if self.c3 <= 0.:
|
||||||
beta = ln_r13 / inv_t13
|
beta = ln_r13 / inv_t13
|
||||||
logging.warn("Using thermistor beta %.3f in heater %s", beta, name)
|
logging.warning("Using thermistor beta %.3f in heater %s",
|
||||||
|
beta, name)
|
||||||
self.setup_coefficients_beta(t1, r1, beta)
|
self.setup_coefficients_beta(t1, r1, beta)
|
||||||
return
|
return
|
||||||
self.c2 = (inv_t12 - self.c3 * ln3_r12) / ln_r12
|
self.c2 = (inv_t12 - self.c3 * ln3_r12) / ln_r12
|
||||||
|
|
|
@ -137,8 +137,8 @@ class SerialReader:
|
||||||
bustype='socketcan')
|
bustype='socketcan')
|
||||||
bus.send(set_id_msg)
|
bus.send(set_id_msg)
|
||||||
except (can.CanError, os.error) as e:
|
except (can.CanError, os.error) as e:
|
||||||
logging.warn("%sUnable to open CAN port: %s",
|
logging.warning("%sUnable to open CAN port: %s",
|
||||||
self.warn_prefix, e)
|
self.warn_prefix, e)
|
||||||
self.reactor.pause(self.reactor.monotonic() + 5.)
|
self.reactor.pause(self.reactor.monotonic() + 5.)
|
||||||
continue
|
continue
|
||||||
bus.close = bus.shutdown # XXX
|
bus.close = bus.shutdown # XXX
|
||||||
|
|
Loading…
Reference in New Issue