Skip to content

Commit

Permalink
修复有空格时校验位计算错误
Browse files Browse the repository at this point in the history
  • Loading branch information
keysking committed May 9, 2023
1 parent aa5b45a commit 731eb00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/SendPanel/SendPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ const sendBuffer = computed(() => {
const checkDigit = computed(() => {
if (!checkAlgorithm.value || sendType.value != "hex") return undefined;
if (sendData.value.length == 0) return [0x00];
return checkAlgorithm.value.algorithm(hexStringToBuffer(sendData.value));
return checkAlgorithm.value.algorithm(
hexStringToBuffer(sendData.value.replaceAll(" ", ""))
);
});
const checkDigitHexFormat = computed(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/useBle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function useBle(
value.buffer,
typeof value.buffer
);
onReadFrame(value);
onReadFrame(new Uint8Array(value.buffer));
});

writeCharacteristic.value = await service.getCharacteristic(
Expand Down

0 comments on commit 731eb00

Please sign in to comment.