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;
|
procedure TMainForm.Run;
|
||||||
const
|
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
|
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) }
|
||||||
|
|
@ -196,8 +192,8 @@ begin
|
||||||
if FDone then
|
if FDone then
|
||||||
Break;
|
Break;
|
||||||
|
|
||||||
{ Drain all available serial data before rendering. Reads up to }
|
{ Drain all available serial data. WriteDeferredBuf renders each }
|
||||||
{ 2048 bytes per call, bypassing the 255-byte short string limit. }
|
{ character run immediately via ExtTextOut -- no deferred pass. }
|
||||||
{ 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
|
||||||
|
|
@ -225,16 +221,11 @@ begin
|
||||||
if FDone then
|
if FDone then
|
||||||
Break;
|
Break;
|
||||||
|
|
||||||
{ Render throttle: during bulk data flow, only render every RenderMs }
|
{ Blink + dirty-row pass. During normal data flow, WriteDeferredBuf }
|
||||||
{ to decouple parse throughput from GDI overhead. When idle, render }
|
{ already rendered inline so FlipToScreen is a no-op. Only blink }
|
||||||
{ immediately for interactive responsiveness. }
|
{ toggle (every 500ms) or scrollbar updates produce dirty rows here. }
|
||||||
Now := GetTickCount;
|
|
||||||
if (not HasData) or (Now - LastRenderTick >= RenderMs) then
|
|
||||||
begin
|
|
||||||
FAnsi.TickBlink;
|
FAnsi.TickBlink;
|
||||||
FAnsi.FlipToScreen;
|
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 }
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue