Added new config variables for timer functions

This commit is contained in:
BlueFox 2024-11-15 19:39:32 +01:00
parent 9d395bd2b8
commit 678ebfe7aa
Signed by: BlueFox
GPG Key ID: 327233DA85435270
2 changed files with 23 additions and 17 deletions

View File

@ -45,22 +45,25 @@ All the configuration can be done in the [config.json](config.json) file in JSON
| 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 |
| `"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` |
| `"TIMER\_1\_DURATION"` | int | the timer duration of the first timer; IN SECONDS | `60` (1min) |
| `"TIMER\_2\_DURATION"` | int | as above, but of the seconds timer; IN SECONDS | `2400` (40min) |
| `"TIMER\_3\_DURATION"` | int | as above, but of the third timer; IN SECONDS | `2700` (45min) |
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! When setting configuration options from your custom code, keep in mind that doing this via the `Config().<ATTR_NAME>` way just means writing the value directly to the file, while getting it goes through the wrapper to make e.g. the pin a machine.Pin object. But you just can't write a pin back into an attribute.

View File

@ -14,5 +14,8 @@
"LCD_I2C_CH": 0,
"LCD_I2C_ADDR": 39,
"LCD_I2C_NUM_ROWS": 2,
"LCD_I2C_NUM_COLS": 16
"LCD_I2C_NUM_COLS": 16,
"TIMER_1_DURATION": 60,
"TIMER_2_DURATION": 2400,
"TIMER_3_DURATION": 2700,
}