Compare commits
No commits in common. "3fc2b410ba296358bea1670ee8c0e615434e1ec4" and "40dabea161f443333211e75ab7576fc65d7c7efc" have entirely different histories.
3fc2b410ba
...
40dabea161
2 changed files with 648 additions and 321 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -166,15 +166,19 @@ end;
|
|||
|
||||
procedure TMainForm.Run;
|
||||
const
|
||||
BufSize = 2048; { Read buffer -- 8x larger than 255-byte string limit }
|
||||
RenderMs = 50; { Minimum ms between renders during bulk flow (20 fps) }
|
||||
BufSize = 2048; { Read buffer -- 8x larger than 255-byte string limit }
|
||||
var
|
||||
Msg: TMsg;
|
||||
Buf: array[0..BufSize - 1] of Char;
|
||||
Len: Integer;
|
||||
HasData: Boolean;
|
||||
Msg: TMsg;
|
||||
Buf: array[0..BufSize - 1] of Char;
|
||||
Len: Integer;
|
||||
HasData: Boolean;
|
||||
Now: Longint;
|
||||
LastRenderTick: Longint;
|
||||
begin
|
||||
Show;
|
||||
FDone := False;
|
||||
FDone := False;
|
||||
LastRenderTick := GetTickCount;
|
||||
while not FDone do
|
||||
begin
|
||||
{ Process all pending Windows messages (keyboard, paint, scrollbar) }
|
||||
|
|
@ -192,8 +196,8 @@ begin
|
|||
if FDone then
|
||||
Break;
|
||||
|
||||
{ Drain all available serial data. WriteDeferredBuf renders each }
|
||||
{ character run immediately via ExtTextOut -- no deferred pass. }
|
||||
{ Drain all available serial data before rendering. Reads up to }
|
||||
{ 2048 bytes per call, bypassing the 255-byte short string limit. }
|
||||
{ Messages are checked between chunks so keyboard stays responsive. }
|
||||
HasData := False;
|
||||
if FComm.PortOpen then
|
||||
|
|
@ -221,11 +225,16 @@ begin
|
|||
if FDone then
|
||||
Break;
|
||||
|
||||
{ Blink + dirty-row pass. During normal data flow, WriteDeferredBuf }
|
||||
{ already rendered inline so FlipToScreen is a no-op. Only blink }
|
||||
{ toggle (every 500ms) or scrollbar updates produce dirty rows here. }
|
||||
FAnsi.TickBlink;
|
||||
FAnsi.FlipToScreen;
|
||||
{ Render throttle: during bulk data flow, only render every RenderMs }
|
||||
{ to decouple parse throughput from GDI overhead. When idle, render }
|
||||
{ immediately for interactive responsiveness. }
|
||||
Now := GetTickCount;
|
||||
if (not HasData) or (Now - LastRenderTick >= RenderMs) then
|
||||
begin
|
||||
FAnsi.TickBlink;
|
||||
FAnsi.FlipToScreen;
|
||||
LastRenderTick := Now;
|
||||
end;
|
||||
|
||||
{ Yield CPU to other apps when no serial data is flowing. }
|
||||
{ PM_NOYIELD keeps message draining fast; Yield here gives other }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue