Explorar el Código

Get thermistors from config, add temp sensors

Scott Lahteine hace 9 años
padre
commit
b2627200ea
Se han modificado 2 ficheros con 21 adiciones y 4 borrados
  1. 5
    0
      Marlin/configurator/index.html
  2. 16
    4
      Marlin/configurator/js/configurator.js

+ 5
- 0
Marlin/configurator/index.html Ver fichero

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

+ 16
- 4
Marlin/configurator/js/configurator.js Ver fichero

@@ -68,15 +68,23 @@ var configuratorApp = (function(){
68 68
       boards_list = {};
69 69
       $.get(marlin_config + "/boards.h", function(txt) {
70 70
         // Get all the boards and save them into an object
71
-        var r, findDef = new RegExp('[ \\t]*#define[ \\t]+(BOARD_[^ \\t]+)[ \\t]+(\\d+)[ \\t]*(//[ \\t]*)?(.+)?', 'mg');
71
+        var r, findDef = new RegExp('[ \\t]*#define[ \\t]+(BOARD_[^ \\t]+)[ \\t]+(\\d+)[ \\t]*(//[ \\t]*)?(.+)?', 'gm');
72 72
         while((r = findDef.exec(txt)) !== null) {
73
-          boards_list[r[1]] = r[2].prePad(r[2] < 100 ? (r[2] < 10 ? 5 : 4) : 0, ' ') + " — " + r[4].replace(/\).*/, ')');
73
+          boards_list[r[1]] = r[2].prePad(3, '  ') + " — " + r[4].replace(/\).*/, ')');
74 74
         }
75 75
       });
76 76
 
77 77
       // Read Configuration.h
78 78
       $.get(marlin_config+"/Configuration.h", function(txt) {
79
+        // File contents into the textarea
79 80
         $config.text(txt);
81
+        // Get all the thermistors and save them into an object
82
+        var r, s, findDef = new RegExp('(//.*\n)+\\s+(#define[ \\t]+TEMP_SENSOR_0)', 'g');
83
+        r = findDef.exec(txt);
84
+        findDef = new RegExp('^//[ \\t]*([-\\d]+)[ \\t]+is[ \\t]+(.*)[ \\t]*$', 'gm');
85
+        while((s = findDef.exec(r[0])) !== null) {
86
+          therms_list[s[1]] = s[1].prePad(4, '  ') + " — " + s[2];
87
+        }
80 88
       });
81 89
 
82 90
       // Read Configuration.h
@@ -152,6 +160,12 @@ var configuratorApp = (function(){
152 160
 
153 161
       this.initField('PS_DEFAULT_OFF');
154 162
 
163
+      $('#TEMP_SENSOR_0, #TEMP_SENSOR_1, #TEMP_SENSOR_2, #TEMP_SENSOR_BED').addOptions(therms_list);
164
+      this.initField('TEMP_SENSOR_0');
165
+      this.initField('TEMP_SENSOR_1');
166
+      this.initField('TEMP_SENSOR_2');
167
+      this.initField('TEMP_SENSOR_BED');
168
+
155 169
 /*
156 170
       $('#serial_stepper').jstepper({
157 171
         min: 0,
@@ -224,8 +238,6 @@ var configuratorApp = (function(){
224 238
       }
225 239
       // Now set the text in the field
226 240
       $config.text(txt);
227
-
228
-      // $config.scrollTo(500);
229 241
     },
230 242
 
231 243
     setFieldFromDefine: function(name, adv) {

Loading…
Cancelar
Guardar