refactoring: better variable name

This commit is contained in:
rusefillc 2022-08-14 12:06:50 -04:00
parent 719354387c
commit 782d80cb3b
1 changed files with 6 additions and 6 deletions

View File

@ -106,14 +106,14 @@ public class BinarySensorLog<T extends BinaryLogEntry> implements SensorLog, Aut
// 0008h Timestamp // 0008h Timestamp
stream.writeInt((int) (System.currentTimeMillis() / 1000)); stream.writeInt((int) (System.currentTimeMillis() / 1000));
// 000ch // 000ch
int offsetToText = Fields.MLQ_HEADER_SIZE + Fields.MLQ_FIELD_HEADER_SIZE * entries.size(); int infoDataStart = Fields.MLQ_HEADER_SIZE + Fields.MLQ_FIELD_HEADER_SIZE * entries.size();
System.out.println("Total " + entries.size() + " fields"); System.out.println("Total " + entries.size() + " fields");
if (offsetToText > 32000) if (infoDataStart > 32000)
throw new IllegalStateException("Too much header " + offsetToText); throw new IllegalStateException("Too much header " + infoDataStart);
stream.writeShort(offsetToText); stream.writeShort(infoDataStart);
stream.writeShort(0); // reserved? stream.writeShort(0); // reserved?
// 0010h = offset_to_data // 0010h = offset_to_data
stream.writeShort(offsetToText + headerText.length()); stream.writeShort(infoDataStart + headerText.length());
// 0012h // 0012h
stream.writeShort(fieldsDataSize); stream.writeShort(fieldsDataSize);
// 0014h number of fields // 0014h number of fields
@ -136,7 +136,7 @@ public class BinarySensorLog<T extends BinaryLogEntry> implements SensorLog, Aut
// 0036h precision // 0036h precision
stream.write(2); stream.write(2);
} }
if (stream.size() != offsetToText) if (stream.size() != infoDataStart)
throw new IllegalStateException("We are doing something wrong :( stream.size=" + stream.size()); throw new IllegalStateException("We are doing something wrong :( stream.size=" + stream.size());
writeLine(stream, headerText, headerText.length()); writeLine(stream, headerText, headerText.length());
} }