diff --git a/Marlin/configurator/config/Configuration.h b/Marlin/configurator/config/Configuration.h index 770c86eb1..13d5545e4 100644 --- a/Marlin/configurator/config/Configuration.h +++ b/Marlin/configurator/config/Configuration.h @@ -51,6 +51,7 @@ Here are some standard links for getting your machine calibrated: #define SERIAL_PORT 0 // This determines the communication speed of the printer +// :[2400,9600,19200,38400,57600,115200,250000] #define BAUDRATE 250000 // This enables the serial port associated to the Bluetooth interface diff --git a/Marlin/configurator/config/_htaccess b/Marlin/configurator/config/_htaccess new file mode 100644 index 000000000..f28955094 --- /dev/null +++ b/Marlin/configurator/config/_htaccess @@ -0,0 +1 @@ +Header set Access-Control-Allow-Origin "*" diff --git a/Marlin/configurator/css/configurator.css b/Marlin/configurator/css/configurator.css index 620311475..e9ef345d9 100644 --- a/Marlin/configurator/css/configurator.css +++ b/Marlin/configurator/css/configurator.css @@ -1,22 +1,82 @@ /* configurator.css */ /* Styles for Marlin Configurator */ -body { margin: 0; padding: 0; background: #56A; color: #FFC; font-family: sans-serif; } -fieldset { height: 16.1em; overflow: auto; margin-top: 10px; } -#main { max-width: 1000px; margin: 0 auto; } -#main { padding: 0 4%; width: 92%; } -#main { font-family: monospace; } -h1, #message { text-align: center; } +.clear { clear: both; } + +/* Prevent selection except PRE tags */ +* { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + } +pre { + -webkit-touch-callout: text; + -webkit-user-select: text; + -khtml-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + } + +body { margin: 0; padding: 0; background: #56A; color: #000; font-family: monospace; } +#main { + max-width: 1000px; + margin: 0 auto; + padding: 0 4%; width: 92%; + } + +h1, h2, h3, h4, h5, h6 { clear: both; } + +h1, p.info { font-family: sans-serif; } +h1 { + background: transparent url(logo.png) right top no-repeat; + height: 38px; + margin-bottom: -30px; + } +p.info { padding: 0; color: #000; } +p.info span { color: #800; } + +#message { text-align: center; } #message { width: 80%; margin: 0 auto 0.25em; color: #FF0; } #message p { padding: 2px 0; } #message p.error, #message p.message { color: #F00; background: #FF4; font-weight: bold; border-radius: 0.8em; } #message p.message { color: #080; background: #CFC; } +#message p.message span { + color: #A00; + background: rgba(255, 255, 255, 1); + border: 1px solid rgba(0,0,0,0.5); + border-radius: 1em; + float: right; + margin-right: 0.5em; + padding: 0 3px; + font-family: sans-serif; + font-size: small; + position: relative; + top: -1px; + } -.info { color: #AAF; } -.info span { color: #FFF; } -.info span span { color: #000; font-weight: bold; } #help strong { color: #0DD; } img { display: none; } + +/* Forms */ + +#config_form { + display: block; + background: #EEE; + padding: 6px 20px 20px; + color: #000; + position: relative; + border-top-right-radius: 1.5em; + } +fieldset { + height: 16.1em; + overflow-y: scroll; + overflow-x: hidden; + margin-top: 10px; + } label, input, select, textarea { display: block; float: left; margin: 1px 0; } label.newline, textarea, fieldset { clear: both; } label { @@ -28,31 +88,9 @@ label { } input[type="text"], select { margin: 0.75em 0 0; } input[type="checkbox"], input[type="radio"], input[type="file"] { margin: 1em 0 0; } -#config_form { - display: block; - background: #EEE; - padding: 6px 20px 20px; - color: #000; - position: relative; - } - -/*#config_text, #config_adv_text { font-family: "Andale mono", monospace; clear: both; }*/ -#config_text, #config_adv_text { - height: 25em; - padding: 10px; - border: 2px solid #888; - border-radius: 5px; - overflow: auto; - background-color: #FFF; - color: #000; - font-family: "Fira Mono"; - font-size: small; - } input[type="checkbox"], input[type="radio"].enabler { margin-left: 1em; } + input:disabled { color: #BBB; } -.clear { clear: both; } -h1, h2, h3, h4, h5, h6 { clear: both; } -h2 { margin: 0; padding: 1em 0 0; } ul.tabs { padding: 0; list-style: none; } ul.tabs li { display: inline; } @@ -100,6 +138,8 @@ fieldset legend { display: none; } #serial_stepper { padding-top: 0.75em; display: block; float: left; } #SERIAL_PORT { display: none; } +/* Tooltips */ + #tooltip { display: none; max-width: 30em; @@ -138,18 +178,61 @@ fieldset legend { display: none; } } #tooltip>strong { color: #00B; } -span.disclose { +/* Tooltips Checkbox */ + +#tipson { float: right; font-weight: bold; font-size: 100%; font-family: helvetica; } +#tipson input { float: none; display: inline; } + +/* Config Text */ + +pre.config { + height: 25em; + padding: 10px; + border: 2px solid #888; + border-radius: 5px; + overflow: auto; + clear: both; + background-color: #FFF; + color: #000; + font-family: "Fira Mono"; + font-size: small; + } + +/* Pre Headers */ + +h2 { + width: 100%; + margin: 12px -300px 4px 0; + padding: 0; + float: left; + } + +/* Disclosure Widget */ + +span.disclose, a.download {︎ + display: block; float: right; - margin-top: -10px; + margin-top: 12px; + } + +span.disclose { + margin-right: -10px; /* total width */ + margin-left: 14px; width: 0; height: 0; + position: relative; + left: 3px; + top: 3px; cursor: pointer; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 10px solid #000; } span.disclose.closed { - margin: -14px 4px 0 0; + margin-right: -8px; /* total width */ + margin-left: 10px; + left: 0; + top: 0; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-right: 10px solid #000; @@ -160,9 +243,26 @@ span.disclose.almost { transform: rotate(45deg); } span.disclose.closed.almost { + left: 1px; + top: 3px; -ms-transform: rotate(315deg); /* IE 9 */ -webkit-transform: rotate(315deg); /* Chrome, Safari, Opera */ transform: rotate(315deg); } -#tipson { float: right; font-weight: bold; font-size: 100%; font-family: helvetica; } -#tipson input { float: none; display: inline; } + +/* Download Button */ + +a.download { + visibility: hidden; + padding: 2px; + border: 1px solid #494; + border-radius: 4px; + margin: 12px 0 0; + background: #FFF; + color: #494; + font-family: sans-serif; + font-size: small; + font-weight: bold; + text-decoration: none; + } + diff --git a/Marlin/configurator/css/logo.png b/Marlin/configurator/css/logo.png new file mode 100644 index 000000000..0618dc17a Binary files /dev/null and b/Marlin/configurator/css/logo.png differ diff --git a/Marlin/configurator/index.html b/Marlin/configurator/index.html index 46f862bf1..ffd4a36f5 100644 --- a/Marlin/configurator/index.html +++ b/Marlin/configurator/index.html @@ -2,7 +2,7 @@ - Marlin Configurator + Marlin Firmware Configurator @@ -15,11 +15,9 @@

Marlin Configurator

+

Select presets (coming soon), modify, and download.

-
-

Enter values in the form, get a Marlin configuration.
Will include a drop-down of known configurations.

-
- +
@@ -83,10 +81,19 @@ More… -

Marlin/Configuration.h

-

-        

Marlin/Configuration_adv.h

-

+        
+

Configuration.h

+ + Download +

+        
+ +
+

Configuration_adv.h

+ + Download +

+        

diff --git a/Marlin/configurator/js/configurator.js b/Marlin/configurator/js/configurator.js index 7ebda3543..88af7d652 100644 --- a/Marlin/configurator/js/configurator.js +++ b/Marlin/configurator/js/configurator.js @@ -16,7 +16,62 @@ $(function(){ -var marlin_config = 'https://api.github.com/repos/MarlinFirmware/Marlin/contents/Marlin'; +/** + * Github API useful GET paths. (Start with "https://api.github.com/repos/:owner/:repo/") + * + * contributors Get a list of contributors + * tags Get a list of tags + * contents/[path]?ref=branch/tag/commit Get the contents of a file + */ + + // GitHub + // Warning! Limited to 60 requests per hour! +var config = { + type: 'github', + host: 'https://api.github.com', + owner: 'thinkyhead', + repo: 'Marlin', + ref: 'marlin_configurator', + path: 'Marlin/configurator/config' +}; +/**/ + +/* // Remote +var config = { + type: 'remote', + host: 'http://www.thinkyhead.com', + path: '_marlin/config' +}; +/**/ + +/* // Local +var config = { + type: 'local', + path: 'config' +}; +/**/ + +function github_command(conf, command, path) { + var req = conf.host+'/repos/'+conf.owner+'/'+conf.repo+'/'+command; + if (path) req += '/' + path; + return req; +} +function config_path(item) { + var path = '', ref = ''; + switch(config.type) { + case 'github': + path = github_command(config, 'contents', config.path); + if (config.ref !== undefined) ref = '?ref=' + config.ref; + break; + case 'remote': + path = config.host + '/' + config.path + '/'; + break; + case 'local': + path = config.path + '/'; + break; + } + return path + '/' + item + ref; +} // Extend builtins String.prototype.lpad = function(len, chr) { @@ -25,6 +80,7 @@ String.prototype.lpad = function(len, chr) { if (need > 0) { s = new Array(need+1).join(chr) + s; } return s; }; + String.prototype.prePad = function(len, chr) { return len ? this.lpad(len, chr) : this; }; String.prototype.zeroPad = function(len) { return this.prePad(len, '0'); }; String.prototype.toHTML = function() { return jQuery('
').text(this).html(); }; @@ -36,6 +92,19 @@ Number.prototype.limit = function(m1, m2) { if (m2 == null) return this > m1 ? m1 : this; return this < m1 ? m1 : this > m2 ? m2 : this; }; +Date.prototype.fileStamp = function(filename) { + var fs = this.getFullYear() + + ((this.getMonth()+1)+'').zeroPad(2) + + (this.getDate()+'').zeroPad(2) + + (this.getHours()+'').zeroPad(2) + + (this.getMinutes()+'').zeroPad(2) + + (this.getSeconds()+'').zeroPad(2); + + if (filename !== undefined) + return filename.replace(/^(.+)(\.\w+)$/g, '$1-['+fs+']$2'); + + return fs; +} /** * selectField.addOptions takes an array or keyed object @@ -49,6 +118,12 @@ $.fn.extend({ sel.append( $('