move channel segment background
This commit is contained in:
34
index.js
34
index.js
@@ -1036,13 +1036,15 @@ function drawChannelData() {
|
||||
// identify expected bit
|
||||
const expectedBit = EXPECTED_ENCODED_BITS[bitIndex];
|
||||
|
||||
// color red if received bit does not match expected bit
|
||||
ctx.fillStyle = actualBit === expectedBit ? 'green' : 'red';
|
||||
ctx.fillRect(endX, top, segmentWidth, channelHeight);
|
||||
|
||||
ctx.lineWidth = 0.5;
|
||||
ctx.strokeStyle = 'rgba(255, 255, 255, 0.5)';
|
||||
ctx.strokeRect(endX, top, segmentWidth, channelHeight);
|
||||
drawChannelSegmentBackground(
|
||||
ctx,
|
||||
endX,
|
||||
channelIndex,
|
||||
channelHeight,
|
||||
segmentWidth,
|
||||
actualBit,
|
||||
expectedBit
|
||||
)
|
||||
|
||||
// show bad value
|
||||
// if(actualBit !== expectedBit) {
|
||||
@@ -1069,6 +1071,24 @@ function drawChannelData() {
|
||||
drawChannelNumbers(ctx, channelCount, channelHeight)
|
||||
console.log('time', performance.now() - S);
|
||||
}
|
||||
function drawChannelSegmentBackground(
|
||||
ctx,
|
||||
endX,
|
||||
channelIndex,
|
||||
channelHeight,
|
||||
segmentWidth,
|
||||
actualBit,
|
||||
expectedBit
|
||||
) {
|
||||
let top = channelHeight * channelIndex;
|
||||
// color red if received bit does not match expected bit
|
||||
ctx.fillStyle = actualBit === expectedBit ? 'green' : 'red';
|
||||
ctx.fillRect(endX, top, segmentWidth, channelHeight);
|
||||
|
||||
ctx.lineWidth = 0.5;
|
||||
ctx.strokeStyle = 'rgba(255, 255, 255, 0.5)';
|
||||
ctx.strokeRect(endX, top, segmentWidth, channelHeight);
|
||||
}
|
||||
function drawChannelByteMarkers(ctx, channelCount, channelHeight, width) {
|
||||
for(let channelIndex = 8; channelIndex < channelCount; channelIndex+= 8) {
|
||||
let top = channelHeight * channelIndex;
|
||||
|
||||
Reference in New Issue
Block a user