Rename currentLine to current_line
This commit is contained in:
1 parent
d25f664be3
commit
ee93e25ffd
3 files changed
+18
-17
No files matched your search
@@ -105,6 +105,7 @@ date of first contribution):
|
||||
* [Nicolai Nielsen](https://github.com/dovecode)
|
||||
* [Janne Mäntyharju](https://github.com/JanneMantyharju)
|
||||
* [Steven Spungin](https://github.com/flamenco)
|
||||
* [Piotr Usewicz](https://github.com/pusewicz)
|
||||
|
||||
OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by
|
||||
[Daid Braam](https://github.com/daid). Parts of its communication layer and
|
||||
|
||||
@@ -137,7 +137,7 @@ class VirtualPrinter(object):
|
||||
self._temperature_reporter = None
|
||||
self._sdstatus_reporter = None
|
||||
|
||||
self.currentLine = 0
|
||||
self.current_line = 0
|
||||
self.lastN = 0
|
||||
|
||||
self._incoming_lock = threading.RLock()
|
||||
@@ -205,7 +205,7 @@ class VirtualPrinter(object):
|
||||
|
||||
self._heatingUp = False
|
||||
|
||||
self.currentLine = 0
|
||||
self.current_line = 0
|
||||
self.lastN = 0
|
||||
|
||||
self._debug_awol = False
|
||||
@@ -312,10 +312,10 @@ class VirtualPrinter(object):
|
||||
checksum = int(data[data.rfind("*") + 1:])
|
||||
data = data[:data.rfind("*")]
|
||||
if not checksum == self._calculate_checksum(data):
|
||||
self._triggerResend(expected=self.currentLine + 1)
|
||||
self._triggerResend(expected=self.current_line + 1)
|
||||
continue
|
||||
|
||||
self.currentLine += 1
|
||||
self.current_line += 1
|
||||
elif settings().getBoolean(["devel", "virtualPrinter", "forceChecksum"]):
|
||||
self._send(self._error("checksum_missing"))
|
||||
continue
|
||||
@@ -324,7 +324,7 @@ class VirtualPrinter(object):
|
||||
if data.startswith("N") and "M110" in data:
|
||||
linenumber = int(re.search("N([0-9]+)", data).group(1))
|
||||
self.lastN = linenumber
|
||||
self.currentLine = linenumber
|
||||
self.current_line = linenumber
|
||||
|
||||
self._triggerResendAt100 = True
|
||||
self._triggerResendWithTimeoutAt105 = True
|
||||
|
||||
+12
-12
@@ -454,7 +454,7 @@ class MachineCom(object):
|
||||
self._sdRelativePath = settings().getBoolean(["serial", "sdRelativePath"])
|
||||
self._blockWhileDwelling = settings().getBoolean(["serial", "blockWhileDwelling"])
|
||||
self._send_m112_on_error = settings().getBoolean(["serial", "sendM112OnError"])
|
||||
self._currentLine = 1
|
||||
self._current_line = 1
|
||||
self._line_mutex = threading.RLock()
|
||||
self._resendDelta = None
|
||||
|
||||
@@ -2488,7 +2488,7 @@ class MachineCom(object):
|
||||
self._send_queue.clear()
|
||||
|
||||
with self._line_mutex:
|
||||
self._currentLine = 0
|
||||
self._current_line = 0
|
||||
self._lastLines.clear()
|
||||
|
||||
self.sayHello(tags={"trigger:comm.on_external_reset"})
|
||||
@@ -2894,17 +2894,17 @@ class MachineCom(object):
|
||||
if lineToResend is None:
|
||||
return False
|
||||
|
||||
if self._resendDelta is None and lineToResend == self._currentLine == 1:
|
||||
if self._resendDelta is None and lineToResend == self._current_line == 1:
|
||||
# We probably just handled a resend and this request originates from lines sent before that
|
||||
self._logger.info("Got a resend request for line 1 which is also our current line. It looks "
|
||||
"like we just handled a reset and this is a left over of this")
|
||||
return False
|
||||
|
||||
elif self._resendDelta is None and lineToResend == self._currentLine:
|
||||
elif self._resendDelta is None and lineToResend == self._current_line:
|
||||
# We don't expect to have an active resend request and the printer is requesting a resend of
|
||||
# a line we haven't yet sent.
|
||||
#
|
||||
# This means the printer got a line from us with N = self._currentLine - 1 but had already
|
||||
# This means the printer got a line from us with N = self._current_line - 1 but had already
|
||||
# acknowledged that. This can happen if the last line was resent due to a timeout during
|
||||
# an active (prior) resend request.
|
||||
#
|
||||
@@ -2916,7 +2916,7 @@ class MachineCom(object):
|
||||
lastCommError = self._lastCommError
|
||||
self._lastCommError = None
|
||||
|
||||
resendDelta = self._currentLine - lineToResend
|
||||
resendDelta = self._current_line - lineToResend
|
||||
|
||||
if lastCommError is not None \
|
||||
and ("line number" in lastCommError.lower() or "expected line" in lastCommError.lower()) \
|
||||
@@ -2947,7 +2947,7 @@ class MachineCom(object):
|
||||
if self._resendDelta > len(self._lastLines) or len(self._lastLines) == 0 or self._resendDelta < 0:
|
||||
error_text = "Printer requested line {} but no sufficient history is available, can't resend".format(lineToResend)
|
||||
self._log(error_text)
|
||||
self._logger.warn(error_text + ". Printer requested line {}, current line is {}, line history has {} entries.".format(lineToResend, self._currentLine, len(self._lastLines)))
|
||||
self._logger.warn(error_text + ". Printer requested line {}, current line is {}, line history has {} entries.".format(lineToResend, self._current_line, len(self._lastLines)))
|
||||
if self.isPrinting():
|
||||
# abort the print & disconnect, there's nothing we can do to rescue it
|
||||
self._trigger_error(error_text, "resend")
|
||||
@@ -2969,7 +2969,7 @@ class MachineCom(object):
|
||||
self._log_resends_rate_count = 0
|
||||
|
||||
self._to_logfile_with_terminal(u"Got a resend request from the printer: requested line = {}, "
|
||||
u"current line = {}".format(lineToResend, self._currentLine))
|
||||
u"current line = {}".format(lineToResend, self._current_line))
|
||||
self._log_resends_rate_count += 1
|
||||
|
||||
self._send_queue.resend_active = True
|
||||
@@ -3013,7 +3013,7 @@ class MachineCom(object):
|
||||
return False
|
||||
|
||||
cmd = self._lastLines[-self._resendDelta]
|
||||
lineNumber = self._currentLine - self._resendDelta
|
||||
lineNumber = self._current_line - self._resendDelta
|
||||
|
||||
result = self._enqueue_for_sending(cmd, linenumber=lineNumber, resend=True)
|
||||
|
||||
@@ -3417,9 +3417,9 @@ class MachineCom(object):
|
||||
|
||||
def _do_increment_and_send_with_checksum(self, cmd):
|
||||
with self._line_mutex:
|
||||
linenumber = self._currentLine
|
||||
linenumber = self._current_line
|
||||
self._addToLastLines(cmd)
|
||||
self._currentLine += 1
|
||||
self._current_line += 1
|
||||
self._do_send_with_checksum(cmd, linenumber)
|
||||
|
||||
def _do_send_with_checksum(self, command, linenumber):
|
||||
@@ -3704,7 +3704,7 @@ class MachineCom(object):
|
||||
self._logger.info("M110 detected, setting current line number to {}".format(newLineNumber))
|
||||
|
||||
# send M110 command with new line number
|
||||
self._currentLine = newLineNumber
|
||||
self._current_line = newLineNumber
|
||||
|
||||
# after a reset of the line number we have no way to determine what line exactly the printer now wants
|
||||
self._lastLines.clear()
|
||||
|
||||
Reference in new issue
Block a user