BetterDisplay icon indicating copy to clipboard operation
BetterDisplay copied to clipboard

Add option to read and update current DDC value periodically

Open joevt opened this issue 1 year ago • 15 comments

If I change the volume using the display, it does not update what BetterDisplay thinks is the current volume for the display.

I think that before BetterDisplay changes or displays a value (increment or decrement) it should read the current value from the display. I believe BetterDisplay currently only has an option to read the current value only when the app starts?

Maybe this can be set so that it doesn't read the value if it was read or written in the last second. In the case of changing volume or brightness, maybe it can read the value only when the onscreen volume or brightness indicator overlay appears in macOS.

joevt avatar Jul 09 '23 10:07 joevt

I'll add an option to read volume/brightness periodically (to update slider values) or on first keypress (and then a cool-off period when the app won't read again for a while). Currently the app is not reading anything by default even on startup (although you can set it to read on startup) as reading can be somewhat unreliable with some hardware.

Btw - generally improving DDC read, auto-configuring stuff by taking into account reported VCP capabilities and min/max ranges for various control codes is also on my todo list, this aspect of the app is somewhat half-baked now. - #1168

@joevt - your contribution to the community is highly appreciated, let me know if you want a free coupon code for the Pro version of the app!

waydabber avatar Jul 09 '23 11:07 waydabber

Just to verify, should reading the current volume level from the monitor work upon startup in the current version?

It does not work for me, although my unit does return the current value in VCP code 0x62 (Audio speaker volume). Is there a way to troubleshoot why it does not work?

vjraitila avatar May 20 '24 17:05 vjraitila

It won't read the display value by default on startup as reading is somewhat unreliable. You can change this under DDC communication settings for the display under Settings (set it to Read values from display).

waydabber avatar May 20 '24 18:05 waydabber

Yeah. I did enable the setting, but the value is still not restored.

vjraitila avatar May 20 '24 19:05 vjraitila

You can try m1ddc and see if the read succeeds.

waydabber avatar May 20 '24 20:05 waydabber

Reading the value with m1ddc works as expected.

Screenshot 2024-05-21 at 18 50 46

vjraitila avatar May 21 '24 15:05 vjraitila

BetterDisplay will read the settings only on startup and from that time on assume you are not changing it externally. So it does not re-read the values periodically or on wake (this issue when implemented is to change that). So the issue is that on app startup the right value is not read? If so, I can reproduce and fix that as that is then a bug. :)

waydabber avatar May 21 '24 16:05 waydabber

Yes. The value is not read on startup no matter how many times I quit and (re)start the app.

Whereas m1ddc consistently returns the correct value.

vjraitila avatar May 21 '24 16:05 vjraitila

All right, thank you, that might be an issue then. Honestly it's a time since I tested this feature as I don't actually use it myself (leave it default), so it might indeed be broken!

waydabber avatar May 21 '24 17:05 waydabber

Added an issue about it! #2990

waydabber avatar May 21 '24 17:05 waydabber

Hi @vjraitila

It seems to me that DDC reading works in general (at least with the display I am testing), for image adjustments. Sadly none of my currently used displays actually support DDC volume control anymore (the one I used for testing that is broken), so this still might be a specific issue with volume control which I can't test right now. Can you confirm whether reading on startup works for Contrast for example but specifically it does not work for Volume?

Thank you!

waydabber avatar May 24 '24 18:05 waydabber

Ok, I tested it with a display that tends to reply random wrong values for DDC reads and based on that volume read does work (in the sense that it gets the random wrong value and sets it on startup). I am not entirely sure what could be the problem, might be display specific. You can maybe try tweaking the DDC communication settings a bit @vjraitila. Still it would be educational to know whether reading any other setting works or not.

waydabber avatar May 24 '24 18:05 waydabber

The contrast is not read either upon startup in BetterDisplay. Whereas m1ddc consistently returns the correct value for both volume and contrast.

Anything particular in the DCC communication settings I could try? I played around with the delays a bit and the only thing it did was to slow down the application starting. BetterDisplay always shows the last values (for both volume and contrast) I had set using the app, not the ones read from the device.

vjraitila avatar May 24 '24 19:05 vjraitila

Honestly, not sure. Did you try reading via betterdisplaycli? Does that work?

Here is how to read the brightness for example:

betterdisplaycli get --namelike=wqhd --ddc --vcp=luminance

This should set brightness directly to 30:

betterdisplaycli set --namelike=wqhd --ddc=30 --vcp=luminance

waydabber avatar May 24 '24 20:05 waydabber

https://github.com/waydabber/betterdisplaycli

waydabber avatar May 24 '24 20:05 waydabber

betterdisplaycli get --namelike=wqhd --ddc --vcp=luminance returns Failed.

betterdisplaycli set --namelike=wqhd --ddc=30 --vcp=luminance succeeds.

m1ddc display 2 get luminance also works and returns the correct value.

vjraitila avatar May 25 '24 09:05 vjraitila

All right. The difference between the two apps is that BetterDisplay actually checks the checksum value sent by the display while m1ddc dos not so it accepts the result even if by spec the result should be considered wrong. It seems like the checksum is incorrectly calculated by the display while the return value is actually fine. I could maybe add an option not to check the checksum during read.

waydabber avatar May 25 '24 10:05 waydabber

https://github.com/waydabber/BetterDisplay/issues/2990

waydabber avatar May 25 '24 10:05 waydabber

This can be enabled in a per display per DDC feature level. Disabled by default. Frequency can be anything between 0.5 and 3600 seconds.

Screenshot 2024-06-18 at 19 49 12

waydabber avatar Jun 18 '24 17:06 waydabber

Note: updated to work with synchronization when syncing of externally induced changes is enabled (originally for Apple screens).

waydabber avatar Jun 18 '24 17:06 waydabber