mirror of
https://github.com/tsl0922/EPD-nRF5.git
synced 2025-12-06 15:42:48 +08:00
add version characteristic
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
let bleDevice, gattServer;
|
||||
let epdService, epdCharacteristic;
|
||||
let startTime, msgIndex;
|
||||
let startTime, msgIndex, appVersion;
|
||||
let canvas, ctx, textDecoder;
|
||||
|
||||
const EpdCmd = {
|
||||
@@ -231,6 +231,16 @@ async function connect() {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const versionCharacteristic = await epdService.getCharacteristic('62750003-d828-918d-fb46-b6c11c675aec');
|
||||
const versionData = await versionCharacteristic.readValue();
|
||||
appVersion = versionData.getUint8(0);
|
||||
addLog(`固件版本: 0x${appVersion.toString(16)}`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
appVersion = 0x15;
|
||||
}
|
||||
|
||||
try {
|
||||
await epdCharacteristic.startNotifications();
|
||||
epdCharacteristic.addEventListener('characteristicvaluechanged', (event) => {
|
||||
|
||||
Reference in New Issue
Block a user