xythobuz / DisplayBacklight

Ambilight clone for macOS made with Arduino and WS2812 stripes
BSD 2-Clause "Simplified" License
38 stars 2 forks source link

Multiple Monitors with equal resolutions not supported #1

Open georgearnall opened 6 years ago

georgearnall commented 6 years ago

I've tried to configure you're app but I can only get my strip to work on a single monitor, all of the LEDs are working.

I have 2x 1080p monitors and my MBP running. It should only be configured for the external displays. Picture: https://cl.ly/1f3y2Z2A452T 152 leds, 16 vertical, 30 horizontal per display

struct DisplayAssignment displays[] = {
    { 1920, 1080 },
    { 1920, 1080 }
};

struct LEDStrand strands[] = {
 //ledID, len, dispID,startX,startY, dir, division
    {   0, 30, 0, 1920, 1080,  DIR_LEFT, 1920 / 30 },
    {  30, 16, 0,    0, 1080,    DIR_UP, 1080 / 16 },
    {  46, 30, 0,    0,    0, DIR_RIGHT, 1920 / 30 },
    {  76, 30, 1,    0,    0, DIR_RIGHT, 1920 / 30 },
    { 106, 16, 1, 1920,    0,  DIR_DOWN, 1080 / 16 },
    { 122, 30, 1, 1920, 1080,  DIR_LEFT, 1920 / 30 }
};
xythobuz commented 6 years ago

Well, it's not actually supported to use these with monitors that have the same resolution, currently... :laughing:

This is hinted at by the comment just above the part you're quoting:

// Identify your displays here. Currently they're only distinguished by their resolution.

If you take a look at the code snippet here:

// Try to find the matching display id for the strand associations
for (int n = 0; n < (sizeof(displays) / sizeof(displays[0])); n++) {
    if ((width == displays[n].width) && (height == displays[n].height)) {
        // ...
    }
}

You can probably see easily why this won't work for your case...

The thing is, I'm no longer running Mac OS X on my Desktop, I've finally moved on to Linux. So I'm sadly not really able to implement and test this for you. But the general idea is:

If you feel you're up to the task, please, go ahead :smiley: I'd be glad to assist in any way I can...

georgearnall commented 6 years ago

Thought that might be the case, just wasn't sure. Ideally the display settings could be taken straight from an API without having to define everything manually.

Not sure I've got time to look at the moment but it's something I'll consider looking at in the future.

xythobuz commented 6 years ago

Yeah, there's a lot of redundant information in the currently implemented configuration. But the user will at least need to be able to configure the offset and length of each strip in leds and pixels, otherwise the colours won't necessarily match up. So you will still have some user configurable options. But all the stuff like display IDs and resolutions is available from the API, I think.