Compare commits
4 commits
40dabea161
...
3fc2b410ba
| Author | SHA1 | Date | |
|---|---|---|---|
| 3fc2b410ba | |||
| a9e25ec67f | |||
| 78753a65d8 | |||
| a7780c8030 |
2 changed files with 320 additions and 647 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -166,19 +166,15 @@ end;
|
|||
|
||||
procedure TMainForm.Run;
|
||||
const
|
||||
RenderMs = 50; { Minimum ms between renders during bulk flow (20 fps) }
|
||||
BufSize = 2048; { Read buffer -- 8x larger than 255-byte string limit }
|
||||
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;
|
||||
Now: Longint;
|
||||
LastRenderTick: Longint;
|
||||
Msg: TMsg;
|
||||
Buf: array[0..BufSize - 1] of Char;
|
||||
Len: Integer;
|
||||
HasData: Boolean;
|
||||
begin
|
||||
Show;
|
||||
FDone := False;
|
||||
LastRenderTick := GetTickCount;
|
||||
FDone := False;
|
||||
while not FDone do
|
||||
begin
|
||||
{ Process all pending Windows messages (keyboard, paint, scrollbar) }
|
||||
|
|
@ -196,8 +192,8 @@ begin
|
|||
if FDone then
|
||||
Break;
|
||||
|
||||
{ Drain all available serial data before rendering. Reads up to }
|
||||
{ 2048 bytes per call, bypassing the 255-byte short string limit. }
|
||||
{ Drain all available serial data. WriteDeferredBuf renders each }
|
||||
{ character run immediately via ExtTextOut -- no deferred pass. }
|
||||
{ Messages are checked between chunks so keyboard stays responsive. }
|
||||
HasData := False;
|
||||
if FComm.PortOpen then
|
||||
|
|
@ -225,16 +221,11 @@ begin
|
|||
if FDone then
|
||||
Break;
|
||||
|
||||
{ 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;
|
||||
{ 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;
|
||||
|
||||
{ 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