Skip to content

Commit

Permalink
Merge pull request #2348 from TheIsotopes/bump_nwjs_version
Browse files Browse the repository at this point in the history
bump nw.js to version 0.50.2
  • Loading branch information
mikeller authored and haslinghuis committed Jan 14, 2021
2 parents b5c8567 + 3c43bc1 commit 17849c4
Show file tree
Hide file tree
Showing 4 changed files with 353 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const NODE_ENV = process.env.NODE_ENV || 'production';
let gitChangeSetId;

const nwBuilderOptions = {
version: '0.47.0',
version: '0.50.2',
files: `${DIST_DIR}**/*`,
macIcns: './src/images/bf_icon.icns',
macPlist: { 'CFBundleDisplayName': 'Betaflight Configurator'},
Expand Down
149 changes: 149 additions & 0 deletions src/css/tabs/receiver.css
Original file line number Diff line number Diff line change
Expand Up @@ -577,3 +577,152 @@
display: inherit;
}
}


/* rx configuration */

.tab-receiver .receiver select {
border: 1px solid var(--subtleAccent);
width: 230px;
height: 20px;
float: left;
margin-right: 15px;
border-radius: 3px;
}

.tab-receiver table {
margin-bottom: 0;
width: 100%;
float: left;
}

.tab-receiver table, .tab-receiver table th, .tab-receiver table td {
padding: 0;
text-align: left;
}

.tab-receiver table th {
padding: 3px;
border-bottom: 1px solid var(--subtleAccent);
}

.tab-receiver table td {
padding: 5px 3px;
border-bottom: 1px solid var(--subtleAccent);
}

.tab-receiver table tr td:first-child {
text-align: left;
width: 55px;
}

.tab-receiver table thead tr:first-child {
background-color: #ececec;
}

.tab-receiver dl.features dt {
float: left;
width: 10px;
height: 18px;
line-height: 18px;
}

.tab-receiver dl.features dt input {
margin-top: 2px;
}

.tab-receiver dl.features dd {
margin: 0 0 0 20px;
height: 18px;
line-height: 18px;
}

.tab-receiver span {
margin: 0;
}

.tab-receiver .spacer_box {
padding-bottom: 10px;
float: left;
width: calc(100% - 20px);
}

.tab-receiver .select
{
margin-bottom: 5px;
clear: left;
padding-bottom: 5px;
border-bottom: 1px solid var(--subtleAccent);
width: 100%;
float: left;
}

.tab-receiver .select:last-child {
border-bottom: none;
padding-bottom: 0;
margin-bottom: 0;
}

.tab-receiver .gui_box_titlebar {
margin-bottom: 0;
}

.tab-receiver .rssi thead {
display: none;
}

.tab-receiver .gui_box {
margin-bottom: 10px;
float: left;
}

.tab-receiver .rssi_feature td {
border-bottom: none;
padding-bottom: 0;
margin-bottom: 0;
}

.tab-receiver .rssi_feature .gui_box {
float: left;
}

.tab-receiver .rssi_feature td:nth-child(2) {
width: 30px;
}

.tab-receiver .serialRXBox, .spiRxBox {
padding-top: 0;
}

.tab-receiver .gui_box {
font-weight: bold;
}

.tab-receiver .gui_box span {
font-style: normal;
font-weight: normal;
line-height: 19px;
color: #4f4f4f;
font-size: 11px;
}

@media only screen and (max-width: 1055px) , only screen and (max-device-width: 1055px) {
.tab-receiver .gui_box span {
line-height: 17px;
}
.tab-receiver .rssi_feature .gui_box {
float: left;
}
}

@media all and (max-width: 575px) {
.tab-receiver .rssi_feature .gui_box {
min-height: auto;
}
.tab-receiver .rssi_feature td:nth-child(2) {
width: auto;
}
select.features.rxMode, select.serialRX {
width: 100%;
}
}
149 changes: 143 additions & 6 deletions src/js/tabs/receiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ TABS.receiver = {
rateChartHeight: 117,
useSuperExpo: false,
deadband: 0,
yawDeadband: 0
yawDeadband: 0,
analyticsChanges: {},
};

