From b25d0c2230e3284345650ce6e10fda69eb412c29 Mon Sep 17 00:00:00 2001 From: nerdCopter <56646290+nerdCopter@users.noreply.github.com> Date: Tue, 30 Apr 2024 13:13:44 -0500 Subject: [PATCH 1/2] MSP 1.54 support (#510) * MSP 1.54 support * MSP 1.54 support - move sampleRate location * MSP 1.54 support - cleanup * MSP 1.54 support - insurance for CONFIG.gyroSampleRateHz validity * MSP 1.54 support - add vtx_low_power_disarm --- locales/en/messages.json | 10 +++++++++- manifest.json | 2 +- package.json | 2 +- src/js/msp/MSPHelper.js | 26 ++++++++++++++++++++++++++ src/js/tabs/configuration.js | 28 +++++++++++++++++++++++++--- src/js/tabs/vtx.js | 17 +++++++++++++++-- src/tabs/configuration.html | 11 +++++++++++ src/tabs/motors.html | 9 ++++++++- src/tabs/vtx.html | 22 +++++----------------- 9 files changed, 101 insertions(+), 26 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index f2ed2c4c0..74e9bfdb4 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -2409,7 +2409,15 @@ "motorsEnableControl": { "message": "I understand the risks, the propellers are removed - enable motor control and arming, and disable Runaway Takeoff Prevention." }, - + "motorConfigNotice": { + "message": "ESC/Motor Features are on the Configuration tab." + }, + "motorPoleCount": { + "message": "Motor Poles" + }, + "motorPoleCountHelp": { + "message": "The number of magnets on the motor bell." + }, "sensorsInfo": { "message": "Keep in mind that using fast update periods and rendering multiple graphs at the same time is resource heavy and will burn your battery quicker if you use a laptop.
We recommend to only render graphs for sensors you are interested in while using reasonable update periods." }, diff --git a/manifest.json b/manifest.json index 451e12db9..5d242563e 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "minimum_chrome_version": "49", "version": "0.4.1", - "max_msp": "1.53.0", + "max_msp": "1.54.0", "COMMENT": "MAX_MSP required!!!!", "author": "Emuflight Team", "name": "Emuflight Configurator", diff --git a/package.json b/package.json index a34fb9cc4..74ea44d77 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "emuflight-configurator", "description": "Crossplatform configuration tool for Emuflight flight control system.", "version": "0.4.1", - "max_msp": "1.53.0", + "max_msp": "1.54.0", "COMMENT": "MAX_MSP required!!!!", "main": "main.html", "chromium-args": "--disable-features=nw2", diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index 391657a44..11d54494e 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -790,6 +790,11 @@ MspHelper.prototype.process_data = function(dataHandler) { } } CONFIG.mcuTypeId = 255; + //MSP 1.54 + if (semver.gte(CONFIG.apiVersion, "1.54.0")) { + CONFIG.gyroSampleRateHz = data.readU16(); + } + //End MSP 1.54 break; case MSPCodes.MSP_NAME: @@ -990,6 +995,11 @@ MspHelper.prototype.process_data = function(dataHandler) { PID_ADVANCED_CONFIG.gyroUse32kHz = gyroUse32kHz; } } + //MSP 1.54 - insert here to avoid new unnecessary MSP code + if (semver.gte(CONFIG.apiVersion, "1.54.0")) { + PID_ADVANCED_CONFIG.motorPoleCount = data.readU8(); + } + //End MSP 1.54 break; case MSPCodes.MSP_FILTER_CONFIG: @@ -1551,6 +1561,11 @@ MspHelper.prototype.process_data = function(dataHandler) { VTX_CONFIG.vtx_power = data.readU8(); VTX_CONFIG.vtx_pit_mode = data.readU8() !== 0; VTX_CONFIG.vtx_frequency = data.readU16(); + //MSP 1.54 + if (semver.gte(CONFIG.apiVersion, "1.54.0")) { + VTX_CONFIG.vtx_low_power_disarm = data.readU8(); + } + // End MSP 1.54 } //console.log('exit MSPCodes.MSP_VTX_CONFIG'); break; @@ -1994,6 +2009,11 @@ MspHelper.prototype.crunch = function(code) { buffer.push8(gyroUse32kHz); } } + //MSP 1.54 - insert here to avoid new unnecessary MSP code + if (semver.gte(CONFIG.apiVersion, "1.54.0")) { + buffer.push8(PID_ADVANCED_CONFIG.motorPoleCount); + } + //End MSP 1.54 break; case MSPCodes.MSP_SET_FILTER_CONFIG: @@ -2272,6 +2292,12 @@ MspHelper.prototype.crunch = function(code) { buffer.push16(VTX_CONFIG.vtx_frequency) .push8(VTX_CONFIG.vtx_power) .push8(VTX_CONFIG.vtx_pit_mode ? 1 : 0); + //MSP 1.54 + if (semver.gte(CONFIG.apiVersion, "1.40.0")) { + //buffer.push16(VTX_CONFIG.vtx_pit_mode_freq); + buffer.push8(VTX_CONFIG.vtx_low_power_disarm); + } + //End MSP 1.54 } break; diff --git a/src/js/tabs/configuration.js b/src/js/tabs/configuration.js index 5a49eee45..445327387 100644 --- a/src/js/tabs/configuration.js +++ b/src/js/tabs/configuration.js @@ -431,6 +431,14 @@ TABS.configuration.initialize = function (callback, scrollPosition) { $('input[name="unsyncedpwmfreq"]').val(PID_ADVANCED_CONFIG.motor_pwm_rate); $('input[name="digitalIdlePercent"]').val(PID_ADVANCED_CONFIG.digitalIdlePercent); + //MSP 1.54 + if (semver.gte(CONFIG.apiVersion, "1.54.0")) { + $('input[name="motorPoleCount"]').val(PID_ADVANCED_CONFIG.motorPoleCount); + $('div.motorPoleCount').show(); + } else { + $('div.motorPoleCount').hide(); + } + //End MSP 1.54 esc_protocol_e.val(PID_ADVANCED_CONFIG.fast_pwm_protocol + 1); esc_protocol_e.change(function () { @@ -485,7 +493,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) { if (semver.gte(CONFIG.apiVersion, "1.25.0")) { while (denom <= 32) { addDenomOption(gyro_select_e, denom, gyroBaseFreq); - denom ++; } } @@ -503,7 +510,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) { if ($(this).is(':checked')) { gyroBaseFreq = 32; } else { - gyroBaseFreq = 8; + if (semver.gte(CONFIG.apiVersion, "1.54.0") && CONFIG.gyroSampleRateHz) { + gyroBaseFreq = CONFIG.gyroSampleRateHz / 1000; + } else { + gyroBaseFreq = 8; + } } updateGyroDenom(gyroBaseFreq); @@ -521,7 +532,12 @@ TABS.configuration.initialize = function (callback, scrollPosition) { gyro_select_e.change(function () { var originalPidDenom = pid_select_e.val(); - var pidBaseFreq = 8; + let pidBaseFreq; + if (semver.gte(CONFIG.apiVersion, "1.54.0") && CONFIG.gyroSampleRateHz) { + pidBaseFreq = CONFIG.gyroSampleRateHz / 1000; + } else { + pidBaseFreq = 8; + } if (semver.gte(CONFIG.apiVersion, "1.25.0") && gyroUse32kHz_e.is(':checked')) { pidBaseFreq = 32; } @@ -1114,6 +1130,12 @@ TABS.configuration.initialize = function (callback, scrollPosition) { } //end MSP 1.51 + //MSP 1.54 + if (semver.gte(CONFIG.apiVersion, "1.54.0")) { + PID_ADVANCED_CONFIG.motorPoleCount = parseInt($('input[name="motorPoleCount"]').val()); + } + //End MSP 1.54 + function save_serial_config() { var next_callback = save_feature_config; MSP.send_message(MSPCodes.MSP_SET_CF_SERIAL_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_CF_SERIAL_CONFIG), false, next_callback); diff --git a/src/js/tabs/vtx.js b/src/js/tabs/vtx.js index 2b0e78106..13acb1f88 100644 --- a/src/js/tabs/vtx.js +++ b/src/js/tabs/vtx.js @@ -117,7 +117,15 @@ TABS.vtx.initialize = function(callback) { $(".field.vtx_pit_mode").hide(); } - //$("#vtx_pit_mode_frequency").val(VTX_CONFIG.vtx_pit_mode_frequency); //no EmuF MSP + // MSP 1.54 + if (semver.gte(CONFIG.apiVersion, "1.54.0")) { + $("#vtx_low_power_disarm").prop('checked', VTX_CONFIG.vtx_low_power_disarm); + $(".field.vtx_low_power_disarm").show(); + } else { + $(".field.vtx_low_power_disarm").hide(); + } + // End MSP 1.54 + //const yesMessage = i18n.getMessage("yes"); //const noMessage = i18n.getMessage("no"); //$("#vtx_device_ready_description").text(VTX_CONFIG.vtx_device_ready ? yesMessage : noMessage); @@ -339,7 +347,12 @@ function dump_html_to_msp() { VTX_CONFIG.vtx_power = parseInt($("#vtx_power").val()); VTX_CONFIG.vtx_pit_mode = $("#vtx_pit_mode").prop('checked'); - // VTX_CONFIG.vtx_low_power_disarm = parseInt($("#vtx_low_power_disarm").val()); //no EmuF MSP + + // MSP 1.54 + if (semver.gte(CONFIG.apiVersion, "1.54.0")) { + VTX_CONFIG.vtx_low_power_disarm = $("#vtx_low_power_disarm").prop('checked'); + } + // End MSP 1.54 //console.log('dump_html_to_msp(): bnd'+VTX_CONFIG.vtx_band+'/ch'+VTX_CONFIG.vtx_channel+'/frq'+VTX_CONFIG.vtx_frequency+'/lvl'+VTX_CONFIG.vtx_power+'/pm'+VTX_CONFIG.vtx_pit_mode); //console.log('exit dump_html_to_msp()'); diff --git a/src/tabs/configuration.html b/src/tabs/configuration.html index a286ebd6b..44a9a9271 100644 --- a/src/tabs/configuration.html +++ b/src/tabs/configuration.html @@ -242,6 +242,17 @@
+ +
+ +
+ diff --git a/src/tabs/motors.html b/src/tabs/motors.html index a2f8d701f..576cba987 100644 --- a/src/tabs/motors.html +++ b/src/tabs/motors.html @@ -4,6 +4,13 @@
+ +
+
+

+
+
+
@@ -171,7 +178,7 @@
-
+
diff --git a/src/tabs/vtx.html b/src/tabs/vtx.html index 723e7d5ae..a562827e0 100644 --- a/src/tabs/vtx.html +++ b/src/tabs/vtx.html @@ -87,27 +87,15 @@
- - +
+ +
- --> +
From 20b9663bbe1159cf01f0828831da8855fc7d9645 Mon Sep 17 00:00:00 2001 From: nerdCopter <56646290+nerdCopter@users.noreply.github.com> Date: Tue, 30 Apr 2024 13:38:47 -0500 Subject: [PATCH 2/2] version bump 0.4.3 (#521) --- manifest.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 5d242563e..e68689775 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "minimum_chrome_version": "49", - "version": "0.4.1", + "version": "0.4.3", "max_msp": "1.54.0", "COMMENT": "MAX_MSP required!!!!", "author": "Emuflight Team", diff --git a/package.json b/package.json index 74ea44d77..cd6539da9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "emuflight-configurator", "description": "Crossplatform configuration tool for Emuflight flight control system.", - "version": "0.4.1", + "version": "0.4.3", "max_msp": "1.54.0", "COMMENT": "MAX_MSP required!!!!", "main": "main.html",