log is ignoring filtered messages.

This commit is contained in:
Teja 2015-07-09 16:42:38 +02:00
parent 7b548763f5
commit 691d8e8d85
2 changed files with 8 additions and 28 deletions

View file

@ -2,31 +2,7 @@
//function TerminalViewModel(loginStateViewModel, settingsViewModel) {
//
// self.log = [];
//
// self.command = ko.observable(undefined);
//
// self.isErrorOrClosed = ko.observable(undefined);
// self.isOperational = ko.observable(undefined);
// self.isPrinting = ko.observable(undefined);
// self.isPaused = ko.observable(undefined);
// self.isError = ko.observable(undefined);
// self.isReady = ko.observable(undefined);
// self.isLoading = ko.observable(undefined);
//
// self.autoscrollEnabled = ko.observable(true);
//
// self.filters = self.settings.terminalFilters;
// self.filterRegex = undefined;
//
// self.cmdHistory = [];
// self.cmdHistoryIdx = -1;
//
// self.activeFilters = ko.observableArray([]);
// self.activeFilters.subscribe(function(e) {
// self.updateFilterRegex();
// self.updateOutput();
// });
//
//
@ -167,7 +143,12 @@ $(function() {
};
self._processCurrentLogData = function(data) {
self.log(self.log().concat(_.map(data, function(line) { return self._toInternalFormat(line) })));
var regex = self.filterRegex();
var lineVisible = function(line) {
return regex == undefined || !line.match(regex);
};
var filtered_data = _.filter(data, lineVisible);
self.log(self.log().concat(_.map(filtered_data, function(line) { return self._toInternalFormat(line) })));
if (self.autoscrollEnabled()) {
self.log(self.log.slice(-300));
}

View file

@ -1183,9 +1183,8 @@ class MachineCom(object):
if(cmd != '?'):
self._log("Send: %s" % cmd)
chars_in_buffer = sum(self.line_lengths)
# TODO needs debugging. it interferes with ordinary commands.
if(not realtime_cmd and (chars_in_buffer + len(cmd)+1 >= self.RX_BUFFER_SIZE-1)): # queue command if arduino serial buffer is full
self._log("RX buffer [%d/%d], queuing cmd %d : %s" % (chars_in_buffer, self.RX_BUFFER_SIZE, self.gcode_line_counter, cmd))
#self._log("queuing cmd %d : %s " % (chars_in_buffer, self.RX_BUFFER_SIZE, self.gcode_line_counter, cmd))
self._commandQueue.put(cmd)
else:
self.line_lengths.append(len(cmd)+1) # count chars sent to the arduino