Skip to content

Commit

Permalink
Fix max brightness not being accounted for when setting brightness
Browse files Browse the repository at this point in the history
  • Loading branch information
xanderfrangos committed Jan 5, 2025
1 parent 402a268 commit ba55108
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Monitors.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,11 @@ function setBrightness(brightness, id) {
} else {
setVCP(monitor.hwid.join("#"), monitor.brightnessType, brightness)
}
// Update tracked brightness values
const brightnessRaw = parseInt(brightness)
monitor.brightness = brightnessRaw * (100 / (monitor.brightnessMax || 100))
monitor.brightnessRaw = brightnessRaw
if(monitor.brightnessValues) monitor.brightnessValues[0] = brightnessRaw;
}
} else {
let monitor = Object.values(monitors).find(mon => mon.type == "wmi")
Expand Down Expand Up @@ -1033,11 +1038,6 @@ async function setHighLevelBrightness(monitor, value) {
if(busyLevel > 0) while(busyLevel > 0) { await wait(100) } // Wait until no longer busy
try {
let result = ddcci._setHighLevelBrightness(monitor, value)
const hwid = monitor.split("#")
if(monitors[hwid[2]]) {
monitors[hwid[2]].brightness = parseInt(value)
monitors[hwid[2]].brightnessRaw = parseInt(value)
}
return result
} catch (e) {
console.log(e)
Expand Down

0 comments on commit ba55108

Please sign in to comment.