Added a configuration list to README.md

This commit is contained in:
BlueFox 2024-11-15 15:57:07 +01:00
parent eef6f8e2cc
commit 20331b81bc
Signed by: BlueFox
GPG Key ID: 327233DA85435270

View File

@ -30,15 +30,40 @@ To install this, use [Thonny](https://thonny.org/), open all the files present i
## Configuration
All the configuration can be done in the [config.py](config.py) file, just have a look around there. Some hints for editing this file:
All the configuration can be done in the [config.json](config.json) file in JSON format just have a look around there. Some hints for editing this file:
- When editing the startup section strings, make sure the "STARTUP_PROJECT_NAME" and the "STARTUP_MESSAGE_FINISHED" values have the same length as your display can show (likely 16 characters). Otherwise it could be that some things won't be displayed correctly.
- For a description of all of the attributes, see below
- When editing the startup section strings, make sure the "STARTUP\_PROJECT\_NAME" and the "STARTUP\_MESSAGE\_FINISHED" values have the same length as your display can show (likely 16 characters). Otherwise it could be that some things won't be displayed correctly.
- When changing Pins in the Pinout section, make sure to follow the pinout assignment of your Pi Pico board (e.g. the i2c sda and scl pins)
- If your display doesn't work properly - the first issue might be a wrong i2c address. To find the address of your display, just follow some of the tutorials on the internet on scanning for i2c devices (e.g. [here](https://randomnerdtutorials.com/raspberry-pi-pico-i2c-scanner-micropython/)).
### Attribute table
| Attribute name (on top level in config.json) | Type | Description | Default |
| -------------------------------------------- | ---- | ----------- | ------- |
| "LOG\_LEVEL" | int | defines up to which log level to show log messages in the serial console: warn (0), info (1), debug (2) | 2 |
| "STARTUP\_WELCOME\_SHOW" | bool | show the startup screen? | true |
| "STARTUP\_PROJECT\_NAME" | str | the name shown at the welcome/startup screen | " UV-Belichter " |
| "STARTUP\_MESSAGE\_STARTING | str | the message shown at startup when starting | "Starting..." |
| "STARTUP\_PROJECT\_FINISHED" | str | the message shown at startup when finished | " Started! " |
| "STARTUP\_WELCOME\_CYCLES" | int | how often the starting string shall go over the welcome screen | 1 |
| "PIN\_IN\_BTN\_1" | dict | the dict must contain the "pin" and "pull" keys with respective values | {"pin": 15, "pull": "down"} |
| "PIN\_IN\_BTN\_2" | dict | as above | {"pin": 14, "pull": "down"} |
| "PIN\_IN\_SWITCH" | dict | as above | {"pin": 13, "pull": "down"} |
| "PIN\_OUT\_RELAIS" | int | pin number where the relais is connected | 21 |
| "PIN\_SDA" | int | the pin number of the sda wire connected to the lcd | 8 |
| "PIN\_SCL" | int | the pin number of the scl wire connected to the lcd | 9 |
| "LCD\_I2C\_CH" | int | the channel of the i2c bus used | 0 |
| "LCD\_I2C\_ADDR" | int | the i2c address of the lcd; make sure to convert hexadecimal to decimal numbers | 38 |
| "LCD\_I2C\_NUM\_ROWS" | int | how many rows for character display has the display? | 2 |
| "LCD\_I2C\_NUM\_COLS" | int | and how many characters can it display per row? | 16 |
Note that this software has it's own small wrapper for the config file, e.g. to have instant access to an LCD object generated on the fly. These are all documented in the [utils.py](utils.py) file!
## Used libraries
- PCF8574T - a driver for the i2c multiplexer used to address the 2x16 lcd display