Commit e6bb5ae2 authored by martin hou's avatar martin hou

fix: 修正存储卡字段信息

parent b39e4736
......@@ -241,7 +241,7 @@ declare class Jensen {
// 获取内部存储卡信息
// used:已使用,capacity:总容量(单位为M),status:900表示正常,其它表示异常
getCardInfo: (seconds?: number) => Promise<{ used: number; capacity: number; status: string }>;
getCardInfo: (seconds?: number) => Promise<{ free: number; used: number; capacity: number; status: string }>;
// 内部存储卡格式化
formatCard: (seconds?: number) => Promise<ReturnStruct['common']>;
......
......@@ -1551,11 +1551,12 @@ Jensen.registerHandler(FIRMWARE_UPLOAD, (msg) => {
});
Jensen.registerHandler(READ_CARD_INFO, (msg) => {
let i = 0;
// used实际上是剩余空间
let used = ((msg.body[i++] & 0xff) << 24) | ((msg.body[i++] & 0xff) << 16) | ((msg.body[i++] & 0xff) << 8) | (msg.body[i++] & 0xff);
let capacity = ((msg.body[i++] & 0xff) << 24) | ((msg.body[i++] & 0xff) << 16) | ((msg.body[i++] & 0xff) << 8) | (msg.body[i++] & 0xff);
let status = ((msg.body[i++] & 0xff) << 24) | ((msg.body[i++] & 0xff) << 16) | ((msg.body[i++] & 0xff) << 8) | (msg.body[i++] & 0xff);
return { used: used, capacity: capacity, status: status.toString(16) };
return { free: used, used: capacity - used, capacity: capacity, status: status.toString(16) };
});
Jensen.registerHandler(TRANSFER_FILE_PARTIAL, (msg) => {
let buf = new Uint8Array(msg.body.length);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment