19 | Marlin Configurator
20 | Select presets (coming soon), modify, and download.
21 |
22 |
23 |
24 |
25 |
127 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/CR-10s Firmware (Marlin)/CR10S-Factory-Thermal-Protection-Enabled/Marlin/configurator/js/FileSaver.min.js:
--------------------------------------------------------------------------------
1 | /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
2 | var saveAs=saveAs||typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob&&navigator.msSaveOrOpenBlob.bind(navigator)||function(view){"use strict";if(typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var doc=view.document,get_URL=function(){return view.URL||view.webkitURL||view},save_link=doc.createElementNS("http://www.w3.org/1999/xhtml","a"),can_use_save_link="download"in save_link,click=function(node){var event=doc.createEvent("MouseEvents");event.initMouseEvent("click",true,false,view,0,0,0,0,0,false,false,false,false,0,null);node.dispatchEvent(event)},webkit_req_fs=view.webkitRequestFileSystem,req_fs=view.requestFileSystem||webkit_req_fs||view.mozRequestFileSystem,throw_outside=function(ex){(view.setImmediate||view.setTimeout)(function(){throw ex},0)},force_saveable_type="application/octet-stream",fs_min_size=0,arbitrary_revoke_timeout=500,revoke=function(file){var revoker=function(){if(typeof file==="string"){get_URL().revokeObjectURL(file)}else{file.remove()}};if(view.chrome){revoker()}else{setTimeout(revoker,arbitrary_revoke_timeout)}},dispatch=function(filesaver,event_types,event){event_types=[].concat(event_types);var i=event_types.length;while(i--){var listener=filesaver["on"+event_types[i]];if(typeof listener==="function"){try{listener.call(filesaver,event||filesaver)}catch(ex){throw_outside(ex)}}}},FileSaver=function(blob,name){var filesaver=this,type=blob.type,blob_changed=false,object_url,target_view,dispatch_all=function(){dispatch(filesaver,"writestart progress write writeend".split(" "))},fs_error=function(){if(blob_changed||!object_url){object_url=get_URL().createObjectURL(blob)}if(target_view){target_view.location.href=object_url}else{var new_tab=view.open(object_url,"_blank");if(new_tab==undefined&&typeof safari!=="undefined"){view.location.href=object_url}}filesaver.readyState=filesaver.DONE;dispatch_all();revoke(object_url)},abortable=function(func){return function(){if(filesaver.readyState!==filesaver.DONE){return func.apply(this,arguments)}}},create_if_not_found={create:true,exclusive:false},slice;filesaver.readyState=filesaver.INIT;if(!name){name="download"}if(can_use_save_link){object_url=get_URL().createObjectURL(blob);save_link.href=object_url;save_link.download=name;click(save_link);filesaver.readyState=filesaver.DONE;dispatch_all();revoke(object_url);return}if(view.chrome&&type&&type!==force_saveable_type){slice=blob.slice||blob.webkitSlice;blob=slice.call(blob,0,blob.size,force_saveable_type);blob_changed=true}if(webkit_req_fs&&name!=="download"){name+=".download"}if(type===force_saveable_type||webkit_req_fs){target_view=view}if(!req_fs){fs_error();return}fs_min_size+=blob.size;req_fs(view.TEMPORARY,fs_min_size,abortable(function(fs){fs.root.getDirectory("saved",create_if_not_found,abortable(function(dir){var save=function(){dir.getFile(name,create_if_not_found,abortable(function(file){file.createWriter(abortable(function(writer){writer.onwriteend=function(event){target_view.location.href=file.toURL();filesaver.readyState=filesaver.DONE;dispatch(filesaver,"writeend",event);revoke(file)};writer.onerror=function(){var error=writer.error;if(error.code!==error.ABORT_ERR){fs_error()}};"writestart progress write abort".split(" ").forEach(function(event){writer["on"+event]=filesaver["on"+event]});writer.write(blob);filesaver.abort=function(){writer.abort();filesaver.readyState=filesaver.DONE};filesaver.readyState=filesaver.WRITING}),fs_error)}),fs_error)};dir.getFile(name,{create:false},abortable(function(file){file.remove();save()}),abortable(function(ex){if(ex.code===ex.NOT_FOUND_ERR){save()}else{fs_error()}}))}),fs_error)}),fs_error)},FS_proto=FileSaver.prototype,saveAs=function(blob,name){return new FileSaver(blob,name)};FS_proto.abort=function(){var filesaver=this;filesaver.readyState=filesaver.DONE;dispatch(filesaver,"abort")};FS_proto.readyState=FS_proto.INIT=0;FS_proto.WRITING=1;FS_proto.DONE=2;FS_proto.error=FS_proto.onwritestart=FS_proto.onprogress=FS_proto.onwrite=FS_proto.onabort=FS_proto.onerror=FS_proto.onwriteend=null;return saveAs}(typeof self!=="undefined"&&self||typeof window!=="undefined"&&window||this.content);if(typeof module!=="undefined"&&module.exports){module.exports.saveAs=saveAs}else if(typeof define!=="undefined"&&define!==null&&define.amd!=null){define([],function(){return saveAs})}
3 |
--------------------------------------------------------------------------------
/CR-10s Firmware (Marlin)/CR10S-Factory-Thermal-Protection-Enabled/Marlin/configurator/js/binaryfileuploader.js:
--------------------------------------------------------------------------------
1 | function BinaryFileUploader(o) {
2 | this.options = null;
3 |
4 |
5 | this._defaultOptions = {
6 | element: null, // HTML file element
7 | onFileLoad: function(file) {
8 | console.log(file.toString());
9 | }
10 | };
11 |
12 |
13 | this._init = function(o) {
14 | if (!this.hasFileUploaderSupport()) return;
15 |
16 | this._verifyDependencies();
17 |
18 | this.options = this._mergeObjects(this._defaultOptions, o);
19 | this._verifyOptions();
20 |
21 | this.addFileChangeListener();
22 | }
23 |
24 |
25 | this.hasFileUploaderSupport = function() {
26 | return !!(window.File && window.FileReader && window.FileList && window.Blob);
27 | }
28 |
29 | this.addFileChangeListener = function() {
30 | this.options.element.addEventListener(
31 | 'change',
32 | this._bind(this, this.onFileChange)
33 | );
34 | }
35 |
36 | this.onFileChange = function(e) {
37 | // TODO accept multiple files
38 | var file = e.target.files[0],
39 | reader = new FileReader();
40 |
41 | reader.onload = this._bind(this, this.onFileLoad);
42 | reader.readAsBinaryString(file);
43 | }
44 |
45 | this.onFileLoad = function(e) {
46 | var content = e.target.result,
47 | string = new BinaryString(content);
48 | this.options.onFileLoad(string);
49 | }
50 |
51 |
52 | this._mergeObjects = function(starting, override) {
53 | var merged = starting;
54 | for (key in override) merged[key] = override[key];
55 |
56 | return merged;
57 | }
58 |
59 | this._verifyOptions = function() {
60 | if (!(this.options.element && this.options.element.type && this.options.element.type === 'file')) {
61 | throw 'Invalid element param in options. Must be a file upload DOM element';
62 | }
63 |
64 | if (typeof this.options.onFileLoad !== 'function') {
65 | throw 'Invalid onFileLoad param in options. Must be a function';
66 | }
67 | }
68 |
69 | this._verifyDependencies = function() {
70 | if (!window.BinaryString) throw 'BinaryString is missing. Check that you\'ve correctly included it';
71 | }
72 |
73 | // helper function for binding methods to objects
74 | this._bind = function(object, method) {
75 | return function() {return method.apply(object, arguments);};
76 | }
77 |
78 | this._init(o);
79 | }
80 |
--------------------------------------------------------------------------------
/CR-10s Firmware (Marlin)/CR10S-Factory-Thermal-Protection-Enabled/Marlin/configurator/js/binarystring.js:
--------------------------------------------------------------------------------
1 | function BinaryString(source) {
2 | this._source = null;
3 | this._bytes = [];
4 | this._pos = 0;
5 | this._length = 0;
6 |
7 | this._init = function(source) {
8 | this._source = source;
9 | this._bytes = this._stringToBytes(this._source);
10 | this._length = this._bytes.length;
11 | }
12 |
13 | this.current = function() {return this._pos;}
14 |
15 | this.rewind = function() {return this.jump(0);}
16 | this.end = function() {return this.jump(this.length() - 1);}
17 | this.next = function() {return this.jump(this.current() + 1);}
18 | this.prev = function() {return this.jump(this.current() - 1);}
19 |
20 | this.jump = function(pos) {
21 | if (pos < 0 || pos >= this.length()) return false;
22 |
23 | this._pos = pos;
24 | return true;
25 | }
26 |
27 | this.readByte = function(pos) {
28 | pos = (typeof pos == 'number') ? pos : this.current();
29 | return this.readBytes(1, pos)[0];
30 | }
31 |
32 | this.readBytes = function(length, pos) {
33 | length = length || 1;
34 | pos = (typeof pos == 'number') ? pos : this.current();
35 |
36 | if (pos > this.length() ||
37 | pos < 0 ||
38 | length <= 0 ||
39 | pos + length > this.length() ||
40 | pos + length < 0
41 | ) {
42 | return false;
43 | }
44 |
45 | var bytes = [];
46 |
47 | for (var i = pos; i < pos + length; i++) {
48 | bytes.push(this._bytes[i]);
49 | }
50 |
51 | return bytes;
52 | }
53 |
54 | this.length = function() {return this._length;}
55 |
56 | this.toString = function() {
57 | var string = '',
58 | length = this.length();
59 |
60 | for (var i = 0; i < length; i++) {
61 | string += String.fromCharCode(this.readByte(i));
62 | }
63 |
64 | return string;
65 | }
66 |
67 | this.toUtf8 = function() {
68 | var inc = 0,
69 | string = '',
70 | length = this.length();
71 |
72 | // determine if first 3 characters are the BOM
73 | // then skip them in output if so
74 | if (length >= 3 &&
75 | this.readByte(0) === 0xEF &&
76 | this.readByte(1) === 0xBB &&
77 | this.readByte(2) === 0xBF
78 | ) {
79 | inc = 3;
80 | }
81 |
82 | for (; inc < length; inc++) {
83 | var byte1 = this.readByte(inc),
84 | byte2 = 0,
85 | byte3 = 0,
86 | byte4 = 0,
87 | code1 = 0,
88 | code2 = 0,
89 | point = 0;
90 |
91 | switch (true) {
92 | // single byte character; same as ascii
93 | case (byte1 < 0x80):
94 | code1 = byte1;
95 | break;
96 |
97 | // 2 byte character
98 | case (byte1 >= 0xC2 && byte1 < 0xE0):
99 | byte2 = this.readByte(++inc);
100 |
101 | code1 = ((byte1 & 0x1F) << 6) +
102 | (byte2 & 0x3F);
103 | break;
104 |
105 | // 3 byte character
106 | case (byte1 >= 0xE0 && byte1 < 0xF0):
107 | byte2 = this.readByte(++inc);
108 | byte3 = this.readByte(++inc);
109 |
110 | code1 = ((byte1 & 0xFF) << 12) +
111 | ((byte2 & 0x3F) << 6) +
112 | (byte3 & 0x3F);
113 | break;
114 |
115 | // 4 byte character
116 | case (byte1 >= 0xF0 && byte1 < 0xF5):
117 | byte2 = this.readByte(++inc);
118 | byte3 = this.readByte(++inc);
119 | byte4 = this.readByte(++inc);
120 |
121 | point = ((byte1 & 0x07) << 18) +
122 | ((byte2 & 0x3F) << 12) +
123 | ((byte3 & 0x3F) << 6) +
124 | (byte4 & 0x3F)
125 | point -= 0x10000;
126 |
127 | code1 = (point >> 10) + 0xD800;
128 | code2 = (point & 0x3FF) + 0xDC00;
129 | break;
130 |
131 | default:
132 | throw 'Invalid byte ' + this._byteToString(byte1) + ' whilst converting to UTF-8';
133 | break;
134 | }
135 |
136 | string += (code2) ? String.fromCharCode(code1, code2)
137 | : String.fromCharCode(code1);
138 | }
139 |
140 | return string;
141 | }
142 |
143 | this.toArray = function() {return this.readBytes(this.length() - 1, 0);}
144 |
145 |
146 | this._stringToBytes = function(str) {
147 | var bytes = [],
148 | chr = 0;
149 |
150 | for (var i = 0; i < str.length; i++) {
151 | chr = str.charCodeAt(i);
152 | bytes.push(chr & 0xFF);
153 | }
154 |
155 | return bytes;
156 | }
157 |
158 | this._byteToString = function(byte) {
159 | var asString = byte.toString(16).toUpperCase();
160 | while (asString.length < 2) {
161 | asString = '0' + asString;
162 | }
163 |
164 | return '0x' + asString;
165 | }
166 |
167 | this._init(source);
168 | }
169 |
--------------------------------------------------------------------------------
/CR-10s Firmware (Marlin)/CR10S-Factory-Thermal-Protection-Enabled/Marlin/digipot_mcp4451.cpp:
--------------------------------------------------------------------------------
1 | #include "Configuration.h"
2 |
3 | #if ENABLED(DIGIPOT_I2C)
4 |
5 | #include "Stream.h"
6 | #include "utility/twi.h"
7 | #include "Wire.h"
8 |
9 | // Settings for the I2C based DIGIPOT (MCP4451) on Azteeg X3 Pro
10 | #if MB(5DPRINT)
11 | #define DIGIPOT_I2C_FACTOR 117.96
12 | #define DIGIPOT_I2C_MAX_CURRENT 1.736
13 | #else
14 | #define DIGIPOT_I2C_FACTOR 106.7
15 | #define DIGIPOT_I2C_MAX_CURRENT 2.5
16 | #endif
17 |
18 | static byte current_to_wiper(float current) {
19 | return byte(ceil(float((DIGIPOT_I2C_FACTOR * current))));
20 | }
21 |
22 | static void i2c_send(byte addr, byte a, byte b) {
23 | Wire.beginTransmission(addr);
24 | Wire.write(a);
25 | Wire.write(b);
26 | Wire.endTransmission();
27 | }
28 |
29 | // This is for the MCP4451 I2C based digipot
30 | void digipot_i2c_set_current(int channel, float current) {
31 | current = min((float) max(current, 0.0f), DIGIPOT_I2C_MAX_CURRENT);
32 | // these addresses are specific to Azteeg X3 Pro, can be set to others,
33 | // In this case first digipot is at address A0=0, A1= 0, second one is at A0=0, A1= 1
34 | byte addr = 0x2C; // channel 0-3
35 | if (channel >= 4) {
36 | addr = 0x2E; // channel 4-7
37 | channel -= 4;
38 | }
39 |
40 | // Initial setup
41 | i2c_send(addr, 0x40, 0xff);
42 | i2c_send(addr, 0xA0, 0xff);
43 |
44 | // Set actual wiper value
45 | byte addresses[4] = { 0x00, 0x10, 0x60, 0x70 };
46 | i2c_send(addr, addresses[channel], current_to_wiper(current));
47 | }
48 |
49 | void digipot_i2c_init() {
50 | const float digipot_motor_current[] = DIGIPOT_I2C_MOTOR_CURRENTS;
51 | Wire.begin();
52 | // setup initial currents as defined in Configuration_adv.h
53 | for (int i = 0; i < COUNT(digipot_motor_current); i++)
54 | digipot_i2c_set_current(i, digipot_motor_current[i]);
55 | }
56 |
57 | #endif //DIGIPOT_I2C
58 |
--------------------------------------------------------------------------------
/CR-10s Firmware (Marlin)/CR10S-Factory-Thermal-Protection-Enabled/Marlin/dogm_font_data_Marlin_symbols.h:
--------------------------------------------------------------------------------
1 | /*
2 | Fontname: Marlin_symbols
3 | Copyright: Created with Fony 1.4.7
4 | Capital A Height: 0, '1' Height: 0
5 | Calculated Max Values w= 5 h=10 x= 0 y= 3 dx= 6 dy= 0 ascent= 8 len=10
6 | Font Bounding box w= 6 h= 9 x= 0 y=-2
7 | Calculated Min Values x= 0 y=-2 dx= 0 dy= 0
8 | Pure Font ascent = 0 descent= 0
9 | X Font ascent = 0 descent= 0
10 | Max Font ascent = 8 descent=-2
11 | */
12 | #include