mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-30 07:18:45 +10:00
fix: Update battery voltage reading and adjust path length handling in ChannelMessage
This commit is contained in:
@@ -3043,7 +3043,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
|||||||
try {
|
try {
|
||||||
final reader = BufferReader(frame);
|
final reader = BufferReader(frame);
|
||||||
reader.skipBytes(1);
|
reader.skipBytes(1);
|
||||||
_batteryMillivolts = reader.readInt16LE();
|
_batteryMillivolts = reader.readUInt16LE();
|
||||||
_storageUsedKb = reader.readUInt32LE();
|
_storageUsedKb = reader.readUInt32LE();
|
||||||
_storageTotalKb = reader.readUInt32LE();
|
_storageTotalKb = reader.readUInt32LE();
|
||||||
final volts = (_batteryMillivolts! / 1000.0).toStringAsFixed(2);
|
final volts = (_batteryMillivolts! / 1000.0).toStringAsFixed(2);
|
||||||
|
|||||||
@@ -132,17 +132,15 @@ class ChannelMessage {
|
|||||||
final hasPath = (flags & 0x01) != 0;
|
final hasPath = (flags & 0x01) != 0;
|
||||||
reader.skipBytes(1); // Skip reserved byte
|
reader.skipBytes(1); // Skip reserved byte
|
||||||
channelIdx = reader.readByte();
|
channelIdx = reader.readByte();
|
||||||
pathLen = reader.readByte();
|
pathLen = reader.readInt8();
|
||||||
txtType = reader.readByte();
|
txtType = reader.readByte();
|
||||||
if (hasPath && pathLen > 0) {
|
if (hasPath && pathLen > 0) {
|
||||||
reader.rewind(); // Rewind to read path length again for pathBytes
|
reader.rewind(); // Rewind to read path length again for pathBytes
|
||||||
pathBytes = reader.readBytes(pathLen);
|
pathBytes = reader.readBytes(pathLen);
|
||||||
} else {
|
|
||||||
pathLen = 0;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
channelIdx = reader.readByte();
|
channelIdx = reader.readByte();
|
||||||
pathLen = reader.readByte();
|
pathLen = reader.readInt8();
|
||||||
txtType = reader.readByte();
|
txtType = reader.readByte();
|
||||||
}
|
}
|
||||||
final timestampRaw = reader.readUInt32LE();
|
final timestampRaw = reader.readUInt32LE();
|
||||||
|
|||||||
@@ -975,7 +975,6 @@ void _privacySettings(BuildContext context, MeshCoreConnector connector) {
|
|||||||
value: advertLocPolicy,
|
value: advertLocPolicy,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setDialogState(() => advertLocPolicy = value);
|
setDialogState(() => advertLocPolicy = value);
|
||||||
advertLocPolicy = value;
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
|||||||
Reference in New Issue
Block a user