refactor/feature/fix: Major refactor of codebase
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

refactor(stdio): replace console/terminal command system with buffer-based stdio
- Introduced stdio.pas as the unified command I/O layer.
- All 31 command procedures across 15 files now receive stdin_buf,
  stdout_buf, and stderr_buf (POutBuf) instead of a single outbuf.
- vterminal.pas creates all three buffers per command invocation and
  displays both stdout and stderr.
- Deleted console.pas, terminal.pas, and 9 obsolete windowing programs
  (shell, splash, edit, memview, themer, netlog, vmlog, vmstate, udpcat).
- Migrated all registerCommand calls to stdio, rewrote vterminal
  processCommand to use stdio.findCommand, and added proper error
  routing to stderr for invalid params, bad paths, and system errors.

refactor(syslog): replace console logging with serial-backed syslog
- Introduced syslog.pas for kernel-level logging over serial/dev.
- Migrated all boot logging in kernel.pas from console.outputln/
  writestringln to syslog.logln/writestringln.
- Converted 19 fault handlers, hashmap, lists, scheduler, tracer, net,
  udp, and all driver init paths to use syslog.
- Rewrote BSOD in util.pas (50+ calls) from console to syslog.
- Removed CONSOLE_SLOW_REDRAW, TRGB565, TRGB565Pair, and HWND
  from system.pas.

fix(keyboard): add ring buffer and proper press/release cycling for LVGL input
- Replaced the single last_key/key_pressed slot in lvgl.pas with a
  16-entry ring buffer (kb_buf, kb_head, kb_tail) to prevent ISR
  overwrites when typing fast.
- Added a kb_pending_release flag so each keystroke gets a
  full PRESSED->RELEASED cycle before the next key is consumed —
  LVGL requires this pairing and was silently dropping intermediate
  keys when receiving consecutive PRESSED events without
  intervening releases.

feat(vterminal): use Hack monospace font for terminal output
- Added Hack Regular 14px (hack_14.c) as a custom LVGL font.
- Removed the .static_bitmap field from the generated font file
  (not present in LVGL 9.2 lv_font_t struct).
- Declared the hack_14 external symbol in lvgl.pas and switched
  vterminal's text label from lv_font_montserrat_14 to hack_14
  for proper monospace terminal rendering.
This commit is contained in:
t3hn3rd committed 2026-03-01 02:06:31 +00:00
1 parent dbe6e958e2
commit f752be48ce
92 files changed
+14917 -5797

No files matched your search

+26 -19
View File
@@ -24,7 +24,7 @@ interface
uses
bios_data_area,
lmemorymanager,
net, nettypes, netutils, ipv4, console, terminal, arp, util;
net, nettypes, netutils, ipv4, arp, util;
type
TARPErrorCode = (aecFailedToResolveHost, aecNoRouteToHost, aecTimeout, aecTTLExpired);
@@ -44,6 +44,9 @@ procedure ping_rep(hdr : PICMPHeader);
implementation
uses
stdio, strings;
var
Handlers : Array[0..255] of TARPHandler;
@@ -163,27 +166,29 @@ begin
end;
var
PING_T1 : uint64;
PING_N : uint16;
PING_C : uint16;
PING_L : uint32;
PING_IP : puint8;
PING_T1 : uint64;
PING_N : uint16;
PING_C : uint16;
PING_L : uint32;
PING_IP : puint8;
PING_STDOUT : POutBuf;
PING_STDERR : POutBuf;
procedure ping_err(hdr : PICMPHeader; Reason : TARPErrorCode);
begin
writestringWND('Ping Error: ', getTerminalHWND);
stdio.bufWriteStr(PING_STDERR, 'Ping Error: ');
case Reason of
aecFailedToResolveHost:writestringlnWND('Failed to resolve host.', getTerminalHWND);
aecNoRouteToHost:writestringlnWND('No route to host.', getTerminalHWND);
aecTimeout:writestringlnWND('Timeout expired.', getTerminalHWND);
aecTTLExpired:writestringlnWND('TTL Expired.', getTerminalHWND);
aecFailedToResolveHost:stdio.bufWriteStrLn(PING_STDERR, 'Failed to resolve host.');
aecNoRouteToHost:stdio.bufWriteStrLn(PING_STDERR, 'No route to host.');
aecTimeout:stdio.bufWriteStrLn(PING_STDERR, 'Timeout expired.');
aecTTLExpired:stdio.bufWriteStrLn(PING_STDERR, 'TTL Expired.');
end;
PING_T1:= Counters.c64;
INC(PING_C);
if PING_C < PING_N then begin
sendICMPRequest(PING_IP, PING_C, 128, @ping_rep, @ping_err);
end else begin
terminal.done(PING_L);
stdio.done(PING_L);
end;
end;
@@ -193,15 +198,15 @@ var
begin
PING_T2:= Counters.c64;
writestringWND('Ping Reply: ', getTerminalHWND);
writeIntWND(PING_T2-PING_T1, getTerminalHWND);
writeStringlnWND('ms.', getTerminalHWND);
stdio.bufWriteStr(PING_STDOUT, 'Ping Reply: ');
stdio.bufWriteInt(PING_STDOUT, PING_T2-PING_T1);
stdio.bufWriteStrLn(PING_STDOUT, 'ms.');
PING_T1:= PING_T2;
INC(PING_C);
if PING_C < PING_N then begin
sendICMPRequest(PING_IP, PING_C, 128, @ping_rep, @ping_err);
end else begin
terminal.done(PING_L);
stdio.done(PING_L);
end;
end;
@@ -210,7 +215,7 @@ begin
PING_N:= 0;
end;
procedure terminal_command_ping(Params : PParamList);
procedure terminal_command_ping(Params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
var
ip_str : pchar;
ip : puint8;
@@ -220,7 +225,9 @@ begin
ip_str:= getParam(0, Params);
ip:= stringToIPv4(ip_str);
if ip <> nil then begin
terminal.halt(PING_L, @ping_terminate);
PING_STDOUT:= stdout_buf;
PING_STDERR:= stderr_buf;
stdio.halt(PING_L, @ping_terminate);
PING_L:= Counters.c32;
PING_N:= 10;
PING_C:= 0;
@@ -242,7 +249,7 @@ begin
Handlers[i].OnReply:= nil;
end;
ipv4.registerProtocol($01, @recv);
terminal.registerCommand('PING', @terminal_command_ping, 'Ping a host.');
stdio.registerCommand('PING', @terminal_command_ping, 'Ping a host.');
end;
end.