Get thermistors from config, add temp sensors

This commit is contained in:
Scott Lahteine 2015-02-05 08:19:09 -08:00
parent ef18bfdd3f
commit b2627200ea
2 changed files with 21 additions and 4 deletions

View file

@ -40,6 +40,11 @@
<label>PS Default Off:</label> <label>PS Default Off:</label>
<input name="PS_DEFAULT_OFF" type="checkbox" value="1" checked /> <input name="PS_DEFAULT_OFF" type="checkbox" value="1" checked />
<label class="newline">Temp Sensor 0:</label><select name="TEMP_SENSOR_0"></select>
<label class="newline">Temp Sensor 1:</label><select name="TEMP_SENSOR_1"></select>
<label class="newline">Temp Sensor 2:</label><select name="TEMP_SENSOR_2"></select>
<label class="newline">Bed Temp Sensor:</label><select name="TEMP_SENSOR_BED"></select>
<h2>Marlin/Configuration.h</h2> <h2>Marlin/Configuration.h</h2>
<pre id="config_text" class="prettyprint linenums"></pre> <pre id="config_text" class="prettyprint linenums"></pre>
<h2>Marlin/Configuration_adv.h</h2> <h2>Marlin/Configuration_adv.h</h2>

View file

@ -68,15 +68,23 @@ var configuratorApp = (function(){
boards_list = {}; boards_list = {};
$.get(marlin_config + "/boards.h", function(txt) { $.get(marlin_config + "/boards.h", function(txt) {
// Get all the boards and save them into an object // Get all the boards and save them into an object
var r, findDef = new RegExp('[ \\t]*#define[ \\t]+(BOARD_[^ \\t]+)[ \\t]+(\\d+)[ \\t]*(//[ \\t]*)?(.+)?', 'mg'); var r, findDef = new RegExp('[ \\t]*#define[ \\t]+(BOARD_[^ \\t]+)[ \\t]+(\\d+)[ \\t]*(//[ \\t]*)?(.+)?', 'gm');
while((r = findDef.exec(txt)) !== null) { while((r = findDef.exec(txt)) !== null) {
boards_list[r[1]] = r[2].prePad(r[2] < 100 ? (r[2] < 10 ? 5 : 4) : 0, ' ') + " — " + r[4].replace(/\).*/, ')'); boards_list[r[1]] = r[2].prePad(3, '  ') + " — " + r[4].replace(/\).*/, ')');
} }
}); });
// Read Configuration.h // Read Configuration.h
$.get(marlin_config+"/Configuration.h", function(txt) { $.get(marlin_config+"/Configuration.h", function(txt) {
// File contents into the textarea
$config.text(txt); $config.text(txt);
// Get all the thermistors and save them into an object
var r, s, findDef = new RegExp('(//.*\n)+\\s+(#define[ \\t]+TEMP_SENSOR_0)', 'g');
r = findDef.exec(txt);
findDef = new RegExp('^//[ \\t]*([-\\d]+)[ \\t]+is[ \\t]+(.*)[ \\t]*$', 'gm');
while((s = findDef.exec(r[0])) !== null) {
therms_list[s[1]] = s[1].prePad(4, '  ') + " — " + s[2];
}
}); });
// Read Configuration.h // Read Configuration.h
@ -152,6 +160,12 @@ var configuratorApp = (function(){
this.initField('PS_DEFAULT_OFF'); this.initField('PS_DEFAULT_OFF');
$('#TEMP_SENSOR_0, #TEMP_SENSOR_1, #TEMP_SENSOR_2, #TEMP_SENSOR_BED').addOptions(therms_list);
this.initField('TEMP_SENSOR_0');
this.initField('TEMP_SENSOR_1');
this.initField('TEMP_SENSOR_2');
this.initField('TEMP_SENSOR_BED');
/* /*
$('#serial_stepper').jstepper({ $('#serial_stepper').jstepper({
min: 0, min: 0,
@ -224,8 +238,6 @@ var configuratorApp = (function(){
} }
// Now set the text in the field // Now set the text in the field
$config.text(txt); $config.text(txt);
// $config.scrollTo(500);
}, },
setFieldFromDefine: function(name, adv) { setFieldFromDefine: function(name, adv) {