Skip to content

Commit e6739a3

Browse files
authored
Merge pull request #593 from basdelfos/profile-switch-fix
Fixed switching profiles and rate profiles
2 parents e6ceb0e + e0fa65b commit e6739a3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tabs/pid_tuning.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,13 @@ TABS.pid_tuning.initialize = function (callback) {
560560
$('.tab-pid_tuning select[name="profile"]').change(function () {
561561
self.currentProfile = parseInt($(this).val());
562562
self.updating = true;
563+
$(this).prop('disabled', 'true');
563564
MSP.promise(MSPCodes.MSP_SELECT_SETTING, [self.currentProfile]).then(function () {
564565
self.refresh(function () {
565566
self.updating = false;
567+
568+
$('.tab-pid_tuning select[name="profile"]').prop('disabled', 'false');
569+
CONFIG.profile = self.currentProfile;
566570

567571
GUI.log(chrome.i18n.getMessage('pidTuningLoadedProfile', [self.currentProfile + 1]));
568572
});
@@ -573,10 +577,14 @@ TABS.pid_tuning.initialize = function (callback) {
573577
$('.tab-pid_tuning select[name="rate_profile"]').change(function () {
574578
self.currentRateProfile = parseInt($(this).val());
575579
self.updating = true;
580+
$(this).prop('disabled', 'true');
576581
MSP.promise(MSPCodes.MSP_SELECT_SETTING, [self.currentRateProfile + self.RATE_PROFILE_MASK]).then(function () {
577582
self.refresh(function () {
578583
self.updating = false;
579584

585+
$('.tab-pid_tuning select[name="rate_profile"]').prop('disabled', 'false');
586+
CONFIG.rateProfile = self.currentRateProfile;
587+
580588
GUI.log(chrome.i18n.getMessage('pidTuningLoadedRateProfile', [self.currentRateProfile + 1]));
581589
});
582590
});
@@ -1003,10 +1011,12 @@ TABS.pid_tuning.checkUpdateProfile = function (updateRateProfile) {
10031011
self.refresh(function () {
10041012
if (changedProfile) {
10051013
GUI.log(chrome.i18n.getMessage('pidTuningReceivedProfile', [CONFIG.profile + 1]));
1014+
CONFIG.profile = self.currentProfile;
10061015
}
10071016

10081017
if (changedRateProfile) {
10091018
GUI.log(chrome.i18n.getMessage('pidTuningReceivedRateProfile', [CONFIG.rateProfile + 1]));
1019+
CONFIG.rateProfile = self.currentRateProfile
10101020
}
10111021
});
10121022
}

0 commit comments

Comments
 (0)