From 99cecfdba8fc3d6aa8ed9b97e2e426870a459ebc Mon Sep 17 00:00:00 2001 From: fgiudice98 Date: Wed, 11 Mar 2020 09:51:59 +0100 Subject: [PATCH] Update KISS logo Thanks Paul! Don't try to open modal if already open Don't assign button if modal already open Changed rates type change warning Max rate independent from deadband New actual rates logo Thanks to @Asizon and @igormedrano --- locales/en/messages.json | 4 +- src/images/rate_logos/actual.svg | 585 +++++++++++++++++++++++++------ src/images/rate_logos/kiss.svg | 108 ++++-- src/js/RateCurve.js | 8 +- src/js/tabs/pid_tuning.js | 34 +- src/tabs/pid_tuning.html | 3 +- 6 files changed, 587 insertions(+), 155 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index ddb8a937..c4634fff 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -5627,12 +5627,12 @@ "message": "Rates type change" }, "dialogRatesTypeNote": { - "message": "WARNING: You are changing the rates type. Your rates will be set to a default curve.

Nothing is saved yet and you can still return to your previous values by setting the previous rates type.

Click the Save button to apply the changes." + "message": "WARNING: You are changing the rates type. If you change the rates type your rates will be set to a default curve.

Nothing is saved yet and you can still return to the values saved in the model by clicking the \"Return to saved values\" button.

If you want to continue editing your rates without changing rates type just click \"Cancel\"." }, "dialogRatesTypeConfirm": { "message": "Change" }, - "dialogRatesTypeCancel": { + "dialogRatesTypeToSaved": { "message": "Return to saved values" } } diff --git a/src/images/rate_logos/actual.svg b/src/images/rate_logos/actual.svg index ccd10479..ac1b2fee 100644 --- a/src/images/rate_logos/actual.svg +++ b/src/images/rate_logos/actual.svg @@ -1,124 +1,483 @@ + + - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - + inkscape:version="0.92.4 (5da689c313, 2019-01-14)">image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/images/rate_logos/kiss.svg b/src/images/rate_logos/kiss.svg index 6388a34d..29a2133d 100644 --- a/src/images/rate_logos/kiss.svg +++ b/src/images/rate_logos/kiss.svg @@ -11,13 +11,22 @@ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="520" height="120" - viewBox="0 0 137.58333 31.75" + viewBox="0 0 137.58333 31.750001" version="1.1" - id="svg8" + id="svg88" inkscape:version="0.92.4 (5da689c313, 2019-01-14)" sodipodi:docname="kiss.svg"> + id="defs82"> + + + + + id="metadata85"> @@ -54,32 +63,77 @@ inkscape:label="Livello 1" inkscape:groupmode="layer" id="layer1" - transform="translate(0,-265.25)"> + transform="translate(0,-265.24998)"> + id="g20" + transform="matrix(0.11725134,0,0,-0.11725134,47.975973,272.29314)"> + + + + - + + + + + + + + + + + + + + + + diff --git a/src/js/RateCurve.js b/src/js/RateCurve.js index c1fda2fa..19d73424 100644 --- a/src/js/RateCurve.js +++ b/src/js/RateCurve.js @@ -156,7 +156,13 @@ RateCurve.prototype.rcCommandRawToDegreesPerSecond = function (rcData, rate, rcR var angleRate; if (rate !== undefined && rcRate !== undefined && rcExpo !== undefined) { - const rcCommandf = this.rcCommand(rcData, 1, deadband) / 500; + let rcCommandf = this.rcCommand(rcData, 1, deadband); + if (semver.gte(CONFIG.apiVersion, "1.43.0")) { + rcCommandf = rcCommandf / (500 - deadband); + } else { + rcCommandf = rcCommandf / 500; + } + var rcCommandfAbs = Math.abs(rcCommandf); switch(TABS.pid_tuning.currentRatesType) { diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js index 7fa1858c..1077a76f 100644 --- a/src/js/tabs/pid_tuning.js +++ b/src/js/tabs/pid_tuning.js @@ -8,6 +8,7 @@ TABS.pid_tuning = { currentProfile: null, currentRateProfile: null, currentRatesType: null, + previousRatesType: null, RATES_TYPE: { BETAFLIGHT: 0, RACEFLIGHT: 1, @@ -422,6 +423,7 @@ TABS.pid_tuning.initialize = function (callback) { } self.currentRatesType = RC_tuning.rates_type; + self.previousRatesType = null; ratesTypeListElement.val(self.currentRatesType); self.changeRatesType(self.currentRatesType); // update rate type code when updating the tab @@ -2337,32 +2339,42 @@ TABS.pid_tuning.updatePIDColors = function(clear = false) { TABS.pid_tuning.changeRatesType = function(rateTypeID) { const self = this; const dialogRatesType = $('.dialogRatesType')[0]; - let sameRatesType = true; - self.currentRatesType = rateTypeID; + if (self.previousRatesType == null) { + self.currentRatesType = rateTypeID; + self.changeRatesTypeLogo(); + self.changeRatesSystem(true); + self.previousRatesType = self.currentRatesType; + return; + } - if (self.currentRatesType !== RC_tuning.rates_type) { - sameRatesType = false; + if (!dialogRatesType.hasAttribute('open')) { dialogRatesType.showModal(); $('.dialogRatesType-cancelbtn').click(function() { - sameRatesType = true; + $('.rates_type select[id="ratesType"]').val(self.currentRatesType); + self.previousRatesType = self.currentRatesType; + dialogRatesType.close(); + }); + + $('.dialogRatesType-tosavedbtn').click(function() { self.currentRatesType = RC_tuning.rates_type; - $('.rates_type select[id="ratesType"]').val(RC_tuning.rates_type); + $('.rates_type select[id="ratesType"]').val(self.currentRatesType); self.changeRatesTypeLogo(); - self.changeRatesSystem(sameRatesType); + self.changeRatesSystem(true); + self.previousRatesType = self.currentRatesType; dialogRatesType.close(); }); $('.dialogRatesType-confirmbtn').click(function() { + self.currentRatesType = rateTypeID; self.changeRatesTypeLogo(); - self.changeRatesSystem(sameRatesType); + self.changeRatesSystem(false); + self.previousRatesType = self.currentRatesType; dialogRatesType.close(); }); - } else { - self.changeRatesTypeLogo(); - self.changeRatesSystem(sameRatesType); } + }; TABS.pid_tuning.changeRatesSystem = function(sameType) { diff --git a/src/tabs/pid_tuning.html b/src/tabs/pid_tuning.html index 145b0322..f150b459 100644 --- a/src/tabs/pid_tuning.html +++ b/src/tabs/pid_tuning.html @@ -1509,7 +1509,8 @@
- + +