diff --git a/html/elrs.css b/html/elrs.css index a684327..4e6502e 100644 --- a/html/elrs.css +++ b/html/elrs.css @@ -289,4 +289,11 @@ body, input, select, textarea { background: #88cef7; } + datalist { + display: flex; + flex-direction: row; + justify-content: space-between; + writing-mode: horizontal-tb; + width: 100%; +} /*==========================*/ \ No newline at end of file diff --git a/html/scan.js b/html/scan.js index 89ae10e..746bbc5 100644 --- a/html/scan.js +++ b/html/scan.js @@ -1,41 +1,87 @@ -document.addEventListener("DOMContentLoaded", get_mode, false); -var scanTimer = undefined; +document.addEventListener("DOMContentLoaded", init, false); function _(el) { return document.getElementById(el); } -function get_mode() { - var json_url = 'mode.json'; - xmlhttp = new XMLHttpRequest(); - xmlhttp.onreadystatechange = function () { - if (this.readyState == 4 && this.status == 200) { - var data = JSON.parse(this.responseText); - if (data.mode==="STA") { - _('stamode').style.display = 'block'; - if (_('rtctab')) _('rtctab').style.display = 'block'; - _('ssid').textContent = data.ssid; - } else { - _('apmode').style.display = 'block'; - if (data.ssid) { - _('homenet').textContent = data.ssid; - } else { - _('connect').style.display = 'none'; - } - scanTimer = setInterval(get_networks, 2000); - } - if((!data.stm32 || data.stm32==="no") && _('tx_tab')) { - mui.tabs.activate('pane-justified-2'); - _('tx_tab').style.display = 'none'; - } - if(data['product-name']) _('product-name').textContent = data['product-name']; - } +function init() { + initAat(); + + // sends XMLHttpRequest, so do it last + initOptions(); +} + +function initAat() { + let aatsubmit = _('aatsubmit'); + if (!aatsubmit) + return; + + aatsubmit.addEventListener('click', callback('Update AAT Parameters', 'An error occurred changing values', '/aatconfig', + () => { return new URLSearchParams(new FormData(_('aatconfig'))); } + )); + _('azim_center').addEventListener('change', aatAzimCenterChanged); + document.querySelectorAll('.aatlive').forEach( + el => el.addEventListener('change', aatLineElementChanged) + ); +} + +function initOptions() { + const xmlhttp = new XMLHttpRequest(); + xmlhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + const data = JSON.parse(this.responseText); + updateConfig(data); + setTimeout(get_networks, 2000); + } }; - xmlhttp.open("POST", json_url, true); - xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xmlhttp.open('GET', '/config', true); xmlhttp.send(); } +function updateConfig(data) { + let config = data.config; + if (config.mode==="STA") { + _('stamode').style.display = 'block'; + if (_('rtctab')) _('rtctab').style.display = 'table-cell'; + _('ssid').textContent = config.ssid; + } else { + _('apmode').style.display = 'block'; + if (config.ssid) { + _('homenet').textContent = config.ssid; + } else { + _('connect').style.display = 'none'; + } + } + if((!data.stm32 || data.stm32==="no") && _('tx_tab')) { + mui.tabs.activate('pane-justified-2'); + _('tx_tab').style.display = 'none'; + } + if(config['product_name']) _('product_name').textContent = config['product_name']; + + updateAatConfig(config); +} + +function updateAatConfig(config) +{ + if (!config.hasOwnProperty('aat')) + return; + _('aattab').style.display = 'table-cell'; + + // AAT + _('servosmoo').value = config.aat.servosmoo; + _('servomode').value = config.aat.servomode; + _('azim_center').value = config.aat.azim_center; + _('azim_min').value = config.aat.azim_min; + _('azim_max').value = config.aat.azim_max; + _('elev_min').value = config.aat.elev_min; + _('elev_max').value = config.aat.elev_max; + aatAzimCenterChanged(); + + // VBAT + _('vbat_offset').value = config.vbat.offset; + _('vbat_scale').value = config.vbat.scale; +} + function get_networks() { var json_url = 'networks.json'; xmlhttp = new XMLHttpRequest(); @@ -44,7 +90,6 @@ function get_networks() { var data = JSON.parse(this.responseText); _('loader').style.display = 'none'; autocomplete(_('network'), data); - clearInterval(scanTimer); } }; xmlhttp.open("POST", json_url, true); @@ -340,6 +385,37 @@ function callback(title, msg, url, getdata) { } } +function aatAzimCenterChanged() +{ + // Update the slider labels to represent the new orientation + let labels; + switch (parseInt(_('azim_center').selectedIndex)) + { + default: /* fallthrough */ + case 0: labels = 'SWNES'; break; // N + case 1: labels = 'WNESW'; break; // E + case 2: labels = 'NESWN'; break; // S + case 3: labels = 'ESWNE'; break; // W + } + let markers = _('bear_markers'); + for (i=0; i - Welcome to your ExpressLRS update page - - From here you can update your TX Backpack module with @PLATFORM@ firmware - - Firmware Rev. @VERSION@ + ExpressLRS + TX Backpack + Firmware Rev. @VERSION@ diff --git a/html/vrx_index.html b/html/vrx_index.html index 2e35d51..b8da64f 100644 --- a/html/vrx_index.html +++ b/html/vrx_index.html @@ -10,17 +10,14 @@ - - - Welcome to your ExpressLRS update page - - From here you can update your VRx Backpack module with @PLATFORM@ firmware - - Firmware Rev. @VERSION@ - - + + + ExpressLRS + VRx Backpack + Firmware Rev. @VERSION@ + - + @@ -28,6 +25,7 @@ Welcome to your ExpressLRS update page Update Network RTC Time + Antenna Tracking @@ -105,6 +103,111 @@ RTC Update via NTP + + + + + Servo maximum speed + Use the slider to limit the maximum rotational speed of the servo. Note that when the azimuth servo + must flip from one side to the other, the servo always will move at full speed. + + + + + + + + + + + + + + + + + Servo mode + Set the mechanical servo mode to match the tracker's design. + + + 2:1 geared - Servo geared for 360 degree movement + Clip 180 - Standard direct driven servo limited to 180 degrees + + + + + + Azimuth servo + Enter the micrsecond (us) values for the min and max position of the horizontal servo, using the slider to test positions. + + + + + + + + + + + Min + + + + N + E + S + W + + Servo center direction + + + + Max + + + Elevation servo + Enter the micrsecond (us) values for the min and max position of the vertical servo, using the slider to test positions. + + + + + + + + + + + + + Min + + + + + + + Max + + + + + Battery voltage + Battery voltage is calculated using the formula VBAT = (ADC - offset) / scale. If voltage is reading too high, increase scale. + + + Scale + + + + Offset + + + + + + + +
From here you can update your TX Backpack module with @PLATFORM@ firmware -
- Firmware Rev. @VERSION@ +
From here you can update your VRx Backpack module with @PLATFORM@ firmware -
- Firmware Rev. @VERSION@ -
-