Hi Genesis,
I have tried your suggestion and it works great! My Pmax 5k+ no longer falls asleep!
Thank you so much for for helping me out!!!
All the best,
Werner
Hi Genesis,
I have tried your suggestion and it works great! My Pmax 5k+ no longer falls asleep!
Thank you so much for for helping me out!!!
All the best,
Werner
Hi Genesis,
I did run into a little problem. I have noticed that whenever I restart PiTool, I loose the entry because a new profile.json file is written. I ran PiService Launcher.exe as administrator, but now I am not sure if this really saves the modified file. What am I doing wrong? I am on PiTool v .112.
Any help is greatly appreciated.
Thank you!
Werner
There should be several options to deal with it:
All options that change the profile.json should be disabled when upgrading to a new PiTool version
Hi mojojojo,
I have read what you have written, but I donāt have a clue what this all means. And definitely do not know how to write a batch file. I am just a flight simulator enthusiast and not a programmer or computer geek. Sorry. All I did was try to follow the instructions of Genesis. My suspicion is that I did not save the modified file correctly.
Youāve done everything correctly, itās just that PiTool will overwrite your changes every time you close it.
If X-Plane comes with Steam launch it from there instead of PiTool, simplest way is to create a desktop shortcut.
PiLauncherService restart is only required if you want to see your changes right now, otherwise theyāll take effect when you next start your computer.
I was thinking of an easy solution to add the paramters via script, dunno if I feel motivated enough and implement it just for science.
Hi mojojojo,
Thank you for your insights!
Good idea to leave Pitool off. As long as I donāt have to make any changes in the Pitool settings, I can leave it off.
For the moment this seems to work.
Many thanks again and all the best,
Werner
Youāre welcome Werner, enjoy your flights.
Iāve put this script together to add the parameters to the config file and preserving all modifications PiTool made.
Before using make sure you have an old backup file of profile.json for the PiTool version you are on
$configfile = "$env:LOCALAPPDATA\pimax\runtime\profile.json"
$injectObj ='{
"enable_screen_saver": 0,
"standby_timeout_min": 14400
}' | ConvertFrom-Json
$jsonObj = (Get-Content $configfile) `
-replace '""\s*:','"a":' `
| ConvertFrom-Json
function Merge-Objects {
Param ([PSCustomObject]$sourceObj, [PSCustomObject]$targetObj)
$sourceObj.psobject.Properties | ForEach-Object {
if ($_.TypeNameOfValue -eq 'System.Management.Automation.PSCustomObject' -and (Get-Member -inputobject $targetObj -name $_.Name -Membertype $_.MemberType)) {
Merge-Objects -sourceObj ($sourceObj | Select -ExpandProperty $_.Name) -targetObj ($targetObj | Select -ExpandProperty $_.Name)
} else {
$targetObj | Add-Member -MemberType $_.MemberType -Name $_.Name -Value $_.Value -Force
}
}
}
Merge-Objects -sourceObj $injectObj -targetObj $jsonObj
($jsonObj | ConvertTo-Json) `
-replace '"a"\s*:','"":' `
| Set-Content $configfile
#cmd /c pause | out-null
Save it as a .ps1 file and then right click and Run with PowerShell. The changes wonāt take effect until the service is restarted.
Note:
Pimax can somehow use āā: as a key and get away with it.
Edit:
Now more generic by merging two jsons
Hello mojojojo,
Thank you very much for your kind efforts to help me!
I will attempt to try this out tomorrow. However this may be beyond my capabilities since I have never done something like this before. Weāll seeā¦
All the best,
Werner
It saves the time to add the 2 configuration lines, thatās all. Thereās no need to use it, just convenience
All the best to you too.
Hi mojojojo,
Thank you so much for this script! It really seems to work!
I have been turning Pitool on and off and the profile.json file is holding so far.
Much appreciate your support!
Thanks again and best regards,
Werner
Iām happy youāre getting a smooth X-Plane experience now.
Because I did a poor job at explaining what the script does, it only adds the configuration settings to the profile.json, the script cannot prevent losing the changes though.
Just to be save and needless to say, the headset should always be turned off between gaming sessions(a few minutes donāt matter) with this configuration to prevent degrading the panels.
In case you need to restart the pimax service often, here is a quicker and more convenient way.
https://community.openmr.ai/t/question-for-bat-programmers-start-stop-service-and-tasks/17209/8
Off topic:
My script only needs a little bit more polish and exchanging game specific settings between users would be easier. However there arenāt many settings for which it is useful and although generating a valid json structure isnāt difficult, it would be too much to ask for from the average user.
It would be cool to find a way to have pimax utilize the new settings on the fly without restarting the service, but probably not going to happen.
I never needed that with Pimax, but something learned at my day job, is to also do taskkill /IM PiServerLauncher.exe /F
So ārefinedā mega script is:
sc stop PiServiceLauncher & timeout 1 & taskkill /IM PiServerLauncher.exe /F & start PiServiceLaunch
Probably needs taskkill statements for all the Pimax services, but you get the idea.
Also I noticed that Pi services are not idle, even when HMD disconnected. Because my gaming requires a lot of tools started/stopped, I just start PiServiceLauncher as part of my game startup script and stop it after I am done.
Cheers
Awesome! Thanks for the improved version.