@@ -15,6 +15,7 @@ public class Vlv0100 : IDisposable
1515 static IntPtr PDFV = new IntPtr ( 0xFE700C00 + 0x4C ) ;
1616 static IntPtr XBID = new IntPtr ( 0xFE700300 + 0xBD ) ;
1717 static IntPtr PDCT = new IntPtr ( 0xFE700C00 + 0x01 ) ;
18+ static IntPtr MCBL = new IntPtr ( 0xFE700B00 + 0x9F ) ;
1819 static ushort IO6C = 0x6C ;
1920
2021 public const ushort MAX_FAN_RPM = 0x1C84 ;
@@ -26,6 +27,7 @@ public struct DeviceVersion
2627 public byte PDCS { get ; set ; }
2728
2829 public bool BatteryTempLE { get ; set ; }
30+ public bool MaxBatteryCharge { get ; set ; }
2931
3032 public bool IsSupported ( ushort deviceFirmware , byte deviceBoardID , byte devicePDCS )
3133 {
@@ -42,11 +44,11 @@ public bool IsSupported(ushort deviceFirmware, byte deviceBoardID, byte devicePD
4244 private static readonly DeviceVersion [ ] deviceVersions = {
4345 // Steam Deck - LCD version
4446 new DeviceVersion ( ) { Firmware = 0xB030 , BoardID = 0x6 , PDCS = 0 /* 0x2B */ , BatteryTempLE = false } ,
45- new DeviceVersion ( ) { Firmware = 0xB030 , BoardID = 0xA , PDCS = 0 /* 0x2B */ , BatteryTempLE = false } ,
47+ new DeviceVersion ( ) { Firmware = 0xB030 , BoardID = 0xA , PDCS = 0 /* 0x2B */ , BatteryTempLE = false , MaxBatteryCharge = true } ,
4648
4749 // Steam Deck - OLED version
4850 // new DeviceVersion() { Firmware = 0x1030, BoardID = 0x5, PDCS = 0 /* 0x2F */, BatteryTempLE = true },
49- new DeviceVersion ( ) { Firmware = 0x1050 , BoardID = 0x5 , PDCS = 0 /* 0x2F */ , BatteryTempLE = true }
51+ new DeviceVersion ( ) { Firmware = 0x1050 , BoardID = 0x5 , PDCS = 0 /* 0x2F */ , BatteryTempLE = true , MaxBatteryCharge = true }
5052 } ;
5153
5254 public static Vlv0100 Instance = new Vlv0100 ( ) ;
@@ -178,6 +180,27 @@ public float GetBattTemperature()
178180 return ( float ) ( value - 0x0AAC ) / 10.0f ;
179181 }
180182
183+ public int ? GetMaxBatteryCharge ( )
184+ {
185+ if ( SupportedDevice ? . MaxBatteryCharge != true )
186+ return null ;
187+ var data = inpOut ? . ReadMemory ( MCBL , 1 ) ;
188+ if ( data is null )
189+ return null ;
190+ if ( data [ 0 ] > 100 )
191+ return null ;
192+ return data [ 0 ] ;
193+ }
194+ public void SetMaxBatteryCharge ( int chargeLimit )
195+ {
196+ if ( SupportedDevice ? . MaxBatteryCharge != true )
197+ return ;
198+ if ( chargeLimit < 0 || chargeLimit > 100 )
199+ return ;
200+ byte [ ] data = BitConverter . GetBytes ( chargeLimit ) ;
201+ inpOut ? . WriteMemory ( MCBL , data ) ;
202+ }
203+
181204 private void SetGain ( ushort gain )
182205 {
183206 byte [ ] data = BitConverter . GetBytes ( gain ) ;
0 commit comments