diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 2745f9a8..7ba888db 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1656,5 +1656,14 @@ }, "failsafeKillSwitchHelp": { "message": "Set this option to make the failsafe switch, configured in the modes tab, act as a direct kill switch, bypassing the selected failsafe procedure. Note: Arming is blocked with the failsafe kill switch in the ON position" + }, + "mainHelpArmed": { + "message": "Motor Arming" + }, + "mainHelpFailsafe": { + "message": "Failsafe Mode" + }, + "mainHelpLink": { + "message": "Serial Link Status" } -} +} \ No newline at end of file diff --git a/images/icons/cf_icon_armed_active.svg b/images/icons/cf_icon_armed_active.svg new file mode 100755 index 00000000..b76fab7e --- /dev/null +++ b/images/icons/cf_icon_armed_active.svg @@ -0,0 +1,16 @@ + + + diff --git a/images/icons/cf_icon_armed_grey.svg b/images/icons/cf_icon_armed_grey.svg new file mode 100755 index 00000000..7ae1904a --- /dev/null +++ b/images/icons/cf_icon_armed_grey.svg @@ -0,0 +1,16 @@ + + + diff --git a/images/icons/cf_icon_bat_grey.svg b/images/icons/cf_icon_bat_grey.svg new file mode 100755 index 00000000..bbde2820 --- /dev/null +++ b/images/icons/cf_icon_bat_grey.svg @@ -0,0 +1,14 @@ + + + diff --git a/images/icons/cf_icon_failsafe_active.svg b/images/icons/cf_icon_failsafe_active.svg new file mode 100755 index 00000000..e3ecd369 --- /dev/null +++ b/images/icons/cf_icon_failsafe_active.svg @@ -0,0 +1,14 @@ + + + diff --git a/images/icons/cf_icon_failsafe_grey.svg b/images/icons/cf_icon_failsafe_grey.svg old mode 100644 new mode 100755 index dd586e1f..70dbbc49 --- a/images/icons/cf_icon_failsafe_grey.svg +++ b/images/icons/cf_icon_failsafe_grey.svg @@ -1,11 +1,15 @@ - + + \ No newline at end of file diff --git a/images/icons/cf_icon_link_active.svg b/images/icons/cf_icon_link_active.svg new file mode 100644 index 00000000..3b6479f4 --- /dev/null +++ b/images/icons/cf_icon_link_active.svg @@ -0,0 +1,18 @@ + + + diff --git a/images/icons/cf_icon_link_grey.svg b/images/icons/cf_icon_link_grey.svg new file mode 100755 index 00000000..d2c0a027 --- /dev/null +++ b/images/icons/cf_icon_link_grey.svg @@ -0,0 +1,18 @@ + + + diff --git a/js/libraries/jbox/jBox.css b/js/libraries/jbox/jBox.css index b5a6fac2..70711ae9 100755 --- a/js/libraries/jbox/jBox.css +++ b/js/libraries/jbox/jBox.css @@ -83,7 +83,7 @@ background: #fff; -webkit-transform: rotate(45deg); transform: rotate(45deg); - border:1px solid #59aa29; + border:1px solid #37a8db; } diff --git a/js/msp.js b/js/msp.js index a7b1ac51..f9387855 100644 --- a/js/msp.js +++ b/js/msp.js @@ -128,6 +128,9 @@ var MSP = { ledDirectionLetters: ['n', 'e', 's', 'w', 'u', 'd'], // in LSB bit order ledFunctionLetters: ['i', 'w', 'f', 'a', 't', 'r', 'c'], // in LSB bit order + + last_received_timestamp: null, + analog_last_received_timestamp: null, supportedBaudRates: [ // 0 based index. 'AUTO', @@ -235,6 +238,7 @@ var MSP = { console.log('Unknown state detected: ' + this.state); } } + this.last_received_timestamp = Date.now(); }, process_data: function (code, message_buffer, message_length) { var data = new DataView(message_buffer, 0); // DataView (allowing us to view arrayBuffer as struct/union) @@ -342,6 +346,7 @@ var MSP = { ANALOG.mAhdrawn = data.getUint16(1, 1); ANALOG.rssi = data.getUint16(3, 1); // 0-1023 ANALOG.amperage = data.getInt16(5, 1) / 100; // A + this.analog_last_received_timestamp = Date.now(); break; case MSP_codes.MSP_RC_TUNING: var offset = 0; diff --git a/js/serial_backend.js b/js/serial_backend.js index f40e6e24..9b1984de 100755 --- a/js/serial_backend.js +++ b/js/serial_backend.js @@ -273,7 +273,9 @@ function onConnect() { port_picker.hide(); var dataflash = $('#dataflash_wrapper_global'); - dataflash.show(); + dataflash.show(); + + startLiveDataRefreshTimer(); } @@ -295,6 +297,9 @@ function onClosed(result) { var dataflash = $('#dataflash_wrapper_global'); dataflash.hide(); + + var battery = $('#quad-status_wrapper'); + battery.hide(); } function read_serial(info) { @@ -394,7 +399,9 @@ function highByte(num) { function lowByte(num) { return 0x00FF & num; -}function update_dataflash_global() { +} + +function update_dataflash_global() { var supportsDataflash = DATAFLASH.totalSize > 0; if (supportsDataflash){ @@ -423,6 +430,88 @@ function lowByte(num) { } +function startLiveDataRefreshTimer() { + // live data refresh + GUI.timeout_add('data_refresh', function () { update_live_status(); }, 100); +} + +function update_live_status() { + + var statuswrapper = $('#quad-status_wrapper'); + + $(".quad-status-contents").css({ + display: 'inline-block' + }); + + if (GUI.active_tab != 'cli') { + MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false); + MSP.send_message(MSP_codes.MSP_STATUS, false, false); + MSP.send_message(MSP_codes.MSP_ANALOG, false, false); + } + + var active = ((Date.now() - MSP.analog_last_received_timestamp) < 300); + + for (var i = 0; i < AUX_CONFIG.length; i++) { + if (AUX_CONFIG[i] == 'ARM') { + if (bit_check(CONFIG.mode, i)) + $(".armedicon").css({ + 'background-image': 'url(images/icons/cf_icon_armed_active.svg)' + }); + else + $(".armedicon").css({ + 'background-image': 'url(images/icons/cf_icon_armed_grey.svg)' + }); + } + if (AUX_CONFIG[i] == 'FAILSAFE') { + if (bit_check(CONFIG.mode, i)) + $(".failsafeicon").css({ + 'background-image': 'url(images/icons/cf_icon_failsafe_active.svg)' + }); + else + $(".failsafeicon").css({ + 'background-image': 'url(images/icons/cf_icon_failsafe_grey.svg)' + }); + } + } + if (ANALOG != undefined) { + var nbCells = Math.floor(ANALOG.voltage / MISC.vbatmaxcellvoltage) + 1; + if (ANALOG.voltage == 0) + nbCells = 1; + + var min = MISC.vbatmincellvoltage * nbCells; + var max = MISC.vbatmaxcellvoltage * nbCells; + var warn = MISC.vbatwarningcellvoltage * nbCells; + + $(".battery-status").css({ + width: ((ANALOG.voltage - min) / (max - min) * 100) + "%", + display: 'inline-block' + }); + + if (active) { + $(".linkicon").css({ + 'background-image': 'url(images/icons/cf_icon_link_active.svg)' + }); + } else { + $(".linkicon").css({ + 'background-image': 'url(images/icons/cf_icon_link_grey.svg)' + }); + } + + if (ANALOG.voltage < warn) { + $(".battery-status").css('background-color', '#D42133'); + } else { + $(".battery-status").css('background-color', '#59AA29'); + } + + $(".battery-legend").text(ANALOG.voltage + " V"); + } + + statuswrapper.show(); + GUI.timeout_remove('data_refresh'); + startLiveDataRefreshTimer(); +} + + function specificByte(num, pos) { return 0x000000FF & (num >> (8 * pos)); } diff --git a/main.css b/main.css index 7b80d521..a30debef 100644 --- a/main.css +++ b/main.css @@ -1517,7 +1517,7 @@ dialog { margin-top: 20px; width:125px; float: right; - margin-right: 20px; + margin-right: 10px; line-height: 12px; height: 33px; border-radius: 5px; @@ -1604,6 +1604,116 @@ dialog { display:none; } +/* Battery element styling*/ + +#quad-status_wrapper { + display:none; + color: white; + font-size: 10px; + margin-top: 20px; + width: 90px; + float: right; + margin-right: 20px; + line-height: 12px; + height: 67px; + border-radius: 5px; + border: 1px solid #272727; + box-shadow: 0px 1px 0px rgba(92, 92, 92, 0.5); + background-color: #434343; + background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.55)); + text-shadow: 0px 1px rgba(0, 0, 0, 1.0); +} + +.quad-status-contents { + display: none; + margin-top: 10px; + margin-left: 14px; + height: 10px; + width: 30px; + /* width: 30px; */ +} + + +.battery-legend { + display: inline; + position: relative; + top: -2px; + margin-top: 0px; + left: 0; + right: 0; + width: 40px; + text-align: left; + color: silver; + margin-left: -8px; +} + +.quad-status-contents progress::-webkit-progress-bar { + height: 12px; + background-color: #eee; +} + +.quad-status-contents progress::-webkit-progress-value { + background-color: #bcf; +} + +.battery-status { + height: 11px; + position: relative; + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.20); + border-radius: 0px; + background-color: #59AA29; + /* border-radius: 4px; */ + margin-top: 0px; +} + +.battery-icon { + background-image: url(images/icons/cf_icon_bat_grey.svg); + background-size: contain; + background-position: center; + display: inline-block; + height: 30px; + width: 60px; + transition: none; + margin-top: 4px; + background-repeat: no-repeat; +} + +.armedicon, +.failsafeicon, +.linkicon { + float: left; + margin-left: 8px; + margin-right: 2px; + margin-top: 6px; + display: block; + height: 18px; + width: 18px; + opacity: 0.8; + background-size: contain; + background-position: center; + transition: none; +} + +.armedicon { + background-image: url(images/icons/cf_icon_armed_grey.svg); +} +.failsafeicon { + background-image: url(images/icons/cf_icon_failsafe_grey.svg); +} + +.linkicon { + background-image: url(images/icons/cf_icon_link_grey.svg); +} + +.bottomStatusIcons { + background-color: #272727; + height: 31px; + margin-top: 2px; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; +} + + @media only screen and (max-width: 1055px) , only screen and (max-device-width: 1055px) { diff --git a/main.html b/main.html index f0f88257..be42e1d7 100755 --- a/main.html +++ b/main.html @@ -177,6 +177,19 @@ +