keypatch/.github/copilot-instructions.md

51 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
# Workspace instructions for the KeyPatch ESP8266 project
This project is a PlatformIO/Arduino sketch for an ESP8266 (Wemos D1 mini) that
implements a captive-portal WiFi configurator, filesystem manager, and NeoPixel
handler. The code is organised into multiple `.ino` tabs under `src/` and uses
several libraries (LittleFS, ESP8266WebServer, DNSServer, Adafruit NeoPixel, PCF8575,
etc.).
## Building and flashing
- Build with PlatformIO via the task or from the command line:
```powershell
& "C:\Users\User\.platformio\penv\Scripts\platformio.exe" run
```
or `pio run`/`platformio run` from a shell that has the `platformio` command.
- Upload to the board using `platformio run -t upload` or through the built-in VS Code task.
- If you see `exit code 1` from the upload task, the problem is generally a connection issue to the
device, not a compilation error; the project compiles cleanly with the current sources.
## Code conventions
- All Arduino headers are included in the main tab (`KeyPatch.ino`). Helper tabs
such as `Connect.ino`, `LittleFS.ino`, etc. depend on those includes being present.
- `setup()` must call `connectWifi()` and `setupFS()` as indicated in the comments.
- Serial debugging is used heavily; the baud rate is 115200 by default.
- When the softAP named `EspConfig` is started, the IP address is printed to the
serial monitor (e.g. `AP-IP-Adresse: 172.217.28.1`).
## Common tasks
1. Change WiFi parameters in `Connect.ino` or use the captive portal.
2. Upload `fs.html` via the web interface to manage LittleFS content.
3. Edit hardware configurations under `hardware/` (FreeCAD files).
## Troubleshooting
- Compilation errors are rare; if you encounter them, run the verbose build
(`platformio run -v`) and inspect `compile.log` for `error:` messages.
- LittleFS operations require `LittleFS.begin()` to succeed; the helper tab
`LittleFS.ino` includes debug prints.
## Personalisation
This file is intended to help any contributor or future self understand the
project layout, build commands, and where to look for the various features.
Feel free to update it with new instructions as the sketch evolves.
---