Removing more review related code. Adding skeleton of new Ports tab.

10.3.x-maintenance
Dominic Clifton 2015-01-02 00:05:09 +00:00
parent 32820853ce
commit fe72557b12
7 changed files with 114 additions and 45 deletions

View File

@ -48,6 +48,9 @@
"tabConfiguration": {
"message": "Configuration"
},
"tabPorts": {
"message": "Ports"
},
"tabPidTuning": {
"message": "PID Tuning"
},
@ -432,6 +435,10 @@
"message": "Save and Reboot"
},
"portsButtonSave": {
"message": "Save and Reboot"
},
"pidTuningName": {
"message": "Name"
},

View File

@ -319,47 +319,3 @@ input[type="number"]::-webkit-inner-spin-button {
text-align: center;
font-weight: bold;
}
#dialog {
position: fixed;
top: 0;
left: 0;
border: 1px solid silver;
background-color: white;
display: none;
z-index: 1001;
}
#dialog.review {
width: 300px;
}
#dialog.review .head {
line-height: 20px;
color: white;
font-weight: bold;
text-align: center;
border-bottom: 1px solid silver;
background-color: #3f4241;
}
#dialog.review .wrapper {
padding: 5px;
}
#dialog.review p {
display: none;
padding: 5px;
text-align: center;
}
#dialog.review .buttons {
float: right;
margin: 5px 0 0 0;
}
#dialog.review .yes,
#dialog.review .no {
display: block;
float: left;
margin: 0 0 0 5px;
height: 24px;
line-height: 24px;
padding: 0 10px 0 10px;
font-weight: bold;
border: 1px solid #dddddd;
background-color: #f1f1f1;
}

View File

@ -11,6 +11,7 @@
<link type="text/css" rel="stylesheet" href="./tabs/landing.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/setup.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/configuration.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/ports.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/pid_tuning.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/receiver.css" media="all" />
<!-- <link type="text/css" rel="stylesheet" href="./tabs/modes.css" media="all" /> -->
@ -46,7 +47,6 @@
<script type="text/javascript" src="./js/protocols/stm32.js"></script>
<script type="text/javascript" src="./js/protocols/stm32usbdfu.js"></script>
<script type="text/javascript" src="./js/localization.js"></script>
<script type="text/javascript" src="./js/review.js"></script>
<script type="text/javascript" src="./main.js"></script>
<script type="text/javascript" src="./tabs/adjustments.js"></script>
@ -55,6 +55,7 @@
<script type="text/javascript" src="./tabs/landing.js"></script>
<script type="text/javascript" src="./tabs/setup.js"></script>
<script type="text/javascript" src="./tabs/configuration.js"></script>
<script type="text/javascript" src="./tabs/ports.js"></script>
<script type="text/javascript" src="./tabs/pid_tuning.js"></script>
<script type="text/javascript" src="./tabs/receiver.js"></script>
<!-- <script type="text/javascript" src="./tabs/modes.js"></script> -->
@ -119,6 +120,7 @@
<ul>
<li class="tab_setup"><a href="#" i18n="tabSetup"></a></li>
<li class="tab_configuration"><a href="#" i18n="tabConfiguration"></a></li>
<li class="tab_ports"><a href="#" i18n="tabPorts"></a></li>
<li class="tab_pid_tuning"><a href="#" i18n="tabPidTuning"></a></li>
<li class="tab_receiver"><a href="#" i18n="tabReceiver"></a></li>
<!-- <li class="tab_modes"><a href="#" i18n="tabModeSelection"></a></li> -->

View File

@ -95,6 +95,9 @@ $(document).ready(function () {
case 'tab_adjustments':
TABS.adjustments.initialize(content_ready);
break;
case 'tab_ports':
TABS.ports.initialize(content_ready);
break;
case 'tab_setup':
TABS.setup.initialize(content_ready);

29
tabs/ports.css Normal file
View File

@ -0,0 +1,29 @@
.tab-ports {
position: relative;
}
.tab-ports > .buttons {
width: calc(100% - 20px);
margin-top: 10px;
bottom: 10px;
}
.tab-ports .save {
display: block;
float: right;
height: 28px;
line-height: 28px;
padding: 0 15px 0 15px;
text-align: center;
font-weight: bold;
border: 1px solid silver;
background-color: #ececec;
}
.tab-ports .save:hover {
background-color: #dedcdc;
}

6
tabs/ports.html Normal file
View File

@ -0,0 +1,6 @@
<div class="tab-ports">
<div class="clear-both"></div>
<div class="buttons">
<a class="save" href="#" i18n="portsButtonSave"></a>
</div>
</div>

66
tabs/ports.js Normal file
View File

@ -0,0 +1,66 @@
'use strict';
TABS.ports = {};
TABS.ports.initialize = function (callback, scrollPosition) {
var self = this;
if (GUI.active_tab != 'ports') {
GUI.active_tab = 'ports';
googleAnalytics.sendAppView('Ports');
}
function load_config() {
MSP.send_message(MSP_codes.MSP_CONFIG, false, false, load_html);
}
function load_html() {
$('#content').load("./tabs/ports.html", process_html);
}
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config);
function process_html() {
localize();
$('a.save').click(function () {
function save_to_eeprom() {
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, reboot);
}
function reboot() {
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
GUI.tab_switch_cleanup(function() {
MSP.send_message(MSP_codes.MSP_SET_REBOOT, false, false, reinitialize);
});
}
function reinitialize() {
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
GUI.log(chrome.i18n.getMessage('deviceReady'));
TABS.ports.initialize(false, $('#content').scrollTop());
});
},1500); // 1500 ms seems to be just the right amount of delay to prevent data request timeouts
}
MSP.send_message(MSP_codes.MSP_SET_CONFIG, MSP.crunch(MSP_codes.MSP_SET_CONFIG), false, save_to_eeprom);
});
// status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function status_pull() {
MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true);
if (callback) callback();
}
};
TABS.ports.cleanup = function (callback) {
if (callback) callback();
};