Esempio n. 1
0
 private bool GetOD8CurrentSetting(int adapterIndex, out ADLOD8CurrentSetting odCurrentSetting)
 {
     odCurrentSetting = ADLOD8CurrentSetting.Create();
     try {
         var r = AdlNativeMethods.ADL2_Overdrive8_Current_Setting_Get(_context, adapterIndex, ref odCurrentSetting);
         if (r < AdlStatus.ADL_OK)
         {
             NTMinerConsole.DevError(() => $"{nameof(AdlNativeMethods.ADL2_Overdrive8_Current_Setting_Get)} {r.ToString()}");
         }
         return(r == AdlStatus.ADL_OK);
     }
     catch (Exception ex) {
         Logger.ErrorDebugLine(ex);
         return(false);
     }
 }
Esempio n. 2
0
 private bool SetOD8Range(ADLOD8InitSetting odInitSetting, ADLOD8CurrentSetting odCurrentSetting, int adapterIndex, ADLOD8SettingId settingId, bool reset, int value)
 {
     try {
         ADLOD8SetSetting odSetSetting = ADLOD8SetSetting.Create();
         for (int i = (int)ADLOD8SettingId.OD8_GFXCLK_FREQ1; i <= (int)ADLOD8SettingId.OD8_UCLK_FMAX; i++)
         {
             odSetSetting.od8SettingTable[i].requested = 1;
             odSetSetting.od8SettingTable[i].value     = odCurrentSetting.Od8SettingTable[i];
         }
         for (int i = (int)ADLOD8SettingId.OD8_FAN_CURVE_TEMPERATURE_1; i <= (int)ADLOD8SettingId.OD8_FAN_CURVE_SPEED_5; i++)
         {
             odSetSetting.od8SettingTable[i].reset     = settingId <= ADLOD8SettingId.OD8_FAN_CURVE_SPEED_5 && settingId >= ADLOD8SettingId.OD8_FAN_CURVE_TEMPERATURE_1 ? 0 : 1;
             odSetSetting.od8SettingTable[i].requested = 1;
             odSetSetting.od8SettingTable[i].value     = odCurrentSetting.Od8SettingTable[i];
         }
         odSetSetting.od8SettingTable[(int)settingId].requested = 1;
         if (!reset)
         {
             odSetSetting.od8SettingTable[(int)settingId].value = value;
             if (ADLOD8SettingId.OD8_GFXCLK_FMAX == settingId)
             {
                 odSetSetting.od8SettingTable[(int)ADLOD8SettingId.OD8_GFXCLK_FREQ3].value = value;
             }
             else if (ADLOD8SettingId.OD8_GFXCLK_FMIN == settingId)
             {
                 odSetSetting.od8SettingTable[(int)ADLOD8SettingId.OD8_GFXCLK_FREQ1].value = value;
             }
         }
         else
         {
             odSetSetting.od8SettingTable[(int)settingId].reset = reset ? 1 : 0;
             odSetSetting.od8SettingTable[(int)settingId].value = odInitSetting.od8SettingTable[(int)settingId].defaultValue;
         }
         var r = AdlNativeMethods.ADL2_Overdrive8_Setting_Set(_context, adapterIndex, ref odSetSetting, ref odCurrentSetting);
         if (r != AdlStatus.ADL_OK)
         {
             NTMinerConsole.DevError(() => $"{nameof(AdlNativeMethods.ADL2_Overdrive8_Setting_Set)} {r.ToString()}");
         }
         return(r == AdlStatus.ADL_OK);
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(false);
     }
 }