Skip to content

Commit fe2b366

Browse files
committed
Add clearer spaces to binary display
1 parent 3ebe888 commit fe2b366

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

frontend/src/components/ReadTable.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ export function ReadTable() {
4646
{
4747
const val = rawDataCopy.shift();
4848
// Convert to binary showing leading zeros
49-
return { address: val!.Address, value: val!.Value.toString(2).padStart(16, '0') };
49+
const stringVal = val!.Value.toString(2).padStart(16, '0')
50+
const strings = stringVal.match(/.{1,4}/g)
51+
return { address: val!.Address, value: strings?.join(' ') };
5052
}
5153
case dataTypes.U16:
5254
{

frontend/src/components/ResultDisplay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function ResultDisplay({ typedData, typeArray, type, setType }: { typedDa
1616
<Stack gap="xs"
1717
>
1818
<strong>{v!.address} </strong>
19-
<div><Text size="lg">{JSON.stringify(v!.value)}</Text>
19+
<div><Text size="lg">{v!.value}</Text>
2020
{(type == "Holding Register" || type == "Input Register") &&
2121
<TypeSelector v={typeArray[i]} updateType={(s) => setType(i, s)}>
2222
<Text size="xs" c="gray.5" style={{ cursor: "pointer" }}>{typeArray[i]}</Text>

0 commit comments

Comments
 (0)