# XY4160 — Control Panel: LEDs & Buttons Explained

## 💡 LEDs

| LED | Colour | Meaning |
|---|---|---|
| **ROT** | 🟢 Green | **Coordinate system is rotated.** Lights up when the plot coordinate system has been rotated (e.g. via the `RO90` HPGL command or manually). Turns **off** when an `IN;` (Initialize) command is received, which resets rotation to default. |
| **OW** | 🟡 Yellow | **Out of Window.** Lights up when the plotter receives coordinates that fall **outside the printable area**. The plotter **pauses** drawing and waits. It resumes automatically once it receives coordinates that are back within bounds. Useful for catching bad HPGL output. |
| **ERR** | 🔴 Red | **Fatal syntax error.** The plotter encountered an HPGL command it could not parse. Usually recovers on its own, but sometimes requires a power cycle. |

---

## 🔘 Buttons

| Button | Meaning |
|---|---|
| **CNT** | **Continue / Mode switch.** The main operational button. After power-on and paper loading, pressing `CNT` puts the plotter into **ready/receive mode**. Pressing it again toggles into **preview mode** (both yellow and green LEDs flash simultaneously). Also used during self-test (see below). |
| **VER** | **Version / Verify.** Most likely displays the **firmware version** of the plotter's internal HPGL interpreter (`VERze` = "version" in Czech). May also trigger a verify/status routine. Exact behaviour is not well documented in surviving sources. |
| **SH** | **Shift.** Acts as a **modifier key** — does nothing on its own. Used in combination with other buttons to access secondary functions (see `SH + PEN` below). |
| **PEN** | **Pen control.** Manually raises or lowers the pen. When used as `SH + PEN`, it enters **manual axis rotation adjustment mode**, confirmed by the green ROT LED lighting up. Note: any `IN;` command sent later will reset this. |

---

## 🔁 Key Combinations & Modes

### `SH + PEN` — Manual Rotation Mode
Pressing **SH** and **PEN** together lets you manually set the rotation of the coordinate axes. The **green ROT LED** lights up to confirm you're in this mode.
> ⚠️ Be aware: if your HPGL file starts with `IN;` (which it should, and most do), this manual rotation will be **immediately reset**.

### Self-Test Mode
To run the built-in self-test:
1. Hold **↑ (up)** and **→ (right)** arrow buttons
2. Power on the plotter while holding them
3. Wait for all LEDs to turn off
4. Press **CNT** twice

The plotter will draw a test pattern to verify mechanics and pen movement.

### Preview Mode
Pressing **CNT** repeatedly cycles through modes. When **both yellow (OW) and green (ROT) LEDs flash simultaneously**, the plotter is in **preview/digitizing mode** — the pen carriage moves but the pen stays up, letting you trace the path without actually drawing.

---

## 📝 Notes for HPGL Users

- The **OW LED** is your best friend for debugging — if it lights up, your coordinates are out of bounds for A4 (max `10400 × 7400` units).
- The **ROT LED** will tell you if a previous session left the coordinate system rotated — always start your HPGL with `IN;` to be safe.
- The **512-byte buffer** means the plotter can fall behind if you send data too fast — use hardware handshaking (RTS/CTS) so the plotter can signal when it's ready.