diff --git a/lib/Surface/Handler.js b/lib/Surface/Handler.js index 3e1e72e8f4..9b1dc224c8 100644 --- a/lib/Surface/Handler.js +++ b/lib/Surface/Handler.js @@ -250,15 +250,18 @@ class SurfaceHandler extends CoreBase { } else if (this.#xkeysPageCount > 0) { this.#xkeysDrawPages() } else if (this.panel.info.type === 'Loupedeck CT') { - for (let y = 0; y < 7; y++) { - for (let x = 0; x < this.panel.info.keysPerRow; x++) { + for (let y = 0; y < 7; y += 1) { + let pageNumber = this.currentPage + if (y > 3) pageNumber += 1 + if (pageNumber > 99) pageNumber = 1 + for (let x = 0; x < this.panel.info.keysPerRow; x += 1) { const image = this.graphics.getBank({ - pageNumber: this.currentPage + Math.floor(row / 4), + pageNumber, column: x, row: y % 4, }) - this.panel.draw(x + xOffset, y + yOffset, image.buffer, image.style) + this.panel.draw(x, y, image.buffer, image.style) } } } else { @@ -304,6 +307,7 @@ class SurfaceHandler extends CoreBase { onButtonDrawn(location, render) { // If device is locked ignore updates. pincode updates are handled separately if (this.isSurfaceLocked) return + console.log('button drawn', location); if (this.#xkeysPageCount > 0) { // xkeys mode @@ -314,10 +318,10 @@ class SurfaceHandler extends CoreBase { } else if ( this.panel.info.type === 'Loupedeck CT' && (location.pageNumber - this.currentPage == 1 || (location.pageNumber == 1 && this.currentPage == 99)) && - bank <= location.row <= 2 + location.row < 3 // lower half of CT has only 3 rows, zero based ) { - // Loupdeck CT lower half, draw buttun with number offset by 32 - this.panel.draw(location.column - xOffset, location.row - yOffset + 4, render.buffer, render.style) + // Loupdeck CT lower half, draw button with row offset by 4 + this.panel.draw(location.column, location.row + 4, render.buffer, render.style) } else if (location.pageNumber == this.currentPage) { // normal mode const xOffset = Math.min(Math.max(this.panelconfig.config.xOffset || 0, 0), this.panelInfo.xOffsetMax) diff --git a/lib/Surface/USB/LoupedeckCt.js b/lib/Surface/USB/LoupedeckCt.js index e184917fc0..0fe5b8890b 100644 --- a/lib/Surface/USB/LoupedeckCt.js +++ b/lib/Surface/USB/LoupedeckCt.js @@ -17,6 +17,7 @@ import { EventEmitter } from 'events' import { LoupedeckBufferFormat, LoupedeckDisplayId, openLoupedeck } from '@loupedeck/node' +import { convertPanelIndexToXY } from '../Util.js' import ImageWriteQueue from '../../Resources/ImageWriteQueue.js' import imageRs from '@julusian/image-rs' import LogController from '../../Log/Controller.js' @@ -288,7 +289,7 @@ class SurfaceUSBLoupedeckCt extends EventEmitter { [2, 4], ], buttons: [ - // row + // row 1-8 [0, 3], [1, 3], [2, 3], @@ -297,19 +298,19 @@ class SurfaceUSBLoupedeckCt extends EventEmitter { [5, 3], [6, 3], [7, 3], - + // home, undo, keyboard [0, 4], [0, 5], [0, 6], - + // return, save, left fn [1, 4], [1, 5], [1, 6], - + // up, left, right fn [6, 4], [6, 5], [6, 6], - + // down, right, E [7, 4], [7, 5], [7, 6], @@ -352,12 +353,11 @@ class SurfaceUSBLoupedeckCt extends EventEmitter { let screen = this.modelInfo.displays.center const lcdX = x - screen.lcdXOffset - if (lcdX >= 0 && lcdX < screen.lcdCols && y >= 0 && y < screen.lcdRows) { + if (x === 3 && y === 4) { + this.key_write_queue.queue(35, buffer) + } else if (lcdX >= 0 && lcdX < screen.lcdCols && y >= 0 && y < screen.lcdRows) { const button = lcdX + y * screen.lcdCols - this.key_write_queue.queue(button, buffer) - } else if (x === 2 && y === 4) { - this.key_write_queue.queue(35, buffer) } const buttonIndex = this.modelInfo.buttons.findIndex((btn) => btn[0] == x && btn[1] == y)