pridany zdrojak pre arduino a AGENTS.md

This commit is contained in:
2026-06-24 02:21:24 +02:00
parent ad4309de9d
commit 24849d308d
2 changed files with 321 additions and 0 deletions

76
AGENTS.md Normal file
View File

@ -0,0 +1,76 @@
# Repository Guidelines
## Project Structure & Module Organization
This repository contains a small ESP8266/ESP32 Arduino project for monitoring water level with conductive electrodes.
- `arduino/arduino.ino` contains the Arduino sketch and main application logic.
- `README.md` gives the high-level project purpose.
- `LICENSE` contains licensing information.
- `.agents/` is reserved for agent/tooling metadata and should not be treated as firmware source.
Keep Arduino source files inside the `arduino/` sketch directory so Arduino IDE can open and build the project correctly.
## Build, Test, and Development Commands
Use Arduino IDE or `arduino-cli` with the ESP8266 or ESP32 board package installed.
Examples:
```sh
arduino-cli compile --fqbn esp8266:esp8266:nodemcuv2 arduino
arduino-cli upload -p COM3 --fqbn esp8266:esp8266:nodemcuv2 arduino
arduino-cli monitor -p COM3 -c baudrate=115200
arduino-cli compile --fqbn esp32:esp32:esp32 arduino
arduino-cli upload -p COM3 --fqbn esp32:esp32:esp32 arduino
arduino-cli monitor -p COM3 -c baudrate=115200
```
- `compile` verifies the sketch builds for the selected board.
- `upload` flashes the firmware to the connected board.
- `monitor` opens the serial console used by debug output.
Adjust `--fqbn` and `COM3` for the actual board and port.
## Coding Style & Naming Conventions
Write C++ compatible with Arduino IDE and the ESP8266/ESP32 cores. Use two-space indentation, braces on the same line, and descriptive names.
- Constants: uppercase or clearly prefixed names, for example `PIN_LEVEL1`, `SLEEP_TIME_SEC`.
- Structs and types: PascalCase, for example `WaterLevels`.
- Functions: lower camelCase, for example `readLevels()` and `connectWifi()`.
Prefer small functions with one responsibility. Keep hardware pins, URLs, timings, and debug flags as constants near the top of the sketch.
## Hardware Notes
For ESP8266 conductive level sensing, use external pull-down resistors from each `PIN_LEVEL1..4` input to `GND`. The common electrode is driven to positive voltage only during measurement.
Avoid ESP8266 boot/strap pins for level inputs when possible, especially `GPIO0`, `GPIO2`, and `GPIO15`. Also avoid `GPIO1`/`GPIO3` unless intentionally sharing the serial port. Prefer ordinary GPIO pins such as `GPIO5`, `GPIO4`, `GPIO14`, `GPIO12`, or `GPIO13`, depending on the board and wiring.
## Testing Guidelines
There is no automated test framework in this repository. Validate changes by compiling the sketch and testing on hardware.
Before committing firmware changes:
- Compile for the target ESP8266 or ESP32 board.
- Test `DEBUG == 1` for local level readings without Wi-Fi.
- Test `DEBUG == 2` for repeated Wi-Fi POST requests.
- Test `DEBUG == 0` for production sleep/wake behavior.
## Commit & Pull Request Guidelines
Current Git history is minimal and uses a simple message such as `Initial commit`. Keep future commits short, imperative, and specific, for example `Add WiFi timeout handling`.
Pull requests should include:
- A brief description of firmware behavior changed.
- Board model and Arduino ESP8266/ESP32 core version used for testing.
- Serial output or screenshots when debugging behavior changes.
- Any required configuration changes, especially Wi-Fi, server URL, or pin mapping.
## Security & Configuration Tips
Avoid committing real Wi-Fi passwords or private server endpoints when possible. For shared changes, replace secrets with placeholders and document required local values.