Implemented @foosel's suggestions + made the blacklist settings actually work [#1026]

(cherry picked from commit 1857f07)
This commit is contained in:
Peter Backx authored and Gina Häußge committed 2017-11-03 12:44:25 +01:00
1 parent 51406b7c42
commit ce16f861b3
4 files changed
+7 -4

No files matched your search

@@ -672,7 +672,7 @@ $(function() {
additionalBaudrates: function() { return _.map(splitTextToArray(self.serial_additionalBaudrates(), ",", true, function(item) { return !isNaN(parseInt(item)); }), function(item) { return parseInt(item); }) },
longRunningCommands: function() { return splitTextToArray(self.serial_longRunningCommands(), ",", true) },
checksumRequiringCommands: function() { return splitTextToArray(self.serial_checksumRequiringCommands(), ",", true) },
autoUppercaseBlacklist: function() { return splitTextToArray(self.serial_autoUppercaseBlacklist(), ",", true) },
autoUppercaseBlacklist: function() { return splitTextToArray(self.serial_autoUppercaseBlacklist(), ",", true) }
},
scripts: {
gcode: function() {
@@ -124,6 +124,11 @@ $(function() {
self.updateFilterRegex();
});
self.blacklist=[];
self.settings.serial_autoUppercaseBlacklist.subscribe(function(newValue) {
self.blacklist = splitTextToArray(newValue, ",", true);
});
self._reenableFancyTimer = undefined;
self._reenableUnfancyTimer = undefined;
self._disableFancy = function(difference) {
@@ -308,7 +313,6 @@ $(function() {
var re = /^([gmt][0-9]+)(\s.*)?/;
var commandMatch = command.match(re);
self.blacklist = splitTextToArray(self.settings.serial_autoUppercaseBlacklist(), ",", true);
if (commandMatch != null) {
command = commandMatch[1].toUpperCase() + ((commandMatch[2] !== undefined) ? commandMatch[2] : "");
if (self.blacklist.indexOf(commandMatch[1].toUpperCase()) < 0){
@@ -145,7 +145,7 @@
<label class="control-label" for="settings-serialAutoUppercaseBlacklist">{{ _('Auto Uppercase Blacklist') }}</label>
<div class="controls">
<input type="text" class="input-block-level" id="settings-serialAutoUppercaseBlacklist" data-bind="value: serial_autoUppercaseBlacklist">
<span class="help-inline">{{ _('Use this to specify the commands that should not be automatically uppercased') }}</span>
<span class="help-inline">{{ _('Use this to specify the commands that should not be automatically uppercased. Comma seperated list.') }}</span>
</div>
</div>
<div class="controls">
-1
View File
@@ -420,7 +420,6 @@ class MachineCom(object):
self._long_running_commands = settings().get(["serial", "longRunningCommands"])
self._checksum_requiring_commands = settings().get(["serial", "checksumRequiringCommands"])
self._auto_uppercase_blacklist = settings().get(["serial", "autoUppercaseBlacklist"])
self._clear_to_send = CountedEvent(max=10, name="comm.clear_to_send")
self._send_queue = SendQueue()