Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 81 additions & 19 deletions ledder/server/drivers/DisplayRPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,87 @@ export class DisplayRPI extends Display {

const offset = this.mapper[floor_x][floor_y]

if (this.rgbOrder==0)
leds.setPixel(
~~(offset / this.pixelsPerChannel), // channel
offset % this.pixelsPerChannel, //led nr
this.gammaMapper[Math.round(color.r)],
this.gammaMapper[Math.round(color.g)],
this.gammaMapper[Math.round(color.b)],
color.a
)
else
leds.setPixel(
~~(offset / this.pixelsPerChannel), // channel
offset % this.pixelsPerChannel, //led nr
this.gammaMapper[Math.round(color.g)],
this.gammaMapper[Math.round(color.r)],
this.gammaMapper[Math.round(color.b)],
color.a
)

/**
* For compatibility reasons 0 = RGB 1 = GRB
* 0 = RGB
* 1 = GRB
* 2 = RBG
* 3 = GBR
* 4 = BRG
* 5 = BGR
*/

switch (this.rgbOrder) {
case 0:
leds.setPixel(
~~(offset / this.pixelsPerChannel), // channel
offset % this.pixelsPerChannel, //led nr
this.gammaMapper[Math.round(color.r)],
this.gammaMapper[Math.round(color.g)],
this.gammaMapper[Math.round(color.b)],
color.a
)
break;
case 1:
leds.setPixel(
~~(offset / this.pixelsPerChannel), // channel
offset % this.pixelsPerChannel, //led nr
this.gammaMapper[Math.round(color.g)],
this.gammaMapper[Math.round(color.r)],
this.gammaMapper[Math.round(color.b)],
color.a
)
break;
case 2:
leds.setPixel(
~~(offset / this.pixelsPerChannel), // channel
offset % this.pixelsPerChannel, //led nr
this.gammaMapper[Math.round(color.r)],
this.gammaMapper[Math.round(color.b)],
this.gammaMapper[Math.round(color.g)],
color.a
)
break;
case 3:
leds.setPixel(
~~(offset / this.pixelsPerChannel), // channel
offset % this.pixelsPerChannel, //led nr
this.gammaMapper[Math.round(color.b)],
this.gammaMapper[Math.round(color.r)],
this.gammaMapper[Math.round(color.g)],
color.a
)
break;
case 4:
leds.setPixel(
~~(offset / this.pixelsPerChannel), // channel
offset % this.pixelsPerChannel, //led nr
this.gammaMapper[Math.round(color.g)],
this.gammaMapper[Math.round(color.r)],
this.gammaMapper[Math.round(color.b)],
color.a
)
break;
case 5:
leds.setPixel(
~~(offset / this.pixelsPerChannel), // channel
offset % this.pixelsPerChannel, //led nr
this.gammaMapper[Math.round(color.b)],
this.gammaMapper[Math.round(color.g)],
this.gammaMapper[Math.round(color.r)],
color.a
)
break;
default:
leds.setPixel(
~~(offset / this.pixelsPerChannel), // channel
offset % this.pixelsPerChannel, //led nr
this.gammaMapper[Math.round(color.r)],
this.gammaMapper[Math.round(color.g)],
this.gammaMapper[Math.round(color.b)],
color.a
)
}

}

Expand Down