|
18 | 18 | </div>
|
19 | 19 | <div class="form-row">
|
20 | 20 | <label for="node-config-input-samplingInt" style="width:150px;"><i class="fa fa-circle"></i> <span data-i18n="arduino.label.samplingInt"></span></label>
|
21 |
| - <input type="number" id="node-config-input-samplingInt" style="width:20%;" data-i18n="[placeholder]arduino.placeholder.samplingInt" min=10 max=65500 /> |
| 21 | + <input type="number" id="node-config-input-samplingInt" style="width:20%;" data-i18n="[placeholder]arduino.placeholder.samplingInt" min=10 max=65500 /> mS |
22 | 22 | </div>
|
23 | 23 | <div class="form-row">
|
24 | 24 | <label for="node-config-input-log2consol"><i class="icon-bookmark"></i>Log to console</label>
|
|
43 | 43 | },
|
44 | 44 | oneditprepare: function() {
|
45 | 45 | try {
|
46 |
| - $("#node-config-input-device").autocomplete( "destroy" ); |
| 46 | + $("#node-config-input-device").autocomplete( "destroy" ); // Remove auto-complete functionality from an <input>. |
47 | 47 | } catch(err) { };
|
48 | 48 |
|
49 |
| - $("#node-config-lookup-serial").click(function() { // Board's serial port search function |
50 |
| - //console.log("Serial Auto-search started."); |
51 |
| - $("#node-config-lookup-serial-icon").removeClass('fa-search'); |
52 |
| - $("#node-config-lookup-serial-icon").addClass('spinner'); |
53 |
| - $("#node-config-lookup-serial") .addClass('disabled'); |
54 |
| - |
55 |
| - $.getJSON('arduinoports', function(data) { |
56 |
| - //console.log('Serial Auto-search found data: %o', data); |
57 |
| - $("#node-config-lookup-serial-icon").removeClass('spinner'); |
58 |
| - $("#node-config-lookup-serial") .removeClass('disabled'); |
59 |
| - $("#node-config-lookup-serial-icon").addClass('fa-search'); |
60 |
| - let ports = data || []; |
61 |
| - $("#node-config-input-device").autocomplete({ |
62 |
| - source: ports, |
63 |
| - minLength: 0, |
64 |
| - close: function( event, ui ) { |
65 |
| - //console.log("Serial Auto-search closing."); |
66 |
| - $("#node-config-input-device").autocomplete( "destroy" ); |
67 |
| - } |
68 |
| - }).autocomplete("search", ""); |
69 |
| - }); |
| 49 | + $("#node-config-lookup-serial").click(async function() { // Board's serial port search function |
| 50 | + console.log("Serial Auto-search started."); |
| 51 | + $("#node-config-lookup-serial-icon").removeClass('fa-search').addClass('spinner'); |
| 52 | + $("#node-config-lookup-serial").addClass('disabled'); |
| 53 | + |
| 54 | + try { |
| 55 | + $.getJSON('arduinoports', async function(data, data2) { |
| 56 | + //console.log('Serial Auto-search found data: %o', data); |
| 57 | + //console.log('Data2: %o', data2); |
| 58 | + |
| 59 | + // UI Updates |
| 60 | + $("#node-config-lookup-serial-icon").removeClass('spinner').addClass('fa-search'); |
| 61 | + $("#node-config-lookup-serial").removeClass('disabled'); |
| 62 | + // Ensure ports is an array (fallback to empty array) |
| 63 | + ports = data || []; |
| 64 | + |
| 65 | + $("#node-config-input-device").autocomplete({ |
| 66 | + source: ports, |
| 67 | + minLength: 0, |
| 68 | + close: function(event, ui) { |
| 69 | + console.log("Serial Auto-search closing."); |
| 70 | + $("#node-config-input-device").autocomplete("destroy"); |
| 71 | + } |
| 72 | + }).autocomplete("search", ""); |
| 73 | + }); |
| 74 | + } catch (error) { |
| 75 | + console.error('Error fetching serial ports:', error); |
| 76 | + |
| 77 | + // Reset UI on error |
| 78 | + $("#node-config-lookup-serial-icon").removeClass('spinner').addClass('fa-search'); |
| 79 | + $("#node-config-lookup-serial").removeClass('disabled'); |
| 80 | + } |
70 | 81 | });
|
71 | 82 | }
|
72 | 83 | });
|
@@ -216,7 +227,7 @@ <h3>The "in" node:</h3>
|
216 | 227 | color:"#3fadb5",
|
217 | 228 | defaults: {
|
218 | 229 | name: {value:""},
|
219 |
| - pin: {value:"",validate: function(v) { |
| 230 | + pin: {value:"", validate: function(v) { |
220 | 231 | var ct = $("#node-input-state").val() || this.state;
|
221 | 232 | return ct === 'STRING' || (v !== '');
|
222 | 233 | }},
|
|
0 commit comments