fixed by myself. working code:
const type = "binary"
const backgroundColor = ({ r: 255, g: 255, b: 0 });
const inactiveColor = ({ r: 0, g: 255, b: 255 });
const activeColor = ({ r: 255, g: 0, b: 255 });
registerEvent(EventType.onCharging, onCharging);
async function onCharging() {
if (type == "normal"){
normalClock();
}
if (type == "binary"){
binaryClock();
}
}
async function startProgram() {
}
async function binaryClock(){
const hour = (Math.floor((getCurrentTime() % 86400) / 3600) + 2);
const minute = Math.floor((getCurrentTime() % 3600) / 60);
const second = (Math.floor((getCurrentTime() % 3600) % 60));
drawMatrixLine(backgroundColor, { x: 0, y: 0 }, { x: 7, y: 0 });
drawMatrixLine(backgroundColor, { x: 0, y: 1 }, { x: 7, y: 1 });
drawMatrixLine(backgroundColor, { x: 0, y: 6 }, { x: 7, y: 6 });
drawMatrixLine(backgroundColor, { x: 0, y: 7 }, { x: 7, y: 7 });
drawMatrixLine(backgroundColor, { x: 2, y: 0 }, { x: 2, y: 7 });
drawMatrixLine(backgroundColor, { x: 5, y: 0 }, { x: 5, y: 7 });
drawMatrixFill(inactiveColor, {x: 0 ,y:2 }, {x:1 ,y:5});
drawMatrixFill(inactiveColor, {x: 3 ,y:2 }, {x:4 ,y:5});
drawMatrixFill(inactiveColor, {x: 6, y:2 }, {x:7, y:5});
const binH = hour.toString(2);
const binM = minute.toString(2);
const binS = second.toString(2);
let time = buildString(binS, binM, binH);
var matrix = [{x:6,y:2},{x:7,y:2},{x:6,y:3},{x:7,y:3},{x:6,y:4},{x:7,y:4},{x:6,y:5},{x:7,y:5},{x:3,y:2},{x:4,y:2},{x:3,y:3},{x:4,y:3},{x:3,y:4},{x:4,y:4},{x:3,y:5},{x:4,y:5},{x:0,y:2},{x:1,y:2},{x:0,y:3},{x:1,y:3},{x:0,y:4},{x:1,y:4},{x:0,y:5},{x:1,y:5}];
for (let index in time.split('')) {
if (time[index] == 0) {
drawMatrixPixel(activeColor,matrix[index]);
} else {
drawMatrixPixel(inactiveColor,matrix[index]);
}
}
}
async function normalClock() {
const hour = (Math.floor((getCurrentTime() % 86400) / 3600) + 2);
const minute = Math.floor((getCurrentTime() % 3600) / 60);
const second = (Math.floor((getCurrentTime() % 3600) % 60));
await scrollMatrixText(buildString(hour,":", minute,".", second), activeColor,15, true);
}