Compare commits

..

No commits in common. "3fc2b410ba296358bea1670ee8c0e615434e1ec4" and "40dabea161f443333211e75ab7576fc65d7c7efc" have entirely different histories.

2 changed files with 648 additions and 321 deletions

File diff suppressed because it is too large Load diff

View file

@ -166,15 +166,19 @@ end;
procedure TMainForm.Run; procedure TMainForm.Run;
const 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 var
Msg: TMsg; Msg: TMsg;
Buf: array[0..BufSize - 1] of Char; Buf: array[0..BufSize - 1] of Char;
Len: Integer; Len: Integer;
HasData: Boolean; HasData: Boolean;
Now: Longint;
LastRenderTick: Longint;
begin begin
Show; Show;
FDone := False; FDone := False;
LastRenderTick := GetTickCount;
while not FDone do while not FDone do
begin begin
{ Process all pending Windows messages (keyboard, paint, scrollbar) } { Process all pending Windows messages (keyboard, paint, scrollbar) }
@ -192,8 +196,8 @@ begin
if FDone then if FDone then
Break; Break;
{ Drain all available serial data. WriteDeferredBuf renders each } { Drain all available serial data before rendering. Reads up to }
{ character run immediately via ExtTextOut -- no deferred pass. } { 2048 bytes per call, bypassing the 255-byte short string limit. }
{ Messages are checked between chunks so keyboard stays responsive. } { Messages are checked between chunks so keyboard stays responsive. }
HasData := False; HasData := False;
if FComm.PortOpen then if FComm.PortOpen then
@ -221,11 +225,16 @@ begin
if FDone then if FDone then
Break; Break;
{ Blink + dirty-row pass. During normal data flow, WriteDeferredBuf } { Render throttle: during bulk data flow, only render every RenderMs }
{ already rendered inline so FlipToScreen is a no-op. Only blink } { to decouple parse throughput from GDI overhead. When idle, render }
{ toggle (every 500ms) or scrollbar updates produce dirty rows here. } { immediately for interactive responsiveness. }
FAnsi.TickBlink; Now := GetTickCount;
FAnsi.FlipToScreen; 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. } { Yield CPU to other apps when no serial data is flowing. }
{ PM_NOYIELD keeps message draining fast; Yield here gives other } { PM_NOYIELD keeps message draining fast; Yield here gives other }