KRYONOS
JS Runtime & Core

System & OS Core

Global System API reference for hardware interrogation, memory statistics, touch inputs, timers, RTC clocks, and virtual keyboard prompts in KryonOS.

Global Object: System

The System global object provides low-level, hardware-accelerated bindings to the ESP32 microcontroller and the KryonOS C++ kernel.

Hardware definitions and source references can be found in the KryonOS GitHub Repository.


Display Metrics & OS Metadata

System.screenWidth()

Returns the physical display width in pixels.

  • Parameters: None
  • Returns: Integer (Defaults to 240 on standard hardware).

System.screenHeight()

Returns the physical display height in pixels.

  • Parameters: None
  • Returns: Integer (Defaults to 320 on standard hardware).

System.getOSVersion()

Returns the semantic version string of the active KryonOS kernel.

  • Parameters: None
  • Returns: String (e.g. "2.0.0").

System.getAPILevel()

Returns the active kernel API level integer.

  • Parameters: None
  • Returns: Integer (e.g. 2).

Timers & CPU Scheduling

System.millis()

Returns the time elapsed in milliseconds since the device booted.

  • Parameters: None
  • Returns: Integer

System.micros()

Returns the time elapsed in microseconds since the device booted. Used for high-resolution timing and signal analysis. Note: The 32-bit counter rolls over approximately every 71 minutes.

  • Parameters: None
  • Returns: Integer

System.delay(ms)

Suspends JavaScript execution for the specified duration and commands the FreeRTOS kernel to perform background Garbage Collection sweeps.

  • Parameters: ms (Integer) - Duration in milliseconds.
  • Returns: undefined

Always invoke System.delay(ms) in application loops to avoid memory fragmentation and CPU watchdog timeouts.

System.delayMicroseconds(us)

Suspends CPU execution for a sub-millisecond duration with microsecond precision. Does not trigger a Garbage Collection cycle.

  • Parameters: us (Integer) - Duration in microseconds.
  • Returns: undefined

Touch Input & Panic Exit Trigger

System.getTouch()

Polls the SPI touch screen controller for coordinates and pressure state.

  • Parameters: None
  • Returns: Object
PropertyTypeDescription
touchedBooleantrue when touch contact is active, false otherwise
xIntegerHorizontal pixel coordinate (0 to screenWidth - 1)
yIntegerVertical pixel coordinate (0 to screenHeight - 1)

Panic Exit Mechanism: If the user presses the top-right corner (x >= 200 and y <= 40), the KryonOS kernel forcibly aborts the JavaScript execution context and returns to the home launcher. Ensure your application UI does not require critical button presses in this coordinate zone.

// Reading touch coordinates in an event loop
var touch = System.getTouch();

if (touch.touched) {
  System.print("User touched at X: " + touch.x + ", Y: " + touch.y);
  System.fillCircle(touch.x, touch.y, 4, 0x00FF00);
}

Hardware Diagnostics & Temperature

System.getInfo()

Returns a comprehensive hardware status snapshot.

  • Parameters: None
  • Returns: Object
PropertyTypeDescription
totalRAMIntegerTotal physical SRAM in bytes
freeRAMIntegerCurrently available SRAM in bytes
minFreeRAMIntegerLowest free SRAM recorded since boot
maxAllocRAMIntegerLargest contiguous allocatable memory block
cpuFreqMHzIntegerCPU clock speed in MHz (e.g. 240)
chipModelStringSilicon model string (e.g. "ESP32-D0WDQ6")
chipCoresIntegerNumber of active CPU cores
flashSizeIntegerPhysical SPI flash storage size in bytes
uptimeMsIntegerMilliseconds elapsed since boot

System.getTemperature()

Reads the internal silicon core temperature sensor.

  • Parameters: None
  • Returns: Float (Temperature in Celsius).

System.hasTemperatureSensor()

Verifies if the installed silicon revision contains a functional on-die temperature sensor.

  • Parameters: None
  • Returns: Boolean

Real-Time Clock & System Control

System.getTime()

Returns the formatted system time, respecting 12-hour or 24-hour OS settings.

  • Parameters: None
  • Returns: String (e.g. "14:30" or "02:30 PM").

System.getDate()

Returns the current system date string.

  • Parameters: None
  • Returns: String (e.g. "15/06/2026").

System.getSeconds()

Returns the active RTC second value (0 to 59).

  • Parameters: None
  • Returns: Integer

System.promptKeyboard(promptMsg, initialText)

Suspends JavaScript execution and launches the native full-screen touch keyboard interface.

  • Parameters:
    • promptMsg (String) - Label displayed in the keyboard header.
    • initialText (String) - Pre-filled input string.
  • Returns: String - Text entered by user, or empty string "" if cancelled.

System.print(str)

Outputs a string to the USB serial interface at 115200 baud.

  • Parameters: str (String)
  • Returns: undefined

System.restart()

Triggers an immediate hardware reboot of the microcontroller.

  • Parameters: None
  • Returns: undefined

On this page