Skip to content

Commit cc25244

Browse files
committed
Minor refactoring
1 parent f8edce4 commit cc25244

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

pages/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ <h2 class="error"></h2>
115115
</form>
116116
<section>
117117
<h3>Send frame</h3>
118-
<p>If there is already a master on the bus, this operation can cause a frame colision on the bus!</p>
118+
<p>If there is already a master on the bus, this operation can cause a frame colision on the bus.</p>
119119
<form name="send">
120120
<fieldset>
121121
<legend>Send any frame:</legend>
@@ -125,8 +125,7 @@ <h3>Send frame</h3>
125125
</label>
126126
<label>
127127
Function code:
128-
<input id="functionCode" type="number" name="functionCode" list="functionCodeList" min="0" max="255"
129-
step="1" required></select>
128+
<input id="functionCode" type="number" name="functionCode" list="functionCodeList" min="0" max="255" step="1" required></select>
130129
<datalist id="functionCodeList"></datalist>
131130
</label>
132131
<label>

src/frame.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class Frame {
3333

3434
getRow(): TableDataColumn[] {
3535
return [
36-
new TableDataColumn(Frame.getDateTime(), this.type),
36+
new TableDataColumn(`${Frame.getDateTime()} (${this.type})`, this.type),
3737
new TableDataColumn(`${this.slaveAddress} = 0x${Converters.byteToHex(this.slaveAddress!)}`, this.type),
3838
new TableDataColumn(FunctionCodes.getDescription(this.functionCode), this.type),
3939
new TableDataColumn(this.getDataLength().toString(), this.type),

src/function-codes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class FunctionCodes {
5555
if (description) {
5656
return this._getDescription(code, description);
5757
}
58-
return this._getDescription(code, '<UNKNOWN>');
58+
return this._getDescription(code, '(UNKNOWN)');
5959
}
6060

6161
private static _getDescription(code: number, description: string): string {

src/main.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ if (!serial) {
1212
Dom.serialForm.setFieldsetDisabled(true);
1313
}
1414

15-
Dom.clearSnifferButton.addEventListener('click', () => {
16-
clearSniffingTable();
17-
});
18-
Dom.downloadSnifferButton.addEventListener('click', () => {
19-
downloadAllSniffedEntries();
20-
});
15+
Dom.clearSnifferButton.addEventListener('click', () => clearSniffingTable());
16+
Dom.downloadSnifferButton.addEventListener('click', () => downloadAllSniffedEntries());
2117

2218
Dom.serialForm.submit = (formData) => {
2319
formData.baudRate = +formData.baudRate;
@@ -81,9 +77,7 @@ Dom.sendForm.submit = (formData) => {
8177
}
8278
const frameBytes: number[] = [formData.slaveAddress, formData.functionCode, ...bytes];
8379
insertFrameRow(new Frame([...frameBytes], 'send'));
84-
if (send) {
85-
send(frameBytes);
86-
}
80+
send?.(frameBytes);
8781
};
8882

8983
// intTest();

0 commit comments

Comments
 (0)