From b76b608bd1a76d8e1f9d15ca4897e672bb5c5497 Mon Sep 17 00:00:00 2001 From: nerdCopter <56646290+nerdCopter@users.noreply.github.com> Date: Thu, 21 Mar 2024 15:53:15 -0500 Subject: [PATCH 1/6] MSP 1.54 support --- locales/en/messages.json | 10 +++++++++- manifest.json | 2 +- package.json | 2 +- src/js/msp/MSPHelper.js | 12 ++++++++++++ src/js/tabs/configuration.js | 29 ++++++++++++++++++++++++++--- src/tabs/configuration.html | 11 +++++++++++ src/tabs/motors.html | 9 ++++++++- 7 files changed, 68 insertions(+), 7 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index 13d5ca809..a1607ac15 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -2410,7 +2410,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 141f036a4..33a659ee4 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..ad866391f 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -990,6 +990,12 @@ 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(); + PID_ADVANCED_CONFIG.gyroSampleRateHz = data.readU16(); + } + //End MSP 1.54 break; case MSPCodes.MSP_FILTER_CONFIG: @@ -1994,6 +2000,12 @@ 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) + .push16(PID_ADVANCED_CONFIG.gyroSampleRateHz); + } + //End MSP 1.54 break; case MSPCodes.MSP_SET_FILTER_CONFIG: diff --git a/src/js/tabs/configuration.js b/src/js/tabs/configuration.js index 5a49eee45..d6f6b61e4 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")) { + gyroBaseFreq = PID_ADVANCED_CONFIG.gyroSampleRateHz / 1000; + } else { + gyroBaseFreq = 8; + } } updateGyroDenom(gyroBaseFreq); @@ -521,7 +532,13 @@ 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")) { + //pidBaseFreq = FC.CONFIG.sampleRateHz / 1000; + pidBaseFreq = PID_ADVANCED_CONFIG.gyroSampleRateHz / 1000; + } else { + pidBaseFreq = 8; + } if (semver.gte(CONFIG.apiVersion, "1.25.0") && gyroUse32kHz_e.is(':checked')) { pidBaseFreq = 32; } @@ -1114,6 +1131,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/tabs/configuration.html b/src/tabs/configuration.html index a286ebd6b..8812ef101 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 @@
-
+
From 52755cc0926284d3171a2cad534b14e828971f22 Mon Sep 17 00:00:00 2001 From: nerdCopter <56646290+nerdCopter@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:00:06 -0500 Subject: [PATCH 2/6] MSP 1.54 support - move sampleRate location --- src/js/msp/MSPHelper.js | 9 ++++++--- src/js/tabs/configuration.js | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index ad866391f..4bafd13c1 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: @@ -993,7 +998,6 @@ MspHelper.prototype.process_data = function(dataHandler) { //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(); - PID_ADVANCED_CONFIG.gyroSampleRateHz = data.readU16(); } //End MSP 1.54 break; @@ -2002,8 +2006,7 @@ MspHelper.prototype.crunch = function(code) { } //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) - .push16(PID_ADVANCED_CONFIG.gyroSampleRateHz); + buffer.push8(PID_ADVANCED_CONFIG.motorPoleCount); } //End MSP 1.54 break; diff --git a/src/js/tabs/configuration.js b/src/js/tabs/configuration.js index d6f6b61e4..ab5c432f5 100644 --- a/src/js/tabs/configuration.js +++ b/src/js/tabs/configuration.js @@ -511,7 +511,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) { gyroBaseFreq = 32; } else { if (semver.gte(CONFIG.apiVersion, "1.54.0")) { - gyroBaseFreq = PID_ADVANCED_CONFIG.gyroSampleRateHz / 1000; + gyroBaseFreq = CONFIG.gyroSampleRateHz / 1000; } else { gyroBaseFreq = 8; } @@ -535,7 +535,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) { let pidBaseFreq; if (semver.gte(CONFIG.apiVersion, "1.54.0")) { //pidBaseFreq = FC.CONFIG.sampleRateHz / 1000; - pidBaseFreq = PID_ADVANCED_CONFIG.gyroSampleRateHz / 1000; + pidBaseFreq = CONFIG.gyroSampleRateHz / 1000; } else { pidBaseFreq = 8; } From a0537daa48391514bf25e59d0b5be5e0e6e7488c Mon Sep 17 00:00:00 2001 From: nerdCopter <56646290+nerdCopter@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:03:18 -0500 Subject: [PATCH 3/6] MSP 1.54 support - cleanup --- src/js/tabs/configuration.js | 1 - src/tabs/configuration.html | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/js/tabs/configuration.js b/src/js/tabs/configuration.js index ab5c432f5..acaa7a2bb 100644 --- a/src/js/tabs/configuration.js +++ b/src/js/tabs/configuration.js @@ -534,7 +534,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) { let pidBaseFreq; if (semver.gte(CONFIG.apiVersion, "1.54.0")) { - //pidBaseFreq = FC.CONFIG.sampleRateHz / 1000; pidBaseFreq = CONFIG.gyroSampleRateHz / 1000; } else { pidBaseFreq = 8; diff --git a/src/tabs/configuration.html b/src/tabs/configuration.html index 8812ef101..44a9a9271 100644 --- a/src/tabs/configuration.html +++ b/src/tabs/configuration.html @@ -242,7 +242,7 @@
- +
From b5f858aebbcbd060a3eae3900029aec77eebcf3d Mon Sep 17 00:00:00 2001 From: nerdCopter <56646290+nerdCopter@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:22:43 -0500 Subject: [PATCH 4/6] MSP 1.54 support - insurance for CONFIG.gyroSampleRateHz validity --- src/js/tabs/configuration.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/tabs/configuration.js b/src/js/tabs/configuration.js index acaa7a2bb..445327387 100644 --- a/src/js/tabs/configuration.js +++ b/src/js/tabs/configuration.js @@ -510,7 +510,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) { if ($(this).is(':checked')) { gyroBaseFreq = 32; } else { - if (semver.gte(CONFIG.apiVersion, "1.54.0")) { + if (semver.gte(CONFIG.apiVersion, "1.54.0") && CONFIG.gyroSampleRateHz) { gyroBaseFreq = CONFIG.gyroSampleRateHz / 1000; } else { gyroBaseFreq = 8; @@ -533,7 +533,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) { var originalPidDenom = pid_select_e.val(); let pidBaseFreq; - if (semver.gte(CONFIG.apiVersion, "1.54.0")) { + if (semver.gte(CONFIG.apiVersion, "1.54.0") && CONFIG.gyroSampleRateHz) { pidBaseFreq = CONFIG.gyroSampleRateHz / 1000; } else { pidBaseFreq = 8; From a20ac7f537cba566b211b45f9a21f11c4c703970 Mon Sep 17 00:00:00 2001 From: nerdCopter <56646290+nerdCopter@users.noreply.github.com> Date: Fri, 5 Apr 2024 14:11:33 -0500 Subject: [PATCH 5/6] MSP 1.54 support - add vtx_low_power_disarm --- src/js/msp/MSPHelper.js | 11 +++++++++++ src/js/tabs/vtx.js | 17 +++++++++++++++-- src/tabs/vtx.html | 22 +++++----------------- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index 4bafd13c1..11d54494e 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -1561,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; @@ -2287,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/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/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 29246a4315eade3fc92196a40a579114ee81279c Mon Sep 17 00:00:00 2001 From: nerdCopter <56646290+nerdCopter@users.noreply.github.com> Date: Sun, 21 Apr 2024 09:36:45 -0500 Subject: [PATCH 6/6] OSD tab - unhide Core/ESC temperature elements form non-export-mode --- src/js/tabs/osd.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/tabs/osd.js b/src/js/tabs/osd.js index c9eae4d44..2d24d057c 100644 --- a/src/js/tabs/osd.js +++ b/src/js/tabs/osd.js @@ -1225,7 +1225,7 @@ OSD.loadDisplayFields = function() { preview: function (osd_data) { return "E" + OSD.generateTemperaturePreview(osd_data, 45); }, - isexpertmode: true //experimental + isexpertmode: false //experimental }, ESC_RPM: { name: 'ESC_RPM', @@ -1299,7 +1299,7 @@ OSD.loadDisplayFields = function() { preview: function (osd_data) { return "C" + OSD.generateTemperaturePreview(osd_data, 33); }, - isexpertmode: true //experimental + isexpertmode: false //experimental }, ANTI_GRAVITY: { name: 'ANTI_GRAVITY',