Skip to content

Commit

Permalink
Hide firmware version dropdown for virtual mode (#4097)
Browse files Browse the repository at this point in the history
* Hide firmware version dropdown for virtual mode

* Another try

* Cleanup
  • Loading branch information
haslinghuis authored Jul 14, 2024
1 parent 1ee980c commit 9a0fb31
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 68 deletions.
8 changes: 7 additions & 1 deletion src/components/port-picker/PortPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@input="updateValue('portOverride', $event)"
/>
<FirmwareVirtualOption
v-if="value.selectedPort === 'virtual'"
v-if="value.selectedPort === 'virtual' && !isConnected"
:value="value.virtualMspVersion"
@input="updateValue('virtualMspVersion', $event)"
/>
Expand All @@ -27,6 +27,7 @@
import PortOverrideOption from "./PortOverrideOption.vue";
import FirmwareVirtualOption from "./FirmwareVirtualOption.vue";
import PortsInput from "./PortsInput.vue";
import CONFIGURATOR from "../../js/data_storage";
export default {
components: {
Expand Down Expand Up @@ -70,6 +71,11 @@ export default {
default: false,
},
},
computed: {
isConnected() {
return CONFIGURATOR.connectionValid;
},
},
methods: {
updateValue(key, value) {
if (key != null) {
Expand Down
28 changes: 9 additions & 19 deletions src/js/serial_backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,14 +642,10 @@ function onConnect() {
}
}

const sensorState = $('#sensor-status');
sensorState.show();

const portPicker = $('#portsinput');
portPicker.hide();

const dataflash = $('#dataflash_wrapper_global');
dataflash.show();
// header bar
$('#sensor-status').show();
$('#portsinput').hide();
$('#dataflash_wrapper_global').show();
}

function onClosed(result) {
Expand All @@ -659,17 +655,11 @@ function onClosed(result) {
$('#tabs ul.mode-connected-cli').hide();
$('#tabs ul.mode-disconnected').show();

const sensorState = $('#sensor-status');
sensorState.hide();

const portPicker = $('#portsinput');
portPicker.show();

const dataflash = $('#dataflash_wrapper_global');
dataflash.hide();

const battery = $('#quad-status_wrapper');
battery.hide();
// header bar
$('#sensor-status').hide();
$('#portsinput').show();
$('#dataflash_wrapper_global').hide();
$('#quad-status_wrapper').hide();

clearLiveDataRefreshTimer();

Expand Down
49 changes: 1 addition & 48 deletions src/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,54 +76,7 @@
:firmware-id="FC.CONFIG.flightControllerIdentifier"
:hardware-id="FC.CONFIG.hardwareName"
></betaflight-logo>
<div id="port-picker">
<div id="port-override-option">
<label for="port-override">
<span i18n="portOverrideText">Port:</span>
<input id="port-override" type="text" value="/dev/rfcomm0"/>
</label>
</div>
<div id="firmware-virtual-option">
<div class="dropdown dropdown-dark">
<select id="firmware-version-dropdown" class="dropdown-select" i18n_title="virtualMSPVersion"></select>
</div>
</div>
<div id="portsinput">
<div class="dropdown dropdown-dark">
<select class="dropdown-select" id="port" i18n_title="firmwareFlasherManualPort">
<option value="loading" i18n="serialPortLoading">Loading</option>
<!-- port list gets generated here -->
</select>
</div>
<div id="auto-connect-and-baud">
<div id="auto-connect-switch">
<label>
<input class="auto_connect togglesmall" type="checkbox"/>
<span class="auto_connect" i18n="autoConnect"></span>
</label>
</div>
<div id="baudselect">
<div class="dropdown dropdown-dark">
<select class="dropdown-select" id="baud" i18n_title="firmwareFlasherBaudRate">
<option value="1000000">1000000</option>
<option value="500000">500000</option>
<option value="250000">250000</option>
<option value="115200" selected="selected">115200</option>
<option value="57600">57600</option>
<option value="38400">38400</option>
<option value="28800">28800</option>
<option value="19200">19200</option>
<option value="14400">14400</option>
<option value="9600">9600</option>
<option value="4800">4800</option>
<option value="2400">2400</option>
<option value="1200">1200</option>
</select>
</div>
</div>
</div>
</div>
</div>
<!-- PortPicker was here -->
<div class="header-wrapper">
<div id="quad-status_wrapper">
<battery-icon
Expand Down

0 comments on commit 9a0fb31

Please sign in to comment.