TABS.receiver.initialize = function (callback) {
Expand Down Expand Up @@ -49,7 +50,11 @@ TABS.receiver.initialize = function (callback) {
}

function load_mixer_config() {
MSP.send_message(MSPCodes.MSP_MIXER_CONFIG, false, false, load_html);
MSP.send_message(MSPCodes.MSP_MIXER_CONFIG, false, false, load_serial_config);
}

function load_serial_config() {
mspHelper.loadSerialConfig(load_html);
}

function load_html() {
Expand All @@ -59,6 +64,12 @@ TABS.receiver.initialize = function (callback) {
MSP.send_message(MSPCodes.MSP_FEATURE_CONFIG, false, false, get_rc_data);

function process_html() {
self.analyticsChanges = {};

const featuresElement = $('.tab-receiver .features');

FC.FEATURE_CONFIG.features.generateElements(featuresElement);

// translate to user-selected language
i18n.localizePage();

Expand Down Expand Up @@ -230,7 +241,122 @@ TABS.receiver.initialize = function (callback) {

$('select[name="rssi_channel"]').val(FC.RSSI_CONFIG.channel);

const serialRxSelectElement = $('select.serialRX');
FC.getSerialRxTypes().forEach((serialRxType, index) => {
serialRxSelectElement.append(`<option value="${index}">${serialRxType}</option>`);
});

serialRxSelectElement.change(function () {
const serialRxValue = parseInt($(this).val());

let newValue;
if (serialRxValue !== FC.RX_CONFIG.serialrx_provider) {
newValue = $(this).find('option:selected').text();
}
self.analyticsChanges['SerialRx'] = newValue;

FC.RX_CONFIG.serialrx_provider = serialRxValue;
});

// select current serial RX type
serialRxSelectElement.val(FC.RX_CONFIG.serialrx_provider);

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_31)) {
const spiRxTypes = [
'NRF24_V202_250K',
'NRF24_V202_1M',
'NRF24_SYMA_X',
'NRF24_SYMA_X5C',
'NRF24_CX10',
'CX10A',
'NRF24_H8_3D',
'NRF24_INAV',
'FRSKY_D',
];

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_37)) {
spiRxTypes.push(
'FRSKY_X',
'A7105_FLYSKY',
'A7105_FLYSKY_2A',
'NRF24_KN'
);
}

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_41)) {
spiRxTypes.push(
'SFHSS',
'SPEKTRUM',
'FRSKY_X_LBT'
);
}

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
spiRxTypes.push(
'REDPINE'
);
}

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
spiRxTypes.push(
'FRSKY_X_V2',
'FRSKY_X_LBT_V2'
);
}

const spiRxElement = $('select.spiRx');
for (let i = 0; i < spiRxTypes.length; i++) {
spiRxElement.append(`<option value="${i}">${spiRxTypes[i]}</option>');
}
spiRxElement.change(function () {
const value = parseInt($(this).val());
let newValue = undefined;
if (value !== FC.RX_CONFIG.rxSpiProtocol) {
newValue = $(this).find('option:selected').text();
}
self.analyticsChanges['SPIRXProtocol'] = newValue;
FC.RX_CONFIG.rxSpiProtocol = value;
});
// select current serial RX type
spiRxElement.val(FC.RX_CONFIG.rxSpiProtocol);
}
// UI Hooks
function checkShowSerialRxBox() {
if (FC.FEATURE_CONFIG.features.isEnabled('RX_SERIAL')) {
$('div.serialRXBox').show();
} else {
$('div.serialRXBox').hide();
}
}
function checkShowSpiRxBox() {
if (FC.FEATURE_CONFIG.features.isEnabled('RX_SPI')) {
$('div.spiRxBox').show();
} else {
$('div.spiRxBox').hide();
}
}
$(featuresElement).filter('select').change(function () {
const element = $(this);
FC.FEATURE_CONFIG.features.updateData(element);
updateTabList(FC.FEATURE_CONFIG.features);
if (element.attr('name') === 'rxMode') {
checkShowSerialRxBox();
checkShowSpiRxBox();
}
});
checkShowSerialRxBox();
checkShowSpiRxBox();
$('a.refresh').click(function () {
tab.refresh(function () {
GUI.log(i18n.getMessage('receiverDataRefreshed'));
Expand Down Expand Up @@ -277,7 +403,11 @@ TABS.receiver.initialize = function (callback) {
}
function save_rssi_config() {
MSP.send_message(MSPCodes.MSP_SET_RSSI_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RSSI_CONFIG), false, save_rc_configs);
MSP.send_message(MSPCodes.MSP_SET_RSSI_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RSSI_CONFIG), false, save_feature_config);
}
function save_feature_config() {
MSP.send_message(MSPCodes.MSP_FEATURE_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FEATURE_CONFIG), false, save_rc_configs);
}
function save_rc_configs() {
Expand All @@ -290,20 +420,27 @@ TABS.receiver.initialize = function (callback) {
}
function save_rx_config() {
const nextCallback = save_to_eeprom;
const nextCallback = save_serial_config;
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, nextCallback);
} else {
nextCallback();
}
}
function save_serial_config() {
mspHelper.sendSerialConfig(save_to_eeprom);
}
function save_to_eeprom() {
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
GUI.log(i18n.getMessage('receiverEepromSaved'));
});
}
analytics.sendChangeEvents(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, self.analyticsChanges);
self.analyticsChanges = {};
MSP.send_message(MSPCodes.MSP_SET_RX_MAP, mspHelper.crunch(MSPCodes.MSP_SET_RX_MAP), false, save_rssi_config);
});
Expand Down Expand Up @@ -458,7 +595,7 @@ TABS.receiver.initialize = function (callback) {
labelsChannelData.ch4.push(element);
}
});

let plotUpdateRate;
const rxRefreshRate = $('select[name="rx_refresh_rate"]');

Expand Down Expand Up @@ -511,7 +648,7 @@ TABS.receiver.initialize = function (callback) {
labelsChannelData.ch2[0].text(FC.RC.channels[1]);
labelsChannelData.ch3[0].text(FC.RC.channels[2]);
labelsChannelData.ch4[0].text(FC.RC.channels[3]);

// push latest data to the main array
for (let i = 0; i < FC.RC.active_channels; i++) {
rxPlotData[i].push([samples, FC.RC.channels[i]]);
Expand Down
Loading

0 comments on commit 17849c4

Please sign in to comment.