From 0ef72db7eb046ad5d7a3731ff5ea33b8089b728c Mon Sep 17 00:00:00 2001 From: Paulo Meira <10246101+PMeira@users.noreply.github.com> Date: Tue, 9 Mar 2021 19:28:14 -0300 Subject: [PATCH] Fix issue with EnergyMeter reports, noticed especially in the time/hour column --- src/Meters/MemoryMap_lib.pas | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Meters/MemoryMap_lib.pas b/src/Meters/MemoryMap_lib.pas index 21a575636..189619e36 100644 --- a/src/Meters/MemoryMap_lib.pas +++ b/src/Meters/MemoryMap_lib.pas @@ -45,8 +45,6 @@ implementation type TByteArr = array of uint8; -var - wordBuf: Word; // $01A0 is Header for identifying String type data // $02A0 is Header for identifying Double type data //****************************************************************************** @@ -56,6 +54,7 @@ implementation function Create_Meter_Space(Init_Str: String): TBytesStream; OVERLOAD; var Mem_Space: TBytesStream; + wordBuf: Word; begin Mem_Space := TBytesStream.Create(); {$IFNDEF FPC} @@ -72,6 +71,8 @@ function Create_Meter_Space(Init_Str: String): TBytesStream; OVERLOAD; // Writes a string into the specified BytesStream //****************************************************************************** procedure WriteintoMemStr(Mem_Space: TBytesStream; Content: String); OVERLOAD; +var + wordBuf: Word; begin {$IFNDEF FPC} Mem_Space.WriteData($01A0); // Header for identifying String type data @@ -86,6 +87,8 @@ procedure WriteintoMemStr(Mem_Space: TBytesStream; Content: String); OVERLOAD; // Writes a DBL into the specified BytesStream //****************************************************************************** procedure WriteintoMem(Mem_Space: TBytesStream; Content: Double); OVERLOAD; +var + wordBuf: Word; begin {$IFNDEF FPC} Mem_Space.WriteData($02A0); // Header for identifying a double type data @@ -196,7 +199,7 @@ procedure CloseMHandler(Mem_Space: TBytesStream; const Dest_Path: String; Append end else // Not recognized begin - idx := idx; + // idx := idx; end; end; end; @@ -371,6 +374,8 @@ procedure Write_String(Mem_Space: TBytesStream; const Content: String); {$ELSE} for idx := 1 to length(Content) do Mem_Space.Write(Content[idx], Length(Content[idx])); // TODO - verify AnsiString vs. unicode + + Mem_Space.WriteByte(0); {$ENDIF} end;