Skip to content

Fix advanced settings TDP limits not persisting across restarts#1387

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-tdp-limits-not-saving
Draft

Fix advanced settings TDP limits not persisting across restarts#1387
Copilot wants to merge 2 commits intomainfrom
copilot/fix-tdp-limits-not-saving

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 16, 2026

Custom TDP min/max limits set in Advanced Settings always reset to device defaults on restart. The saved values were never actually written to Properties.Settings.Default.

Root cause

NumberBox_TDPMax/Min_ValueChanged updated IDevice.GetCurrent().cTDP[i] before calling SetProperty. SettingsManager.GetProperty falls back to cTDP[i] when no value has been saved yet (default 0) or when the ConfigurableTDPOverride toggle is off. With cTDP[i] already holding the new value, SetProperty's change-detection saw prevValue == value and returned early — never persisting anything.

// Before (broken): cTDP updated first, SetProperty sees no change
IDevice.GetCurrent().cTDP[1] = value;                              // cTDP[1] = 20
ManagerFactory.settingsManager.SetProperty("ConfigurableTDPOverrideUp", value);
// GetProperty("ConfigurableTDPOverrideUp") → cTDP[1] = 20 == 20 → skip save ❌

// After (fixed): SetProperty runs first against the old cTDP value
ManagerFactory.settingsManager.SetProperty("ConfigurableTDPOverrideUp", value);
// GetProperty("ConfigurableTDPOverrideUp") → cTDP[1] = 25 != 20 → saves ✅
IDevice.GetCurrent().cTDP[1] = value;

Changes

  • DevicePage.xaml.cs — Swapped order in NumberBox_TDPMax_ValueChanged and NumberBox_TDPMin_ValueChanged: call SetProperty before updating cTDP[i].
  • PerformanceManager.cs — Fixed typos in SettingsManager_SettingValueChanged validation guards: guards compared the existing static TDPMin/TDPMax fields against each other (always valid, so never rejected anything) instead of comparing the incoming TDPmin/TDPmax against the current limit. This could allow an invalid TDPMin > TDPMax state to be set.
Original prompt

This section details on the original issue you should resolve

<issue_title>Advanced settings TDP limits not saving</issue_title>
<issue_description>Device manufacturer

  • ASUS
  • LENOVO

Device model

  • Flow Z13 2025
  • Legion Go Z1E

Handheld Companion Version

  • 0.28.4.6

Describe the bug

  • On the flow z14 the default device TDP limits are set from 10-25TDP. You can set the min max TDP but it will always reset to 10-25TDP upon restart of device or app.

  • On the legion go default is 5 - 30TDP. Since its within device limitations I never bothered with it but yesterday I did and it also reset upon restarting the app.

Feature suggestions for the Flow Z13

  • Also a feature for the flow Z13 could be to map the armory crate button and also a toggle for the touchscreen.
    </issue_description>

Comments on the Issue (you are @copilot in this section)

@Valkirie Let me look into it.

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

In NumberBox_TDPMax_ValueChanged and NumberBox_TDPMin_ValueChanged, the
in-memory cTDP was updated before calling SetProperty. SettingsManager's
GetProperty falls back to IDevice.GetCurrent().cTDP[i] when the saved value
is 0 or the toggle is off, so the freshly-updated cTDP made SetProperty see
no change and skip the save entirely.

Fix: call SetProperty before updating cTDP so the change is correctly
detected and persisted.

Also fix typos in PerformanceManager.SettingsManager_SettingValueChanged
where the validation guards compared the existing static TDPMin/TDPMax
fields against each other instead of comparing the incoming new value
against the current limit.

Co-authored-by: Valkirie <934757+Valkirie@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix advanced settings TDP limits not saving Fix advanced settings TDP limits not persisting across restarts Mar 16, 2026
Copilot AI requested a review from Valkirie March 16, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Advanced settings TDP limits not saving

2 participants