Gpio improvements (#24)

* Return network status

* lvgl v8 preparations

* Fix pin assignment

* Improve idle checking

* Add bcklpin 32

* Update upload_port

* Comment on seperate line

* Update test.yaml

* Copy boot partitions

* Add release workflow

* Update README.md

* Small changes

* Add docs

* Delete 17-javascript.md

* Update docs

* Rename haspWakeUp to guiWakeUp

* Code cleanup

* Rename haspWakeUp to guiWakeUp

* Code cleanup

* Change to lvgl#dev-v8

* Update check_obj_type

* Enable default PULLUP

* Bump StreamUtils Version

* Increase JsonDocument size

* Improve GPIO Settings

* Comment default ports

* Add more GPIOs configs

* Gpio improvements

* Use saved_page in hasp_new_object

Co-authored-by: fvanroie
This commit is contained in:
fvanroie 2020-12-13 00:26:02 +01:00 committed by GitHub
parent cb2eabf25a
commit ade03960ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
105 changed files with 7874 additions and 1049 deletions

56
.github/workflows/test.yaml vendored Normal file
View File

@ -0,0 +1,56 @@
name: PlatformIO CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Enable ESP platforms from platformio_override-template.ini
run: |
sed 's/; user_setups\/esp/user_setups\/esp/g' platformio_override-template.ini > platformio_override.ini
- name: List all files in current folder
run: |
ls -la
- name: Cat platformio_override.ini
run: |
cat platformio_override.ini
- name: Run PlatformIO
run: pio run -e d1-mini-esp32_ili9341 -e d1-mini-esp8266_ili9341
- name: Upload output file
uses: actions/upload-artifact@v2
with:
name: hasp-lvgl firmware.zip
path: build_output/firmware/*.bin
#- name: Create release and upload firmware
# run: |
# set -x
# assets=()
# for asset in build_output/firmware/*.bin; do
# assets+=("-a" "$asset")
# done
# tag_name="${GITHUB_REF##*/}"
# hub release create "${assets[@]}" -m "$tag_name" "$tag_name"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore vendored
View File

@ -13,7 +13,6 @@ build_output/*
build_output/firmware/*.bin
## Test result files
*.html
*.xml
*.bin

View File

@ -4,6 +4,7 @@
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/fvanroie/hasp-lvgl/blob/master/LICENSE)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
[![GitHub issues](https://img.shields.io/github/issues/fvanroie/hasp-lvgl.svg)](http://github.com/fvanroie/hasp-lvgl/issues)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/fvanroie/hasp-lvgl/PlatformIO%20CI?label=Build%20Firmware&logo=github&logoColor=%23dddddd)](https://github.com/fvanroie/hasp-lvgl/actions?query=workflow%3A%22PlatformIO+CI%22)
[![Discord](https://img.shields.io/discord/538814618106331137?color=%237289DA&label=support&logo=discord&logoColor=white)][6]
This project is a re-implementation of the popular HASwitchPlate sketch created by aderusha.

0
docs/.nojekyll Normal file
View File

152
docs/01-hardware.md Normal file
View File

@ -0,0 +1,152 @@
Hasp-lvgl supports the ESP32, ESP8266 and STM32F4 families of microcontrollers.
It needs a compatible micro-controller with drivers supporting the attached display, touch controller, storage and network.
Below is a list of recommended development boards and a TFT touchscreen to get you up-and-running in no time.
## Recommended Boards
<style>
table th:first-of-type {
width: 12%;
}
table th:nth-of-type(2) {
width: 22%;
}
table th:nth-of-type(3) {
width: 22%;
}
table th:nth-of-type(4) {
width: 22%;
}
table th:last-of-type {
width: 22%;
}
</style>
| | Basic | Standard | Pro | Experimental |
|:-----------|:-----------:|:------------:|:------------:|:------------:|
| MCU | ESP8266 | ESP32-WROOM | ESP32-WROVER | STM32F4 |
| CPU Freq. | 80Mhz | 240Mhz | 240Mhz | 168 MHz |
| Ram | 80Kb | 520Kb | 520Kb | 192Kb |
| PSRam | no | no | yes | no |
| Minimal Flash | 4MB | 4MB | 4MB | 512Kb |
| Display | ILI9341 SPI | ILI9341 SPI | ILI9341 SPI | ILI9341 FSMC |
| Touch | XPT2046 SPI | XPT2046 SPI | XPT2046 SPI | XPT2046 SPI |
| Network | Wifi | Wifi | Wifi | Ethernet / Wifi |
| Dev. Board*|[D1 mini ESP8266][3]|[D1 mini ESP32][4]|[TTGO T7 v1.4 Mini32][5]| STM32F407VET/ZGT Black |
| Firmware | [Download][1] | [Download][1] | [Download][1] | |
[1]: ./installation.md
[3]: https://www.aliexpress.com/item/32643142716.html
[4]: https://www.aliexpress.com/item/32815530502.html
[5]: https://www.aliexpress.com/item/32977375539.html
!> \* *Due to the large number of possible hardware options a selection of 3 popular ESP development boards has been made for the precompiled binaries.*
> **Note:**</br>Advanced users can build and compile custom configurations using PlatformIO, however this is not currently supported.
## Recommended Display
#### Lolin TFT 2.4"
ILI9341 SPI touchscreens with backlight dimming via PWM are quite cheap to get.
An ILI9341 TFT display with SPI is required when using a pre-built binary.
The touchcontroller needs to be the XPT2046 Resistive Touch driver.
The Lolin TFT 2.4" is **plug-and-play** with the 3 recommended ESP development boards.
If you have another ESP or MCU, you can still use this display using jumper cables.
You can also solder a row of headers at the bottom of the display to plug it into a breadboard.
Therefor the Lolin TFT 2.4 Touch Shield is used as the development display of choice.
##### Backlight Control
To use PWM dimming on the Lolin TFT 2.4" you must solder the TFT-LED pin to either D1, D2 or D4.
**D1 is recommended** for backlight control and configured by default.
![TFT-LED PWM dimming](https://github.com/fvanroie/hasp-lvgl/blob/master/docs/img/tft-led-pwm.png)
**Warning** Do *not* use D3 for backlight control because it is already in use for touch!
{: .notice--warning}
**Note** It is also *not* recommended to use D4 for backlight control because it is already in use for PSram on the ESP32-Wrover.
{: .notice--info}
##### Compatible ESP boards
The Lolin TFT 2.4" header is **plug-and-play** compatible with these development boards,
no need to use any jumper cables:
**ESP32:**
- Wemos D1 Mini ESP32 *(**only** solder the inner row of the pinheaders)*
- TTGO T7 V1.4 MINI32 ESP32 *(**only** solder the inner row of the pinheaders)*
- LOLIN D32 Pro V2.0.0 *using an **additional** TFT cable*
**ESP8266:**
- Wemos D1 Mini ESP8266
- Lolin D1 Mini Pro ESP8266 V2.0.0
> **Note:**</br>If you have a Lolin TFT 2.4" Display and a compatible ESP development board, you have all the hardware that is needed.
> In that case you can skip ahead to the [Firmware Installation](./installation.md).
## Alternative SPI Display
Any common ILI9341 320x240 4-wire SPI touchscreen with XPT2046 Resistive Touch driver can be used, like:
- 2.4" SKU: MSP2402
- 2.8" SKU: MSP2807
- 3.2" SKU: MSP3218
You will need to connect the GPIO pins using jumper wires.
## Experimental MCUs
#### STM32F407xxT Black Combo
There are several cheap STM32F407xx Black boards available on the market with a TFT display header
and accompanying 3.2" ILI9341 FSMC screen (320x240). This hardware is experimental and not fully supported.
<figure class="third">
<a href="assets//images/boards/STM32F407VGT6_diymore-1.jpg"><img src="assets//images/boards/STM32F407VGT6_diymore-1.jpg"></a>
<a href="assets//images/boards/STM32F407VGT6_STM32F4XX_M-1.jpg"><img src="assets//images/boards/STM32F407VGT6_STM32F4XX_M-1.jpg"></a>
<a href="assets//images/boards/STM32F407VET6_STM32_F4VE_V2.0-1.jpg"><img src="assets//images/boards/STM32F407VET6_STM32_F4VE_V2.0-1.jpg"></a>
<a href="assets//images/boards/STM32F407ZET6-STM32F4XX-1.jpg"><img src="assets//images/boards/STM32F407ZET6-STM32F4XX-1.jpg"></a>
<a href="assets//images/boards/STM32F407ZGT6_Euse_M4_DEMO_Large-1.jpg"><img src="assets//images/boards/STM32F407ZGT6_Euse_M4_DEMO_Large-1.jpg"></a>
<a href="assets//images/boards/STM32F407VET6_Euse_M4_DEMO_Medium-1.jpg"><img src="assets//images/boards/STM32F407VET6_Euse_M4_DEMO_Medium-1.jpg"></a>
<figcaption>Selection of STM32F407 boards.</figcaption>
</figure>
**Warning** Make sure to purchase a compatible screen, preferably from the same vendor.
There are multiple FSMC interfaces: e.g. One is marked `TFT`, another is marked `New-TFT` and
a third has no markings.
The pinout of each header & display is different and are **not** interchangable!
<br>You can however use jumper cables instead, but it won't be plug-and-plug anymore.
{: .notice--warning}
The following boards are being tested:
- STM32F407VET6 Black (v2.1) with 512 KB flash
<figure class="third">
<a href="assets//images/boards/STM32F407VET6_STM32_F4VE_V2.0-1.jpg"><img src="assets//images/boards/STM32F407VET6_STM32_F4VE_V2.0-1.jpg"></a>
<a href="assets//images/boards/STM32F407VET6_STM32_F4VE_V2.0-2.jpg"><img src="assets//images/boards/STM32F407VET6_STM32_F4VE_V2.0-2.jpg"></a>
<a href="assets//images/boards/STM32F407VET6_STM32_F4VE_V2.0-3.jpg"><img src="assets//images/boards/STM32F407VET6_STM32_F4VE_V2.0-3.jpg"></a>
<figcaption>STM32F407VET6 Black (v2.0 and v2.1)</figcaption>
</figure>
- Purchase Link:
[AliExpress](https://www.aliexpress.com/item/32618222721.html)
[AliExpress](https://www.aliexpress.com/item/33013274704.html)
[AliExpress](https://www.aliexpress.com/item/1000006481553.html) (! V2.0 !)
- Documentation can be found on [GitHub](https://github.com/mcauser/BLACK_F407VE)
- STM32F407ZGT6 Black (V3.0) with 1 MB flash
<figure class="third">
<a href="assets//images/boards/STM32F407ZET6-STM32F4XX-1.jpg"><img src="assets//images/boards/STM32F407ZET6-STM32F4XX-1.jpg"></a>
<a href="assets//images/boards/STM32F407ZET6-STM32F4XX-2.jpg"><img src="assets//images/boards/STM32F407ZET6-STM32F4XX-2.jpg"></a>
<a href="assets//images/boards/STM32F407ZET6-STM32F4XX-3.jpg"><img src="assets//images/boards/STM32F407ZET6-STM32F4XX-3.jpg"></a>
<figcaption>STM32F407ZGT6 Black (v3.0)</figcaption>
</figure>
- Purchase Link:
- Documentation can be found on [GitHub](https://github.com/mcauser/BLACK_F407ZG)
**Info** The STM32F4 boards do not have network connectivity. You can use a compatible network adapter and configure it in PlatformIO.
{: .notice--info}
<sub>Images of STM32 boards are [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) from https://stm32-base.org/</sub>

View File

@ -0,0 +1,100 @@
---
title: "Quick-Start Guide"
permalink: /projects/hasp-lvgl/quick-start-guide/
excerpt: "How to quickly install and setup Minimal Mistakes for use with GitHub Pages."
last_modified_at: 2020-04-27
redirect_from:
- /theme-setup/
toc: true
---
Minimal Mistakes has been developed as a [Gem-based theme](http://jekyllrb.com/docs/themes/) for easier use, and 100% compatible with GitHub Pages when used as a remote theme.
**If you enjoy this software, please consider [supporting me](https://www.paypal.me/netwize) for developing and maintaining it.**
[![Support via PayPal](https://cdn.jsdelivr.net/gh/twolfson/paypal-github-button@1.0.0/dist/button.svg)](https://www.paypal.me/mmistakes)
## Installing the theme
If you're running Jekyll v3.5+ and self-hosting you can quickly install the theme as a Ruby gem.
[^structure]: See [**Structure** page]({{ "/docs/structure/" | relative_url }}) for a list of theme files and what they do.
**ProTip:** Be sure to remove `/docs` and `/test` if you forked Minimal Mistakes. These folders contain documentation and test pages for the theme and you probably don't want them littering up your repo.
{: .notice--info}
**Note:** The theme uses the [jekyll-include-cache](https://github.com/benbalter/jekyll-include-cache) plugin which will need to be installed in your `Gemfile` and added to the `plugins` array of `_config.yml`. Otherwise you'll throw `Unknown tag 'include_cached'` errors at build.
{: .notice--warning}
### Firmware
Remote themes are similar to Gem-based themes, but do not require `Gemfile` changes or whitelisting making them ideal for sites hosted with GitHub Pages.
To install as a remote theme:
1. Create/replace the contents of your `Gemfile` with the following:
```ruby
source "https://rubygems.org"
gem "github-pages", group: :jekyll_plugins
```
2. Add `jekyll-include-cache` to the `plugins` array of your `_config.yml`.
3. Fetch and update bundled gems by running the following [Bundler](http://bundler.io/) command:
```bash
bundle
```
4. Add `remote_theme: "mmistakes/minimal-mistakes@4.19.2"` to your `_config.yml` file. Remove any other `theme:` or `remote_theme:` entry.
You may also optionally specify a branch, [tag](https://github.com/mmistakes/minimal-mistakes/tags), or commit to use by appending an @ and the Git ref (e.g., `mmistakes/minimal-mistakes@4.9.0` or `mmistakes/minimal-mistakes@bbf3cbc5fd64a3e1885f3f99eb90ba92af84063d`). This is useful when rolling back to older versions of the theme. If you don't specify a Git ref, the latest on `master` will be used.
**Looking for an example?** Use the [Minimal Mistakes remote theme starter](https://github.com/mmistakes/mm-github-pages-starter/generate) for the quickest method of getting a GitHub Pages hosted site up and running. Generate a new repository from the starter, replace sample content with your own, and configure as needed.
{: .notice--info}
---
**Note:** Your Jekyll site should be viewable immediately at <http://USERNAME.github.io>. If it's not, you can force a rebuild by **Customizing Your Site** (see below for more details).
{: .notice--warning}
If you're hosting several Jekyll based sites under the same GitHub username you will have to use Project Pages instead of User Pages. Essentially you rename the repo to something other than **USERNAME.github.io** and create a `gh-pages` branch off of `master`. For more details on how to set things up check [GitHub's documentation](https://help.github.com/articles/user-organization-and-project-pages/).
<figure>
<img src="{{ '/assets/images/mm-gh-pages.gif' | relative_url }}" alt="creating a new branch on GitHub">
</figure>
You can also install the theme by copying all of the theme files[^structure] into your project.
To do so fork the [Minimal Mistakes theme](https://github.com/mmistakes/minimal-mistakes/fork), then rename the repo to **USERNAME.github.io** --- replacing **USERNAME** with your GitHub username.
<figure>
<img src="{{ '/assets/images/mm-theme-fork-repo.png' | relative_url }}" alt="fork Minimal Mistakes">
</figure>
**GitHub Pages Alternatives:** Looking to host your site for free and install/update the theme painlessly? [Netlify][netlify-jekyll], [GitLab Pages][gitlab-jekyll], and [Continuous Integration (CI) services][ci-jekyll] have you covered. In most cases all you need to do is connect your repository to them, create a simple configuration file, and install the theme following the [Ruby Gem Method](#ruby-gem-method) above.
{: .notice--info}
[netlify-jekyll]: https://www.netlify.com/blog/2015/10/28/a-step-by-step-guide-jekyll-3.0-on-netlify/
[gitlab-jekyll]: https://about.gitlab.com/2016/04/07/gitlab-pages-setup/
[ci-jekyll]: https://jekyllrb.com/docs/continuous-integration/
### Minimal Configuration
You need to setup network connectivity to your network and connect to an MQTT broker service.
## Home Automation
There are some examples available to help you integrate HASP into your Home Automation setup:
- Home Assistant
- OpenHAB
- Node-RED
- Tasmota Slave
**ProTip:** The source code and content files for this site can be found in the [`/docs` folder](https://github.com/mmistakes/minimal-mistakes/tree/master/docs) if you want to copy or learn from them.
{: .notice--info}

82
docs/02-installation.md Normal file
View File

@ -0,0 +1,82 @@
## Download the firmware
Go to the releases page on Github to download the latest hasp-lvgl binaries.
[<i class="fas fa-download"></i> Hasp-lvgl Releases](https://github.com/fvanroie/hasp-lvgl/releases){: .btn .btn--info}
There are currently 2 download options, pick the one appropriate for your hardware:
- hasp-lvgl-0.2.0-esp32_ili9341_spi.bin
- hasp-lvgl-0.2.0-esp8266_ili9341_spi.bin + boot files
> If no precompiled firmware file is available for your board you can configure, compile and upload the firmware yourself using PlatformIO.
{: .notice--info}
## Install the firmware
### Flash ESP32
When flashing the ESP32 for the first time, you need to install a bootloader, partitionscheme and application loader:
```shell
esptool.py --port "COM1" erase_flash
esptool.py --port "COM1" write_flash 0x1000 bootloader_dio_40m.bin --flash_mode dio --flash_freq 40m
esptool.py --port "COM1" write_flash 0x8000 partitions.bin
esptool.py --port "COM1" write_flash 0xe000 boot_app0.bin
```
Change `COM1` to the correct port on your computer.
then flash the actual firmware:
```shell
esptool.py -p "COM1" --baud 921600 write_flash 0x10000 d1-mini-esp32_ili9341_<version>.bin
```
or all previous steps in one long commandline:
```shell
esptool.py -p "COM1" --baud 921600 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 bootloader_dio_40m.bin 0x8000 partitions.bin 0xe000 boot_app0.bin 0x10000 d1-mini-esp32_ili9341_<version>.bin
```
### Flash ESP8266
Unlike the ESP32, for ESP8266 you only need one single `.bin` file:
#### Using Tasmotizer (Windows)
#### Using esp-tool.py
```shell
esptool.py -p "COM1" write_flash --flash_mode qio --flash_size 4m 0x0 d1-mini-esp8266_ili9341_<version>.bin
```
Change `COM1` to the correct port on your computer and `4m` to the correct size of the internal flash chip.
----------------------------------------------------------------------------------
### STM32F407 devEbox
**Note** There is no precompiled firmware file available for STM32F4 boards. You will need to configure, compile and upload the firmware yourself using PlatformIO.
{: .notice--info}
#### Using Serial
- Connect your serial TTL adapter RX and TX pins to PA9 and PA10 of the devEbox.
- Place the boot jumpers into programming mode
- Reset the board.
- Upload the firmware using:
#### Using DFU (USB)
- Connect your serial TTL adapter RX and TX pins to PA9 and PA10 of the devEbox.
- Place the boot jumpers into programming mode
- Reset the board.
- Upload the firmware using:
#### Using ST Link (USB)
- Install ST Link software
- Connect the devEbox using the USB port
- Launch ST Link
- Select the hasp-lvgl-0.2.0-stm32f407_devEbox_3.2_ili9341_fsmc.bin file
- Flash the firmware to the board

42
docs/03-wifi-setup.md Normal file
View File

@ -0,0 +1,42 @@
At first boot, when no wifi setup is found, the device will create an initial Access Point for configuring the device.
If the touchscreen is properly connected it will display a QR code, along with a temporary SSID and password, to connect to the device.
<figure class="third">
<a href="assets//images/hasp/oobe_setup.png"><img src="assets//images/hasp/oobe_setup.png"></a>
<a href="assets//images/hasp/touch_calibration.png"><img src="assets//images/hasp/touch_calibration.png"></a>
<a href="assets//images/hasp/wifi_setup.png"><img src="assets//images/hasp/wifi_setup.png"></a>
</figure>
Either use the touchscreen interface or connect via a webbrowser to setup the credentials for your local wifi access point:
## Using Touchscreen
1. Tap on the screen to start a Touch Calibration sequence:
2. Precisely touch the 4 courners as indicated
3. Use the on-screen keyboard to enter your local SSID and password
- Tap on the Checkmark button in the lower righthand corner to save the settings
The device will validate the entered credentials and reboot if they are correct.
## Using WiFi Access-Point
Connect to the temporary Access Point by scanning the QR on the display, if available.
Or Check the serial log for the SSID and password to connect.
- Browse to http://192.168.4.1
- Enter your local SSID and password for joining the device to your wireless network
- Click Save Settings
- The device will automatically reboot and connect to your wireless LAN
## Using Command line
You can also directly configure the wifi settings via the serial console:
```bash
ssid myAccessPointName
pass myWifiPassword
reboot
```
> **Note:**</br>To skip this step, wifi credentials can be saved into the .bin file when you compile the firmware yourself.

150
docs/05-commands.md Normal file
View File

@ -0,0 +1,150 @@
Commands are not related to an object, but can get or set global properties or invoke system commands on the device.
Commands can be issued via the Serial Commandline, Telnet Commandline or MQTT.
For MQTT, use the `hasp/<platename>/command` topic with payload `<keyword> <parameter(s)>`
Here is a list of all the recaognized command keywords:
## Pages
`page` [0-11]
Switches the display to show the objects from a diferent page.
`clearpage` [0-11,254]
Deletes all objects on a given page. If no page number is specified, it clears the current page.
To delete individual objects, you can issue the `p[x].b[y].delete` command.
## Backlight
`dim` [0-100] (alias: `brightness`)
Sets the level of the backlight from 0 to 100%, where 0% is off and 100% is full brightness.
Example: `dim 50` sets the display to half the brightness.
Tip: this can be used in conjunction with the idle event e.g. to dim the backlight after a short period of inactivity.
`light`
Switches the backlight on or off, independent of the set dim level.
Turning the backlight on will restore the brightness to the previous dim level.
Example: `light on` acepted values: on/off, true/false, 0/1, yes/no
Tip: this can be used in conjunction with the idle event, e.g. to turn the backlight off after a long period of inactivity.
Note: The `dim`and `light` command depends on a GPIO pin to be connected to control the the TFT_LED backlight via a transistor.
`wakeup`
Clears the idle state of the device and publishes an `state/idle = OFF` status message. It resets the idle counter as if a touch event occured on the devide. This is helpfull e.g. when you want to wake up the display when an external event has occured, like a PIR motion sensor.
## System commands
`calibrate`
Start on-screen touch calibration.
Note: You need to issue a soft reboot command to save the new calibration settings. If you do a hard reset of the device, the calibration settings will be lost.
`screenshot`
Saves a picture of the current screen to the flash filesystem. You can retrieve it via http://&gt;ip-address&lt;/screenshot.bmp
This can be handy for bug reporting or documentation.
The previous screenshot is overwritten.
`statusupdate`
Reports the status of the MCU. The response will be posted to the state topic:
```json
"statusupdate": {
"status": "available",
"espVersion": "0.0.6",
"espUptime": 124,
"signalStrength": -72,
"haspIP": "10.1.0.148",
"heapFree": 5912,
"heapFragmentation": 7,
"espCore": "2_6_3"
}
```
`reboot` (alias: `restart`)
Saves any changes in the configuration file and reboots the device.
`factoryreset`
Clear the filesystem and eeprom and reboot the device in its initial state.
Warning: There is no confirmation prompt nor undo function!
## Configuration Settings
### Wifi
`ssid`
Sets network name of the access point to connect to.
`pass`
Sets the optional password for the access point to connect to.
### MQTT
`hostname`
Sets the hostname of the device and mqtt topic for the node to `hasp/<hostname>/`
`mqtthost`
Sets the hostname of the mqtt broker.
`mqttport`
Sets the port of the mqtt broker.
`mqttuser`
Sets the optional username for the mqtt broker.
`mqttpass`
Sets the optional password for the mqtt broker.
### Config/xxx
You can get or set the configuration of a hasp-lvgl submodule in json format.
To get the configuration, the command `config/&gt;submodule&lt;`.
The result will be published to `hasp/plate35/state/config`. Passwords will be omited from the result.
```
config/wifi
config/mqtt
config/http
config/mdns
config/hasp
config/gui
config/debug
```
To update the configuration simple issue the same command `config/&gt;submodule&lt;` with updated json payload.
## Multiple Commands
`json`
When you want to execute multiple commands in one payload, you can use the json command to create an array of commands.
Each command is an element in this array of strings:
```json
["page 5","dim 50","light on","statusupdate"]
```
The commands are interpreted and processed sequentially.

1067
docs/05-configuration.md Normal file

File diff suppressed because it is too large Load Diff

17
docs/06-faq.md Normal file
View File

@ -0,0 +1,17 @@
#### Q: HASP Settings
A:
#### Q: Is there a file browser built-in?
*A:* There is no native file browser included yet, as this currently is low on the priority list.
However, you can upload the `edit.htm.gz` (3kB) file to the SPIFFS partition from the ESP32 FSBrowser repository.
Download it from: https://github.com/espressif/arduino-esp32/blob/master/libraries/WebServer/examples/FSBrowser/data/edit.htm.gz
When the `edit.htm.gz` file is present on Spiffs you will see an additional File Browser button on the Main Webpage:
![HTTP configuration](assets/images/faq/faq_file_browser.png "File Browser")
Using that webpage, you can right-click and delete files:
![HTTP configuration](assets/images/faq/faq_file_delete.png "Delete file")

View File

@ -0,0 +1,20 @@
When installing the theme as a Ruby Gem its layouts, includes, stylesheets, and other assets are all bundled in the `gem`. Meaning they're not easily visible in your project.
Each of these files can be modified, but you'll need to copy the default version into your project first. For example, if you wanted to modify the default [`single` layout](https://github.com/mmistakes/minimal-mistakes/blob/master/_layouts/single.html), you'd start by copying it to `_layouts/single.html`.
**ProTip**: To locate theme files, run `bundle info minimal-mistakes-jekyll`. Then copy the files you want to override from the returned path, to the appropriate folder in your project.
{: .notice--info}
Jekyll will use the files in your project first before falling back to the default versions of the theme. It exhibits this behavior with files in the following folders:
```
/assets
/_layouts
/_includes
/_sass
```
Additionally, from `v4.5.0` the theme-gem will also exhibit above behavior for `/_data` via a plugin.
Consequently, the data files for UI Text and Navigation are also bundled within the theme-gem.
For more information on customizing the theme's [stylesheets]({{ "/docs/stylesheets/" | relative_url }}) and [JavaScript]({{ "/docs/javascript/" | relative_url }}), see the appropriate pages.

65
docs/07-navigation.md Normal file
View File

@ -0,0 +1,65 @@
Customize site navigational links through a Jekyll data file.
## Masthead
The masthead links use a "priority plus" design pattern. Meaning, show as many navigation items that will fit horizontally with a toggle to reveal the rest.
To define these links add titles and URLs under the `main` key in `_data/navigation.yml`:
```yaml
main:
- title: "Quick-Start Guide"
url: /projects/hasp-lvgl/quick-start-guide/
- title: "Posts"
url: /year-archive/
- title: "Categories"
url: /categories/
- title: "Tags"
url: /tags/
- title: "Pages"
url: /page-archive/
- title: "Collections"
url: /collection-archive/
- title: "External Link"
url: https://google.com
```
Which will give you a responsive masthead similar to this:
![priority plus masthead animation]({{ "/assets/images/mm-priority-plus-masthead.gif" | relative_url }})
Optionally, you can add a `description` key per title in the `main` key. This `description` will show up like a tooltip, when the user hovers over the link on a desktop browser.
**ProTip:** Put the most important links first so they're always visible and not hidden behind the **menu toggle**.
{: .notice--info}
## Breadcrumbs (beta)
Enable breadcrumb links to help visitors better navigate deep sites. Because of the fragile method of implementing them they don't always produce accurate links reliably. For best results:
1. Use a category based permalink structure e.g. `permalink: /:categories/:title/`
2. Manually create pages for each category or use a plugin like [jekyll-archives](https://github.com/jekyll/jekyll-archives) to auto-generate them. If these pages don't exist breadcrumb links to them will be broken.
![breadcrumb navigation example]({{ "/assets/images/mm-breadcrumbs-example.jpg" | relative_url }})
```yaml
breadcrumbs: true # disabled by default
```
Breadcrumb start link text and separator character can both be changed in `_data/ui-text.yml`.
```yaml
breadcrumb_home_label : "Home"
breadcrumb_separator : "/"
```
For breadcrumbs that resemble something like `Start > Blog > My Awesome Post` you'd apply these settings:
```yaml
breadcrumb_home_label : "Start"
breadcrumb_separator : ">"
```
## Custom sidebar navigation menu
See the [**sidebars** documentation]({{ "/projects/hasp-lvgl/layouts/#custom-sidebar-navigation-menu" | relative_url }}) for information on setting up a custom navigation menu.

43
docs/08-ui-text.md Normal file
View File

@ -0,0 +1,43 @@
Text for UI elements, `_layouts`, and `_includes` grouped together as a set of translation keys. This is by no means a full-on i18n solution, but it does help make customizing theme text a bit easier.
The English[^yaml-anchors] main keys in [`_data/ui-text.yml`](https://github.com/mmistakes/minimal-mistakes/blob/master/_data/ui-text.yml) are translated in the following languages:
- Brazilian Portuguese (Português brasileiro)
- Catalan
- Chinese
- Danish
- Dutch
- Finnish
- French (Français)
- German (Deutsch)
- Greek
- Hungarian
- Indonesian
- Irish (Gaeilge)
- Italian (Italiano)
- Korean
- Japanese
- Malayalam
- Myanmar (Burmese)
- Nepali (Nepalese)
- Polish
- Persian (فارسی)
- Romanian
- Russian
- Slovak
- Spanish (Español)
- Swedish
- Thai
- Turkish (Türkçe)
- Vietnamese
If you're are interested in localizing them into other languages feel free to submit a pull request and I will be happy to look it over.
[^yaml-anchors]: `en-US`, and `en-GB` use [YAML anchors](http://www.yaml.org/spec/1.2/spec.html#id2785586) to reference the values in `en` as to not repeat them.
Many of the label based keys like `meta_label`, `categories_label`, `tags_label`, `share_on_label`, and `follow_label` can be left blank if you'd like to omit them from view. It really depends on you and if you want an even more minimal look to your site.
![UI text labels]({{ "/assets/images/mm-ui-text-labels.jpg" | relative_url }})
**Note:** The theme comes with localized text in English (`en`, `en-US`, `en-GB`). If you change `locale` in `_config.yml` to something else, most of the UI text will go blank. Be sure to add the corresponding locale key and translated text to `_data/ui-text.yml` to avoid this.
{: .notice--warning}

44
docs/09-authors.md Normal file
View File

@ -0,0 +1,44 @@
Sites that may have content authored from various individuals can be accommodated by using [data files](https://jekyllrb.com/docs/datafiles/).
To assign an author to a post or page that is different from the site author specified in `_config.yml`:
**Step 1.** Create `_data/authors.yml` and add authors using the following format. Any variables found under `author:` in `_config.yml` can be used (e.g. `name`, `bio`, `avatar`, author `links`, etc.).
```yaml
# /_data/authors.yml
Billy Rick:
name : "Billy Rick"
bio : "What do you want, jewels? I am a very extravagant man."
avatar : "/assets/images/bio-photo-2.jpg"
links:
- label: "Email"
icon: "fas fa-fw fa-envelope-square"
url: "mailto:billyrick@rick.com"
- label: "Website"
icon: "fas fa-fw fa-link"
url: "https://thewhip.com"
- label: "Twitter"
icon: "fab fa-fw fa-twitter-square"
url: "https://twitter.com/extravagantman"
Cornelius Fiddlebone:
name : "Cornelius Fiddlebone"
bio : "I ordered what?"
avatar : "/assets/images/bio-photo.jpg"
links:
- label: "Email"
icon: "fas fa-fw fa-envelope-square"
url: "mailto:cornelius@thewhip.com"
- label: "Twitter"
icon: "fab fa-fw fa-twitter-square"
url: "https://twitter.com/rhymeswithsackit"
```
**Step 2.** Assign one of the authors in `authors.yml` to a post or page you wish to override the `site.author` with.
Example: To assign `Billy Rick` as an author for a post the following YAML Front Matter would be applied:
```yaml
author: Billy Rick
```

734
docs/10-layouts.md Normal file
View File

@ -0,0 +1,734 @@
The bread and butter of any theme. Below you'll find the layouts included with Minimal Mistakes, what they look like and the type of content they've been built for.
## Default layout
The base layout all other layouts inherit from. There's not much to this layout apart from pulling in several `_includes`:
* `<head>` elements
* masthead navigation links
* {% raw %}`{{ content }}`{% endraw %}
* page footer
* scripts
**Note:** You won't ever assign this layout directly to a post or page. Instead all other layouts will build off of it by setting `layout: default` in their YAML Front Matter.
{: .notice--warning}
### Layout based and user-defined classes
Class names corresponding to each layout are automatically added to the `<body>` element eg. `<body class="layout--single">`.
| layout | class name |
| ---------------- | --------------------------- |
| archive | `.layout--archive` |
| archive-taxonomy | `.layout--archive-taxonomy` |
| search | `.layout--search` |
| single | `.layout--single` |
| splash | `.layout--splash` |
| home | `.layout--home` |
| posts | `.layout--posts` |
| categories | `.layout--categories` |
| category | `.layout--category` |
| tags | `.layout--tags` |
| tag | `.layout--tag` |
Using YAML Front Matter you can also assign custom classes to target with CSS or JavaScript. Perfect for "art directed" posts or adding custom styles to specific pages.
Example:
```yaml
---
layout: splash
classes:
- landing
- dark-theme
---
```
Outputs:
```html
<body class="layout--splash landing dark-theme">
```
### Canonical URL
You can set custom Canonical URL for a page by specifying `canonical_url` option in pages YAML Front Matter. For example, if you have the following:
```yaml
layout: single
title: Title of Your Post
canonical_url: "https://yoursite.com/custom-canonical-url"
```
This will generate the following in the `<head>` of your page:
```html
<link rel="canonical" href="https://yoursite.com/custom-canonical-url" />
```
## Compress layout
A Jekyll layout that compresses HTML in pure Liquid. To enable add `layout: compress` to `_layouts/default.html`.
**Note:** Has been known to mangle markup and break JavaScript... especially if inline `// comments` are present. For this reason it has been disabled by default.
{: .notice--danger}
* [Documentation](http://jch.penibelst.de/)
## Single layout
The layout you'll likely use the most --- sidebar and main content combo.
**Includes:**
* Optional header image with caption
* Optional header overlay (solid color/image) + text and optional "call to action" button
* Optional social sharing links module
* Optional comments module
* Optional related posts module
* Wide page variant
{% include gallery id="single_layout_gallery" caption="Image header and meta info examples for `single` layout" %}
Assign with `layout: single` , or better yet apply as a [Front Matter default]({{ "/docs/configuration/#front-matter-defaults" | relative_url }}) in `_config.yml`.
### Wide page
To expand the main content to the right, filling the space of what is normally occupied by the table of contents. Add the following to a post or page's YAML Front Matter:
```yaml
classes: wide
```
**Note:** If the page contains a table of contents, it will no longer appear to the right. Instead it will be forced into the main content container directly following the page's title.
{: .notice--info}
### Table of contents
Auto-generated table of contents list for your posts and pages can be enabled by adding `toc: true` to the YAML Front Matter.
![table of contents example]({{ "/assets/images/mm-toc-helper-example.jpg" | relative_url }})
| Parameter | Required | Description | Default |
| --------- | -------- | ----------- | ------- |
| **toc** | Optional | Show table of contents. (boolean) | `false` |
| **toc_label** | Optional | Table of contents title. (string) | `toc_label` in UI Text data file. |
| **toc_icon** | Optional | Table of contents icon, displays before the title. (string) | [Font Awesome](https://fontawesome.com/icons?d=gallery&s=solid&m=free) <i class="fas fa-file-alt"></i> **file-alt** icon. Other FA icons can be used instead. |
**TOC example with custom title and icon**
```yaml
---
toc: true
toc_label: "My Table of Contents"
toc_icon: "cog"
---
```
## Archive layout
Essentially the same as `single` with markup adjustments and some modules removed.
**Includes:**
* Optional header image with caption
* Optional header overlay (solid color/image) + text and optional "call to action" button
* List and grid views
<figure>
<img src="{{ '/assets/images/mm-layout-archive.png' | relative_url }}" alt="archive layout example">
<figcaption>List view example.</figcaption>
</figure>
Below are sample archive pages you can easily drop into your project, taking care to rename `permalink`, `title`, or the filename to fit your site. Each is 100% compatible with GitHub Pages.
* [All Posts Grouped by Category -- List View][posts-categories]
* [All Posts Grouped by Tag -- List View][posts-tags]
* [All Posts Grouped by Year -- List View][posts-year]
* [All Posts Grouped by Collection -- List View][posts-collection]
* [Portfolio Collection -- Grid View][portfolio-collection]
[posts-categories]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/category-archive.md
[posts-tags]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/tag-archive.md
[posts-year]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/year-archive.md
[posts-collection]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/collection-archive.html
[portfolio-collection]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/portfolio-archive.md
Post and page excerpts are auto-generated by Jekyll which grabs the first paragraph of text. To override this text with something more specific use the following YAML Front Matter:
```yaml
excerpt: "A unique line of text to describe this post that will display in an archive listing and meta description with SEO benefits."
```
### Wide page
To expand the main content to the right, filling the space of what is normally occupied by the table of contents. Add the following to a post or page's YAML Front Matter:
```yaml
classes: wide
```
### Grid view
Adding `type=grid` to the `archive-single` helper will display archive posts in a 4 column grid. For example to create an archive displaying all documents in the portfolio collection:
Create a portfolio archive page (eg. `_pages/portfolio-archive.md`) with the following YAML Front Matter:
```yaml
---
title: Portfolio
layout: collection
permalink: /portfolio/
collection: portfolio
entries_layout: grid
---
```
Teaser images are assigned similar to header images using the following YAML Front Matter:
```yaml
header:
teaser: path-to-teaser-image.jpg
```
**Note:** More information on using this `_include` can be found under [**Helpers**]({{ "/docs/helpers/" | relative_url }}).
{: .notice--info}
## Taxonomy archives
If you have the luxury of using Jekyll plugins, the creation of category and tag archives is greatly simplified. Simply enable support for the [`jekyll-archives`](https://github.com/jekyll/jekyll-archives) plugin with a few `_config.yml` settings as noted in the [**Configuration**]({{ "/docs/configuration/#archive-settings" | relative_url }}) section and you're good to go.
![archive taxonomy layout example]({{ "/assets/images/mm-layout-archive-taxonomy.png" | relative_url }})
If you're not using the `jekyll-archives` plugin then you need to create archive pages yourself. Sample taxonomy archives can be found by grabbing the Markdown sources below and adding to your site.
| Name | Layout | Example |
| -------------------- | ------ | ------ |
| [Posts Archive](https://mmistakes.github.io/minimal-mistakes/year-archive/) | `layout: posts` | [year-archive.md](https://github.com/mmistakes/minimal-mistakes/blob/master/docs/_pages/year-archive.md) |
| [Categories Archive](https://mmistakes.github.io/minimal-mistakes/categories/) | `layout: categories` | [category-archive.md](https://github.com/mmistakes/minimal-mistakes/blob/master/docs/_pages/category-archive.md) |
| [Category Archive](https://mmistakes.github.io/minimal-mistakes/categories/edge-case/) | `layout: category` | [edge-case.md](https://github.com/mmistakes/minimal-mistakes/blob/master/docs/_pages/edge-case.md) |
| [Tags Archive](https://mmistakes.github.io/minimal-mistakes/tags/) | `layout: tags` | [tag-archive.md](https://github.com/mmistakes/minimal-mistakes/blob/master/docs/_pages/tag-archive.md) |
| [Tag Archive](https://mmistakes.github.io/minimal-mistakes/tags/markup/) | `layout: tag` | [markup.md](https://github.com/mmistakes/minimal-mistakes/blob/master/docs/_pages/markup.md) |
| [Collection Archive](https://mmistakes.github.io/minimal-mistakes/recipes-archive/) | `layout: collection` | [recipes-archive.md](https://github.com/mmistakes/minimal-mistakes/blob/master/docs/_pages/recipes-archive.md) |
**Note:** By default, documents are shown in a list view. To change to a grid view add `entries_layout: grid` to the page's front matter.
{: .notice--info}
### `layout: posts`
This layout displays all posts grouped by the year they were published. It accommodates the same front matter as `layout: archive`.
### `layout: categories`
This layout displays all posts grouped category. It accommodates the same front matter as `layout: archive`.
### `layout: tags`
This layout displays all posts grouped by tag. It accommodates the same front matter as `layout: archive`.
### `layout: collection`
This layout displays all documents grouped by a specific collection. It accommodates the same front matter as `layout: archive` with the addition of the following:
```yaml
collection: # collection name
entries_layout: # list (default), grid
show_excerpts: # true (default), false
sort_by: # date (default) title
sort_order: # forward (default), reverse
```
To create a page showing all documents in the `recipes` collection you'd create `recipes.md` in the root of your project and add this front matter:
```yaml
title: Recipes
layout: collection
permalink: /recipes/
collection: recipes
```
If you want to sort the collection by title add `sort_by: title`. If you want reverse sorting, add `sort_order: reverse`.
### `layout: category`
This layout displays all posts grouped by a specific category. It accommodates the same front matter as `layout: archive` with the addition of the following:
```yaml
taxonomy: # category name
entries_layout: # list (default), grid
```
To create a page showing all posts assigned to the category `foo` you'd create `foo.md` and add this front matter:
```yaml
title: Foo
layout: category
permalink: /categories/foo/
taxonomy: foo
```
### `layout: tag`
This layout displays all posts grouped by a specific tag. It accommodates the same front matter as `layout: archive` with the addition of the following:
```yaml
taxonomy: # tag name
entries_layout: # list (default), grid
```
To create a page showing all posts assigned to the tag `foo bar` you'd create `foo-bar.md` and add this front matter:
```yaml
title: Foo Bar
layout: tag
permalink: /tags/foo-bar/
taxonomy: foo bar
```
## Home page layout
A derivative archive page layout to be used as a simple home page. It is built to show a paginated list of recent posts based off of the [pagination settings]({{ "/docs/configuration/#paginate" | relative_url }}) in `_config.yml`.
<figure>
<img src="{{ '/assets/images/mm-home-post-pagination-example.jpg' | relative_url }}" alt="paginated home page example">
<figcaption>Example of a paginated home page showing 5 recent posts.</figcaption>
</figure>
To use create `index.html` at the root of your project and add the following YAML Front Matter:
```yaml
---
layout: home
---
```
Then configure pagination in `_config.yml`.
```yaml
paginate: 5 # amount of posts to show
paginate_path: /page:num/
```
If you'd rather have a paginated page of posts reside in a subfolder instead of acting as your homepage make the following adjustments.
Create `index.html` in the location you'd like. For example if I wanted it to live at **/blog** I'd create `/blog/index.html` with `layout: home` in its YAML Front Matter.
Then adjust the `paginate_path` in **_config.yml** to match.
```yaml
paginate_path: /blog/page:num
```
**Note:** Jekyll can only paginate a single `index.html` file. If you'd like to paginate more pages (e.g. category indexes) you'll need the help of a custom plugin. For more pagination related settings check the [**Configuration**]({{ "/docs/configuration/#paginate" | relative_url }}) section.
{: .notice--info}
## Splash page layout
For full-width landing pages that need a little something extra add `layout: splash` to the YAML Front Matter.
**Includes:**
* Optional header image with caption
* Optional header overlay (solid color/image) + text and optional "call to action" button
* Feature blocks (`left`, `center`, and `right` alignment options)
![splash page layout example]({{ "/assets/images/mm-layout-splash.png" | relative_url }})
Feature blocks can be assigned and aligned to the `left`, `right`, or `center` with a sprinkling of YAML. For full details on how to use the `feature_row` helper check the [**Content**]({{ "/docs/helpers/" | relative_url }}) section or review a [sample splash page](https://github.com/{{ site.repository }}/blob/master/docs/_pages/splash-page.md).
## Search page layout
A page with a search form. Add `layout: search` to the YAML Front Matter similar to [this example](https://github.com/mmistakes/minimal-mistakes/blob/master/test/_pages/search.md) on the test site.
![search page layout example]({{ "/assets/images/search-layout-example.png" | relative_url }})
**Note:** A page using the `layout: search` isn't compatible with the new [site search feature]({{ "/docs/configuration/#site-search" | relative_url }}) incorporated in the masthead.
{: .notice--warning}
### Exclusions
If you would like to exclude specific pages/posts from the search index set the search flag to `false` in the YAML Front Matter for the page/post.
```yaml
search: false
```
**ProTip:** Add a link to this page in the masthead navigation.
{: .notice--info}
---
## Headers
To add some visual punch to a post or page, a large full-width header image can be included.
Be sure to resize your header images. `~1280px` is a good width if you aren't [responsively serving up images](http://alistapart.com/article/responsive-images-in-practice). Through the magic of CSS they will scale up or down to fill the container. If you go with something too small it will look like garbage when upscaled, and something too large will hurt performance.
**Please Note:** Paths for image headers, overlays, teasers, [galleries]({{ "/docs/helpers/#gallery" | relative_url }}), and [feature rows]({{ "/docs/helpers/#feature-row" | relative_url }}) have changed and require a full path. Instead of just `image: filename.jpg` you'll need to use the full path eg: `image: /assets/images/filename.jpg`. The preferred location is now `/assets/images/`, but can be placed elsewhere or external hosted. This all applies for image references in `_config.yml` and `author.yml` as well.
{: .notice--danger}
![single layout header image example]({{ "/assets/images/mm-single-header-example.jpg" | relative_url }})
Place your images in the `/assets/images/` folder and add the following YAML Front Matter:
```yaml
header:
image: /assets/images/image-filename.jpg
```
For externally hosted images include the full image path instead of just the filename:
```yaml
header:
image: http://some-site.com/assets/images/image.jpg
```
To provide a custom alt tag for screen readers:
```yaml
header:
image: /assets/images/unsplash-image-1.jpg
image_description: "A description of the image"
```
To include a caption or attribution for the image:
```yaml
header:
image: /assets/images/unsplash-image-1.jpg
caption: "Photo credit: [**Unsplash**](https://unsplash.com)"
```
**ProTip:** Captions written in Markdown are supported, so feel free to add links, or style text. Just be sure to wrap it in quotes.
{: .notice--info}
### Header overlay
To overlay text on top of a header image you have a few more options:
| Name | Description | Default |
| ---- | ----------- | ------- |
| **overlay_image** | Header image you'd like to overlay. Same rules as `header.image` from above. | |
| **overlay_filter** | Color/opacity to overlay on top of the header image eg: `0.5` or `rgba(255, 0, 0, 0.5)`. |
| **show_overlay_excerpt** | Display excerpt in the overlay text | true |
| **excerpt** | Auto-generated page excerpt is added to the overlay text or can be overridden. | |
| **tagline** | Overrides page excerpt. Useful when header text needs to be different from excerpt in archive views. | |
| **actions** | Call to action button links (`actions` array: `label` and `url`). More than one button link can be assigned. | |
| **cta_label** | Deprecated, use `actions` instead. Call to action button text label. | `more_label` in UI Text data file |
| **cta_url** | Deprecated, use `actions` instead. Call to action button URL. | |
With this YAML Front Matter:
```yaml
excerpt: "This post should display a **header with an overlay image**, if the theme supports it."
header:
overlay_image: /assets/images/unsplash-image-1.jpg
caption: "Photo credit: [**Unsplash**](https://unsplash.com)"
actions:
- label: "More Info"
url: "https://unsplash.com"
```
You'd get a header image overlaid with text and a call to action button like this:
![single layout header overlay example]({{ "/assets/images/mm-single-header-overlay-example.jpg" | relative_url }})
You also have the option of specifying a solid background-color to use instead of an image.
![single layout header overlay with background fill]({{ "/assets/images/mm-single-header-overlay-fill-example.jpg" | relative_url }})
```yaml
excerpt: "This post should display a **header with a solid background color**, if the theme supports it."
header:
overlay_color: "#333"
```
You can also specifying the opacity (between `0` and `1`) of a black overlay like so:
![transparent black overlay]({{ "/assets/images/mm-header-overlay-black-filter.jpg" | relative_url }})
```yaml
excerpt: "This post should [...]"
header:
overlay_image: /assets/images/unsplash-image-1.jpg
overlay_filter: 0.5 # same as adding an opacity of 0.5 to a black background
caption: "Photo credit: [**Unsplash**](https://unsplash.com)"
actions:
- label: "Download"
url: "https://github.com"
```
Or if you want to do more fancy things, go full rgba:
![transparent red overlay]({{ "/assets/images/mm-header-overlay-red-filter.jpg" | relative_url }})
```yaml
excerpt: "This post should [...]"
header:
overlay_image: /assets/images/unsplash-image-1.jpg
overlay_filter: rgba(255, 0, 0, 0.5)
caption: "Photo credit: [**Unsplash**](https://unsplash.com)"
actions:
- label: "Download"
url: "https://github.com"
```
Multiple call to action button links can be assigned like this:
```yaml
excerpt: "This post should display a **header with an overlay image**, if the theme supports it."
header:
overlay_image: /assets/images/unsplash-image-1.jpg
caption: "Photo credit: [**Unsplash**](https://unsplash.com)"
actions:
- label: "Foo Button"
url: "#foo"
- label: "Bar Button"
url: "#bar"
```
### Open Graph & Twitter Card images
By default the large page header or overlay images are used for sharing previews. If you'd like to set this image to something else use `page.header.og_image` like:
```yaml
header:
image: /assets/images/your-page-image.jpg
og_image: /assets/images/your-og-image.jpg
```
**ProTip:** `og_image` is useful for setting OpenGraph images on pages that don't have a header or overlay image.
{: .notice--info}
---
## Sidebars
The space to the left of a page's main content is blank by default, but has the ability to show an author profile (name, short biography, social media links), custom content, or both.
### Author profile
Add `author_profile: true` to a post or page's YAML Front Matter.
![single layout example]({{ "/assets/images/mm-layout-single.png" | relative_url }})
Better yet, enable it with Front Matter Defaults set in `_config.yml`.
```yaml
defaults:
# _posts
- scope:
path: ""
type: posts
values:
author_profile: true
```
**Note:** To disable the author sidebar profile for a specific post or page, add `author_profile: false` to the YAML Front Matter instead.
{: .notice--warning}
To assign more author links, add to the `author.links` array in [`_config.yml`]({{ "/docs/configuration/" | relative_url }}) link so. Any of [Font Awesome's icons](https://fontawesome.com/icons?d=gallery) are available for use.
```yaml
author:
name: "Your Name"
avatar: "/assets/images/bio-photo.jpg"
bio: "I am an **amazing** person." # Note: Markdown is allowed
location: "Somewhere"
links:
- label: "Made Mistakes"
icon: "fas fa-fw fa-link"
url: "https://mademistakes.com"
- label: "Twitter"
icon: "fab fa-fw fa-twitter-square"
url: "https://twitter.com/mmistakes"
- label: "GitHub"
icon: "fab fa-fw fa-github"
url: "https://github.com/mmistakes"
- label: "Instagram"
icon: "fab fa-fw fa-instagram"
url: "https://instagram.com/mmistakes"
```
**Note:** Depending on the icon and theme skin used, colors may not be used. Popular social networks like Twitter, Facebook, Instagram, etc. have the appropriate brand color set in CSS. To change or add missing colors edit [`_utilities.scss`](https://github.com/mmistakes/minimal-mistakes/blob/master/_sass/minimal-mistakes/_utilities.scss) in `<site root>/_sass/minimal-mistakes/`.
{: .notice--info}
For example, to color a Reddit icon, simply add a `color` declaration and the corresponding hex code like so:
```scss
.social-icons {
.fa-reddit {
color: #ff4500;
}
}
```
![Reddit link in author profile with color]({{ "/assets/images/mm-author-profile-reddit-color.png" | relative_url }})
### Custom sidebar content
Blocks of content can be added by using the following under `sidebar`:
| Name | Description |
| ---- | ----------- |
| **title** | Title or heading. |
| **image** | Image path placed in `/images/` folder or an external URL. |
| **image_alt** | Alternate description for image. |
| **text** | Text. Markdown is allowed. |
Multiple blocks can also be added by following the example below:
```yaml
sidebar:
- title: "Title"
image: http://placehold.it/350x250
image_alt: "image"
text: "Some text here."
- title: "Another Title"
text: "More text here."
```
<figure>
<img src="{{ '/assets/images/mm-custom-sidebar-example.jpg' | relative_url }}" alt="custom sidebar content example">
<figcaption>Example of custom sidebar content added as YAML Front Matter.</figcaption>
</figure>
**Note:** Custom sidebar content added to a post or page's YAML Front Matter will appear below the author profile if enabled with `author_profile: true`.
{: .notice--info}
### Custom sidebar navigation menu
To create a sidebar menu[^sidebar-menu] similar to the one found in the theme's documentation pages you'll need to modify a `_data` file and some YAML Front Matter.
[^sidebar-menu]: Sidebar menu supports 1 level of nested links.
<figure>
<img src="{{ '/assets/images/mm-custom-sidebar-nav.jpg' | relative_url }}" alt="sidebar navigation example">
<figcaption>Custom sidebar navigation menu example.</figcaption>
</figure>
To start, add a new key to `_data/navigation.yml`. This will be referenced later in via YAML Front Matter so keep it short and memorable. In the case of the theme's documentation menu I used `docs`.
**Sample sidebar menu links:**
```yaml
docs:
- title: Getting Started
children:
- title: "Quick-Start Guide"
url: /docs/quick-start-guide/
- title: "Structure"
url: /docs/structure/
- title: "Installation"
url: /docs/installation/
- title: "Upgrading"
url: /docs/upgrading/
- title: Customization
children:
- title: "Configuration"
url: /docs/configuration/
- title: "Navigation"
url: /docs/navigation/
- title: "UI Text"
url: /docs/ui-text/
- title: "Authors"
url: /docs/authors/
- title: "Layouts"
url: /docs/layouts/
- title: Content
children:
- title: "Working with Posts"
url: /docs/posts/
- title: "Working with Pages"
url: /docs/pages/
- title: "Working with Collections"
url: /docs/collections/
- title: "Helpers"
url: /docs/helpers/
- title: "Utility Classes"
url: /docs/utility-classes/
- title: Extras
children:
- title: "Stylesheets"
url: /docs/stylesheets/
- title: "JavaScript"
url: /docs/javascript/
```
Now you can pull these links into any page by adding the following YAML Front Matter.
```yaml
sidebar:
nav: "docs"
```
**Note:** `nav: "docs"` references the `docs` key in `_data/navigation.yml` so make sure they match.
{: .notice--info}
If you're adding a sidebar navigation menu to several pages the use of Front Matter Defaults is a better option. You can define them in `_config.yml` to avoid adding it to every page or post.
**Sample sidebar nav default:**
```yaml
defaults:
# _docs
- scope:
path: ""
type: docs
values:
sidebar:
nav: "docs"
```
---
## Social sharing links
The `single` layout has an option to enable social links at the bottom of posts for sharing on Twitter, Facebook, and LinkedIn. Similar to the links found in the author sidebar, the theme ships with defaults for the most common social networks.
![default social share link buttons]({{ "/assets/images/mm-social-share-links-default.png" | relative_url }})
To enable these links add `share: true` to a post or page's YAML Front Matter or use a [default](https://jekyllrb.com/docs/configuration/#front-matter-defaults) in your `_config.yml` to apply more globally.
If you'd like to add, remove, or change the order of these default links you can do so by editing [`_includes/social-share.html`](https://github.com/mmistakes/minimal-mistakes/blob/master/_includes/social-share.html).
Let's say you wanted to replace the LinkedIn button with a Reddit one. Simply replace the HTML with the following:
```html
{% raw %}<a href="https://www.reddit.com/submit?url={{ page.url | absolute_url | url_encode }}&title={{ page.title }}" class="btn" title="{{ site.data.ui-text[site.locale].share_on_label }} Reddit"><i class="fab fa-fw fa-reddit" aria-hidden="true"></i><span> Reddit</span></a>{% endraw %}
```
The important parts to change are:
1. Share point URL *eg. `https://www.reddit.com/submit?url=`
2. Link `title`
3. [Font Awesome icon](http://fontawesome.io/icons/) (`fa-` class)
4. Link label
![Reddit social share link button]({{ "/assets/images/mm-social-share-links-reddit-gs.png" | relative_url }})
To change the color of the button use one of the built in [utility classes]({{ "/docs/utility-classes/#buttons" | relative_url }}). Or you can create a new button class to match whatever color you want.
Under the `$social` color map in `assets/_scss/_buttons.scss` simply add a name (this will be appened to `btn--`) that matches the new button class. In our case `reddit` ~> `.btn--reddit`.
```scss
$social:
(facebook, $facebook-color),
(twitter, $twitter-color),
(linkedin, $linkedin-color),
(reddit, #ff4500);
```
**ProTip:** For bonus points you can add it as a Sass `$variable` that you set in `_variables.scss` like the other ["brand" colors](http://brandcolors.net/).
{: .notice--info}
Add the new `.btn--reddit` class to the `<a>` element from earlier, [compile `main.css`]({{ "/docs/stylesheets/" | relative_url }}) and away you go.
```html
{% raw %}<a href="https://www.reddit.com/submit?url={{ page.url | relative_url }}&title={{ page.title }}" class="btn btn--reddit" title="{{ site.data.ui-text[site.locale].share_on_label }} Reddit"><i class="fab fa-fw fa-reddit" aria-hidden="true"></i><span> Reddit</span></a>{% endraw %}
```
![Reddit social share link button]({{ "/assets/images/mm-social-share-links-reddit-color.png" | relative_url }})

30
docs/11-posts.md Normal file
View File

@ -0,0 +1,30 @@
Posts are stored in the `_posts` directory and named according to the `YEAR-MONTH-DAY-title.MARKUP` format as per [the usual](https://jekyllrb.com/docs/posts/).
Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit numbers, and `MARKUP` is the file extension representing the format used in the file. For example, the following are examples of valid post filenames:
```
2016-07-20-writing-jekyll-posts.md
2015-01-03-static-site-generators.markdown
```
**Recommended Front Matter Defaults:**
```yaml
defaults:
# _posts
- scope:
path: ""
type: posts
values:
layout: single
author_profile: true
read_time: true
comments: true
share: true
related: true
```
Adding the above to `_config.yml` will assign the `single` layout and enable: *author profile*, *reading time*, *comments*, [*social sharing links*]({{ "/docs/layouts/#social-sharing-links" | relative_url }}), and *related posts*, for all posts.
**ProTip:** Remember to write unique `excerpt` descriptions for each post for improved SEO and archive listings.
{: .notice--info}

59
docs/12-pages.md Normal file
View File

@ -0,0 +1,59 @@
The initial layout of the pages is defined by creating a special file on the SPIFFS file system.
This layout is displayed each time HASP starts up.
You can upload this file *(and other resource assets like fonts and images)* in the web interface Configuration > HASP Settings.
### pages.jsonl
The location of this file is `/pages.jsonl` in the root of the filesystem.
It uses the [JSON Lines format](http://www.jsonlines.org) with one json object per line.
Each line should contain exactly **one** valid json object and end with a line-break `\n` *(not a comma)*.
The file is interpreted **line-by-line**.
When a malformed line is encountered, the processing of the rest of the file stops.
If you are missing objects, check the logs to see which line was processed last.
You probably have a typo in the following line which blocks parsing the rest of the file.
> **Note**</br>The complete file in its entirety is *not* a valid json file.
> Each individual line however must be a valid json object.
> The file extension is `.jsonl` and not `.json`.
### Objects
Each line in `pages.jsonl` creates **one object** on a page and has to be in the json format.
The order of objects dictates the layer on the page from bottom to top.
Example Objects
```json
{"page":2,"id":1,"objid":12,"x":5,"y":20,"h":50,"w":50,"enabled":"true","hidden":"false"}
{"page":2,"id":2,"objid":50,"x":5,"y":120,"h":90,"w":50,"enabled":"false","hidden":"false"}
```
Once the object is created, you can reference it with `p[x].b[y]` where `x` is the pagenumber and `y` is the id of the object.
for example:
```
p[2].b[1].w=100
p[2].b[2].hidden=true
```
## Comments
If any of the required `id` or `objid` properties are missing -*and the line is still valid json*- then it is interpreted as a comment.
You can also use the `page` parameter in a comment to set the default page for new objects that don't have a `page` parameter.
Example 1: Add a comment on a single line that is ignored.
```json
{"comment":" ----------- Page 2 layout ------------"}
```
Example 2: Set the default `page` for next object(s) to `3` besides adding a comment as well.
```json
{"page":3,"comment":" ---- My Awesome Color Picker Layout ----"}
```
If you then omit the `page` parameter in the lines below this comment, those objects will appear by default on page `3`.
> Note: If the line is not valid json, the parsing of the rest of the file is also stopped.
## Blank Lines
Blank lines are allowed for readability and are ignored.

247
docs/13-objects.md Normal file
View File

@ -0,0 +1,247 @@
## Common Properties
These are the common properties shared among all objects:
<style>
table th:first-of-type {
width: 12%;
}
table th:nth-of-type(2) {
width: 12%;
}
table th:nth-of-type(3) {
width: 12%;
}
table th:nth-of-type(4) {
width: 12%;
}
table th:last-of-type {
width: 48%;
}
</style>
| Property | Value | Required | Default | Description |
|:---------|:----------:|:--------:|:-------:|:------------|
| id | 0-255 | yes | n/a | ID of the object on this page |
| objid | 0-255 | yes | n/a | ID of the object type *(see below)* |
| page | 0-255 | no | n/a | ID of the page the object appears on |
| x | int16 | no | 0 | horizontal position on the page |
| y | int16 | no | 0 | vertical position on the page |
| w | int16 | no | 0 | width of the object |
| h | int16 | no | 0 | height of the object |
| enabled | true/false | no | true | object is clickable |
| hidden | true/false | no | false | object is hidden |
| opacity | 0-255 | no | 255 | how much the the object is opaque |
If the `page` parameter is not present, the object is placed on the same page as the _previous object_. If `page` is not specified for the first object either, the _current page_ being displayed is used.
The maximum number of pages and objects is limited by the memory available in the MCU.
`"page":254` indicates that the object is visible on every page. It can be used for example to specify a static menu bar.
You can still hide the object on select pages if needed. Objects on this page appear on top of any objects on the underlying page.
## Object Types
Each object type is an ID that indicates which object type that line represents.
Besides the common properties listed above, each object type can have specific properties.
### Button
**objid:10**
<div align="center">
![lv_btn](assets/images/objects/lv_ex_btn_1.png)
</div>
<details open=""><summary>Show Jsonl Code (Click to expand)</summary>
```json
{"page":0,"comment":"---------- Page 0 ----------"}
{"objid":10,"id":1,"x":10,"y":45,"w":220,"h":55,"toggle":"TRUE","txt":"Push Me \uf0a6"}
```
</details>
| Property | Value | Required | Default | Description
|----------|------------|----------|---------|--------------
| toggle | boolean | no | false | When enabled, creates a toggle-on/toggle-off button. If false, creates a normal button
| val | int16 | no | 0 | The value: 1 for toggled, 0 for untoggled
| txt | string | no | "" | The text of the label
| mode | string | no | expand | The wrapping mode of long text labels
Normal Switches send touch events out as they occor. The possible events are:
- DOWN: Occurs when a button goes from unpressed to being pressed
- SHORT: The button was released within a short time i.e. a short click has occured
- LONG: Event is send when the button is *still* being pressed after the threshold time
<!-- - HOLD: The HOLD event is repeated every 400ms while the button is still pressed -->
- UP: The button is released after being pressing for a LONG threshold time.
- LOST: This event occurs when the object looses the focus while the screen is still being touched
Toggle Switches only send out their new value (0 or 1) when toggled.
Possible wrapping modes are: expand, break, dots, scroll and loop
### Checkbox
**objid:11**
![lv_checkbox](assets/images/objects/lv_ex_checkbox_1.png){: .align-center}
| Property | Value | Required | Default | Description
|----------|------------|----------|------------|--------------
| val | int16 | no | 0 | The value: 1 for checked, 0 for unchecked
| txt | string | no | "Checkbox" | The label of the checkbox
### Text Label
**objid:12**
![lv_label](assets/images/objects/lv_ex_label_1.png){: .align-center}
| Property | Value | Required | Default | Description
|----------|------------|----------|------------|--------------
| txt | string | no | "Text" | The text of the label
| mode | string | no | expand | The wrapping mode of long text labels
Possible wrapping modes are: expand, break, dots, scroll and loop
```json
{"page":2,"id":1,"objid":12,"h":24,"w":120,"txt":"\ufe05 Icon Demo"}
```
### Arc
**objid:22**
![lv_arc](assets/images/objects/lv_ex_arc_1.png){: .align-center}
| Property | Value | Required | Default | Description
|-----------|------------|----------|---------|--------------
| min | int16 | no | 0 |
| max | int16 | no | 100 |
| val | int16 | no | 0 |
| rotation | int16 | no | 0 |
| type | int16 | no | normal | normal, reverse, symetrical
### Spinner
**objid:21**
![lv_spinner](assets/images/objects/lv_ex_spinner_1.png){: .align-center}
| Property | Value | Required | Default | Description
|-----------|------------|----------|---------|--------------
| speed | int16 | no | 1000 | The time for 1 furn in ms
| direction | int16 | no | 100 | 0 for clockwise, 1 for counter-clockwise
| thickness | int16 | no | dep. on theme | The width of the arcline
### Colorpicker
**objid:20**
![lv_cpicker](assets/images/objects/lv_ex_cpicker_1.png){: .align-center}
| Property | Value | Required | Default | Description
|----------|------------|----------|---------|--------------
| val | uint16 | no | 0 | The selected color in RBG565 format
| color | hex string | no | 0 | The selected color in html format #rrggbb
| rect | boolean | no | false | True if the color picker has a rectangular shape like a slider. False for a circular shape.
### Slider
**objid:30**
![lv_slider](assets/images/objects/lv_ex_slider_1.png){: .align-center}
| Property | Value | Required | Default |
|----------|------------|----------|---------|
| min | int16 | no | 0 |
| max | int16 | no | 100 |
| val | int16 | no | 0 |
### Double Slider
**objid:30**
| Property | Value | Required | Default |
|----------|------------|----------|---------|
| min | int16 | no | 0 |
| max | int16 | no | 100 |
| val | int16 | no | 0 |
### Gauge
**objid:31**
![lv_gauge](assets/images/objects/lv_ex_gauge_1.png){: .align-center}
| Property | Value | Required | Default |
|----------|------------|----------|---------|
| min | int16 | no | 0 |
| max | int16 | no | 100 |
| val | int16 | no | 0 |
### Progressbar
**objid:32**
![lv_bar](assets/images/objects/lv_ex_bar_1.png){: .align-center}
| Property | Value | Required | Default |
|----------|------------|----------|---------|
| min | int16 | no | 0 |
| max | int16 | no | 100 |
| val | int16 | no | 0 |
### Switch
**objid:40**
![lv_switch](assets/images/objects/lv_ex_switch_1.png){: .align-center}
| Property | Value | Required | Default | Description
|------------|------------|----------|---------|---------------
| val | int16 | no | 0 | The value: 1 for on, 0 for off
### LED Indicator
**objid:41**
![lv_led](assets/images/objects/lv_ex_led_1.png){: .align-center}
| Property | Value | Required | Default | Description
|------------|------------|----------|---------|---------------
| val | byte | no | 0 | The brightness of the indicator 0-255
### Dropdown List
**objid:50**
![lv_dropdown](assets/images/objects/lv_ex_dropdown_1.png){: .align-center}
| Property | Value | Required | Default | Description
|----------|------------|----------|---------|--------------------------
| options | string | no | "" | The items separated by \n
| val | int16 | no | 0 | The number of the selected item
| txt | string | no | "" | *Read-only* The text of the selected item
To change the currently selected item, use the `val` attribute.
To change the items in the list, use the `options` attribute.
When the item is changed both `val` and `txt` of the newly selected item are send out.
### Roller
**objid:51**
![lv_roller](assets/images/objects/lv_ex_roller_1.png){: .align-center}
| Property | Value | Required | Default | Description
|----------|------------|----------|---------|--------------------------
| options | string | no | "" | The items separated by \n
| val | int16 | no | 0 | The number of the selected item
| txt | string | no | "" | *Read-only* The text of the selected item
| rows | int8 | no | 3 | The number ow rows that are visible
Note: A roller does not use the `h` attribute to set its height, but uses the rows to set the visible number of rows instead.
To change the currently selected item, use the `val` attribute.
To change the items in the list, use the `options` attribute.
When the item is changed both `val` and `txt` of the newly selected item are send out.

315
docs/14-styling.md Normal file
View File

@ -0,0 +1,315 @@
## Styling Properties
You can adjust the appearance of objects by changing the foreground, background and/or border color of each object.
## Object Types
Each object type is an ID that indicates which object type that line represents.
Besides the common properties listed above, each object type can have specific properties.
## Button
**objid:10**
A button can have 3 states. All the following parameters can be appended by a number to change the appearance of that state only:
- 0: Released
- 1: Pressed
- 2: Disabled
Or if the postfix index is ommited, then the default state 0 or Pressed is used.
A button can accept the attributes of the following groups:
- Background
- Border
- Outline
- Shadow
- Value
## Attribute groups
### Padding and Margin
Padding sets the space on the inner sides of the edges. It means "I don't want my children too close to my sides, so keep this space".Padding inner set the "gap" between the children. Margin sets the space on the outer side of the edges. It means "I want this space around me".
Objects use them to set spacing. See the documentation of the objects for the details.
| Property | Type | Required | Default | Description
|----------|------------|----------|---------|--------------
| pad_top | int | Set the padding on the top
| pad_bottom | int | Set the padding on the bottom
| pad_left | int | Set the padding on the left
| pad_right | int | Set the padding on the right
| pad_inner | int | Set the padding inside the object between children
| margin_top | int | Set the margin on the top
| margin_bottom | int | Set the margin on the bottom
| margin_left | int | Set the margin on the left
| margin_right | int | Set the margin on the right
### Background
| Property | Type | Required | Default | Description
|----------|------------|----------|---------|--------------
| bg_opa | byte | no | "" | The background opacity level
| bg_color | color | no | true | The background color
| bg_grad_color | color | no | 0 | The background gradient color
| bg_grad_dir | [0..2]| no | expand | 0 = None, 1 = Horizontal, 2 = Vertical
| bg_grad_stop | byte | no | expand | Specifies where the gradient should stop. 0: at left/top most position, 255: at right/bottom most position. Default value: 255.
| bg_main_stop | byte | no | expand | Specifies where should the gradient start. 0: at left/top most position, 255: at right/bottom most position. Default value: 0.
### Border
The border is drawn on top of the background. It has radius rounding.
| Property | Type | Required | Default | Description
|----------|------------|----------|---------|--------------
| border_color | color| Specifies the color of the border
| border_opa | byte | Specifies opacity of the border
| border_width | byte | Set the width of the border
| border_side | byte | Specifies which sides of the border to draw. Can be 0=LV_BORDER_SIDE_NONE/1=LEFT/2=RIGHT/4=TOP/8=BOTTOM/15=FULL. A sum of these values is also possible to select specific sides.
| border_post | bool | If `true` the border will be drawn after all children have been drawn.
### Shadow
The shadow is a blurred area under the object.
| Property | Type | Required | Default | Description
|----------|------------|----------|---------|--------------
| shadow_color | color | Specifies the color of the shadow
| shadow_opa | byte | Specifies opacity of the shadow
| shadow_width | int16 | Set the width (blur size) of the outline
| shadow_ofs_x | int16 | Set the an X offset for the shadow
| shadow_ofs_y | int16 | Set the an Y offset for the shadow
| shadow_spread | byte | make the shadow larger than the background in every direction by this value
### Value
Value is an arbitrary text drawn to the background. It can be a lightweighted replacement of creating label objects.
| Property | Type | Required | Default | Description
|----------|------------|----------|---------|--------------
| value_str | string | Text to display. Only the pointer is saved! (Don't use local variable with lv_style_set_value_str, instead use static, global or dynamically allocated data)
| value_color | color | Color of the text
| value_opa | byte | Opacity level of the text [0-255]
| value_font | byte | The font ID
| value_letter_space | int | Letter space of the text
| value_line_space | int | Line space of the text
| value_align | align | Alignment of the text. Can be LV_ALIGN_.... Default value: LV_ALIGN_CENTER.
| value_ofs_x | int | X offset from the original position of the alignment
| value_ofs_y | int | Y offset from the original position of the alignment
### Text
Properties for textual object.
| Property | Type | Required | Default | Description
|----------|------------|----------|---------|--------------
| text_color | color | Color of the text
| text_opa | byte | Opacity level of the text [0-255]
| text_font | byte | Font ID
| text_letter_space | int | Letter space of the text
| text_line_space | int | Line space of the text
| text_decor | byte | Add text decoration. 0=None, 1=Underline, 2=Strikethrough, 3=Underline&Strikethrough
| text_sel_color | color | Set background color of text selection
### Line
n/a
### Image
n/a
### Outline
n/a
### Pattern
n/a
### Transitions
n/a
### Checkbox
**objid:11**
![lv_checkbox](assets/images/objects/lv_ex_checkbox_1.png){: .align-center}
| Property | Value | Required | Default | Description
|----------|------------|----------|------------|--------------
| val | int16 | no | 0 | The value: 1 for checked, 0 for unchecked
| txt | string | no | "Checkbox" | The label of the checkbox
### Text Label
**objid:12**
![lv_label](assets/images/objects/lv_ex_label_1.png){: .align-center}
| Property | Value | Required | Default | Description
|----------|------------|----------|------------|--------------
| txt | string | no | "Text" | The text of the label
| mode | string | no | expand | The wrapping mode of long text labels
Possible wrapping modes are: expand, break, dots, scroll and loop
```json
{"page":2,"id":1,"objid":12,"h":24,"w":120,"txt":"\ufe05 Icon Demo"}
```
### Spinner
**objid:21**
![lv_spinner](assets/images/objects/lv_ex_spinner_1.png){: .align-center}
| Property | Value | Required | Default | Description
|-----------|------------|----------|---------|--------------
| speed | int16 | no | 1000 | The time for 1 furn in ms
| direction | int16 | no | 100 | 0 for clockwise, 1 for counter-clockwise
| thickness | int16 | no | dep. on theme | The width of the arcline
### Colorpicker
**objid:20**
![lv_cpicker](assets/images/objects/lv_ex_cpicker_1.png){: .align-center}
| Property | Value | Required | Default | Description
|----------|------------|----------|---------|--------------
| val | uint16 | no | 0 | The selected color in RBG565 format
| color | hex string | no | 0 | The selected color in html format #rrggbb
| rect | boolean | no | false | True if the color picker has a rectangular shape like a slider. False for a circular shape.
### Slider
**objid:30**
![lv_slider](assets/images/objects/lv_ex_slider_1.png){: .align-center}
| Property | Value | Required | Default |
|----------|------------|----------|---------|
| min | int16 | no | 0 |
| max | int16 | no | 100 |
| val | int16 | no | 0 |
### Double Slider
**objid:30**
| Property | Value | Required | Default |
|----------|------------|----------|---------|
| min | int16 | no | 0 |
| max | int16 | no | 100 |
| val | int16 | no | 0 |
### Gauge
**objid:31**
![lv_gauge](assets/images/objects/lv_ex_gauge_1.png){: .align-center}
| Property | Value | Required | Default |
|----------|------------|----------|---------|
| min | int16 | no | 0 |
| max | int16 | no | 100 |
| val | int16 | no | 0 |
### Progressbar
**objid:32**
![lv_bar](assets/images/objects/lv_ex_bar_1.png){: .align-center}
| Property | Value | Required | Default |
|----------|------------|----------|---------|
| min | int16 | no | 0 |
| max | int16 | no | 100 |
| val | int16 | no | 0 |
### Switch
**objid:40**
![lv_switch](assets/images/objects/lv_ex_switch_1.png){: .align-center}
| Property | Value | Required | Default | Description
|------------|------------|----------|---------|---------------
| val | int16 | no | 0 | The value: 1 for on, 0 for off
### LED Indicator
**objid:41**
![lv_led](assets/images/objects/lv_ex_led_1.png){: .align-center}
| Property | Value | Required | Default | Description
|------------|------------|----------|---------|---------------
| val | byte | no | 0 | The brightness of the indicator 0-255
### Dropdown List
**objid:50**
![lv_dropdown](assets/images/objects/lv_ex_dropdown_1.png){: .align-center}
| Property | Value | Required | Default | Description
|----------|------------|----------|---------|--------------------------
| options | string | no | "" | The items separated by \n
| val | int16 | no | 0 | The number of the selected item
| txt | string | no | "" | *Read-only* The text of the selected item
To change the currently selected item, use the `val` attribute.
To change the items in the list, use the `options` attribute.
When the item is changed both `val` and `txt` of the newly selected item are send out.
### Roller
**objid:51**
![lv_roller](assets/images/objects/lv_ex_roller_1.png){: .align-center}
| Property | Value | Required | Default | Description
|----------|------------|----------|---------|--------------------------
| options | string | no | "" | The items separated by \n
| val | int16 | no | 0 | The number of the selected item
| txt | string | no | "" | *Read-only* The text of the selected item
| rows | int8 | no | 3 | The number ow rows that are visible
Note: A roller does not use the `h` attribute to set its height, but uses the rows to set the visible number of rows instead.
To change the currently selected item, use the `val` attribute.
To change the items in the list, use the `options` attribute.
When the item is changed both `val` and `txt` of the newly selected item are send out.
## Example file
This is a real-world demo `pages.jsonl` file:
```json
{"comment":"---------- Page 0 ----------"}
{"objid":10,"id":1,"page":0,"x":10,"y":45,"w":220,"h":55,"toggle":"TRUE","txt":"Toggle Me \uf0a6"}
{"objid":11,"id":2,"page":0,"x":10,"y":100,"w":220,"h":55,"txt":"Checkbox 1"}
{"objid":12,"id":3,"page":0,"x":10,"y":10,"w":220,"h":30,"txt":"Text Label 1","align":1,"padh":50}
{"objid":40,"id":4,"page":0,"x":70,"y":205,"w":100,"h":55}
{"objid":41,"id":5,"page":0,"x":10,"y":205,"w":55,"h":55}
{"objid":50,"id":6,"page":0,"x":10,"y":150,"w":150,"txt":"\uf007 Option 1\n\uf007 Option 2\n\uf007 Option 3"}
{"objid":21,"id":7,"page":0,"x":165,"y":140,"w":70,"h":70}
{"comment":"---------- Page 1 ----------"}
{"objid":30,"id":1,"page":1,"x":10,"y":170,"w":200,"h":50}
{"objid":31,"id":3,"page":1,"x":13,"y":10,"w":100,"h":100}
{"objid":32,"id":4,"page":1,"x":10,"y":110,"w":200,"h":50}
{"objid":33,"id":5,"page":1,"x":127,"y":10,"w":100,"h":100}
{"objid":12,"id":10,"page":1,"x":0,"y":0,"w":70,"h":50,"parentid":5,"txt":"\uf00c OK"}
{"comment":"---------- Page 2 ----------"}
{"objid":20,"id":1,"page":2,"x":20,"y":0,"w":200,"h":200}
{"objid":20,"id":2,"page":2,"x":20,"y":210,"w":200,"h":50,"rect":"TRUE"}
{"comment":"---------- Page 3 ----------"}
{"objid":50,"id":1,"page":3,"x":10,"y":10,"w":220,"txt":"Spring\nSummer\nAutumn\nWinter"}
{"objid":51,"id":2,"page":3,"x":40,"y":50,"w":160,"txt":"2018\n2019\n2020\n2021\n2022\n2023\n2024","rows":4}
{"comment":"---------- Page 254 ----------"}
{"objid":10,"id":1,"page":254,"x":0,"y":270,"w":75,"h":50,"opacity":100,"txt":"\uF053 Prev"}
{"objid":10,"id":2,"page":254,"x":75,"y":270,"w":90,"h":50,"opacity":100,"txt":"\uF015 Home"}
{"objid":10,"id":3,"page":254,"x":165,"y":270,"w":75,"h":50,"opacity":100,"txt":"Next \uF054"}
```

50
docs/15-example-pages.md Normal file
View File

@ -0,0 +1,50 @@
## Example file
This is a real-world example of a `pages.jsonl` file:
<details>
<summary>Show Jsonl Code (Click to expand)</summary>
```json
{"page":0,"comment":"---------- Page 0 ----------"}
{"objid":10,"id":1,"x":10,"y":45,"w":220,"h":55,"toggle":"TRUE","txt":"Push Me \uf0a6"}
{"objid":11,"id":2,"x":10,"y":100,"w":220,"h":55,"txt":"A Checkbox"}
{"objid":12,"id":3,"x":10,"y":10,"w":220,"h":30,"txt":"My Label","align":1,"padh":50}
{"objid":40,"id":4,"x":70,"y":205,"w":100,"h":55}
{"objid":41,"id":5,"x":10,"y":205,"w":55,"h":55}
{"objid":50,"id":6,"x":10,"y":150,"w":150,"options":"\uf007 Line 1\n\uf007 Line 2\n\uf007 Line 3"}
{"objid":21,"id":7,"x":165,"y":140,"w":70,"h":70}
{"page":1,"comment":"---------- Page 1 ----------"}
{"objid":30,"id":1,"x":10,"y":170,"w":200,"h":50}
{"objid":31,"id":3,"x":13,"y":10,"w":100,"h":100}
{"objid":32,"id":4,"x":10,"y":110,"w":200,"h":50}
{"objid":33,"id":5,"x":127,"y":10,"w":100,"h":100}
{"objid":12,"id":10,"x":0,"y":0,"w":70,"h":50,"parentid":5,"txt":"\uf00c OK"}
{"comment":"---------- Page 2 ----------"}
{"objid":20,"id":1,"page":2,"x":20,"y":0,"w":200,"h":200}
{"objid":20,"id":2,"page":2,"x":20,"y":210,"w":200,"h":50,"rect":"TRUE"}
{"page":3,"comment":"---------- Page 3 ----------"}
{"objid":50,"id":1,"x":10,"y":10,"w":220,"options":"Spring\nSummer\nAutumn\nWinter"}
{"objid":51,"id":2,"x":40,"y":50,"w":160,"rows":3,"options":"2020\n2021\n2022\n2023\n2024"}
{"page":254,"comment":"---------- Page 254 ----------"}
{"objid":10,"id":1,"x":0,"y":270,"w":75,"h":50,"opacity":100,"txt":"\uF053 Prev"}
{"objid":10,"id":2,"x":75,"y":270,"w":90,"h":50,"opacity":100,"txt":"\uF015 Home"}
{"objid":10,"id":3,"x":165,"y":270,"w":75,"h":50,"opacity":100,"txt":"Next \uF054"}
```
</details>
## Result
Page 0
Page 1
Page 2
Page 3

22
docs/16-compiling.md Normal file
View File

@ -0,0 +1,22 @@
## Cloning
Make sure to add the `--recursive` parameter when cloning the project from GitHub. Otherwise git will not download the required submodules in the `/lib` subdirectory.
```bash
git clone --recursive https://github.com/fvanroie/hasp-lvgl
```
If you already cloned hasp-lvgl without the submodules, you can fetch the submodules seperately using:
```bash
git submodule update --init --recursive
```
To switch to a different branch use:
```bash
git clone --recursive https://github.com/fvanroie/hasp-lvgl
cd hasp-lvgl
git checkout 0.2.0
git submodule update --init --recursive
```

1460
docs/18-history.md Normal file

File diff suppressed because it is too large Load Diff

15
docs/19-contributing.md Normal file
View File

@ -0,0 +1,15 @@
Having trouble working with the theme? Found a typo in the documentation? Interested in adding a feature or [fixing a bug](https://github.com/mmistakes/minimal-mistakes/issues)? Then by all means [submit an issue](https://github.com/mmistakes/minimal-mistakes/issues/new) or [pull request](https://help.github.com/articles/using-pull-requests/). If this is your first pull request, it may be helpful to read up on the [GitHub Flow](https://guides.github.com/introduction/flow/) first.
Minimal Mistakes has been designed as a base for you to customize and fit your site's unique needs. Please keep this in mind when requesting features and/or submitting pull requests. If it's not something that most people will use, I probably won't consider it. When in doubt ask.
This goes for author sidebar links and "share button" additions -- I have no intention of merging in every possibly option, the essentials are there to get you started :smile:.
## Pull requests
When submitting a pull request:
1. Clone the repo.
2. Create a branch off of `master` and give it a meaningful name (e.g. `my-awesome-new-feature`) and describe the feature or fix.
3. Open a pull request on GitHub.
Theme documentation and demo pages can be found in the [`/docs`](https://github.com/{{ site.repository }}/blob/master/docs) folder if you'd like to tackle any "low-hanging fruit" like fixing typos, bad grammar, etc.

292
docs/20-docs-2-2.md Normal file
View File

@ -0,0 +1,292 @@
## Installation
Minimal Mistakes now requires [Jekyll](http://jekyllrb.com/) 3.0. Make sure to run `bundle update` if you aren't on the latest version to update all gem dependencies.
If you are creating a new Jekyll site using Minimal Mistakes follow these steps:
1. Fork the [Minimal Mistakes repo](http://github.com/mmistakes/minimal-mistakes/fork).
2. Clone the repo you just forked and rename it.
3. [Install Bundler](http://bundler.io) `gem install bundler` and Run `bundle install` to install all dependencies (Jekyll, [Jekyll-Sitemap](https://github.com/jekyll/jekyll-sitemap), [Octopress](https://github.com/octopress/octopress), etc)
4. Update `config.yml`, add navigation, and replace demo posts and pages with your own. Full details below.
If you want to use Minimal Mistakes with an existing Jekyll site follow these steps:
1. [Download Minimal Mistakes](https://github.com/mmistakes/minimal-mistakes/releases/tag/2.2.1) and unzip.
2. Rename `minimal-mistakes-master` to something meaningful ie: `new-site`
3. Run `bundle install` to install all dependencies (Jekyll, [Jekyll-Sitemap](https://github.com/jekyll/jekyll-sitemap), [Octopress](https://github.com/octopress/octopress), etc)
4. Remove demo posts/pages and replace with your own posts, pages, and any other content you want to move over.
5. Update posts' and pages' YAML to match variables used by Minimal Mistakes. Full details below.
6. Update `_config.yml` and add navigation links. Full details below.
**Pro-tip:** Delete the `gh-pages` branch after cloning and start fresh by branching off `master`. There is a bunch of garbage in `gh-pages` used for the theme's demo site that I'm guessing you won't want.
{: .notice}
## Running Jekyll
The preferred method for running Jekyll is with `bundle exec`, but if you're willing to deal gem conflicts feel free to go cowboy with a `jekyll serve` or `jekyll build`.
> In some cases, running executables without bundle exec may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle.
>
>However, this is unreliable and is the source of considerable pain. Even if it looks like it works, it may not work in the future or on another machine.
```bash
bundle exec jekyll serve
```
## Scaffolding
How Minimal Mistakes is organized and what the various files are. All posts, layouts, includes, stylesheets, assets, and whatever else is grouped nicely under the root folder. The compiled Jekyll site outputs to `_site/`.
```bash
minimal-mistakes/
├── _includes/
| ├── author-bio.html # bio stuff layout. pulls optional owner data from _config.yml
| ├── browser-upgrade # prompt to install a modern browser for < IE9
| ├── disqus-comments # Disqus comments script
| ├── footer # site footer
| ├── head # site head
| ├── navigation # site top navigation
| ├── open-graph.html # Twitter Cards and Open Graph meta data
| └── scripts # site scripts
├── _layouts/
| ├── home.html # homepage layout
| ├── page.html # page layout
| ├── post-index.html # post index layout
| └── post.html # single post layout
├── _posts/ # MarkDown formatted posts
├── _sass/ # Sass stylesheets
├── _templates/ # used by Octopress to define YAML variables for new posts/pages
├── about/ # sample about page
├── assets/
| ├── css/ # compiled stylesheets
| ├── fonts/ # webfonts
| ├── js/
| | ├── _main.js # main JavaScript file, plugin settings, etc
| | ├── plugins/ # scripts and jQuery plugins to combine with _main.js
| | ├── scripts.min.js # concatenated and minified _main.js + plugin scripts
| | └── vendor/ # vendor scripts to leave alone and load as is
| └── less/
├── images/ # images for posts and pages
├── 404.md # 404 page
├── feed.xml # Atom feed template
├── index.md # sample homepage. lists 5 latest posts
├── posts/ # sample post index page. lists all posts in reverse chronology
└── theme-setup/ # theme setup page. safe to remove
```
## Site Setup
A quick checklist of the files you'll want to edit to get up and running.
### Site Wide Configuration
`_config.yml` is your friend. Open it up and personalize it. Most variables are self explanatory but here's an explanation of each if needed:
#### title
The title of your site... shocker!
Example `title: My Awesome Site`
#### url
Used to generate absolute urls in `sitemap.xml`, `feed.xml`, and for generating canonical URLs in `<head>`. When developing locally either comment this out or use something like `http://localhost:4000` so all assets load properly. *Don't include a trailing `/`*.
Examples:
```yaml
url: http://mmistakes.github.io/minimal-mistakes
url: http://localhost:4000
url: //cooldude.github.io
url:
```
#### Google Analytics and Webmaster Tools
Google Analytics UA and Webmaster Tool verification tags can be entered under `owner` in `_config.yml`. For more information on obtaining these meta tags check [Google Webmaster Tools](http://support.google.com/webmasters/bin/answer.py?hl=en&answer=35179) and [Bing Webmaster Tools](https://ssl.bing.com/webmaster/configure/verify/ownership) support.
### Navigation Links
To set what links appear in the top navigation edit `_data/navigation.yml`. Use the following format to set the URL and title for as many links as you'd like. *External links will open in a new window.*
```yaml
- title: Portfolio
url: /portfolio/
- title: Made Mistakes
url: http://mademistakes.com
```
## Adding New Content with Octopress
While completely optional, I've included Octopress and some starter templates to automate the creation of new posts and pages. To take advantage of it start by installing the [Octopress](https://github.com/octopress/octopress) gem if it isn't already.
```bash
$ gem install octopress
```
### New Post
Default command
```bash
$ octopress new post "Post Title"
```
Default works great if you want all your posts in one directory, but if you're like me and want to group them into subfolders like `/posts`, `/portfolio`, etc. Then this is the command for you. By specifying the DIR it will create a new post in that folder and populate the `categories:` YAML with the same value.
```bash
$ octopress new post "New Portfolio Post Title" --dir portfolio
```
### New Page
To create a new page use the following command.
```bash
$ octopress new page new-page/
```
This will create a page at `/new-page/index.md`
## Layouts and Content
Explanations of the various `_layouts` included with the theme and when to use them.
### Post and Page
These two layouts are very similar. Both have an author sidebar, allow for large feature images at the top, and optional Disqus comments. The only real difference is the post layout includes related posts at the end of the page.
### Post Index Page
A [sample index page]({{ site.url }}/posts/) listing all posts grouped by the year they were published has been provided. The name can be customized to your liking by editing a few references. For example, to change **Posts** to **Writing** update the following:
In `_config.yml` under `links:` rename the title and URL to the following:
```yaml
links:
- title: Writing
url: /writing/
```
* Rename `posts/index.md` to `writing/index.md` and update the YAML front matter accordingly.
* Update the **View all posts** link in the `post.html` layout found in `_layouts` to match title and URL set previously.
### Feature Images
A good rule of thumb is to keep feature images nice and wide so you don't push the body text too far down. An image cropped around around 1024 x 256 pixels will keep file size down with an acceptable resolution for most devices. If you want to serve these images responsively I'd suggest looking at the [Jekyll Picture Tag](https://github.com/robwierzbowski/jekyll-picture-tag) plugin[^plugins].
[^plugins]: If you're using GitHub Pages to host your site be aware that plugins are disabled. You'll need to build your site locally and then manually deploy if you want to use this sweet plugin.
The post and page layouts make the assumption that the feature images live in the `images/` folder. To add a feature image to a post or page just include the filename in the front matter like so. It's probably best to host all your images from this folder, but you can hotlink from external sources if you desire.
```yaml
image:
feature: feature-image-filename.jpg
thumb: thumbnail-image.jpg #keep it square 200x200 px is good
```
To add attribution to a feature image use the following YAML front matter on posts or pages. Image credits appear directly below the feature image with a link back to the original source if supplied.
```yaml
image:
feature: feature-image-filename.jpg
credit: Michael Rose #name of the person or site you want to credit
creditlink: http://mademistakes.com #url to their site or licensing
```
### Thumbnails for OG and Twitter Cards
Feature and thumbnail images are used by [Open Graph](https://developers.facebook.com/docs/opengraph/) and [Twitter Cards](https://dev.twitter.com/docs/cards) as well. If you don't assign a thumbnail the default graphic *(default-thumb.png)* is used. I'd suggest changing this to something more meaningful --- your logo or avatar are good options.
**Pro-Tip**: You need to [apply for Twitter Cards](https://dev.twitter.com/docs/cards) before they will begin showing up when links to your site are shared.
{:.notice}
### Author Override
By making use of data files you can assign different authors for each post.
Start by modifying `authors.yml` file in the `_data` folder and add your authors using the following format.
```yaml
# Authors
billy_rick:
name : "Billy Rick"
web : "http://thewhip.com"
email : "billy@rick.com"
bio : "What do you want, jewels? I am a very extravagant man."
avatar : "bio-photo-2.jpg"
twitter : "extravagantman"
google_plus : "BillyRick"
cornelius_fiddlebone:
name : "Cornelius Fiddlebone"
email : "cornelius@thewhip.com"
bio : "I ordered what?"
avatar : "bio-photo.jpg"
twitter : "rhymeswithsackit"
google_plus : "CorneliusFiddlebone"
```
To assign Billy Rick as an author for our post. We'd add the following YAML front matter to a post:
```yaml
author: billy_rick
```
### Kramdown Table of Contents
To include an auto-generated **table of contents** for posts and pages, add the following `_include` before the actual content. [Kramdown will take care of the rest](http://kramdown.rubyforge.org/converter/html.html#toc) and convert all headlines into list of links.
```html
{% raw %}{% include toc.html %}{% endraw %}
```
### Paragraph Indentation
By default the margin below paragraphs has been removed and indent added to each. This is an intentional design decision to mimic the look of type set in a printed book or manuscript.
<figure>
<img src="{{ '/assets/images/paragraph-indent.png' | relative_url }}" alt="screen shot of paragraphs with default indent style set">
<figcaption>Example of the default paragraph style (indented first line and bottom margin removed).</figcaption>
</figure>
To disable the indents and add spacing between paragraphs change the following line in `_sass/variables.scss` from `true !default` to `false` like so.
```scss
$paragraph-indent: false;
```
<figure>
<img src="{{ '/assets/images/paragraph-no-indent.png' | relative_url }}" alt="screen shot of paragraphs with indent style disabled">
<figcaption>Example of paragraphs with $paragraph-indent disabled.</figcaption>
</figure>
### Videos
Video embeds are responsive and scale with the width of the main content block with the help of [FitVids](http://fitvidsjs.com/).
Not sure if this only effects Kramdown or if it's an issue with Markdown in general. But adding YouTube video embeds causes errors when building your Jekyll site. To fix add a space between the `<iframe>` tags and remove `allowfullscreen`. Example below:
```html
<iframe width="560" height="315" src="http://www.youtube.com/embed/PWf4WUoMXwg" frameborder="0"> </iframe>
```
### Social Sharing Links
Social sharing links for Twitter, Facebook, and Google+ are included on posts/pages by default. To hide them on specific posts or pages add `share: false` to the YAML Front Matter. If you'd like to use different social networks modify `_includes/social-share` to your liking. Icons are set using [Font Awesome](http://fontawesome.io).
## Further Customization
Jekyll 2.x added support for Sass files making it much easier to modify a theme's fonts and colors. By editing values found in `_sass/variables.scss` you can fine tune the site's colors and typography.
For example if you wanted a red background instead of white you'd change `$bodycolor: #fff;` to `$bodycolor: $cc0033;`.
To modify the site's JavaScript files I setup a Grunt build script to lint/concatenate/minify all scripts into `scripts.min.js`. [Install Node.js](http://nodejs.org/), then [install Grunt](http://gruntjs.com/getting-started), and then finally install the dependencies for the theme contained in `package.json`:
```bash
npm install
```
From the theme's root, use `grunt` concatenate JavaScript files, and optimize .jpg, .png, and .svg files in the `images/` folder. You can also use `grunt dev` in combination with `jekyll build --watch` to watch for updates JS files that Grunt will then automatically re-build as you write your code which will in turn auto-generate your Jekyll site when developing locally.

83
docs/21-license.md Normal file
View File

@ -0,0 +1,83 @@
The MIT License (MIT)
Hasp-lvgl is Copyright (c) 2019-{{ site.time | date: '%Y' }} fvanroie, netwize.be and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-------------------------------------------
Hasp-lvgl is based on the previous work of the following open source developers:
- [HASwitchPlate](https://github.com/aderusha/HASwitchPlate), the original Arduino project,
Copyright© 2019 Allen Derusha.
HASwitchPlate is distributed under the terms of the [MIT License](http://opensource.org/licenses/MIT).
- [LVGL](https://lvgl.io/) graphics library,
Copyright© 2016 Gábor Kiss-Vámosi and
Copyright (c) 2020 LVGL LLC.
LVGL is distributed under the terms of the [MIT License](http://opensource.org/licenses/MIT).
- [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI) display library,
Copyright© 2020 Bodmer (https://github.com/Bodmer) All rights reserved.
TFT_eSPI is distributed under the terms of the [FreeBSD License](https://opensource.org/licenses/BSD-2-Clause)
and includes parts from the [Adafruit_GFX library](https://github.com/adafruit/Adafruit-GFX-Library),
Copyright© 2012 Adafruit Industries. All rights reserved.
Adafruit_GFX is distributed under the terms of the [BSD License](https://opensource.org/licenses/BSD-2-Clause)
- zi Font Engine
Copyright© 2020 fvanroie, netwize.be
[MIT License](http://opensource.org/licenses/MIT).
- [ArduinoJson](https://arduinojson.org/)
Copyright© 2014-2020 Benoit BLANCHON
[MIT License](http://opensource.org/licenses/MIT).
- [PubSubClient](https://github.com/knolleary/pubsubclient)
Copyright© 2008-2015 Nicholas O'Leary
[MIT License](http://opensource.org/licenses/MIT).
- Logging engine is based on [ArduinoLog](https://github.com/thijse/Arduino-Log),
Copyright© 2017,2018 Thijs Elenbaas, MrRobot62, rahuldeo2047, NOX73, dhylands, Josha blemasle, mfalkvidd
with modifications by fvanroie, netwize.be.
ArduinoLog is distributed under the terms of the [MIT License](http://opensource.org/licenses/MIT).
- [Syslog library](https://github.com/arcao/Syslog),
Copyright© 2016 Martin Sloup
[MIT License](http://opensource.org/licenses/MIT).
- [QR Code generator](https://github.com/nayuki/QR-Code-generator)
Copyright© Project Nayuki
[MIT License](http://opensource.org/licenses/MIT).
- [AceButton](https://github.com/bxparks/AceButton)
Copyright© 2018 Brian T. Park
[MIT License](http://opensource.org/licenses/MIT).
- Custom zi Fonts incorporate [Font Awesome](http://fontawesome.io/),
Copyright© 2017 Dave Gandy.
Font Awesome is distributed under the terms of the [SIL OFL 1.1](http://scripts.sil.org/OFL)
and [MIT License](http://opensource.org/licenses/MIT).
- The bootscreen uses the [MaterialDesign Icons](https://materialdesignicons.com/) font,
Copyright© 2014, Austin Andrews (http://materialdesignicons.com/),
MaterialDesign Icons font is licensed under the SIL Open Font License, Version 1.1.
- This website theme is based on [Minimal Mistakes](https://mmistakes.github.io/minimal-mistakes/),
Copyright© 2013-2020 Michael Rose and contributors
[MIT License](http://opensource.org/licenses/MIT).

18
docs/38-firmware-esp.md Normal file
View File

@ -0,0 +1,18 @@
## ESP Firmware Update
### Serial Upload
Either use Tasmotizer or esptool.py to upload a new firmware file to the ESP. This procedure is the same as the initial installation.
### HTTP Upload
When the ESP has previously been flashed via serial, you can upload a new firmware file using the internal webserver.
### HTTP Update
When the ESP has previously been flashed via serial you can download and install new firmware directly from an external webserver.
### OTA Upload
When the ESP has previously been flashed via serial, subsequent updates can be performed Over-the-Air from within PlatformIO.

View File

@ -0,0 +1 @@
## STM32F4xx Firmware Update

18
docs/CHANGELOG.md Normal file
View File

@ -0,0 +1,18 @@
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [0.3.0](https://github.com/anikethsaha/docsify-changelog-plugin/compare/v0.2.0...v0.3.0) (2020-02-11)
## [0.2.0](https://github.com/anikethsaha/docsify-changelog-plugin/compare/v0.1.0...v0.2.0) (2020-02-11)
### Bug Fixes
* major fix and added docs ([af58522](https://github.com/anikethsaha/docsify-changelog-plugin/commit/af58522))
## 0.1.0 (2020-02-11)

View File

@ -0,0 +1,9 @@
### Setup HTTP User Athentication
To restrict access to the web user interface you can set a Username and Password.
![HTTP configuration](assets/images/settings/configuration.png "HTTP configuration")
Click 'Save Settings' to activate.
* Please note that all http communication is unencrypted and that this is only a simple security measure

View File

@ -0,0 +1,49 @@
## MQTT
All communication between **HASP Open Display** and your Home Automation service is done over MQTT. You will need an already working MQTT Broker.
:question: If you do not know what MQTT is you can find more about the protocol on [MQTT Essentials](http://www.hivemq.com/mqtt-essentials/)
![MQTT Settings](assets/images/settings/mqtt_settings.png "MQTT Settings")
### MQTT Settings
##### HASP Node Name
The *Node Name* is the unique identifier of your device on your MQTT Broker.
For example, setting the *Node Name* to **plate35** will make the device listen and communicate on the main topic **hasp/plate35/**
##### Group Name
The *Group Name* is the unique identifier for a **Group** of devices.
For example, the default *Group Name* is **plates**. This will make all devices in this group listen on the main topic **hasp/plates/**
This way you can send a command to all devices in the group at the same moment. Each devices will only respond on their own main *Node Name* topic.
##### MQTT Broker
Set the IP or hostname of your MQTT Broker
##### MQTT Port
Set the port for your MQTT Broker
##### MQTT User and Password
Enter credentials if your *MQTT Broker* requires a Username and Password.
---
Click 'Save Settings' to save you settings to the device. A restart is required to make the settings active. Navigate back to the Main Menu and click Restart to activate the settings.
## Commandline
You can also configure the mqtt settings via the serial or telnet console:
```bash
hostname myPlateName
mqtthost 192.168.0.123
mqttport 1883
mqttuser myUsername
mqttpass myPassword
reboot
```

View File

@ -0,0 +1,40 @@
## HASP interface
You can configure the general look and feel for the interface by uploading you favorite fonts and selecting your favorite theme and color.
![HASP Settings](assets/images/settings/hasp_settings.png "HASP Settings")
### HASP Settings
##### Upload
With the upload function you can upload 2 types of files
* .jsonl
This file contains the layout for the pages
See 'pages' section for more information on this file
* .zi
These are font files used in the Nextion/TJC HMI disp.
##### UI Theme and Hue
Select one of the built-in themes to select the general style for the HASP interface.
With the Hue slider you can select the base color for the built-in theme.
##### Startup layout
Enter the filename of the .jsonl you have uploaded to enables the layout on startup.
##### Startup Page
Select to what page the display should switch on startup.
##### Startup brightness
Select the brightness level of the display on startup.
*Please note that the display must support dim feature and GPIO for dim is set in display setup.*
---
Click 'Save Settings' to save you settings to the device. A restart is required to make the settings active. Navigate back to the Main Menu and click Restart to activate the settings.

View File

@ -0,0 +1,31 @@
## Wifi
When using a wireless network adapter, you need to configure the SSID to connect.
![HASP Settings](assets/images/settings/wifi_settings.png "Wifi Settings")
### Wifi Settings
#### SSID
The name of the access point to connect to.
#### Password
Optional password for the access point, if required.
---
Click 'Save Settings' to save you settings to the device. A restart is required to make the settings active. Navigate back to the Main Menu and click Restart to activate the settings.
## Commandline
You can also configure the wifi settings via the serial or telnet console:
```bash
ssid myAccessPointName
pass myWifiPassword
reboot
```

View File

@ -0,0 +1,39 @@
## Display
You can configure the general look and feel for the interface by uploading you favorite fonts and selecting your favorite theme and color.
![HASP Settings](assets/images/settings/hasp_settings.png "HASP Settings")
### HASP Settings
##### Upload
With the upload function you can upload 2 types of files
* .jsonl
This file contains the layout for the pages
See 'pages' section for more information on this file
* .zi
These are font files used in the Nextion/TJC HMI disp.
##### UI Theme and Hue
Select one of the built-in themes to select the general style for the HASP interface.
With the Hue slider you can select the base color for the built-in theme.
##### Startup layout
Enter the filename of the .jsonl you have uploaded to enables the layout on startup.
##### Startup Page
Select to what page the display should switch on startup.
##### Startup brightness
Select the brightness level of the display on startup.
*Please note that the display must support dim feature and GPIO for dim is set in display setup.*
---
Click 'Save Settings' to save you settings to the device. A restart is required to make the settings active. Navigate back to the Main Menu and click Restart to activate the settings.

View File

@ -0,0 +1,40 @@
## GPIO
You can configure the general look and feel for the interface by uploading you favorite fonts and selecting your favorite theme and color.
![HASP Settings](assets/images/settings/hasp_settings.png "HASP Settings")
### HASP Settings
##### Upload
With the upload function you can upload 2 types of files
* .jsonl
This file contains the layout for the pages
See 'pages' section for more information on this file
* .zi
These are font files used in the Nextion/TJC HMI disp.
##### UI Theme and Hue
Select one of the built-in themes to select the general style for the HASP interface.
With the Hue slider you can select the base color for the built-in theme.
##### Startup layout
Enter the filename of the .jsonl you have uploaded to enables the layout on startup.
##### Startup Page
Select to what page the display should switch on startup.
##### Startup brightness
Select the brightness level of the display on startup.
*Please note that the display must support dim feature and GPIO for dim is set in display setup.*
---
Click 'Save Settings' to save you settings to the device. A restart is required to make the settings active. Navigate back to the Main Menu and click Restart to activate the settings.

View File

@ -0,0 +1,40 @@
## Debug
You can configure the general look and feel for the interface by uploading you favorite fonts and selecting your favorite theme and color.
![HASP Settings](assets/images/settings/hasp_settings.png "HASP Settings")
### HASP Settings
##### Upload
With the upload function you can upload 2 types of files
* .jsonl
This file contains the layout for the pages
See 'pages' section for more information on this file
* .zi
These are font files used in the Nextion/TJC HMI disp.
##### UI Theme and Hue
Select one of the built-in themes to select the general style for the HASP interface.
With the Hue slider you can select the base color for the built-in theme.
##### Startup layout
Enter the filename of the .jsonl you have uploaded to enables the layout on startup.
##### Startup Page
Select to what page the display should switch on startup.
##### Startup brightness
Select the brightness level of the display on startup.
*Please note that the display must support dim feature and GPIO for dim is set in display setup.*
---
Click 'Save Settings' to save you settings to the device. A restart is required to make the settings active. Navigate back to the Main Menu and click Restart to activate the settings.

View File

@ -0,0 +1,10 @@
<!-- docs/_sidebar.md -->
- **Configuration**
- [HTTP](./configuration/30-http.md)
- [MQTT](./configuration/32-mqtt.md)
- [HASP](./configuration/33-hasp.md)
- [Wifi](./configuration/34-wifi.md)
- [Display](./configuration/35-display.md)
- [GPIO](./configuration/36-gpio.md)
- [Debug](./configuration/37-debug.md)

32
docs/README.md Normal file
View File

@ -0,0 +1,32 @@
# HASP-LVGL
## Welcome to the hasp-lvgl documentation.
### Getting Started
- Hardware
- Firmware Install
- Inital Setup
### Configuration
### Usage
- Command Reference
- Frequently Asked Questions
### Design Pages
- Pages
- Objects
- Styling
### Demo Layouts
- Example Pages
### Firmware Updates
- ESP32
- ESP8266
- STM32F4xx

23
docs/_navbar.md Normal file
View File

@ -0,0 +1,23 @@
<!-- _navbar.md -->
* Getting started
* [Quick start](quickstart.md)
* [Writing more pages](more-pages.md)
* [Custom navbar](custom-navbar.md)
* [Cover page](cover.md)
* Objects
* [Button](13-objects?id=button)
* [Checkbox](13-objects?id=checkbox)
* [Text Label](13-objects?id=text-label)
* [Arc](13-objects?id=arc)
* [Colorwheel](13-objects?id=colorwheel)
* [Slider](13-objects?id=slider)
* [Double Slider](13-objects?id=double-slider)
* [Gauge](13-objects?id=gauge)
* [Progressbar](13-objects?id=progressbar)
* [Switch](13-objects?id=switch)
* [LED Indicator](13-objects?id=led-indicator)
* [Dropdown List](13-objects?id=dropdown-list)
* [Roller](13-objects?id=roller)

23
docs/_sidebar.md Normal file
View File

@ -0,0 +1,23 @@
<!-- docs/_sidebar.md -->
- **Getting Started**
- [Hardware](./01-hardware.md)
- [Firmware Install](./02-installation.md)
- [Initial Setup](./03-wifi-setup.md)
- **Usage**
- [Command Reference](./05-commands.md)
- [Frequently Asked Questions](./06-faq.md)
- **Design Pages**
- [Pages](./12-pages.md)
- [Objects](./13-objects.md)
- [Styling](./14-styling.md)
- **Demo Layouts**
- [Example Pages](./15-example-pages.md)
- **Firmware Updates**
- [ESP32](./38-firmware-esp.md)
- [ESP8266](./38-firmware-esp.md)
- [STM32F4xx](./39-firmware-stm32.md)

View File

@ -0,0 +1,189 @@
/**
* xonokai theme for JavaScript, CSS and HTML
* based on: https://github.com/MoOx/sass-prism-theme-base by Maxime Thirouin ~ MoOx --> http://moox.fr/ , which is Loosely based on Monokai textmate theme by http://www.monokai.nl/
* license: MIT; http://moox.mit-license.org/
*/
code[class*="language-"],
pre[class*="language-"] {
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
white-space: pre;
white-space: pre-wrap;
word-wrap: normal;
font-family: Menlo, Monaco, "Courier New", monospace;
font-size: 14px;
color: #76d9e6;
text-shadow: none;
}
pre > code[class*="language-"] {
font-size: 1em;
}
pre[class*="language-"],
:not(pre) > code[class*="language-"] {
background: #2a2a2a;
}
pre[class*="language-"] {
padding: 15px;
border-radius: 4px;
border: 1px solid #e1e1e8;
overflow: auto;
position: relative;
}
pre[class*="language-"] code {
white-space: pre;
display: block;
}
:not(pre) > code[class*="language-"] {
padding: 0.15em 0.2em 0.05em;
border-radius: .3em;
border: 0.13em solid #7a6652;
box-shadow: 1px 1px 0.3em -0.1em #000 inset;
}
.token.namespace {
opacity: .7;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: #6f705e;
}
.token.operator,
.token.boolean,
.token.number {
color: #a77afe;
}
.token.attr-name,
.token.string {
color: #e6d06c;
}
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #e6d06c;
}
.token.selector,
.token.inserted {
color: #a6e22d;
}
.token.atrule,
.token.attr-value,
.token.keyword,
.token.important,
.token.deleted {
color: #ef3b7d;
}
.token.regex,
.token.statement {
color: #76d9e6;
}
.token.placeholder,
.token.variable {
color: #fff;
}
.token.important,
.token.statement,
.token.bold {
font-weight: bold;
}
.token.punctuation {
color: #bebec5;
}
.token.entity {
cursor: help;
}
.token.italic {
font-style: italic;
}
code.language-markup {
color: #f9f9f9;
}
code.language-markup .token.tag {
color: #ef3b7d;
}
code.language-markup .token.attr-name {
color: #a6e22d;
}
code.language-markup .token.attr-value {
color: #e6d06c;
}
code.language-markup .token.style,
code.language-markup .token.script {
color: #76d9e6;
}
code.language-markup .token.script .token.keyword {
color: #76d9e6;
}
/* Line highlight plugin */
pre[class*="language-"][data-line] {
position: relative;
padding: 1em 0 1em 3em;
}
pre[data-line] .line-highlight {
position: absolute;
left: 0;
right: 0;
padding: 0;
margin-top: 1em;
background: rgba(255, 255, 255, 0.08);
pointer-events: none;
line-height: inherit;
white-space: pre;
}
pre[data-line] .line-highlight:before,
pre[data-line] .line-highlight[data-end]:after {
content: attr(data-start);
position: absolute;
top: .4em;
left: .6em;
min-width: 1em;
padding: 0.2em 0.5em;
background-color: rgba(255, 255, 255, 0.4);
color: black;
font: bold 65%/1 sans-serif;
height: 1em;
line-height: 1em;
text-align: center;
border-radius: 999px;
text-shadow: none;
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
}
pre[data-line] .line-highlight[data-end]:after {
content: attr(data-end);
top: auto;
bottom: .4em;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

75
docs/index.html Normal file
View File

@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1, minimum-scale=1.0, shrink-to-fit=no, viewport-fit=cover">
<meta name="description"
content="A delightfully simple theme system for docsify.js. Features multiple themes with rich customization options, an improved desktop and mobile experience, and legacy browser support (IE10+).">
<meta name="google-site-verification" content="_EWJaM8G6xwMtEqemO4yN8WqSU2CaKVi3jTj0gLg48E">
<title>HASP-lvgl documentation</title>
<!-- Stylesheets -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple.css"
title="Simple">
<link rel="stylesheet" href="assets/css/main.css">
<!-- Alternate Stylesheets -->
<link rel="stylesheet alternate" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-defaults.css"
title="Defaults">
<link rel="stylesheet alternate"
href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple-dark.css" title="Simple Dark">
<!-- Test Stylesheets -->
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify@4/themes/vue.css"> -->
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify@4/themes/buble.css"> -->
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify@4/themes/dark.css"> -->
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify@4/themes/pure.css"> -->
</head>
<body>
<div id="app"></div>
<script>
window.$docsify = {
el: "#app",
repo: 'https://fvanroie.github.io/hasp-lvgl',
homepage: 'README.md',
auto2top: true,
name: 'hasp-lvgl',
autoHeader: true,
loadSidebar: true,
loadNavbar: true,
search: 'auto',
alias: {
'/.*/_sidebar.md': '/_sidebar.md',
},
subMaxLevel: 3,
pagination: {
crossChapter: true,
crossChapterText: false,
},
}
</script>
<!-- Docsify v4 -->
<script src="https://cdn.jsdelivr.net/npm/docsify@4"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-ini.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-json.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify-copy-code@2/dist/docsify-copy-code.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify-edit-on-github"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify-sidebar-collapse/dist/docsify-sidebar-collapse.min.js"></script>
<script src="https://unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
</body>
</html>

View File

@ -74,16 +74,16 @@
#endif
#ifndef HASP_NUM_GPIO_CONFIG
#define HASP_NUM_GPIO_CONFIG 5
#define HASP_NUM_GPIO_CONFIG 8
#endif
#ifndef HASP_NUM_INPUTS
#define HASP_NUM_INPUTS 3 // Buttons
#define HASP_NUM_INPUTS 4 // Number of ACE Buttons
#endif
#ifndef HASP_NUM_OUTPUTS
#define HASP_NUM_OUTPUTS 3
#endif
// #ifndef HASP_NUM_OUTPUTS
// #define HASP_NUM_OUTPUTS 3
// #endif
#ifndef HASP_NUM_PAGES
#if defined(ARDUINO_ARCH_ESP8266)

42
include/lv_comp_conf.h Normal file
View File

@ -0,0 +1,42 @@
/**
* @file lv_comp_conf.h
*
*/
/*
* COPY THIS FILE AS `lv_comp_conf.h` NEXT TO the `lvgl` FOLDER
*/
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_COMP_CONF_H
#define LV_COMP_CONF_H
#define LV_USE_CALENDAR 1
#define LV_USE_CALENDAR_HEADER_ARROW 1
#define LV_USE_COLORWHEEL 1
#define LV_USE_KEYBOARD 1
#define LV_USE_LED 1
#define LV_LED_BRIGHT_MIN 0
#define LV_LED_BRIGHT_MAX 255
#define LV_USE_LIST 1
#define LV_USE_MSGBOX 1
#define LV_USE_SPINBOX 1
#define LV_USE_SPINNER 1
#define LV_USE_TABVIEW 1
#define LV_USE_TILEVIEW 1
#define LV_USE_WIN 1
#endif /*LV_COMP_CONF_H*/
#endif /*End of "Content enable"*/

View File

@ -1,666 +1,85 @@
/**
* @file lv_conf.h
*
*/
//#include "lv_conf_v7.h"
#include "lv_conf_v8.h"
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_STUB_H
#define LV_CONF_STUB_H
#ifndef LV_CONF_H
#define LV_CONF_H
/* clang-format off */
#ifdef LV_THEME_DEFAULT_FLAG
#include <stdint.h>
//#define lv_task_handler lv_timer_handler
#if defined(ARDUINO_ARCH_ESP8266)
#define LV_HIGH_RESOURCE_MCU 0
#endif
#define lv_obj_set_click(obj, en) \
((en) ? lv_obj_add_flag(obj, LV_OBJ_FLAG_CLICKABLE) : lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE))
#define lv_obj_get_click(obj) (lv_obj_has_flag(obj, LV_OBJ_FLAG_CLICKABLE))
#ifndef LV_HIGH_RESOURCE_MCU
#define LV_HIGH_RESOURCE_MCU 1
#endif
#define lv_obj_set_hidden(obj, en) \
((en) ? lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN) : lv_obj_clear_flag(obj, LV_OBJ_FLAG_HIDDEN))
#define lv_obj_get_hidden(obj) (lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN))
/*====================
Graphical settings
*====================*/
#define lv_btn_set_checkable(obj, en) \
((en) ? lv_obj_add_flag(obj, LV_OBJ_FLAG_CHECKABLE) : lv_obj_clear_flag(obj, LV_OBJ_FLAG_CHECKABLE))
#define lv_btn_get_checkable(obj) (lv_obj_has_flag(obj, LV_OBJ_FLAG_CHECKABLE))
/* Maximal horizontal and vertical resolution to support by the library.*/
#define LV_HOR_RES_MAX (TFT_WIDTH)
#define LV_VER_RES_MAX (TFT_HEIGHT)
#define lv_checkbox_set_checked(obj, en) \
((en) ? lv_obj_add_state(obj, LV_STATE_CHECKED) : lv_obj_clear_state(obj, LV_STATE_CHECKED))
#define lv_checkbox_is_checked(obj) ((lv_obj_get_state(obj) & LV_STATE_CHECKED)?true:false)
/* Color depth:
* - 1: 1 byte per pixel
* - 8: RGB233
* - 16: RGB565
* - 32: ARGB8888
*/
#define LV_COLOR_DEPTH 16
#define lv_chart_set_range(chart, ymin, ymax) lv_chart_set_y_range(chart, LV_CHART_AXIS_PRIMARY_Y, ymin, ymax)
#define lv_obj_set_style_local_pad_inner lv_obj_set_style_local_pad_top
#define lv_dropdown_set_draw_arrow(obj, en) lv_dropdown_set_symbol(obj, en ? LV_SYMBOL_DOWN : NULL)
/* Swap the 2 bytes of RGB565 color.
* Useful if the display has a 8 bit interface (e.g. SPI)*/
#define LV_COLOR_16_SWAP 0
#define lv_cont_set_fit(obj, fit)
#define lv_cont_set_layout(obj, fit)
#define lv_roller_set_auto_fit(obj, fit)
#define lv_obj_set_top(obj, fit)
/* 1: Enable screen transparency.
* Useful for OSD or other overlapping GUIs.
* Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/
#define LV_COLOR_SCREEN_TRANSP 0
#define LV_BTN_STATE_PRESSED LV_STATE_PRESSED
#define LV_BTN_STATE_DISABLED LV_STATE_DISABLED
#define LV_BTN_STATE_CHECKED_RELEASED LV_STATE_CHECKED
#define LV_BTN_STATE_CHECKED_PRESSED LV_STATE_CHECKED + LV_STATE_PRESSED
#define LV_BTN_STATE_CHECKED_DISABLED LV_STATE_CHECKED + LV_STATE_DISABLED
#define LV_BTN_STATE_RELEASED LV_STATE_DEFAULT
/*Images pixels with this color will not be drawn (with chroma keying)*/
#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/
#define lv_btn_set_state lv_obj_set_state
#define lv_btn_get_state lv_obj_get_state
#define lv_btn_state_t lv_state_t
/* Enable chroma keying for indexed images. */
#define LV_INDEXED_CHROMA 1
#define LV_CPICKER_PART_MAIN LV_COLORWHEEL_PART_MAIN
#define LV_CPICKER_PART_KNOB LV_COLORWHEEL_PART_KNOB
#define LV_CPICKER_TYPE_RECT 0
#define LV_CPICKER_TYPE_DISC 0
#define lv_cpicker_get_color lv_colorwheel_get_rgb
#define lv_cpicker_set_color lv_colorwheel_set_rgb
#define lv_cpicker_create lv_colorwheel_create
#define lv_cont_create lv_obj_create
#define lv_page_create lv_obj_create
/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
#define LV_ANTIALIAS 1
#define LV_BAR_PART_BG LV_BAR_PART_MAIN
#define LV_CHECKBOX_PART_BG LV_CHECKBOX_PART_MAIN
#define LV_PAGE_PART_SCROLLBAR
/* Default display refresh period.
* Can be changed in the display driver (`lv_disp_drv_t`).*/
#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
#define LV_TEXTAREA_PART_BG LV_TEXTAREA_PART_MAIN
#define LV_BTNMATRIX_PART_BG LV_BTNMATRIX_PART_MAIN
#define LV_KEYBOARD_PART_BG LV_BTNMATRIX_PART_MAIN
#define LV_KEYBOARD_PART_BTN LV_BTNMATRIX_PART_BTN
#define LV_SPINBOX_PART_BG LV_ARC_PART_MAIN
#define LV_SWITCH_PART_BG LV_SWITCH_PART_MAIN
#define LV_SLIDER_PART_BG LV_SLIDER_PART_MAIN
#define LV_DROPDOWN_PART_SCROLLBAR LV_DROPDOWN_PART_LIST // ??
#define LV_TEXTAREA_PART_SCROLLBAR LV_TEXTAREA_PART_PLACEHOLDER // ??
/* Dot Per Inch: used to initialize default sizes.
* E.g. a button with width = LV_DPI / 2 -> half inch wide
* (Not so important, you can adjust it to modify default sizes and spaces)*/
#define LV_DPI 100 /*[px]*/
#define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
typedef int16_t lv_coord_t;
#define lv_img_get_file_name(img) \
(((lv_img_ext_t *)lv_obj_get_ext_attr(img))->src_type == LV_IMG_SRC_FILE) \
? (const char *)((lv_img_ext_t *)lv_obj_get_ext_attr(img))->src \
: ""
/*=========================
Memory manager settings
*=========================*/
// For hasp_theme.c
#define lv_obj_refresh_style _lv_obj_refresh_style
#define lv_obj_get_style_list _lv_obj_get_style_list
#define lv_obj_add_style_list _lv_obj_add_style_list
#define lv_obj_report_style_mod lv_obj_report_style_change
/* LittelvGL's internal memory manager's settings.
* The graphical objects and other related data are stored here. */
/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */
#define LV_MEM_CUSTOM 0
#if LV_MEM_CUSTOM == 0
/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
#ifndef LV_MEM_SIZE
#if defined(ARDUINO_ARCH_ESP8266)
# define LV_MEM_SIZE (10 * 1024U) // Minimum 10 Kb
#else
# define LV_MEM_SIZE (20 * 1024U) // 20Kb is much better
#endif
#endif
/* Complier prefix for a big array declaration */
# define LV_MEM_ATTR
/* Set an address for the memory pool instead of allocating it as an array.
* Can be in external SRAM too. */
# define LV_MEM_ADR 0
# define LV_MEM_ADD_JUNK 0
/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */
# define LV_MEM_AUTO_DEFRAG 1
#else /*LV_MEM_CUSTOM*/
# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
#endif /*LV_MEM_CUSTOM*/
/* Garbage Collector settings
* Used if lvgl is binded to higher level language and the memory is managed by that language */
#define LV_ENABLE_GC 0
#if LV_ENABLE_GC != 0
# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/
# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/
#endif /* LV_ENABLE_GC */
/*=======================
Input device settings
*=======================*/
/* Input device default settings.
* Can be changed in the Input device driver (`lv_indev_drv_t`)*/
/* Input device read period in milliseconds */
#define LV_INDEV_DEF_READ_PERIOD 30
/* Drag threshold in pixels */
#define LV_INDEV_DEF_DRAG_LIMIT 10
/* Drag throw slow-down in [%]. Greater value -> faster slow-down */
#define LV_INDEV_DEF_DRAG_THROW 20
/* Long press time in milliseconds.
* Time to send `LV_EVENT_LONG_PRESSSED`) */
#define LV_INDEV_DEF_LONG_PRESS_TIME 400
/* Repeated trigger period in long press [ms]
* Time between `LV_EVENT_LONG_PRESSED_REPEAT */
#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100
/* Gesture threshold in pixels */
#define LV_INDEV_DEF_GESTURE_LIMIT 50
/* Gesture min velocity at release before swipe (pixels)*/
#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3
/*==================
* Feature usage
*==================*/
/*1: Enable the Animations */
#define LV_USE_ANIMATION (LV_HIGH_RESOURCE_MCU)
#if LV_USE_ANIMATION
/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/
typedef void* lv_anim_user_data_t;
#endif
/* 1: Enable shadow drawing*/
#define LV_USE_SHADOW (LV_HIGH_RESOURCE_MCU)
/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
#define LV_USE_BLEND_MODES 0
/* 1: Use the `opa_scale` style property to set the opacity of an object and its children at once*/
#define LV_USE_OPA_SCALE 1
/* 1: Enable object groups (for keyboard/encoder navigation) */
#define LV_USE_GROUP 0
#if LV_USE_GROUP
typedef void* lv_group_user_data_t;
#endif /*LV_USE_GROUP*/
/* 1: Enable GPU interface*/
#define LV_USE_GPU 0
/* 1: Enable file system (might be required for images */
#define LV_USE_FILESYSTEM 1
#if LV_USE_FILESYSTEM
/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/
typedef void* lv_fs_drv_user_data_t;
/*File system interface*/
#define LV_USE_FS_IF 1
#if LV_USE_FS_IF
# define LV_FS_IF_FATFS '\0'
# define LV_FS_IF_PC '\0'
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
# define LV_FS_IF_SPIFFS 'E' // internal esp Flash
#else
# define LV_FS_IF_SPIFFS '\0' // no internal esp Flash
#endif
#endif /*LV_USE_FS_IF*/
#endif
/*1: Add a `user_data` to drivers and objects*/
#define LV_USE_USER_DATA 1
/*========================
* Image decoder and cache
*========================*/
/* 1: Enable indexed (palette) images */
#define LV_IMG_CF_INDEXED 1
/* 1: Enable alpha indexed images */
#define LV_IMG_CF_ALPHA 1
/* Default image cache size. Image caching keeps the images opened.
* If only the built-in image formats are used there is no real advantage of caching.
* (I.e. no new image decoder is added)
* With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
* However the opened images might consume additional RAM.
* LV_IMG_CACHE_DEF_SIZE must be >= 1 */
#define LV_IMG_CACHE_DEF_SIZE 1
/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/
typedef void* lv_img_decoder_user_data_t;
/*=====================
* Compiler settings
*====================*/
/* Define a custom attribute to `lv_tick_inc` function */
#define LV_ATTRIBUTE_TICK_INC
/* Define a custom attribute to `lv_task_handler` function */
#define LV_ATTRIBUTE_TASK_HANDLER
/* With size optimization (-Os) the compiler might not align data to
* 4 or 8 byte boundary. This alignment will be explicitly applied where needed.
* E.g. __attribute__((aligned(4))) */
#define LV_ATTRIBUTE_MEM_ALIGN
/* Attribute to mark large constant arrays for example
* font's bitmaps */
#define LV_ATTRIBUTE_LARGE_CONST
/* Export integer constant to binding.
* This macro is used with constants in the form of LV_<CONST> that
* should also appear on lvgl binding API such as Micropython
*
* The default value just prevents a GCC warning.
*/
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
/*===================
* HAL settings
*==================*/
/* 1: use a custom tick source.
* It removes the need to manually update the tick with `lv_tick_inc`) */
#define LV_TICK_CUSTOM 0
#if LV_TICK_CUSTOM == 1
#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
#endif /*LV_TICK_CUSTOM*/
typedef void* lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
typedef void* lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/
/*================
* Log settings
*===============*/
#define LV_USE_PERF_MONITOR 0
/*1: Enable the log module*/
#define LV_USE_LOG 1 // set back to 0 before release !!
#if LV_USE_LOG
/* How important log should be added:
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
* LV_LOG_LEVEL_INFO Log important events
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
* LV_LOG_LEVEL_NONE Do not log anything
*/
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
/* 1: Print the log with 'printf';
* 0: user need to register a callback with `lv_log_register_print_cb`*/
# define LV_LOG_PRINTF 0
#endif /*LV_USE_LOG*/
/*=================
* Debug settings
*================*/
/* If Debug is enabled LittelvGL validates the parameters of the functions.
* If an invalid parameter is found an error log message is printed and
* the MCU halts at the error. (`LV_USE_LOG` should be enabled)
* If you are debugging the MCU you can pause
* the debugger to see exactly where the issue is.
*
* The behavior of asserts can be overwritten by redefining them here.
* E.g. #define LV_ASSERT_MEM(p) <my_assert_code>
*/
#define LV_USE_DEBUG 1
#if LV_USE_DEBUG
/*Check if the parameter is NULL. (Quite fast) */
#define LV_USE_ASSERT_NULL 1
/*Checks is the memory is successfully allocated or no. (Quite fast)*/
#define LV_USE_ASSERT_MEM 1
/*Check the integrity of `lv_mem` after critical operations. (Slow)*/
#ifndef LV_USE_ASSERT_MEM_INTEGRITY
#define LV_USE_ASSERT_MEM_INTEGRITY 0
#endif
/* Check the strings.
* Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#define LV_USE_ASSERT_STR 0
/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#define LV_USE_ASSERT_OBJ 0
/*Check if the styles are properly initialized. (Fast)*/
#define LV_USE_ASSERT_STYLE 1
#endif /*LV_USE_DEBUG*/
/*==================
* FONT USAGE
*===================*/
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
* The symbols are available via `LV_SYMBOL_...` defines
* More info about fonts: https://docs.littlevgl.com/#Fonts
* To create a new font go to: https://littlevgl.com/ttf-font-to-c-array
*/
/* Robot fonts with bpp = 4
* https://fonts.google.com/specimen/Roboto */
#define LV_FONT_MONTSERRAT_12 LV_HIGH_RESOURCE_MCU
#define LV_FONT_MONTSERRAT_16 LV_HIGH_RESOURCE_MCU
#define LV_FONT_MONTSERRAT_22 LV_HIGH_RESOURCE_MCU
#define LV_FONT_MONTSERRAT_28 0 // LV_HIGH_RESOURCE_MCU
/* Demonstrate special features */
#define LV_FONT_MONTSERRAT_12_SUBPX 0
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 // LV_HIGH_RESOURCE_MCU /*bpp = 3*/
/*Pixel perfect monospace font
* http://pelulamu.net/unscii/ */
#define LV_FONT_UNSCII_8 0
/*Custom font*/
#define UNSCII_8_ICON 1
/* Optionally declare your custom fonts here.
* You can use these fonts as default font too
* and they will be available globally. E.g.
* #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \
* LV_FONT_DECLARE(my_font_2)
*/
//#define LV_FONT_CUSTOM_DECLARE
/* Enable it if you have fonts with a lot of characters.
* The limit depends on the font size, font face and bpp
* but with > 10,000 characters if you see issues probably you need to enable it.*/
#define LV_FONT_FMT_TXT_LARGE 1
/* Set the pixel order of the display.
* Important only if "subpx fonts" are used.
* With "normal" font it doesn't matter.
*/
#define LV_FONT_SUBPX_BGR 0
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
typedef void* lv_font_user_data_t;
/*Always set a default font from the built-in fonts*/
#if LV_HIGH_RESOURCE_MCU>0
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(lv_font_montserrat_16);
#define LV_FONT_DEFAULT &lv_font_montserrat_16
#else
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(unscii_8_icon);
#define LV_FONT_DEFAULT &unscii_8_icon //&lv_font_unscii_8
//#define LV_FONT_DEFAULT my_font
#endif
/*================
* THEME USAGE
*================*/
/*Always enable at least on theme*/
#define LV_USE_THEME_MATERIAL 1 /*A fast and impressive theme*/
#define LV_THEME_DEFAULT_INIT lv_theme_hasp_init // We init the theme ourselves
#define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED
#define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE
#define LV_THEME_DEFAULT_FLAGS 0 //LV_THEME_MATERIAL_FLAG_NONE
#if LV_HIGH_RESOURCE_MCU
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_12
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_16
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_22
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_22 //&lv_font_montserrat_28_compressed
#else
#define LV_THEME_DEFAULT_FONT_SMALL LV_FONT_DEFAULT // &lv_font_montserrat_12
#define LV_THEME_DEFAULT_FONT_NORMAL LV_FONT_DEFAULT // &lv_font_montserrat_16
#define LV_THEME_DEFAULT_FONT_SUBTITLE LV_FONT_DEFAULT // &lv_font_montserrat_22
#define LV_THEME_DEFAULT_FONT_TITLE LV_FONT_DEFAULT // &lv_font_montserrat_28_compressed
#endif
#define LV_USE_THEME_EMPTY 0
#define LV_USE_THEME_TEMPLATE 0
#define LV_USE_THEME_HASP 1
/*=================
* Text settings
*=================*/
/* Select a character encoding for strings.
* Your IDE or editor should have the same character encoding
* - LV_TXT_ENC_UTF8
* - LV_TXT_ENC_ASCII
* */
#define LV_TXT_ENC LV_TXT_ENC_UTF8
/*Can break (wrap) texts on these chars*/
#define LV_TXT_BREAK_CHARS " ,.;:-_"
/* If a word is at least this long, will break wherever "prettiest"
* To disable, set to a value <= 0 */
#define LV_TXT_LINE_BREAK_LONG_LEN 0
/* Minimum number of characters in a long word to put on a line before a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
/* Minimum number of characters in a long word to put on a line after a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
/* The control character to use for signalling text recoloring. */
#define LV_TXT_COLOR_CMD "#"
/* Support bidirectional texts.
* Allows mixing Left-to-Right and Right-to-Left texts.
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
#define LV_USE_BIDI 0
#if LV_USE_BIDI
/* Set the default direction. Supported values:
* `LV_BIDI_DIR_LTR` Left-to-Right
* `LV_BIDI_DIR_RTL` Right-to-Left
* `LV_BIDI_DIR_AUTO` detect texts base direction */
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
#endif
/*Change the built in (v)snprintf functions*/
#define LV_SPRINTF_CUSTOM 0
#if LV_SPRINTF_CUSTOM
# define LV_SPRINTF_INCLUDE <stdio.h>
# define lv_snprintf snprintf
# define lv_vsnprintf vsnprintf
#endif /*LV_SPRINTF_CUSTOM*/
/*===================
* LV_OBJ SETTINGS
*==================*/
/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/
typedef uint8_t lv_obj_user_data_t;
/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
#define LV_USE_OBJ_REALIGN 1
/* Enable to make the object clickable on a larger area.
* LV_EXT_CLICK_AREA_OFF or 0: Disable this feature
* LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px)
* LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px)
*/
#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY
/*==================
* LV OBJ X USAGE
*================*/
/*
* Documentation of the object types: https://docs.littlevgl.com/#Object-types
*/
/*Arc (dependencies: -)*/
#define LV_USE_ARC 1
/*Bar (dependencies: -)*/
#define LV_USE_BAR 1
/*Button (dependencies: lv_cont*/
#define LV_USE_BTN 1
#if LV_USE_BTN != 0
/*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/
# define LV_BTN_INK_EFFECT 0
#endif
/*Button matrix (dependencies: -)*/
#define LV_USE_BTNMATRIX 1
/*Calendar (dependencies: -)*/
#define LV_USE_CALENDAR (LV_HIGH_RESOURCE_MCU)
/*Canvas (dependencies: lv_img)*/
#define LV_USE_CANVAS 1
/*Check box (dependencies: lv_btn, lv_label)*/
#define LV_USE_CHECKBOX 1
/*Chart (dependencies: -)*/
#define LV_USE_CHART 1
#if LV_USE_CHART
# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 20
#endif
/*Container (dependencies: -*/
#define LV_USE_CONT 1
/*Color picker (dependencies: -*/
#define LV_USE_CPICKER 1
/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
#define LV_USE_DROPDOWN 1
#if LV_USE_DROPDOWN != 0
/*Open and close default animation time [ms] (0: no animation)*/
# define LV_DROPDOWN_DEF_ANIM_TIME 200
#endif
/*Gauge (dependencies:lv_bar, lv_linemeter)*/
#define LV_USE_GAUGE 1
/*Image (dependencies: lv_label*/
#define LV_USE_IMG 1
/*Image Button (dependencies: lv_btn*/
#define LV_USE_IMGBTN 1
#if LV_USE_IMGBTN
/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/
# define LV_IMGBTN_TILED 0
#endif
/*Keyboard (dependencies: lv_btnm)*/
#define LV_USE_KEYBOARD 1
/*Label (dependencies: -*/
#define LV_USE_LABEL 1
#if LV_USE_LABEL != 0
/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/
# define LV_LABEL_DEF_SCROLL_SPEED 25
/* Waiting period at beginning/end of animation cycle */
# define LV_LABEL_WAIT_CHAR_COUNT 3
/*Enable selecting text of the label */
# define LV_LABEL_TEXT_SEL 0
/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/
# define LV_LABEL_LONG_TXT_HINT 0
#endif
/*LED (dependencies: -)*/
#define LV_USE_LED 1
/*Line (dependencies: -*/
#define LV_USE_LINE 1
/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/
#define LV_USE_LIST 1
#if LV_USE_LIST != 0
/*Default animation time of focusing to a list element [ms] (0: no animation) */
# define LV_LIST_DEF_ANIM_TIME 100
#endif
/*Line meter (dependencies: *;)*/
#define LV_USE_LMETER 1
/*Mask (dependencies: -)*/
#define LV_USE_OBJMASK 1
/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/
#define LV_USE_MSGBOX 1
/*Page (dependencies: lv_cont)*/
#define LV_USE_PAGE 1
#if LV_USE_PAGE != 0
/*Focus default animation time [ms] (0: no animation)*/
# define LV_PAGE_DEF_ANIM_TIME 400
#endif
/*Preload (dependencies: lv_arc, lv_anim)*/
#define LV_USE_SPINNER 0
#if LV_USE_SPINNER != 0
# define LV_SPINNER_DEF_ARC_LENGTH 60 /*[deg]*/
# define LV_SPINNER_DEF_SPIN_TIME 1000 /*[ms]*/
# define LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_SPINNING_ARC
#endif
/*Roller (dependencies: lv_ddlist)*/
#define LV_USE_ROLLER 1
#if LV_USE_ROLLER != 0
/*Focus animation time [ms] (0: no animation)*/
# define LV_ROLLER_DEF_ANIM_TIME 200
/*Number of extra "pages" when the roller is infinite*/
# define LV_ROLLER_INF_PAGES 7
#endif
/*Slider (dependencies: lv_bar)*/
#define LV_USE_SLIDER 1
/*Spinbox (dependencies: lv_ta)*/
#define LV_USE_SPINBOX 1
/*Switch (dependencies: lv_slider)*/
#define LV_USE_SWITCH 1
/*Text area (dependencies: lv_label, lv_page)*/
#define LV_USE_TEXTAREA 1
#if LV_USE_TEXTAREA != 0
# define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME 400 /*ms*/
# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
#endif
/*Table (dependencies: lv_label)*/
#define LV_USE_TABLE 1 //(LV_HIGH_RESOURCE_MCU)
#if LV_USE_TABLE
# define LV_TABLE_COL_MAX 12
#endif
/*Tab (dependencies: lv_page, lv_btnm)*/
#define LV_USE_TABVIEW 1
# if LV_USE_TABVIEW != 0
/*Time of slide animation [ms] (0: no animation)*/
# define LV_TABVIEW_DEF_ANIM_TIME 300
#endif
/*Tileview (dependencies: lv_page) */
#define LV_USE_TILEVIEW 1
#if LV_USE_TILEVIEW
/*Time of slide animation [ms] (0: no animation)*/
# define LV_TILEVIEW_DEF_ANIM_TIME 300
#endif
/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/
#define LV_USE_WIN 1
/*==================
* Non-user section
*==================*/
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
# define _CRT_SECURE_NO_WARNINGS
#endif
/*--END OF LV_CONF_H--*/
#endif /*LV_CONF_H*/
/*Be sure every define has a default value*/
#include "src/lv_conf_internal.h"
#endif /*End of "Content enable"*/

666
include/lv_conf_v7.h Normal file
View File

@ -0,0 +1,666 @@
/**
* @file lv_conf.h
*
*/
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
/* clang-format off */
#include <stdint.h>
#if defined(ARDUINO_ARCH_ESP8266)
#define LV_HIGH_RESOURCE_MCU 0
#endif
#ifndef LV_HIGH_RESOURCE_MCU
#define LV_HIGH_RESOURCE_MCU 1
#endif
/*====================
Graphical settings
*====================*/
/* Maximal horizontal and vertical resolution to support by the library.*/
#define LV_HOR_RES_MAX (TFT_WIDTH)
#define LV_VER_RES_MAX (TFT_HEIGHT)
/* Color depth:
* - 1: 1 byte per pixel
* - 8: RGB233
* - 16: RGB565
* - 32: ARGB8888
*/
#define LV_COLOR_DEPTH 16
/* Swap the 2 bytes of RGB565 color.
* Useful if the display has a 8 bit interface (e.g. SPI)*/
#define LV_COLOR_16_SWAP 0
/* 1: Enable screen transparency.
* Useful for OSD or other overlapping GUIs.
* Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/
#define LV_COLOR_SCREEN_TRANSP 0
/*Images pixels with this color will not be drawn (with chroma keying)*/
#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/
/* Enable chroma keying for indexed images. */
#define LV_INDEXED_CHROMA 1
/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
#define LV_ANTIALIAS 1
/* Default display refresh period.
* Can be changed in the display driver (`lv_disp_drv_t`).*/
#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
/* Dot Per Inch: used to initialize default sizes.
* E.g. a button with width = LV_DPI / 2 -> half inch wide
* (Not so important, you can adjust it to modify default sizes and spaces)*/
#define LV_DPI 100 /*[px]*/
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
typedef int16_t lv_coord_t;
/*=========================
Memory manager settings
*=========================*/
/* LittelvGL's internal memory manager's settings.
* The graphical objects and other related data are stored here. */
/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */
#define LV_MEM_CUSTOM 0
#if LV_MEM_CUSTOM == 0
/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
#ifndef LV_MEM_SIZE
#if defined(ARDUINO_ARCH_ESP8266)
# define LV_MEM_SIZE (10 * 1024U) // Minimum 10 Kb
#else
# define LV_MEM_SIZE (20 * 1024U) // 20Kb is much better
#endif
#endif
/* Complier prefix for a big array declaration */
# define LV_MEM_ATTR
/* Set an address for the memory pool instead of allocating it as an array.
* Can be in external SRAM too. */
# define LV_MEM_ADR 0
# define LV_MEM_ADD_JUNK 0
/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */
# define LV_MEM_AUTO_DEFRAG 1
#else /*LV_MEM_CUSTOM*/
# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
#endif /*LV_MEM_CUSTOM*/
/* Garbage Collector settings
* Used if lvgl is binded to higher level language and the memory is managed by that language */
#define LV_ENABLE_GC 0
#if LV_ENABLE_GC != 0
# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/
# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/
#endif /* LV_ENABLE_GC */
/*=======================
Input device settings
*=======================*/
/* Input device default settings.
* Can be changed in the Input device driver (`lv_indev_drv_t`)*/
/* Input device read period in milliseconds */
#define LV_INDEV_DEF_READ_PERIOD 30
/* Drag threshold in pixels */
#define LV_INDEV_DEF_DRAG_LIMIT 10
/* Drag throw slow-down in [%]. Greater value -> faster slow-down */
#define LV_INDEV_DEF_DRAG_THROW 20
/* Long press time in milliseconds.
* Time to send `LV_EVENT_LONG_PRESSSED`) */
#define LV_INDEV_DEF_LONG_PRESS_TIME 400
/* Repeated trigger period in long press [ms]
* Time between `LV_EVENT_LONG_PRESSED_REPEAT */
#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100
/* Gesture threshold in pixels */
#define LV_INDEV_DEF_GESTURE_LIMIT 50
/* Gesture min velocity at release before swipe (pixels)*/
#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3
/*==================
* Feature usage
*==================*/
/*1: Enable the Animations */
#define LV_USE_ANIMATION (LV_HIGH_RESOURCE_MCU)
#if LV_USE_ANIMATION
/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/
typedef void* lv_anim_user_data_t;
#endif
/* 1: Enable shadow drawing*/
#define LV_USE_SHADOW (LV_HIGH_RESOURCE_MCU)
/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
#define LV_USE_BLEND_MODES 0
/* 1: Use the `opa_scale` style property to set the opacity of an object and its children at once*/
#define LV_USE_OPA_SCALE 1
/* 1: Enable object groups (for keyboard/encoder navigation) */
#define LV_USE_GROUP 0
#if LV_USE_GROUP
typedef void* lv_group_user_data_t;
#endif /*LV_USE_GROUP*/
/* 1: Enable GPU interface*/
#define LV_USE_GPU 0
/* 1: Enable file system (might be required for images */
#define LV_USE_FILESYSTEM 1
#if LV_USE_FILESYSTEM
/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/
typedef void* lv_fs_drv_user_data_t;
/*File system interface*/
#define LV_USE_FS_IF 1
#if LV_USE_FS_IF
# define LV_FS_IF_FATFS '\0'
# define LV_FS_IF_PC '\0'
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
# define LV_FS_IF_SPIFFS 'E' // internal esp Flash
#else
# define LV_FS_IF_SPIFFS '\0' // no internal esp Flash
#endif
#endif /*LV_USE_FS_IF*/
#endif
/*1: Add a `user_data` to drivers and objects*/
#define LV_USE_USER_DATA 1
/*========================
* Image decoder and cache
*========================*/
/* 1: Enable indexed (palette) images */
#define LV_IMG_CF_INDEXED 1
/* 1: Enable alpha indexed images */
#define LV_IMG_CF_ALPHA 1
/* Default image cache size. Image caching keeps the images opened.
* If only the built-in image formats are used there is no real advantage of caching.
* (I.e. no new image decoder is added)
* With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
* However the opened images might consume additional RAM.
* LV_IMG_CACHE_DEF_SIZE must be >= 1 */
#define LV_IMG_CACHE_DEF_SIZE 1
/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/
typedef void* lv_img_decoder_user_data_t;
/*=====================
* Compiler settings
*====================*/
/* Define a custom attribute to `lv_tick_inc` function */
#define LV_ATTRIBUTE_TICK_INC
/* Define a custom attribute to `lv_task_handler` function */
#define LV_ATTRIBUTE_TASK_HANDLER
/* With size optimization (-Os) the compiler might not align data to
* 4 or 8 byte boundary. This alignment will be explicitly applied where needed.
* E.g. __attribute__((aligned(4))) */
#define LV_ATTRIBUTE_MEM_ALIGN
/* Attribute to mark large constant arrays for example
* font's bitmaps */
#define LV_ATTRIBUTE_LARGE_CONST
/* Export integer constant to binding.
* This macro is used with constants in the form of LV_<CONST> that
* should also appear on lvgl binding API such as Micropython
*
* The default value just prevents a GCC warning.
*/
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
/*===================
* HAL settings
*==================*/
/* 1: use a custom tick source.
* It removes the need to manually update the tick with `lv_tick_inc`) */
#define LV_TICK_CUSTOM 0
#if LV_TICK_CUSTOM == 1
#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
#endif /*LV_TICK_CUSTOM*/
typedef void* lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
typedef void* lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/
/*================
* Log settings
*===============*/
#define LV_USE_PERF_MONITOR 0
/*1: Enable the log module*/
#define LV_USE_LOG 1 // set back to 0 before release !!
#if LV_USE_LOG
/* How important log should be added:
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
* LV_LOG_LEVEL_INFO Log important events
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
* LV_LOG_LEVEL_NONE Do not log anything
*/
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
/* 1: Print the log with 'printf';
* 0: user need to register a callback with `lv_log_register_print_cb`*/
# define LV_LOG_PRINTF 0
#endif /*LV_USE_LOG*/
/*=================
* Debug settings
*================*/
/* If Debug is enabled LittelvGL validates the parameters of the functions.
* If an invalid parameter is found an error log message is printed and
* the MCU halts at the error. (`LV_USE_LOG` should be enabled)
* If you are debugging the MCU you can pause
* the debugger to see exactly where the issue is.
*
* The behavior of asserts can be overwritten by redefining them here.
* E.g. #define LV_ASSERT_MEM(p) <my_assert_code>
*/
#define LV_USE_DEBUG 1
#if LV_USE_DEBUG
/*Check if the parameter is NULL. (Quite fast) */
#define LV_USE_ASSERT_NULL 1
/*Checks is the memory is successfully allocated or no. (Quite fast)*/
#define LV_USE_ASSERT_MEM 1
/*Check the integrity of `lv_mem` after critical operations. (Slow)*/
#ifndef LV_USE_ASSERT_MEM_INTEGRITY
#define LV_USE_ASSERT_MEM_INTEGRITY 0
#endif
/* Check the strings.
* Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#define LV_USE_ASSERT_STR 0
/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#define LV_USE_ASSERT_OBJ 0
/*Check if the styles are properly initialized. (Fast)*/
#define LV_USE_ASSERT_STYLE 1
#endif /*LV_USE_DEBUG*/
/*==================
* FONT USAGE
*===================*/
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
* The symbols are available via `LV_SYMBOL_...` defines
* More info about fonts: https://docs.littlevgl.com/#Fonts
* To create a new font go to: https://littlevgl.com/ttf-font-to-c-array
*/
/* Robot fonts with bpp = 4
* https://fonts.google.com/specimen/Roboto */
#define LV_FONT_MONTSERRAT_12 LV_HIGH_RESOURCE_MCU
#define LV_FONT_MONTSERRAT_16 LV_HIGH_RESOURCE_MCU
#define LV_FONT_MONTSERRAT_22 LV_HIGH_RESOURCE_MCU
#define LV_FONT_MONTSERRAT_28 0 // LV_HIGH_RESOURCE_MCU
/* Demonstrate special features */
#define LV_FONT_MONTSERRAT_12_SUBPX 0
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 // LV_HIGH_RESOURCE_MCU /*bpp = 3*/
/*Pixel perfect monospace font
* http://pelulamu.net/unscii/ */
#define LV_FONT_UNSCII_8 0
/*Custom font*/
#define UNSCII_8_ICON 1
/* Optionally declare your custom fonts here.
* You can use these fonts as default font too
* and they will be available globally. E.g.
* #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \
* LV_FONT_DECLARE(my_font_2)
*/
//#define LV_FONT_CUSTOM_DECLARE
/* Enable it if you have fonts with a lot of characters.
* The limit depends on the font size, font face and bpp
* but with > 10,000 characters if you see issues probably you need to enable it.*/
#define LV_FONT_FMT_TXT_LARGE 1
/* Set the pixel order of the display.
* Important only if "subpx fonts" are used.
* With "normal" font it doesn't matter.
*/
#define LV_FONT_SUBPX_BGR 0
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
typedef void* lv_font_user_data_t;
/*Always set a default font from the built-in fonts*/
#if LV_HIGH_RESOURCE_MCU>0
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(lv_font_montserrat_16);
#define LV_FONT_DEFAULT &lv_font_montserrat_16
#else
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(unscii_8_icon);
#define LV_FONT_DEFAULT &unscii_8_icon //&lv_font_unscii_8
//#define LV_FONT_DEFAULT my_font
#endif
/*================
* THEME USAGE
*================*/
/*Always enable at least on theme*/
#define LV_USE_THEME_MATERIAL 1 /*A fast and impressive theme*/
#define LV_THEME_DEFAULT_INIT lv_theme_hasp_init // We init the theme ourselves
#define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED
#define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE
#define LV_THEME_DEFAULT_FLAG 0 //LV_THEME_MATERIAL_FLAG_NONE
#if LV_HIGH_RESOURCE_MCU
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_12
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_16
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_22
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_22 //&lv_font_montserrat_28_compressed
#else
#define LV_THEME_DEFAULT_FONT_SMALL LV_FONT_DEFAULT // &lv_font_montserrat_12
#define LV_THEME_DEFAULT_FONT_NORMAL LV_FONT_DEFAULT // &lv_font_montserrat_16
#define LV_THEME_DEFAULT_FONT_SUBTITLE LV_FONT_DEFAULT // &lv_font_montserrat_22
#define LV_THEME_DEFAULT_FONT_TITLE LV_FONT_DEFAULT // &lv_font_montserrat_28_compressed
#endif
#define LV_USE_THEME_EMPTY 0
#define LV_USE_THEME_TEMPLATE 0
#define LV_USE_THEME_HASP 1
/*=================
* Text settings
*=================*/
/* Select a character encoding for strings.
* Your IDE or editor should have the same character encoding
* - LV_TXT_ENC_UTF8
* - LV_TXT_ENC_ASCII
* */
#define LV_TXT_ENC LV_TXT_ENC_UTF8
/*Can break (wrap) texts on these chars*/
#define LV_TXT_BREAK_CHARS " ,.;:-_"
/* If a word is at least this long, will break wherever "prettiest"
* To disable, set to a value <= 0 */
#define LV_TXT_LINE_BREAK_LONG_LEN 0
/* Minimum number of characters in a long word to put on a line before a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
/* Minimum number of characters in a long word to put on a line after a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
/* The control character to use for signalling text recoloring. */
#define LV_TXT_COLOR_CMD "#"
/* Support bidirectional texts.
* Allows mixing Left-to-Right and Right-to-Left texts.
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
#define LV_USE_BIDI 0
#if LV_USE_BIDI
/* Set the default direction. Supported values:
* `LV_BIDI_DIR_LTR` Left-to-Right
* `LV_BIDI_DIR_RTL` Right-to-Left
* `LV_BIDI_DIR_AUTO` detect texts base direction */
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
#endif
/*Change the built in (v)snprintf functions*/
#define LV_SPRINTF_CUSTOM 0
#if LV_SPRINTF_CUSTOM
# define LV_SPRINTF_INCLUDE <stdio.h>
# define lv_snprintf snprintf
# define lv_vsnprintf vsnprintf
#endif /*LV_SPRINTF_CUSTOM*/
/*===================
* LV_OBJ SETTINGS
*==================*/
/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/
typedef uint8_t lv_obj_user_data_t;
/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
#define LV_USE_OBJ_REALIGN 1
/* Enable to make the object clickable on a larger area.
* LV_EXT_CLICK_AREA_OFF or 0: Disable this feature
* LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px)
* LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px)
*/
#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY
/*==================
* LV OBJ X USAGE
*================*/
/*
* Documentation of the object types: https://docs.littlevgl.com/#Object-types
*/
/*Arc (dependencies: -)*/
#define LV_USE_ARC 1
/*Bar (dependencies: -)*/
#define LV_USE_BAR 1
/*Button (dependencies: lv_cont*/
#define LV_USE_BTN 1
#if LV_USE_BTN != 0
/*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/
# define LV_BTN_INK_EFFECT 0
#endif
/*Button matrix (dependencies: -)*/
#define LV_USE_BTNMATRIX 1
/*Calendar (dependencies: -)*/
#define LV_USE_CALENDAR (LV_HIGH_RESOURCE_MCU)
/*Canvas (dependencies: lv_img)*/
#define LV_USE_CANVAS 1
/*Check box (dependencies: lv_btn, lv_label)*/
#define LV_USE_CHECKBOX 1
/*Chart (dependencies: -)*/
#define LV_USE_CHART 1
#if LV_USE_CHART
# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 20
#endif
/*Container (dependencies: -*/
#define LV_USE_CONT 1
/*Color picker (dependencies: -*/
#define LV_USE_CPICKER 1
/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
#define LV_USE_DROPDOWN 1
#if LV_USE_DROPDOWN != 0
/*Open and close default animation time [ms] (0: no animation)*/
# define LV_DROPDOWN_DEF_ANIM_TIME 200
#endif
/*Gauge (dependencies:lv_bar, lv_linemeter)*/
#define LV_USE_GAUGE 1
/*Image (dependencies: lv_label*/
#define LV_USE_IMG 1
/*Image Button (dependencies: lv_btn*/
#define LV_USE_IMGBTN 1
#if LV_USE_IMGBTN
/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/
# define LV_IMGBTN_TILED 0
#endif
/*Keyboard (dependencies: lv_btnm)*/
#define LV_USE_KEYBOARD 1
/*Label (dependencies: -*/
#define LV_USE_LABEL 1
#if LV_USE_LABEL != 0
/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/
# define LV_LABEL_DEF_SCROLL_SPEED 25
/* Waiting period at beginning/end of animation cycle */
# define LV_LABEL_WAIT_CHAR_COUNT 3
/*Enable selecting text of the label */
# define LV_LABEL_TEXT_SEL 0
/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/
# define LV_LABEL_LONG_TXT_HINT 0
#endif
/*LED (dependencies: -)*/
#define LV_USE_LED 1
/*Line (dependencies: -*/
#define LV_USE_LINE 1
/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/
#define LV_USE_LIST 1
#if LV_USE_LIST != 0
/*Default animation time of focusing to a list element [ms] (0: no animation) */
# define LV_LIST_DEF_ANIM_TIME 100
#endif
/*Line meter (dependencies: *;)*/
#define LV_USE_LMETER 1
/*Mask (dependencies: -)*/
#define LV_USE_OBJMASK 1
/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/
#define LV_USE_MSGBOX 1
/*Page (dependencies: lv_cont)*/
#define LV_USE_PAGE 1
#if LV_USE_PAGE != 0
/*Focus default animation time [ms] (0: no animation)*/
# define LV_PAGE_DEF_ANIM_TIME 400
#endif
/*Preload (dependencies: lv_arc, lv_anim)*/
#define LV_USE_SPINNER 0
#if LV_USE_SPINNER != 0
# define LV_SPINNER_DEF_ARC_LENGTH 60 /*[deg]*/
# define LV_SPINNER_DEF_SPIN_TIME 1000 /*[ms]*/
# define LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_SPINNING_ARC
#endif
/*Roller (dependencies: lv_ddlist)*/
#define LV_USE_ROLLER 1
#if LV_USE_ROLLER != 0
/*Focus animation time [ms] (0: no animation)*/
# define LV_ROLLER_DEF_ANIM_TIME 200
/*Number of extra "pages" when the roller is infinite*/
# define LV_ROLLER_INF_PAGES 7
#endif
/*Slider (dependencies: lv_bar)*/
#define LV_USE_SLIDER 1
/*Spinbox (dependencies: lv_ta)*/
#define LV_USE_SPINBOX 1
/*Switch (dependencies: lv_slider)*/
#define LV_USE_SWITCH 1
/*Text area (dependencies: lv_label, lv_page)*/
#define LV_USE_TEXTAREA 1
#if LV_USE_TEXTAREA != 0
# define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME 400 /*ms*/
# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
#endif
/*Table (dependencies: lv_label)*/
#define LV_USE_TABLE 1 //(LV_HIGH_RESOURCE_MCU)
#if LV_USE_TABLE
# define LV_TABLE_COL_MAX 12
#endif
/*Tab (dependencies: lv_page, lv_btnm)*/
#define LV_USE_TABVIEW 1
# if LV_USE_TABVIEW != 0
/*Time of slide animation [ms] (0: no animation)*/
# define LV_TABVIEW_DEF_ANIM_TIME 300
#endif
/*Tileview (dependencies: lv_page) */
#define LV_USE_TILEVIEW 1
#if LV_USE_TILEVIEW
/*Time of slide animation [ms] (0: no animation)*/
# define LV_TILEVIEW_DEF_ANIM_TIME 300
#endif
/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/
#define LV_USE_WIN 1
/*==================
* Non-user section
*==================*/
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
# define _CRT_SECURE_NO_WARNINGS
#endif
/*--END OF LV_CONF_H--*/
#endif /*LV_CONF_H*/
/*Be sure every define has a default value*/
#include "src/lv_conf_internal.h"
#endif /*End of "Content enable"*/

739
include/lv_conf_v8.h Normal file
View File

@ -0,0 +1,739 @@
/**
* @file lv_conf.h
* Configuration file for v8.0.0-dev
*/
/*
* COPY THIS FILE AS `lv_conf.h` NEXT TO the `lvgl` FOLDER
*/
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
/* clang-format off */
#include <stdint.h>
#if defined(ARDUINO_ARCH_ESP8266)
#define LV_HIGH_RESOURCE_MCU 0
#endif
#ifndef LV_HIGH_RESOURCE_MCU
#define LV_HIGH_RESOURCE_MCU 1
#endif
/*====================
Graphical settings
*====================*/
/* Maximal horizontal and vertical resolution to support by the library.*/
#define LV_HOR_RES_DEF (TFT_WIDTH)
#define LV_VER_RES_DEF (TFT_HEIGHT)
#define LV_HOR_RES_MAX (TFT_WIDTH)
#define LV_VER_RES_MAX (TFT_HEIGHT)
/* Color depth:
* - 1: 1 byte per pixel
* - 8: RGB332
* - 16: RGB565
* - 32: ARGB8888
*/
#define LV_COLOR_DEPTH 16
/* Swap the 2 bytes of RGB565 color.
* Useful if the display has a 8 bit interface (e.g. SPI)*/
#define LV_COLOR_16_SWAP 0
/* 1: Enable screen transparency.
* Useful for OSD or other overlapping GUIs.
* Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/
#define LV_COLOR_SCREEN_TRANSP 0
/*Images pixels with this color will not be drawn (with chroma keying)*/
#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/
/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
#define LV_ANTIALIAS 1
/* Default display refresh period.
* Can be changed in the display driver (`lv_disp_drv_t`).*/
#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
/* Dot Per Inch: used to initialize default sizes.
* E.g. a button with width = LV_DPI / 2 -> half inch wide
* (Not so important, you can adjust it to modify default sizes and spaces)*/
#define LV_DPI 130 /*[px]*/
/* The the real width of the display changes some default values:
* default object sizes, layout of examples, etc.
* According to the width of the display (hor. res. / dpi)
* the displays fall in 4 categories.
* The 4th is extra large which has no upper limit so not listed here
* The upper limit of the categories are set below in 0.1 inch unit.
*/
#define LV_DISP_SMALL_LIMIT 30
#define LV_DISP_MEDIUM_LIMIT 50
#define LV_DISP_LARGE_LIMIT 70
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
typedef int16_t lv_coord_t;
/*=========================
Memory manager settings
*=========================*/
/* LittelvGL's internal memory manager's settings.
* The graphical objects and other related data are stored here. */
/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */
#define LV_MEM_CUSTOM 0
#if LV_MEM_CUSTOM == 0
/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
//# define LV_MEM_SIZE (32U * 1024U)
/* Complier prefix for a big array declaration */
# define LV_MEM_ATTR
/* Set an address for the memory pool instead of allocating it as an array.
* Can be in external SRAM too. */
# define LV_MEM_ADR 0
/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */
# define LV_MEM_AUTO_DEFRAG 1
#else /*LV_MEM_CUSTOM*/
# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
#endif /*LV_MEM_CUSTOM*/
/* Use the standard memcpy and memset instead of LVGL's own functions.
* The standard functions might or might not be faster depending on their implementation. */
#define LV_MEMCPY_MEMSET_STD 0
/* Garbage Collector settings
* Used if lvgl is binded to higher level language and the memory is managed by that language */
#define LV_ENABLE_GC 0
#if LV_ENABLE_GC != 0
# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/
# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/
#endif /* LV_ENABLE_GC */
/*=======================
Input device settings
*=======================*/
/* Input device default settings.
* Can be changed in the Input device driver (`lv_indev_drv_t`)*/
/* Input device read period in milliseconds */
#define LV_INDEV_DEF_READ_PERIOD 30
/* Drag threshold in pixels */
#define LV_INDEV_DEF_DRAG_LIMIT 10
/* Drag throw slow-down in [%]. Greater value -> faster slow-down */
#define LV_INDEV_DEF_DRAG_THROW 10
/* Long press time in milliseconds.
* Time to send `LV_EVENT_LONG_PRESSSED`) */
#define LV_INDEV_DEF_LONG_PRESS_TIME 400
/* Repeated trigger period in long press [ms]
* Time between `LV_EVENT_LONG_PRESSED_REPEAT */
#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100
/* Gesture threshold in pixels */
#define LV_INDEV_DEF_GESTURE_LIMIT 50
/* Gesture min velocity at release before swipe (pixels)*/
#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3
/*==================
* Feature usage
*==================*/
/*1: Enable the Animations */
#define LV_USE_ANIMATION 1
#if LV_USE_ANIMATION
/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_anim_user_data_t;
#endif
/* 1: Enable shadow drawing on rectangles*/
#define LV_USE_SHADOW (LV_HIGH_RESOURCE_MCU)
#if LV_USE_SHADOW
/* Allow buffering some shadow calculation
* LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer,
* where shadow size is `shadow_width + radius`
* Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
#define LV_SHADOW_CACHE_SIZE 0
#endif
/*1: enable outline drawing on rectangles*/
#define LV_USE_OUTLINE 1
/*1: enable pattern drawing on rectangles*/
#define LV_USE_PATTERN 1
/*1: enable value string drawing on rectangles*/
#define LV_USE_VALUE_STR 1
/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
#define LV_USE_BLEND_MODES 1
/* 1: Use the `opa_scale` style property to set the opacity of an object and its children at once*/
#define LV_USE_OPA_SCALE 1
/* 1: Use image zoom and rotation*/
#define LV_USE_IMG_TRANSFORM 1
/* 1: Enable object groups (for keyboard/encoder navigation) */
#define LV_USE_GROUP 1
#if LV_USE_GROUP
typedef void * lv_group_user_data_t;
#endif /*LV_USE_GROUP*/
/* 1: Enable GPU interface*/
#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */
#define LV_USE_GPU_STM32_DMA2D 0
/*If enabling LV_USE_GPU_STM32_DMA2D, LV_GPU_DMA2D_CMSIS_INCLUDE must be defined to include path of CMSIS header of target processor
e.g. "stm32f769xx.h" or "stm32f429xx.h" */
#define LV_GPU_DMA2D_CMSIS_INCLUDE
/*1: Use PXP for CPU off-load on NXP RTxxx platforms */
#define LV_USE_GPU_NXP_PXP 0
/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c)
* and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol FSL_RTOS_FREE_RTOS
* has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected.
*0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init()
* */
#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0
/*1: Use VG-Lite for CPU offload on NXP RTxxx platforms */
#define LV_USE_GPU_NXP_VG_LITE 0
/* 1: Enable file system (might be required for images */
#define LV_USE_FILESYSTEM 1
#if LV_USE_FILESYSTEM
/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_fs_drv_user_data_t;
#endif
/*1: Add a `user_data` to drivers and objects*/
#define LV_USE_USER_DATA 1
/*1: Show CPU usage and FPS count in the right bottom corner*/
#define LV_USE_PERF_MONITOR 0
/*1: Use the functions and types from the older API if possible */
#define LV_USE_API_EXTENSION_V6 0
#define LV_USE_API_EXTENSION_V7 0
/*========================
* Image decoder and cache
*========================*/
/* 1: Enable indexed (palette) images */
#define LV_IMG_CF_INDEXED 1
/* 1: Enable alpha indexed images */
#define LV_IMG_CF_ALPHA 1
/* Default image cache size. Image caching keeps the images opened.
* If only the built-in image formats are used there is no real advantage of caching.
* (I.e. no new image decoder is added)
* With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
* However the opened images might consume additional RAM.
* LV_IMG_CACHE_DEF_SIZE must be >= 1 */
#define LV_IMG_CACHE_DEF_SIZE 1
/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_img_decoder_user_data_t;
/*=====================
* Compiler settings
*====================*/
/* For big endian systems set to 1 */
#define LV_BIG_ENDIAN_SYSTEM 0
/* Define a custom attribute to `lv_tick_inc` function */
#define LV_ATTRIBUTE_TICK_INC
/* Define a custom attribute to `lv_task_handler` function */
#define LV_ATTRIBUTE_TIMER_HANDLER
/* Define a custom attribute to `lv_disp_flush_ready` function */
#define LV_ATTRIBUTE_FLUSH_READY
/* Required alignment size for buffers */
#define LV_ATTRIBUTE_MEM_ALIGN_SIZE
/* With size optimization (-Os) the compiler might not align data to
* 4 or 8 byte boundary. Some HW may need even 32 or 64 bytes.
* This alignment will be explicitly applied where needed.
* LV_ATTRIBUTE_MEM_ALIGN_SIZE should be used to specify required align size.
* E.g. __attribute__((aligned(LV_ATTRIBUTE_MEM_ALIGN_SIZE))) */
#define LV_ATTRIBUTE_MEM_ALIGN
/* Attribute to mark large constant arrays for example
* font's bitmaps */
#define LV_ATTRIBUTE_LARGE_CONST
/* Prefix performance critical functions to place them into a faster memory (e.g RAM)
* Uses 15-20 kB extra memory */
#define LV_ATTRIBUTE_FAST_MEM
/* Export integer constant to binding.
* This macro is used with constants in the form of LV_<CONST> that
* should also appear on lvgl binding API such as Micropython
*
* The default value just prevents a GCC warning.
*/
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
/* Prefix variables that are used in GPU accelerated operations, often these need to be
* placed in RAM sections that are DMA accessible */
#define LV_ATTRIBUTE_DMA
/*===================
* HAL settings
*==================*/
/* 1: use a custom tick source.
* It removes the need to manually update the tick with `lv_tick_inc`) */
#define LV_TICK_CUSTOM 0
#if LV_TICK_CUSTOM == 1
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
#endif /*LV_TICK_CUSTOM*/
typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/
/*================
* Log settings
*===============*/
/*1: Enable the log module*/
#define LV_USE_LOG 0
#if LV_USE_LOG
/* How important log should be added:
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
* LV_LOG_LEVEL_INFO Log important events
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
* LV_LOG_LEVEL_NONE Do not log anything
*/
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
/* 1: Print the log with 'printf';
* 0: user need to register a callback with `lv_log_register_print_cb`*/
# define LV_LOG_PRINTF 0
#endif /*LV_USE_LOG*/
/*=================
* Debug settings
*================*/
/* If Debug is enabled LittelvGL validates the parameters of the functions.
* If an invalid parameter is found an error log message is printed and
* the MCU halts at the error. (`LV_USE_LOG` should be enabled)
* If you are debugging the MCU you can pause
* the debugger to see exactly where the issue is.
*
* The behavior of asserts can be overwritten by redefining them here.
* E.g. #define LV_ASSERT_MEM(p) <my_assert_code>
*/
#define LV_USE_DEBUG 1
#if LV_USE_DEBUG
/*Check if the parameter is NULL. (Quite fast) */
#define LV_USE_ASSERT_NULL 1
/*Checks is the memory is successfully allocated or no. (Quite fast)*/
#define LV_USE_ASSERT_MEM 1
/*Check the integrity of `lv_mem` after critical operations. (Slow)*/
#define LV_USE_ASSERT_MEM_INTEGRITY 0
/* Check the strings.
* Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#define LV_USE_ASSERT_STR 0
/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#define LV_USE_ASSERT_OBJ 0
/*Check if the styles are properly initialized. (Fast)*/
#define LV_USE_ASSERT_STYLE 0
#endif /*LV_USE_DEBUG*/
/*==================
* FONT USAGE
*===================*/
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
* The symbols are available via `LV_SYMBOL_...` defines
* More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html
* To create a new font go to: https://lvgl.com/ttf-font-to-c-array
*/
/* Montserrat fonts with bpp = 4
* https://fonts.google.com/specimen/Montserrat */
#define LV_FONT_MONTSERRAT_8 0
#define LV_FONT_MONTSERRAT_10 0
#define LV_FONT_MONTSERRAT_12 (LV_HIGH_RESOURCE_MCU)
#define LV_FONT_MONTSERRAT_14 0
#define LV_FONT_MONTSERRAT_16 (LV_HIGH_RESOURCE_MCU)
#define LV_FONT_MONTSERRAT_18 0
#define LV_FONT_MONTSERRAT_20 0
#define LV_FONT_MONTSERRAT_22 (LV_HIGH_RESOURCE_MCU)
#define LV_FONT_MONTSERRAT_24 0
#define LV_FONT_MONTSERRAT_26 0
#define LV_FONT_MONTSERRAT_28 0
#define LV_FONT_MONTSERRAT_30 0
#define LV_FONT_MONTSERRAT_32 0
#define LV_FONT_MONTSERRAT_34 0
#define LV_FONT_MONTSERRAT_36 0
#define LV_FONT_MONTSERRAT_38 0
#define LV_FONT_MONTSERRAT_40 0
#define LV_FONT_MONTSERRAT_42 0
#define LV_FONT_MONTSERRAT_44 0
#define LV_FONT_MONTSERRAT_46 0
#define LV_FONT_MONTSERRAT_48 0
/* Demonstrate special features */
#define LV_FONT_MONTSERRAT_12_SUBPX 0
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, PErisan letters and all their forms*/
#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
/*Pixel perfect monospace font
* http://pelulamu.net/unscii/ */
#define LV_FONT_UNSCII_8 0
#define LV_FONT_UNSCII_16 0
/*Custom font*/
#define UNSCII_8_ICON 1
/* Optionally declare your custom fonts here.
* You can use these fonts as default font too
* and they will be available globally. E.g.
* #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \
* LV_FONT_DECLARE(my_font_2)
*/
/*Always set a default font from the built-in fonts*/
#if LV_HIGH_RESOURCE_MCU>0
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(lv_font_montserrat_16);
#define LV_FONT_DEFAULT &lv_font_montserrat_16
#else
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(unscii_8_icon);
#define LV_FONT_DEFAULT &unscii_8_icon //&lv_font_unscii_8
//#define LV_FONT_DEFAULT my_font
#endif
/* Enable it if you have fonts with a lot of characters.
* The limit depends on the font size, font face and bpp
* but with > 10,000 characters if you see issues probably you need to enable it.*/
#define LV_FONT_FMT_TXT_LARGE 0
/* Enables/disables support for compressed fonts. If it's disabled, compressed
* glyphs cannot be processed by the library and won't be rendered.
*/
#define LV_USE_FONT_COMPRESSED 1
/* Enable subpixel rendering */
#define LV_USE_FONT_SUBPX 1
#if LV_USE_FONT_SUBPX
/* Set the pixel order of the display.
* Important only if "subpx fonts" are used.
* With "normal" font it doesn't matter.
*/
#define LV_FONT_SUBPX_BGR 0
#endif
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_font_user_data_t;
/*================
* THEME USAGE
*================*/
/*Always enable at least on theme*/
/* No theme, you can apply your styles as you need
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
#define LV_USE_THEME_EMPTY 0
/* A fast and impressive theme.
* Flags:
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme
* LV_THEME_MATERIAL_FLAG_DARK: dark theme
* LV_THEME_MATERIAL_FLAG_NO_TRANSITION: disable transitions (state change animations)
* LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state)
* */
#define LV_USE_THEME_MATERIAL 1
/* Mono-color theme for monochrome displays.
* If LV_THEME_DEFAULT_COLOR_PRIMARY is LV_COLOR_BLACK the
* texts and borders will be black and the background will be
* white. Else the colors are inverted.
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
#define LV_USE_THEME_MONO 1
#define LV_USE_THEME_HASP 1
#define LV_THEME_DEFAULT_INCLUDE <stdint.h> /*Include a header for the init. function*/
#define LV_THEME_DEFAULT_INIT lv_theme_hasp_init
#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1)
#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6)
#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT
#if LV_HIGH_RESOURCE_MCU
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_12
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_16
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_22
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_22 //&lv_font_montserrat_28_compressed
#else
#define LV_THEME_DEFAULT_FONT_SMALL LV_FONT_DEFAULT // &lv_font_montserrat_12
#define LV_THEME_DEFAULT_FONT_NORMAL LV_FONT_DEFAULT // &lv_font_montserrat_16
#define LV_THEME_DEFAULT_FONT_SUBTITLE LV_FONT_DEFAULT // &lv_font_montserrat_22
#define LV_THEME_DEFAULT_FONT_TITLE LV_FONT_DEFAULT // &lv_font_montserrat_28_compressed
#endif
/*=================
* Text settings
*=================*/
/* Select a character encoding for strings.
* Your IDE or editor should have the same character encoding
* - LV_TXT_ENC_UTF8
* - LV_TXT_ENC_ASCII
* */
#define LV_TXT_ENC LV_TXT_ENC_UTF8
/*Can break (wrap) texts on these chars*/
#define LV_TXT_BREAK_CHARS " ,.;:-_"
/* If a word is at least this long, will break wherever "prettiest"
* To disable, set to a value <= 0 */
#define LV_TXT_LINE_BREAK_LONG_LEN 0
/* Minimum number of characters in a long word to put on a line before a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
/* Minimum number of characters in a long word to put on a line after a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
/* The control character to use for signalling text recoloring. */
#define LV_TXT_COLOR_CMD "#"
/* Support bidirectional texts.
* Allows mixing Left-to-Right and Right-to-Left texts.
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
#define LV_USE_BIDI 0
#if LV_USE_BIDI
/* Set the default direction. Supported values:
* `LV_BIDI_DIR_LTR` Left-to-Right
* `LV_BIDI_DIR_RTL` Right-to-Left
* `LV_BIDI_DIR_AUTO` detect texts base direction */
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
#endif
/* Enable Arabic/Persian processing
* In these languages characters should be replaced with
* an other form based on their position in the text */
#define LV_USE_ARABIC_PERSIAN_CHARS 0
/*Change the built in (v)snprintf functions*/
#define LV_SPRINTF_CUSTOM 0
#if LV_SPRINTF_CUSTOM
# define LV_SPRINTF_INCLUDE <stdio.h>
# define lv_snprintf snprintf
# define lv_vsnprintf vsnprintf
#else /*!LV_SPRINTF_CUSTOM*/
# define LV_SPRINTF_DISABLE_FLOAT 1
#endif /*LV_SPRINTF_CUSTOM*/
/*=================
* STYLE SETTINGS
*================*/
/* Enable/Disable caching some information about the most common style properties.
* Results in faster drawing but has some memory cost per object per part.
* LEVEL 0: no caching
* LEVEL 1: mark if a property is different from its default value (uses 4 extra byte)
* LEVEL 2: LEVEL 1 + cache the value of some common properties (uses 8 extra bytes)
*/
#define LV_STYLE_CACHE_LEVEL 0 /*Cache level*/
/*===================
* LV_OBJ SETTINGS
*==================*/
typedef struct {
uint8_t objid:8;
uint8_t groupid:8;
uint8_t id;
} lv_obj_user_data_t;
#if LV_USE_USER_DATA
/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/
//typedef hasp_obj_user_data_t lv_obj_user_data_t;
/*Provide a function to free user data*/
#define LV_USE_USER_DATA_FREE 0
#if LV_USE_USER_DATA_FREE
# define LV_USER_DATA_FREE_INCLUDE "something.h" /*Header for user data free function*/
/* Function prototype : void user_data_free(lv_obj_t * obj); */
# define LV_USER_DATA_FREE (user_data_free) /*Invoking for user data free function*/
#endif
#endif
#define LV_USE_OBJ_REALIGN 1
/* Enable to make the object clickable on a larger area.
* LV_EXT_CLICK_AREA_OFF or 0: Disable this feature
* LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px)
* LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px)
*/
#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY
/*==================
* LV OBJ X USAGE
*================*/
/*
* Documentation of the object types: https://docs.lvgl.com/#Object-types
*/
/*Arc (dependencies: -)*/
#define LV_USE_ARC 1
/*Bar (dependencies: -)*/
#define LV_USE_BAR 1
/*Button (dependencies: lv_cont*/
#define LV_USE_BTN 1
/*Button matrix (dependencies: -)*/
#define LV_USE_BTNMATRIX 1
/*Canvas (dependencies: lv_img)*/
#define LV_USE_CANVAS 1
/*Check box (dependencies: lv_btn, lv_label)*/
#define LV_USE_CHECKBOX 1
/*Chart (dependencies: -)*/
#define LV_USE_CHART 1
#if LV_USE_CHART
# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 256
#endif
/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
#define LV_USE_DROPDOWN 1
#if LV_USE_DROPDOWN != 0
/*Open and close default animation time [ms] (0: no animation)*/
# define LV_DROPDOWN_DEF_ANIM_TIME 200
#endif
/*Gauge (dependencies:lv_bar, lv_linemeter)*/
#define LV_USE_GAUGE 1
/*Image (dependencies: lv_label*/
#define LV_USE_IMG 1
/*Image Button (dependencies: lv_btn*/
#define LV_USE_IMGBTN 1
#if LV_USE_IMGBTN
/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/
# define LV_IMGBTN_TILED 0
#endif
/*Label (dependencies: -*/
#define LV_USE_LABEL 1
#if LV_USE_LABEL != 0
/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/
# define LV_LABEL_DEF_SCROLL_SPEED 25
/* Waiting period at beginning/end of animation cycle */
# define LV_LABEL_WAIT_CHAR_COUNT 3
/*Enable selecting text of the label */
# define LV_LABEL_TEXT_SEL 0
/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/
# define LV_LABEL_LONG_TXT_HINT 0
#endif
/*Line (dependencies: -*/
#define LV_USE_LINE 1
/*Linemeter (dependencies: -*/
#define LV_USE_LINEMETER 1
#if LV_USE_LINEMETER
/* Set how precisely should the lines of the line meter be calculated.
* Higher precision means slower rendering.
* 0: normal
* 1: extra precision in the inner ring
* 2. extra precision on the outer ring too
*/
# define LV_LINEMETER_PRECISE 1
#endif
/*Mask (dependencies: -)*/
#define LV_USE_OBJMASK 1
/*Roller (dependencies: lv_ddlist)*/
#define LV_USE_ROLLER 1
#if LV_USE_ROLLER != 0
/*Focus animation time [ms] (0: no animation)*/
# define LV_ROLLER_DEF_ANIM_TIME 200
/*Number of extra "pages" when the roller is infinite*/
# define LV_ROLLER_INF_PAGES 7
#endif
/*Slider (dependencies: lv_bar)*/
#define LV_USE_SLIDER 1
/*Switch (dependencies: lv_slider)*/
#define LV_USE_SWITCH 1
/*Text area (dependencies: lv_label, lv_page)*/
#define LV_USE_TEXTAREA 1
#if LV_USE_TEXTAREA != 0
# define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME 400 /*ms*/
# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
#endif
/*Table (dependencies: lv_label)*/
#define LV_USE_TABLE 1
#if LV_USE_TABLE
# define LV_TABLE_COL_MAX 12
# define LV_TABLE_CELL_STYLE_CNT 4
#endif
/*==================
* Non-user section
*==================*/
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
# define _CRT_SECURE_NO_WARNINGS
#endif
/*--END OF LV_CONF_H--*/
#endif /*LV_CONF_H*/
#endif /*End of "Content enable"*/

View File

@ -47,6 +47,7 @@ build_flags =
; -- littlevgl build options ------------------------------
-D LV_CONF_INCLUDE_SIMPLE ; for lvgl
-D LV_LVGL_H_INCLUDE_SIMPLE ; for lv_drivers
-D LV_COMP_CONF_INCLUDE_SIMPLE ; for components
; -- littlevgl build options ------------------------------
-D SPIFFS_TEMPORAL_FD_CACHE ; speedup opening recent files
; -- ArduinoJson build options ----------------------------
@ -57,20 +58,23 @@ build_flags =
;-D DISABLE_LOGGING
${override.build_flags}
-D HASP_VERSION_MAJOR=0
-D HASP_VERSION_MINOR=2
-D HASP_VERSION_REVISION=1129
-D HASP_VERSION_MINOR=3
-D HASP_VERSION_REVISION=1207
; -- Shared library dependencies in all environments
; Warning : don't put comments after github links => causes infinite download loop
lib_deps =
lvgl/lvgl @ ^7.7.2 ; from PIO library
;bodmer/TFT_eSPI @ ^2.3.4 ; Tft SPI drivers
bxparks/AceButton @ ^1.7.1 ; GPIO button library
bxparks/AceButton @ ^1.8.0 ; GPIO button library
bblanchon/ArduinoJson @ ^6.17.2 ; Json(l) parser
bblanchon/StreamUtils @ 1.6.0 ; for EEPromStream
knolleary/PubSubClient @ ^2.8.0 ; MQTT client
https://github.com/Bodmer/TFT_eSPI.git ; ^2.3.5 needed for DMA
https://github.com/fvanroie/ConsoleInput.git
https://github.com/andrethomas/TasmotaSlave.git
git+https://github.com/Bodmer/TFT_eSPI.git
git+https://github.com/fvanroie/ConsoleInput.git
git+https://github.com/andrethomas/TasmotaSlave.git
git+https://github.com/fvanroie/lv_components.git
git+https://github.com/lvgl/lvgl.git#dev-v8
;lvgl/lvgl @ ^7.7.2 ; from PIO library
;bodmer/TFT_eSPI @ 2.3.4 ; Tft SPI drivers EXACT version 2.3.5 has compile error
; ------ Unused / Test libraries
;https://github.com/netwizeBE/TFT_eSPI.git
;Syslog@^2.0.0 ; Obsoleted
@ -119,6 +123,10 @@ lib_ignore =
lib_deps = LittleFS_esp32
extra_scripts =
tools/copy_partitions.py
[esp8266]
build_flags=
-D HTTP_UPLOAD_BUFLEN=640 ; lower http upload buffer
@ -126,7 +134,7 @@ build_flags=
-D ATOMIC_FS_UPDATE ; enabled compressed ota updates
-D NO_GLOBAL_HTTPUPDATE ; dont instantiate httpUpdate
; -- lvgl build options -----------------------------
-D LV_MEM_SIZE=10240U ; 10kB lvgl memory
-D LV_MEM_SIZE=16384U ; 16kB lvgl memory
; -- hasp-lvgl build options ------------------------
-D HASP_USE_WIFI=1
-D HASP_USE_MQTT=1

View File

@ -1,14 +1,11 @@
; MIT License - Copyright (c) 2020 Francis Van Roie
; For full license information read the LICENSE file in the project folder
;
; Copy this file and rename it to platformio_override.ini
; ONLY edit platformio_override.ini to make local changes to the parameters
; USAGE: Copy this file and rename it to platformio_override.ini
;
; The platformio_override.ini file is not overwritten or monitored by git
; ONLY edit platformio_override.ini to make local changes to the parameters
[platformio]
extra_configs =
; Uncomment the following line to show all User Setups in the PIO sidebar
; Uncomment or edit the lines to show more User Setups in the PIO sidebar
; user_setups/esp32/*.ini
; user_setups/esp8266/*.ini
; user_setups/stm32f4xx/*.ini
@ -16,73 +13,72 @@ extra_configs =
[override]
; -- Hasp config options --------------------------------------
build_flags =
; -- Use settings from file user_config_override.h
; -- Uncomment the next line to use the file src/user_config_override.h settings
; -DUSE_CONFIG_OVERRIDE
;region -- Default Build Environments : Used when Build All ---
extra_default_envs =
;my_custom_build
; Comment unneeded environments or create extra
;esp32dev-mrb3511
;d1mini-lolintft24
;d1mini32-lolintft24
;lolind32pro-lolintft24
;esp12e-st7735
;d132-unoshield
;nodemcu32s-raspi
;esp32dev-ili9488
; d1-mini-esp32_ili9341
; d1-mini-esp8266_ili9341
; lolind32pro-lolintft24
; esp32dev-mrb3511
; esp12e-st7735
; d132-unoshield
; nodemcu32s-raspi
; esp32dev-ili9488
; my_custom_build
;endregion
; -- Define COM ports for each environment --------------------
[env:d1-mini-esp32_ili9341.ini]
upload_port = COM6 ; Change to the correct port
;region -- Define your local COM ports for each environment ---
[env:d1-mini-esp32_ili9341]
monitor_port = COM6 ; Change to the correct port
upload_port = ${env:d1-mini-esp32_ili9341.monitor_port}
[env:d1-mini-esp8266_ili9341.ini]
upload_port = COM4 ; Change to the correct port
[env:d1-mini-esp8266_ili9341]
monitor_port = COM4 ; Change to the correct port
upload_port = ${env:d1-mini-esp8266_ili9341.monitor_port}
[env:lolind32pro-lolintft24]
upload_port = COM3 ; Change to the correct port
[env:esp32dev-mrb3511]
monitor_port = COM3 ; Change to the correct port
upload_port = ${env:esp32dev-mrb3511.monitor_port}
[env:d132-unoshield]
monitor_port = COM9 ; Change to the correct port
;upload_port = ${$env:d132-unoshield.monitor_port}
upload_port = 192.168.4.4 ; IP of the ESP
upload_protocol = espota ; Use ArduinoOTA after flashing over serial
upload_port = 192.168.0.4 ; IP of the ESP
upload_flags =
--port=3232
upload_flags = --port=3232
[env:ttgo_esp32_poe-lolintft24]
monitor_port = COM9 ; Change to the correct port
upload_port = COM9 ; Change to the correct port
;upload_protocol = espota ; Use ArduinoOTA after flashing over serial
;upload_port = 10.1.0.130 ; IP of the ESP
upload_flags =
--port=3232
;upload_port = ${env:ttgo_esp32_poe-lolintft24.monitor_port}
upload_port = 192.168.4.5 ; IP of the ESP
upload_protocol = espota ; Use ArduinoOTA after flashing over serial
upload_flags = --port=3232
; -- Custom Environment configuration example -----------------
[env:lolind32pro-lolintft24]
monitor_port = COM3 ; Change to the correct port
upload_port = ${env:lolind32pro-lolintft24.monitor_port}
;endregion
;region -- Custom Environment configuration example -----------------
[env:my_custom_build]
platform = espressif32@^2.0.0
platform = espressif32
board = nodemcu-32s
board_build.partitions = user_setups/esp32_partition_app1300k_spiffs1216k.csv
upload_port = COM3
monitor_port = COM3
monitor_filters = esp32_exception_decoder
upload_port = ${env:my_custom_build.monitor_port}
debug_tool = esp-prog
debug_init_break = tbreak setup
build_flags =
${esp32.build_flags}
; -- TFT_eSPI build options -----------------------------------
;region -- TFT_eSPI build options -----------------------------------
${lcd.raspberrypi}
${pins.vspi32}
-D TFT_CS=5
-D TFT_DC=4
-D TFT_RST=32
-D TOUCH_CS=22
;endregion
lib_deps =
${env.lib_deps}
${esp32.lib_deps}
lib_ignore =
${env.lib_ignore}
${esp32.lib_ignore}
;endregion

View File

@ -42,40 +42,17 @@
**********************/
// void hasp_background(uint16_t pageid, uint16_t imageid);
/**********************
* STATIC VARIABLES
**********************/
#if LV_USE_ANIMATION
// static void kb_hide_anim_end(lv_anim_t * a);
#endif
/**********************
* STATIC VARIABLES
**********************/
uint8_t haspStartDim = 100;
uint8_t haspStartPage = 0;
uint8_t haspThemeId = 2;
uint16_t haspThemeHue = 200;
char haspPagesPath[32] = "/pages.jsonl";
char haspZiFontPath[32];
lv_style_t style_mbox_bg; /*Black bg. style with opacity*/
lv_obj_t * kb;
// lv_font_t * defaultFont;
#if LV_DEMO_WALLPAPER
LV_IMG_DECLARE(img_bubble_pattern)
#endif
/*
static const char * btnm_map1[] = {" ", "\n", " ", "\n", " ", "\n", " ", "\n", "P1", "P2", "P3", ""};
static const char * btnm_map2[] = {"0", "1", "\n", "2", "3", "\n", "4", "5",
"\n", "6", "7", "\n", "P1", "P2", "P3", ""};
*/
lv_obj_t * pages[HASP_NUM_PAGES];
static lv_font_t * haspFonts[4] = {nullptr, LV_THEME_DEFAULT_FONT_NORMAL, LV_THEME_DEFAULT_FONT_SUBTITLE,
LV_THEME_DEFAULT_FONT_TITLE};
uint8_t current_page = 0;
/**********************
* MACROS
**********************/
@ -86,6 +63,23 @@ uint8_t current_page = 0;
void haspLoadPage(const char * pages);
////////////////////////////////////////////////////////////////////////////////////////////////////
uint8_t haspStartDim = 100;
uint8_t haspStartPage = 0;
uint8_t haspThemeId = 2;
uint16_t haspThemeHue = 200;
char haspPagesPath[32] = "/pages.jsonl";
char haspZiFontPath[32];
lv_style_t style_mbox_bg; /*Black bg. style with opacity*/
lv_obj_t * kb;
// lv_font_t * defaultFont;
lv_obj_t * pages[HASP_NUM_PAGES];
static lv_font_t * haspFonts[4] = {nullptr, LV_THEME_DEFAULT_FONT_NORMAL, LV_THEME_DEFAULT_FONT_SUBTITLE,
LV_THEME_DEFAULT_FONT_TITLE};
uint8_t current_page = 0;
/**
* Get Font ID
*/
@ -136,13 +130,6 @@ bool get_page_id(lv_obj_t * obj, uint8_t * pageid)
////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* WakeUp the display using a command instead of touch
*/
void haspWakeUp()
{
lv_disp_trig_activity(NULL);
}
void haspDisconnect()
{
@ -187,7 +174,7 @@ void haspReconnect()
void haspProgressVal(uint8_t val)
{
lv_obj_t * layer = lv_disp_get_layer_sys(NULL);
lv_obj_t * bar = hasp_find_obj_from_id(255, 10);
lv_obj_t * bar = hasp_find_obj_from_parent_id(get_page_obj(255), (uint8_t)10);
if(layer && bar) {
if(val == 255) {
if(!lv_obj_get_hidden(bar)) {
@ -212,7 +199,7 @@ void haspProgressVal(uint8_t val)
// Sets the value string of the global progress bar
void haspProgressMsg(const char * msg)
{
lv_obj_t * bar = hasp_find_obj_from_id(255, 10);
lv_obj_t * bar = hasp_find_obj_from_parent_id(get_page_obj(255), (uint8_t)10);
char value_str[10];
snprintf_P(value_str, sizeof(value_str), PSTR("value_str"));
@ -399,9 +386,8 @@ void haspSetup()
} else {
Log.error(TAG_HASP, F("Theme could not be loaded"));
}
// lv_theme_set_current(th);
/* ********** Theme Initializations ********** */
/* ********** Theme Initializations ********** */
// lv_style_list_t * list;
// static lv_style_t pagefont;
// lv_style_init(&pagefont);
@ -425,14 +411,6 @@ void haspSetup()
haspLoadPage(haspPagesPath);
haspSetPage(haspStartPage);
// lv_obj_t * obj = lv_btn_create(pages[0], NULL);
// lv_obj_set_size(obj, 100, 100);
// lv_obj_set_user_data(obj, (lv_obj_user_data_t)15);
// /* lv_obj_t * label ; */
// lv_label_create(obj, NULL);
// // haspSetOpacity(obj, LV_OPA_COVER);
// lv_obj_set_event_cb(obj, btn_event_handler);
}
/**********************
@ -493,13 +471,9 @@ void hasp_background(uint16_t pageid, uint16_t imageid)
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void haspGetVersion(char * version, size_t len)
{
// char buffer[16];
snprintf_P(version, len, "%u.%u.%u", HASP_VERSION_MAJOR, HASP_VERSION_MINOR, HASP_VERSION_REVISION);
// return buffer;
}
void haspClearPage(uint16_t pageid)
@ -539,13 +513,14 @@ void haspSetPage(uint8_t pageid)
}
}
// TODO make this a recursicee function
void hasp_set_group_objects(uint8_t groupid, uint8_t eventid, lv_obj_t * src_obj)
{
bool state = dispatch_get_event_state(eventid);
for(uint8_t page = 0; page < HASP_NUM_PAGES; page++) {
uint8_t startid = 100 + groupid * 10; // groups start at id 100
for(uint8_t objid = startid; objid < (startid + 10); objid++) {
lv_obj_t * obj = hasp_find_obj_from_id(page, objid);
lv_obj_t * obj = hasp_find_obj_from_parent_id(get_page_obj(page), objid);
if(obj && obj != src_obj) { // skip source object, if set
lv_obj_set_state(obj, state ? LV_STATE_PRESSED | LV_STATE_CHECKED : LV_STATE_DEFAULT);
}

View File

@ -27,19 +27,6 @@ extern "C" {
* TYPEDEFS
**********************/
enum hasp_event_t { // even = released, odd = pressed
HASP_EVENT_OFF = 0,
HASP_EVENT_ON = 1,
HASP_EVENT_UP = 2,
HASP_EVENT_DOWN = 3,
HASP_EVENT_SHORT = 4,
HASP_EVENT_LONG = 5,
HASP_EVENT_LOST = 6,
HASP_EVENT_HOLD = 7,
HASP_EVENT_DOUBLE = 8
};
/**********************
* GLOBAL PROTOTYPES
**********************/
@ -60,13 +47,12 @@ uint8_t haspGetPage();
void haspClearPage(uint16_t pageid);
void haspGetVersion(char* version,size_t len);
void haspBackground(uint16_t pageid, uint16_t imageid);
//void haspBackground(uint16_t pageid, uint16_t imageid);
void hasp_set_group_objects(uint8_t groupid, uint8_t eventid, lv_obj_t * src_obj);
// void haspNewObject(const JsonObject & config, uint8_t & saved_page_id);
void haspWakeUp(void);
void haspProgressVal(uint8_t val);
bool haspGetConfig(const JsonObject & settings);

View File

@ -5,7 +5,11 @@
#include "ArduinoLog.h"
#include "lvgl.h"
#include "lv_conf.h"
#if LVGL_VERSION_MAJOR != 7
#include "../lv_components.h"
#endif
#include "hasp_conf.h"
#include "hasp.h"
#include "hasp_object.h"
@ -389,6 +393,12 @@ lv_obj_t * FindButtonLabel(lv_obj_t * btn)
{
if(btn) {
lv_obj_t * label = lv_obj_get_child_back(btn, NULL);
#if LVGL_VERSION_MAJOR != 7
if(label) {
if(check_obj_type(label, LV_HASP_LABEL)) {
return label;
}
#else
if(label) {
lv_obj_type_t list;
lv_obj_get_type(label, &list);
@ -397,6 +407,7 @@ lv_obj_t * FindButtonLabel(lv_obj_t * btn)
if(check_obj_type(objtype, LV_HASP_LABEL)) {
return label;
}
#endif
} else {
Log.error(TAG_ATTR, F("FindButtonLabel NULL Pointer encountered"));
@ -426,6 +437,12 @@ static bool haspGetLabelText(lv_obj_t * obj, char * text)
lv_obj_t * label = lv_obj_get_child_back(obj, NULL);
if(label) {
#if LVGL_VERSION_MAJOR != 7
if(check_obj_type(label, LV_HASP_LABEL)) {
text = lv_label_get_text(label);
return true;
}
#else
lv_obj_type_t list;
lv_obj_get_type(label, &list);
@ -433,6 +450,7 @@ static bool haspGetLabelText(lv_obj_t * obj, char * text)
text = lv_label_get_text(label);
return true;
}
#endif
} else {
Log.warning(TAG_ATTR, F("haspGetLabelText NULL Pointer encountered"));
@ -462,11 +480,11 @@ static void hasp_attribute_get_part_state(lv_obj_t * obj, const char * attr_in,
attr_out[len] = 0;
/* Attributes depending on objecttype */
lv_obj_type_t list;
lv_obj_get_type(obj, &list);
const char * objtype = list.type[0];
//lv_obj_type_t list;
//lv_obj_get_type(obj, &list);
//const char * objtype = list.type[0];
if(check_obj_type(objtype, LV_HASP_BUTTON)) {
if(check_obj_type(obj, LV_HASP_BUTTON)) {
switch(index) {
case 1:
state = LV_BTN_STATE_PRESSED;
@ -490,7 +508,7 @@ static void hasp_attribute_get_part_state(lv_obj_t * obj, const char * attr_in,
return;
}
if(check_obj_type(objtype, LV_HASP_BAR)) {
if(check_obj_type(obj, LV_HASP_BAR)) {
if(index == 1) {
part = LV_BAR_PART_INDIC;
} else {
@ -500,7 +518,7 @@ static void hasp_attribute_get_part_state(lv_obj_t * obj, const char * attr_in,
return;
}
if(check_obj_type(objtype, LV_HASP_CHECKBOX)) {
if(check_obj_type(obj, LV_HASP_CHECKBOX)) {
if(index == 1) {
part = LV_CHECKBOX_PART_BULLET;
} else {
@ -510,7 +528,7 @@ static void hasp_attribute_get_part_state(lv_obj_t * obj, const char * attr_in,
return;
}
if(check_obj_type(objtype, LV_HASP_CPICKER)) {
if(check_obj_type(obj, LV_HASP_CPICKER)) {
if(index == 1) {
part = LV_CPICKER_PART_KNOB;
} else {
@ -591,10 +609,9 @@ static void hasp_local_style_attr(lv_obj_t * obj, const char * attr_p, uint16_t
return attribute_bg_grad_dir(obj, part, state, update, attr_p, (lv_grad_dir_t)var);
case ATTR_BG_COLOR: {
lv_color_t color = haspPayloadToColor(payload);
if(part != 64)
return lv_obj_set_style_local_bg_color(obj, part, state, color);
else
return lv_obj_set_style_local_bg_color(obj, LV_PAGE_PART_SCROLLBAR, LV_STATE_CHECKED, color);
if(part != 64) return lv_obj_set_style_local_bg_color(obj, part, state, color);
// else
// return lv_obj_set_style_local_bg_color(obj, LV_PAGE_PART_SCROLLBAR, LV_STATE_CHECKED, color);
}
case ATTR_BG_GRAD_COLOR:
return lv_obj_set_style_local_bg_grad_color(obj, part, state, haspPayloadToColor(payload));
@ -610,8 +627,10 @@ static void hasp_local_style_attr(lv_obj_t * obj, const char * attr_p, uint16_t
return attribute_pad_left(obj, part, state, update, attr_p, (lv_style_int_t)var);
case ATTR_PAD_RIGHT:
return attribute_pad_right(obj, part, state, update, attr_p, (lv_style_int_t)var);
#if LVGL_VERSION_MAJOR == 7
case ATTR_PAD_INNER:
return attribute_pad_inner(obj, part, state, update, attr_p, (lv_style_int_t)var);
#endif
/* Text attributes */
case ATTR_TEXT_LETTER_SPACE:
@ -890,11 +909,11 @@ static void hasp_process_btnmatrix_attribute(lv_obj_t * obj, const char * attr_p
static void hasp_process_obj_attribute_txt(lv_obj_t * obj, const char * attr, const char * payload, bool update)
{
/* Attributes depending on objecttype */
lv_obj_type_t list;
lv_obj_get_type(obj, &list);
const char * objtype = list.type[0];
//lv_obj_type_t list;
//lv_obj_get_type(obj, &list);
//const char * objtype = list.type[0];
if(check_obj_type(objtype, LV_HASP_BUTTON)) {
if(check_obj_type(obj, LV_HASP_BUTTON)) {
if(update) {
haspSetLabelText(obj, payload);
} else {
@ -903,25 +922,28 @@ static void hasp_process_obj_attribute_txt(lv_obj_t * obj, const char * attr, co
}
return;
}
if(check_obj_type(objtype, LV_HASP_LABEL)) {
if(check_obj_type(obj, LV_HASP_LABEL)) {
return update ? lv_label_set_text(obj, payload) : hasp_out_str(obj, attr, lv_label_get_text(obj));
}
if(check_obj_type(objtype, LV_HASP_CHECKBOX)) {
if(check_obj_type(obj, LV_HASP_CHECKBOX)) {
return update ? lv_checkbox_set_text(obj, payload) : hasp_out_str(obj, attr, lv_checkbox_get_text(obj));
}
if(check_obj_type(objtype, LV_HASP_DDLIST)) {
if(check_obj_type(obj, LV_HASP_DDLIST)) {
char buffer[128];
lv_dropdown_get_selected_str(obj, buffer, sizeof(buffer));
return hasp_out_str(obj, attr, buffer);
}
if(check_obj_type(objtype, LV_HASP_ROLLER)) {
if(check_obj_type(obj, LV_HASP_ROLLER)) {
char buffer[128];
lv_roller_get_selected_str(obj, buffer, sizeof(buffer));
return hasp_out_str(obj, attr, buffer);
}
if(check_obj_type(objtype, LV_HASP_WINDOW)) {
return update ? lv_win_set_title(obj, payload) : hasp_out_str(obj, attr, lv_win_get_title(obj));
#if LV_USE_WIN != 0
if(check_obj_type(obj, LV_HASP_WINDOW)) {
// return update ? lv_win_set_title(obj, (const char *)payload) : hasp_out_str(obj, attr,
// lv_win_get_title(obj));
}
#endif
Log.warning(TAG_ATTR, F("Unknown property %s"), attr);
}
@ -932,11 +954,11 @@ static void hasp_process_obj_attribute_val(lv_obj_t * obj, const char * attr, co
uint16_t val = atoi(payload);
/* Attributes depending on objecttype */
lv_obj_type_t list;
lv_obj_get_type(obj, &list);
const char * objtype = list.type[0];
//lv_obj_type_t list;
//lv_obj_get_type(obj, &list);
//const char * objtype = list.type[0];
if(check_obj_type(objtype, LV_HASP_BUTTON) && lv_btn_get_checkable(obj)) {
if(check_obj_type(obj, LV_HASP_BUTTON) && lv_btn_get_checkable(obj)) {
if(update) {
lv_btn_state_t state;
switch(val) {
@ -970,45 +992,45 @@ static void hasp_process_obj_attribute_val(lv_obj_t * obj, const char * attr, co
}
}
if(check_obj_type(objtype, LV_HASP_CHECKBOX)) {
if(check_obj_type(obj, LV_HASP_CHECKBOX)) {
return update ? lv_checkbox_set_checked(obj, is_true(payload))
: hasp_out_int(obj, attr, lv_checkbox_is_checked(obj));
}
if(check_obj_type(objtype, LV_HASP_SWITCH)) {
if(check_obj_type(obj, LV_HASP_SWITCH)) {
if(update) {
return is_true(payload) ? lv_switch_on(obj, LV_ANIM_ON) : lv_switch_off(obj, LV_ANIM_ON);
} else {
return hasp_out_int(obj, attr, lv_switch_get_state(obj));
}
} else if(check_obj_type(objtype, LV_HASP_DDLIST)) {
} else if(check_obj_type(obj, LV_HASP_DDLIST)) {
lv_dropdown_set_selected(obj, val);
return;
} else if(check_obj_type(objtype, LV_HASP_LMETER)) {
} else if(check_obj_type(obj, LV_HASP_LMETER)) {
return update ? lv_linemeter_set_value(obj, intval) : hasp_out_int(obj, attr, lv_linemeter_get_value(obj));
} else if(check_obj_type(objtype, LV_HASP_SLIDER)) {
} else if(check_obj_type(obj, LV_HASP_SLIDER)) {
return update ? lv_slider_set_value(obj, intval, LV_ANIM_ON)
: hasp_out_int(obj, attr, lv_slider_get_value(obj));
} else if(check_obj_type(objtype, LV_HASP_LED)) {
} else if(check_obj_type(obj, LV_HASP_LED)) {
return update ? lv_led_set_bright(obj, (uint8_t)val) : hasp_out_int(obj, attr, lv_led_get_bright(obj));
} else if(check_obj_type(objtype, LV_HASP_ARC)) {
} else if(check_obj_type(obj, LV_HASP_ARC)) {
return update ? lv_arc_set_value(obj, intval) : hasp_out_int(obj, attr, lv_arc_get_value(obj));
} else if(check_obj_type(objtype, LV_HASP_GAUGE)) {
} else if(check_obj_type(obj, LV_HASP_GAUGE)) {
return update ? lv_gauge_set_value(obj, 0, intval) : hasp_out_int(obj, attr, lv_gauge_get_value(obj, 0));
} else if(check_obj_type(objtype, LV_HASP_ROLLER)) {
} else if(check_obj_type(obj, LV_HASP_ROLLER)) {
lv_roller_set_selected(obj, val, LV_ANIM_ON);
return;
} else if(check_obj_type(objtype, LV_HASP_BAR)) {
} else if(check_obj_type(obj, LV_HASP_BAR)) {
return update ? lv_bar_set_value(obj, intval, LV_ANIM_ON) : hasp_out_int(obj, attr, lv_bar_get_value(obj));
} else if(check_obj_type(objtype, LV_HASP_CPICKER)) {
} else if(check_obj_type(obj, LV_HASP_CPICKER)) {
return update ? (void)lv_cpicker_set_color(obj, haspPayloadToColor(payload))
: hasp_out_color(obj, attr, lv_cpicker_get_color(obj));
}
@ -1024,11 +1046,11 @@ static void hasp_process_obj_attribute_range(lv_obj_t * obj, const char * attr,
int32_t val32 = strtol(payload, nullptr, DEC);
/* Attributes depending on objecttype */
lv_obj_type_t list;
lv_obj_get_type(obj, &list);
const char * objtype = list.type[0];
//lv_obj_type_t list;
//lv_obj_get_type(obj, &list);
//const char * objtype = list.type[0];
if(check_obj_type(objtype, LV_HASP_SLIDER)) {
if(check_obj_type(obj, LV_HASP_SLIDER)) {
int16_t min = lv_slider_get_min_value(obj);
int16_t max = lv_slider_get_max_value(obj);
if(update && (set_min ? val : min) >= (set_max ? val : max)) return; // prevent setting min>=max
@ -1036,7 +1058,7 @@ static void hasp_process_obj_attribute_range(lv_obj_t * obj, const char * attr,
: hasp_out_int(obj, attr, set_min ? min : max);
}
if(check_obj_type(objtype, LV_HASP_GAUGE)) {
if(check_obj_type(obj, LV_HASP_GAUGE)) {
int32_t min = lv_gauge_get_min_value(obj);
int32_t max = lv_gauge_get_max_value(obj);
if(update && (set_min ? val32 : min) >= (set_max ? val32 : max)) return; // prevent setting min>=max
@ -1044,7 +1066,7 @@ static void hasp_process_obj_attribute_range(lv_obj_t * obj, const char * attr,
: hasp_out_int(obj, attr, set_min ? min : max);
}
if(check_obj_type(objtype, LV_HASP_ARC)) {
if(check_obj_type(obj, LV_HASP_ARC)) {
int16_t min = lv_arc_get_min_value(obj);
int16_t max = lv_arc_get_max_value(obj);
if(update && (set_min ? val : min) >= (set_max ? val : max)) return; // prevent setting min>=max
@ -1052,7 +1074,7 @@ static void hasp_process_obj_attribute_range(lv_obj_t * obj, const char * attr,
: hasp_out_int(obj, attr, set_min ? min : max);
}
if(check_obj_type(objtype, LV_HASP_BAR)) {
if(check_obj_type(obj, LV_HASP_BAR)) {
int16_t min = lv_bar_get_min_value(obj);
int16_t max = lv_bar_get_max_value(obj);
if(update && (set_min ? val : min) >= (set_max ? val : max)) return; // prevent setting min>=max
@ -1060,7 +1082,7 @@ static void hasp_process_obj_attribute_range(lv_obj_t * obj, const char * attr,
: hasp_out_int(obj, attr, set_min ? min : max);
}
if(check_obj_type(objtype, LV_HASP_LMETER)) {
if(check_obj_type(obj, LV_HASP_LMETER)) {
int32_t min = lv_linemeter_get_min_value(obj);
int32_t max = lv_linemeter_get_max_value(obj);
if(update && (set_min ? val32 : min) >= (set_max ? val32 : max)) return; // prevent setting min>=max
@ -1068,7 +1090,7 @@ static void hasp_process_obj_attribute_range(lv_obj_t * obj, const char * attr,
: hasp_out_int(obj, attr, set_min ? min : max);
}
if(check_obj_type(objtype, LV_HASP_CHART)) {
if(check_obj_type(obj, LV_HASP_CHART)) {
int16_t min = lv_chart_get_min_value(obj);
int16_t max = lv_chart_get_max_value(obj);
if(update && (set_min ? val : min) >= (set_max ? val : max)) return; // prevent setting min>=max
@ -1113,8 +1135,10 @@ void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char
if(update) {
lv_obj_set_width(obj, val);
if(check_obj_type(obj, LV_HASP_CPICKER)) {
#if LVGL_VERSION_MAJOR == 7
lv_cpicker_set_type(obj, lv_obj_get_width(obj) == lv_obj_get_height(obj) ? LV_CPICKER_TYPE_DISC
: LV_CPICKER_TYPE_RECT);
#endif
}
} else {
hasp_out_int(obj, attr, lv_obj_get_width(obj));
@ -1126,8 +1150,10 @@ void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char
if(update) {
lv_obj_set_height(obj, val);
if(check_obj_type(obj, LV_HASP_CPICKER)) {
#if LVGL_VERSION_MAJOR == 7
lv_cpicker_set_type(obj, lv_obj_get_width(obj) == lv_obj_get_height(obj) ? LV_CPICKER_TYPE_DISC
: LV_CPICKER_TYPE_RECT);
#endif
}
} else {
hasp_out_int(obj, attr, lv_obj_get_height(obj));
@ -1136,7 +1162,7 @@ void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char
}
case ATTR_ID:
return update ? (void)(obj->user_data = (uint8_t)val) : hasp_out_int(obj, attr, obj->user_data);
return update ? (void)(obj->user_data.id = (uint8_t)val) : hasp_out_int(obj, attr, obj->user_data.id);
case ATTR_VIS:
return update ? lv_obj_set_hidden(obj, !is_true(payload))

View File

@ -5,8 +5,12 @@
#define HASP_ATTR_SET_H
#include "lvgl.h"
#if LVGL_VERSION_MAJOR != 7
#include "../lv_components.h"
#endif
#include "hasp_conf.h"
#include "hasp.h"
#include "lv_core/lv_obj_style_dec.h"
#ifdef __cplusplus
extern "C" {
@ -44,7 +48,7 @@ _HASP_ATTRIBUTE(PAD_TOP, pad_top, lv_style_int_t)
_HASP_ATTRIBUTE(PAD_BOTTOM, pad_bottom, lv_style_int_t)
_HASP_ATTRIBUTE(PAD_LEFT, pad_left, lv_style_int_t)
_HASP_ATTRIBUTE(PAD_RIGHT, pad_right, lv_style_int_t)
_HASP_ATTRIBUTE(PAD_INNER, pad_inner, lv_style_int_t)
//_HASP_ATTRIBUTE(PAD_INNER, pad_inner, lv_style_int_t)
#if LV_USE_BLEND_MODES
_HASP_ATTRIBUTE(BG_BLEND_MODE, bg_blend_mode, lv_blend_mode_t)
_HASP_ATTRIBUTE(BORDER_BLEND_MODE, border_blend_mode, lv_blend_mode_t)

View File

@ -346,7 +346,7 @@ void configWriteConfig()
void configSetup()
{
DynamicJsonDocument settings(1024 + 128);
DynamicJsonDocument settings(1024 + 512);
for(uint8_t i = 0; i < 2; i++) {
Serial.print(__FILE__);

View File

@ -5,6 +5,7 @@
#define HASP_DEBUG_H
#include "ArduinoJson.h"
#include "ArduinoLog.h"
#include "lvgl.h"
/* ===== Default Event Processors ===== */

View File

@ -66,21 +66,11 @@ bool dispatch_factory_reset()
return formated && erased;
}
void dispatchGpioOutput(int output, bool state)
void dispatchGpioOutput(int groupid, bool state)
{
int pin = 0;
if(pin >= 0) {
Log.notice(TAG_MSGR, F("PIN OUTPUT STATE %d"), state);
#if defined(ARDUINO_ARCH_ESP32)
ledcWrite(99, state ? 1023 : 0); // ledChannel and value
#elif defined(STM32F4xx)
digitalWrite(HASP_OUTPUT_PIN, state);
#else
digitalWrite(D1, state);
// analogWrite(pin, state ? 1023 : 0);
#endif
if(groupid >= 0) {
Log.notice(TAG_MSGR, F("GROUP %d OUTPUT STATE %d"), groupid, state);
gpio_set_group_outputs(groupid, state ? HASP_EVENT_ON : HASP_EVENT_OFF);
}
}
@ -88,7 +78,7 @@ void dispatchGpioOutput(String strTopic, const char * payload)
{
String strTemp((char *)0);
strTemp.reserve(128);
strTemp = strTopic.substring(7, strTopic.length());
strTemp = strTopic.substring(6, strTopic.length());
dispatchGpioOutput(strTemp.toInt(), is_true(payload));
}
@ -241,18 +231,31 @@ void dispatch_text_line(const char * cmnd)
}
// send idle state to the client
void dispatch_output_idle_state(const char * state)
void dispatch_output_idle_state(uint8_t state)
{
char buffer[6];
switch(state) {
case HASP_SLEEP_LONG:
memcpy_P(buffer, PSTR("LONG"), sizeof(buffer));
break;
case HASP_SLEEP_SHORT:
memcpy_P(buffer, PSTR("SHORT"), sizeof(buffer));
break;
default:
memcpy_P(buffer, PSTR("OFF"), sizeof(buffer));
}
#if !defined(HASP_USE_MQTT) && !defined(HASP_USE_TASMOTA_SLAVE)
Log.notice(TAG_MSGR, F("idle = %s"), state);
Log.notice(TAG_MSGR, F("idle = %s"), buffer);
#else
#if HASP_USE_MQTT > 0
mqtt_send_state(F("idle"), state);
mqtt_send_state(F("idle"), buffer);
#endif
#if HASP_USE_TASMOTA_SLAVE > 0
slave_send_state(F("idle"), state);
slave_send_state(F("idle"), buffer);
#endif
#endif
@ -708,7 +711,7 @@ void dispatch_calibrate(const char *, const char *)
void dispatch_wakeup(const char *, const char *)
{
haspWakeUp();
guiWakeUp();
}
void dispatch_reboot(const char *, const char *)

View File

@ -8,6 +8,19 @@
#define LOG_CMND_CTR "CMND: "
enum hasp_event_t { // even = released, odd = pressed
HASP_EVENT_OFF = 0,
HASP_EVENT_ON = 1,
HASP_EVENT_UP = 2,
HASP_EVENT_DOWN = 3,
HASP_EVENT_SHORT = 4,
HASP_EVENT_LONG = 5,
HASP_EVENT_LOST = 6,
HASP_EVENT_HOLD = 7,
HASP_EVENT_DOUBLE = 8
};
/* ===== Default Event Processors ===== */
void dispatchSetup(void);
void IRAM_ATTR dispatchLoop(void);
@ -31,7 +44,7 @@ void dispatch_backlight(const char * payload);
void dispatch_web_update(const char * espOtaUrl);
void dispatch_reboot(bool saveConfig);
void dispatch_output_idle_state(const char * state);
void dispatch_output_idle_state(uint8_t state);
void dispatch_output_statusupdate(void);
void dispatch_output_current_page();

View File

@ -21,7 +21,7 @@ static AceButton * button[HASP_NUM_INPUTS];
// An array of button pins, led pins, and the led states. Cannot be const
// because ledState is mutable.
hasp_gpio_config_t gpioConfig[HASP_NUM_GPIO_CONFIG] = {
// {2, 8, INPUT, LOW}, {3, 9, OUTPUT, LOW}, {4, 10, INPUT, HIGH}, {5, 11, OUTPUT, LOW}, {6, 12, INPUT, LOW},
// {2, 8, INPUT, LOW}, {3, 9, OUTPUT, LOW}, {4, 10, INPUT, HIGH}, {5, 11, OUTPUT, LOW}, {6, 12, INPUT, LOW},
};
#if defined(ARDUINO_ARCH_ESP32)
@ -81,7 +81,7 @@ static void gpio_event_handler(AceButton * button, uint8_t eventType, uint8_t bu
eventid = HASP_EVENT_LOST;
memcpy_P(buffer, PSTR("UNKNOWN"), sizeof(buffer));
}
dispatch_button(button->getId(), buffer);
dispatch_button(gpioConfig[button->getId()].group, buffer);
dispatch_send_group_event(gpioConfig[button->getId()].group, eventid, true);
}
@ -183,37 +183,14 @@ void gpioSetup()
{
aceButtonSetup();
// return;
#if defined(ARDUINO_ARCH_ESP8266)
gpioAddButton(D2, INPUT_PULLUP, HIGH, 1);
pinMode(D1, OUTPUT);
#endif
#if defined(ARDUINO_ARCH_ESP32)
// gpioAddButton( D2, INPUT, HIGH, 1);
// pinMode(D1, OUTPUT);
#endif
/*
#if defined(ARDUINO_ARCH_ESP8266)
pinMode(D1, OUTPUT);
pinMode(D2, INPUT_PULLUP);
#endif
#if defined(STM32F4xx)
pinMode(HASP_OUTPUT_PIN, OUTPUT);
pinMode(HASP_INPUT_PIN, INPUT);
#endif
*/
for(uint8_t i = 0; i < HASP_NUM_GPIO_CONFIG; i++) {
uint8_t input_mode;
switch(gpioConfig[i].gpio_function) {
case OUTPUT:
input_mode = OUTPUT;
break;
case INPUT_PULLUP:
input_mode = INPUT_PULLUP;
case INPUT:
input_mode = INPUT;
break;
#ifndef ARDUINO_ARCH_ESP8266
case INPUT_PULLDOWN:
@ -221,7 +198,7 @@ void gpioSetup()
break;
#endif
default:
input_mode = INPUT;
input_mode = INPUT_PULLUP;
}
switch(gpioConfig[i].type) {
@ -379,13 +356,14 @@ bool gpioIsSystemPin(uint8_t gpio)
} // if tft_espi pins
// To-do:
// Backlight GPIO
// Network GPIOs
// Serial GPIOs
// Tasmota Slave GPIOs
#ifdef ARDUINO_ARCH_ESP32
if(psramFound()) {
if((gpio >= 16) && (gpio <= 17)) return true; // PSRAM
if((gpio == 16) || (gpio == 17)) return true; // PSRAM
}
#endif

View File

@ -79,27 +79,24 @@ static Ticker tick; /* timer for interrupt handler */
static Ticker tick(lv_tick_handler, LVGL_TICK_PERIOD); // guiTickPeriod);
#endif
bool guiCheckSleep()
/* **************************** SLEEP & WAKEUP ************************************** */
bool IRAM_ATTR guiCheckSleep()
{
char idle_state[6];
uint32_t idle = lv_disp_get_inactive_time(NULL);
if(idle >= (guiSleepTime1 + guiSleepTime2) * 1000U) {
if(guiSleeping != HASP_SLEEP_SHORT) {
snprintf_P(idle_state, sizeof(idle_state), PSTR("LONG"));
dispatch_output_idle_state(idle_state);
if(guiSleeping != HASP_SLEEP_LONG) {
dispatch_output_idle_state(HASP_SLEEP_LONG);
guiSleeping = HASP_SLEEP_LONG;
}
} else if(idle >= guiSleepTime1 * 1000U) {
if(guiSleeping != HASP_SLEEP_SHORT) {
snprintf_P(idle_state, sizeof(idle_state), PSTR("SHORT"));
dispatch_output_idle_state(idle_state);
dispatch_output_idle_state(HASP_SLEEP_SHORT);
guiSleeping = HASP_SLEEP_SHORT;
}
} else {
if(guiSleeping != HASP_SLEEP_OFF) {
snprintf_P(idle_state, sizeof(idle_state), PSTR("OFF"));
dispatch_output_idle_state(idle_state);
dispatch_output_idle_state(HASP_SLEEP_OFF);
guiSleeping = HASP_SLEEP_OFF;
}
}
@ -107,6 +104,16 @@ bool guiCheckSleep()
return (guiSleeping != HASP_SLEEP_OFF);
}
/**
* WakeUp the display using a command instead of touch
*/
void guiWakeUp()
{
lv_disp_trig_activity(NULL);
}
/* **************************** SCREENSHOTS ************************************** */
/* After flusing to the file stream or web client, we also send the buffer to the tft */
static void IRAM_ATTR printscreen_flush_cb(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p)
{
@ -135,6 +142,8 @@ static void IRAM_ATTR printscreen_flush_cb(lv_disp_drv_t * disp, const lv_area_t
// lv_disp_flush_ready(disp); ===> moved into the drivers
}
/* **************************** GUI TICKER ************************************** */
/* Interrupt driven periodic handler */
static void ICACHE_RAM_ATTR lv_tick_handler(void)
{
@ -408,23 +417,12 @@ bool IRAM_ATTR my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t *
// Ignore first press?
// if(touchX > tft.width() || touchY > tft.height()) {
// Serial.print(F("Y or y outside of expected parameters.. x: "));
// Serial.print(touchX);
// Serial.print(F(" / y: "));
// Serial.println(touchY);
// } else {
/*Save the state and save the pressed coordinate for cursor position */
data->state = touched ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
if(touched) {
data->point.x = touchX;
data->point.y = touchY;
}
/* Serial.print("Data x");
Serial.println(touchX);
Serial.print("Data y");
Serial.println(touchY);*/
//}
#endif
return false; /*Return `false` because we are not buffering and no more data to read*/
@ -600,7 +598,8 @@ void guiSetup()
lv_bar_set_value(bar, 10, LV_ANIM_OFF);
lv_obj_set_size(bar, 200, 15);
lv_obj_align(bar, lv_layer_sys(), LV_ALIGN_CENTER, 0, -10);
lv_obj_set_user_data(bar, 10);
lv_obj_user_data_t udata = (lv_obj_user_data_t){10, 1, 0};
lv_obj_set_user_data(bar, udata);
lv_obj_set_style_local_value_color(bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_obj_set_style_local_value_align(bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_ALIGN_CENTER);
lv_obj_set_style_local_value_ofs_y(bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, 20);
@ -682,6 +681,7 @@ void guiStop()
#endif
}
////////////////////////////////////////////////////////////////////////////////////////////////////
bool guiGetBacklight()
{
return guiBacklightIsOn;

View File

@ -24,11 +24,12 @@ void guiTakeScreenshot(const char * pFileName); // to file
void guiTakeScreenshot(); // webclient
/* ===== Getter and Setter Functions ===== */
void guiWakeUp(void);
void guiSetDim(int8_t level);
int8_t guiGetDim(void);
void guiSetBacklight(bool lighton);
bool guiGetBacklight();
bool guiCheckSleep();
bool IRAM_ATTR guiCheckSleep();
/* ===== Read/Write Configuration ===== */
bool guiGetConfig(const JsonObject & settings);

View File

@ -146,6 +146,7 @@ String getOption(int value, String label, bool selected)
(selected ? PSTR(" selected") : ""), label.c_str());
return buffer;
}
String getOption(String value, String label, bool selected)
{
char buffer[128];
@ -153,6 +154,7 @@ String getOption(String value, String label, bool selected)
(selected ? PSTR(" selected") : ""), label.c_str());
return buffer;
}
void webSendFooter()
{
char buffer[16];
@ -179,7 +181,7 @@ void webSendPage(char * nodename, uint32_t httpdatalength, bool gohome = false)
/* Calculate Content Length upfront */
uint16_t contentLength = strlen(buffer); // verion length
contentLength += sizeof(HTTP_DOCTYPE) - 1;
contentLength += sizeof(HTTP_HEADER) - 1 - 2 + strlen(nodename);
contentLength += sizeof(HTTP_HEADER) - 1 - 2 + strlen(nodename); // -2 for %s
contentLength += sizeof(HTTP_SCRIPT) - 1;
contentLength += sizeof(HTTP_STYLE) - 1;
contentLength += sizeof(HASP_STYLE) - 1;
@ -1090,14 +1092,15 @@ void webHandleGuiConfig()
httpMessage += F("<p><b>Backlight Control</b> <select id='bcklpin' name='bcklpin'>");
httpMessage += getOption(-1, F("None"), bcklpin == -1);
#if defined(ARDUINO_ARCH_ESP32)
httpMessage += getOption(5, F("GPIO 5"), bcklpin == 5);
httpMessage += getOption(5, F("GPIO 5"), bcklpin == 5); // D8 on ESP32 for D1 mini 32
httpMessage += getOption(16, F("GPIO 16"), bcklpin == 16); // D4 on ESP32 for D1 mini 32
httpMessage += getOption(17, F("GPIO 17"), bcklpin == 17);
httpMessage += getOption(18, F("GPIO 18"), bcklpin == 18);
httpMessage += getOption(19, F("GPIO 19"), bcklpin == 19);
httpMessage += getOption(21, F("GPIO 21"), bcklpin == 21);
httpMessage += getOption(22, F("GPIO 22"), bcklpin == 22);
httpMessage += getOption(23, F("GPIO 23"), bcklpin == 23);
httpMessage += getOption(17, F("GPIO 17"), bcklpin == 17); // D3 on ESP32 for D1 mini 32
httpMessage += getOption(18, F("GPIO 18"), bcklpin == 18); // D5 on ESP32 for D1 mini 32
httpMessage += getOption(19, F("GPIO 19"), bcklpin == 19); // D6 on ESP32 for D1 mini 32
httpMessage += getOption(21, F("GPIO 21"), bcklpin == 21); // D1 on ESP32 for D1 mini 32
httpMessage += getOption(22, F("GPIO 22"), bcklpin == 22); // D2 on ESP32 for D1 mini 32
httpMessage += getOption(23, F("GPIO 23"), bcklpin == 23); // D7 on ESP32 for D1 mini 32
httpMessage += getOption(32, F("GPIO 32"), bcklpin == 32); // TFT_LED on the Lolin D32 Pro
#else
httpMessage += getOption(5, F("D1 - GPIO 5"), bcklpin == 5);
httpMessage += getOption(4, F("D2 - GPIO 4"), bcklpin == 4);
@ -1216,9 +1219,9 @@ void webHandleGpioConfig()
if(webServer.hasArg(PSTR("save"))) {
uint8_t id = webServer.arg(F("id")).toInt();
uint8_t pin = webServer.arg(F("pin")).toInt() + webServer.arg(F("state")).toInt();
uint8_t type = webServer.arg(F("type")).toInt();
uint8_t group = webServer.arg(F("chan")).toInt();
uint8_t pin = webServer.arg(F("pin")).toInt();
uint8_t type = webServer.arg(F("type")).toInt() + webServer.arg(F("state")).toInt();
uint8_t group = webServer.arg(F("group")).toInt();
uint8_t pinfunc = webServer.arg(F("func")).toInt();
gpioSavePinConfig(id, pin, type, group, pinfunc);
}
@ -1269,7 +1272,18 @@ void webHandleGpioConfig()
httpMessage += F("</td><td>");
httpMessage += conf.group;
httpMessage += F("</td><td>Low</td><td><a href='/config/gpio/options?id=");
httpMessage += F("</td><td>");
bool inverted = (conf.type == HASP_GPIO_BUTTON_INVERTED) ||
(conf.type == HASP_GPIO_SWITCH_INVERTED) || (conf.type == HASP_GPIO_LED_INVERTED) ||
(conf.type == HASP_GPIO_RELAY_INVERTED) || (conf.type == HASP_GPIO_PWM_INVERTED);
if(inverted) {
httpMessage += F("High");
} else {
httpMessage += F("Low");
}
httpMessage += F("</td><td><a href='/config/gpio/options?id=");
httpMessage += id;
httpMessage += ("'>Edit</a> <a href='/config/gpio?save=&id=");
httpMessage += id;
@ -1356,18 +1370,18 @@ void webHandleGpioOptions()
}
httpMessage += F("</select></p>");
httpMessage += F("<p><b>Channel</b> <select id='chan' name='chan'>");
httpMessage += F("<p><b>Group</b> <select id='group' name='group'>");
for(uint8_t i = 0; i < 15; i++) {
httpMessage += getOption(i, "Channel " + String(i), i == conf.group);
httpMessage += getOption(i, "Group " + String(i), i == conf.group);
}
httpMessage += F("</select></p>");
httpMessage += F("<p><b>Default State</b> <select id='state' name='state'>");
selected = (conf.type == HASP_GPIO_BUTTON_INVERTED) || (conf.type == HASP_GPIO_SWITCH_INVERTED) ||
bool inverted = (conf.type == HASP_GPIO_BUTTON_INVERTED) || (conf.type == HASP_GPIO_SWITCH_INVERTED) ||
(conf.type == HASP_GPIO_LED_INVERTED) || (conf.type == HASP_GPIO_RELAY_INVERTED) ||
(conf.type == HASP_GPIO_PWM_INVERTED);
httpMessage += getOption(0, F("High"), !selected);
httpMessage += getOption(1, F("Low"), selected);
httpMessage += getOption(1, F("High"), inverted);
httpMessage += getOption(0, F("Low"), !inverted);
httpMessage += F("</select></p>");
httpMessage += F("<p><button type='submit' name='save' value='gpio'>Save Settings</button></p></form>");

View File

@ -303,7 +303,7 @@ static void mqtt_message_cb(char * topic, byte * payload, unsigned int length)
snprintf_P(tmp_topic, sizeof(tmp_topic), PSTR("%sstatus"), mqttNodeTopic);
snprintf_P(msg, sizeof(msg), PSTR("ON"));
/*bool res =*/ mqttClient.publish(tmp_topic, msg, true);
/*bool res =*/mqttClient.publish(tmp_topic, msg, true);
}
} else {
@ -334,6 +334,7 @@ void mqttStart()
bool mqttFirstConnect = true;
mqttClient.setServer(mqttServer, 1883);
// mqttClient.setSocketTimeout(10); //in seconds
/* Construct unique Client ID*/
{
@ -348,6 +349,8 @@ void mqttStart()
snprintf_P(buffer, sizeof(buffer), PSTR("%sstatus"), mqttNodeTopic); // lastWillTopic
snprintf_P(lastWillPayload, sizeof(lastWillPayload), PSTR("OFF")); // lastWillPayload
haspProgressMsg(F("Connecting MQTT..."));
haspProgressVal(mqttReconnectCount * 5);
if(!mqttClient.connect(mqttClientId, mqttUser, mqttPassword, buffer, 2, false, lastWillPayload, true)) {
// Retry until we give up and restart after connectTimeout seconds
mqttReconnectCount++;
@ -388,7 +391,7 @@ void mqttStart()
}
Log.warning(TAG_MQTT, buffer);
if(mqttReconnectCount > 50) {
if(mqttReconnectCount > 20) {
Log.error(TAG_MQTT, F("Retry count exceeded, rebooting..."));
dispatch_reboot(false);
}

View File

@ -58,12 +58,13 @@ void IRAM_ATTR networkLoop(void)
bool networkEvery5Seconds(void)
{
#if HASP_USE_ETHERNET > 0
ethernetEvery5Seconds();
return ethernetEvery5Seconds();
#endif
#if HASP_USE_WIFI > 0
wifiEvery5Seconds();
return wifiEvery5Seconds();
#endif
return false;
}
bool networkEverySecond(void)
@ -75,6 +76,7 @@ bool networkEverySecond(void)
#if HASP_USE_WIFI > 0
// return wifiEverySecond();
#endif
return true;
}
#endif

View File

@ -15,6 +15,11 @@
#include "ArduinoLog.h"
#include "lvgl.h"
#if LVGL_VERSION_MAJOR != 7
#include "../lv_components.h"
#endif
#include "hasp.h"
#include "hasp_gui.h"
#include "hasp_object.h"
@ -23,7 +28,7 @@
// ##################### Object Finders ########################################################
lv_obj_t * hasp_find_obj_from_id(lv_obj_t * parent, uint8_t objid)
lv_obj_t * hasp_find_obj_from_parent_id(lv_obj_t * parent, uint8_t objid)
{
if(objid == 0 || parent == nullptr) return parent;
@ -31,14 +36,15 @@ lv_obj_t * hasp_find_obj_from_id(lv_obj_t * parent, uint8_t objid)
child = lv_obj_get_child(parent, NULL);
while(child) {
/* child found, return it */
if(child->user_data && (lv_obj_user_data_t)objid == child->user_data) return child;
if(objid == child->user_data.id) return child;
/* check grandchildren */
lv_obj_t * grandchild = hasp_find_obj_from_id(child, objid);
lv_obj_t * grandchild = hasp_find_obj_from_parent_id(child, objid);
if(grandchild) return grandchild; /* grandchild found, return it */
/* check tabs */
if(check_obj_type(child, LV_HASP_TABVIEW)) {
#if LVGL_VERSION_MAJOR == 7
uint16_t tabcount = lv_tabview_get_tab_count(child);
for(uint16_t i = 0; i < tabcount; i++) {
lv_obj_t * tab = lv_tabview_get_tab(child, i);
@ -46,9 +52,10 @@ lv_obj_t * hasp_find_obj_from_id(lv_obj_t * parent, uint8_t objid)
if(tab->user_data && (lv_obj_user_data_t)objid == tab->user_data) return tab; /* tab found, return it */
/* check grandchildren */
grandchild = hasp_find_obj_from_id(tab, objid);
grandchild = hasp_find_obj_from_parent_id(tab, objid);
if(grandchild) return grandchild; /* grandchild found, return it */
}
#endif
}
/* try next sibling */
@ -57,16 +64,17 @@ lv_obj_t * hasp_find_obj_from_id(lv_obj_t * parent, uint8_t objid)
return NULL;
}
lv_obj_t * hasp_find_obj_from_id(uint8_t pageid, uint8_t objid)
{
return hasp_find_obj_from_id(get_page_obj(pageid), objid);
}
// lv_obj_t * hasp_find_obj_from_page_id(uint8_t pageid, uint8_t objid)
// {
// return hasp_find_obj_from_parent_id(get_page_obj(pageid), objid);
// }
bool hasp_find_id_from_obj(lv_obj_t * obj, uint8_t * pageid, lv_obj_user_data_t * objid)
bool hasp_find_id_from_obj(lv_obj_t * obj, uint8_t * pageid, uint8_t * objid)
{
if(!get_page_id(obj, pageid)) return false;
if(!(obj->user_data > 0)) return false;
memcpy(objid, &obj->user_data, sizeof(lv_obj_user_data_t));
if(!(obj->user_data.id > 0)) return false;
// memcpy(objid, &obj->user_data.id, sizeof(lv_obj_user_data_t));
*objid = obj->user_data.id;
return true;
}
@ -77,7 +85,7 @@ bool hasp_find_id_from_obj(lv_obj_t * obj, uint8_t * pageid, lv_obj_user_data_t
* @return true or false wether the types match
* @note
*/
bool check_obj_type(const char * lvobjtype, lv_hasp_obj_type_t haspobjtype)
bool check_obj_type_str(const char * lvobjtype, lv_hasp_obj_type_t haspobjtype)
{
lvobjtype += 3; // skip "lv_"
@ -153,10 +161,14 @@ bool check_obj_type(const char * lvobjtype, lv_hasp_obj_type_t haspobjtype)
*/
bool check_obj_type(lv_obj_t * obj, lv_hasp_obj_type_t haspobjtype)
{
#if LVGL_VERSION_MAJOR != 7
return obj->user_data.objid == (uint8_t)haspobjtype;
#else
lv_obj_type_t list;
lv_obj_get_type(obj, &list);
const char * objtype = list.type[0];
return check_obj_type(objtype, haspobjtype);
#endif
}
void hasp_object_tree(lv_obj_t * parent, uint8_t pageid, uint16_t level)
@ -173,7 +185,7 @@ void hasp_object_tree(lv_obj_t * parent, uint8_t pageid, uint16_t level)
child = lv_obj_get_child(parent, NULL);
while(child) {
/* child found, process it */
if(child->user_data) hasp_object_tree(child, pageid, level + 1);
hasp_object_tree(child, pageid, level + 1);
/* try next sibling */
child = lv_obj_get_child(parent, child);
@ -181,12 +193,14 @@ void hasp_object_tree(lv_obj_t * parent, uint8_t pageid, uint16_t level)
/* check tabs */
if(check_obj_type(parent, LV_HASP_TABVIEW)) {
#if LVGL_VERSION_MAJOR == 7
uint16_t tabcount = lv_tabview_get_tab_count(parent);
for(uint16_t i = 0; i < tabcount; i++) {
lv_obj_t * tab = lv_tabview_get_tab(child, i);
Log.verbose(TAG_HASP, "Found tab %i", i);
if(tab->user_data) hasp_object_tree(tab, pageid, level + 1);
}
#endif
}
}
@ -256,33 +270,27 @@ static inline void hasp_send_obj_attribute_txt(lv_obj_t * obj, const char * txt)
void IRAM_ATTR btn_event_handler(lv_obj_t * obj, lv_event_t event)
{
uint8_t eventid;
char buffer[6];
switch(event) {
case LV_EVENT_PRESSED:
eventid = HASP_EVENT_DOWN;
memcpy_P(buffer, PSTR("DOWN"), sizeof(buffer));
break;
case LV_EVENT_CLICKED:
// UP = the same object was release then was pressed and press was not lost!
eventid = HASP_EVENT_UP;
memcpy_P(buffer, PSTR("UP"), sizeof(buffer));
break;
case LV_EVENT_SHORT_CLICKED:
eventid = HASP_EVENT_SHORT;
memcpy_P(buffer, PSTR("SHORT"), sizeof(buffer));
break;
case LV_EVENT_LONG_PRESSED:
eventid = HASP_EVENT_LONG;
memcpy_P(buffer, PSTR("LONG"), sizeof(buffer));
break;
case LV_EVENT_LONG_PRESSED_REPEAT:
eventid = HASP_EVENT_HOLD;
memcpy_P(buffer, PSTR("HOLD"), sizeof(buffer));
break;
return; // we don't care about hold
// eventid = HASP_EVENT_HOLD;
// break;
case LV_EVENT_PRESS_LOST:
eventid = HASP_EVENT_LOST;
memcpy_P(buffer, PSTR("LOST"), sizeof(buffer));
break;
case LV_EVENT_PRESSING:
case LV_EVENT_FOCUSED:
@ -303,15 +311,20 @@ void IRAM_ATTR btn_event_handler(lv_obj_t * obj, lv_event_t event)
return;
}
guiCheckSleep();
guiCheckSleep(); // wakeup?
dispatch_send_object_event(haspGetPage(), (uint8_t)obj->user_data.id, eventid);
}
/**
* Called when a press on the system layer is detected
* @param obj pointer to a button matrix
* @param event type of event that occured
*/
void wakeup_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(obj == lv_disp_get_layer_sys(NULL)) {
#if HASP_USE_MQTT > 0
mqtt_send_state(F("wakeuptouch"), buffer); // TODO: enable wakeuptouch
#endif
} else {
// hasp_send_obj_attribute_event(obj, buffer);
dispatch_send_object_event(haspGetPage(), (uint8_t)obj->user_data, eventid);
guiCheckSleep(); // wakeup?
lv_obj_set_click(obj, false); // disable fist click
}
}
@ -322,7 +335,10 @@ void IRAM_ATTR btn_event_handler(lv_obj_t * obj, lv_event_t event)
*/
static void btnmap_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) hasp_send_obj_attribute_val(obj, lv_btnmatrix_get_active_btn(obj));
if(event == LV_EVENT_VALUE_CHANGED) {
guiCheckSleep(); // wakeup?
hasp_send_obj_attribute_val(obj, lv_btnmatrix_get_active_btn(obj));
}
}
/**
@ -333,10 +349,10 @@ static void btnmap_event_handler(lv_obj_t * obj, lv_event_t event)
static void table_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
guiCheckSleep(); // wakeup?
uint16_t row;
uint16_t col;
guiCheckSleep();
if(lv_table_get_pressed_cell(obj, &row, &col) == LV_RES_OK) hasp_send_obj_attribute_val(obj, row);
}
}
@ -349,11 +365,8 @@ static void table_event_handler(lv_obj_t * obj, lv_event_t event)
void IRAM_ATTR toggle_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
bool toggled = lv_btn_get_state(obj) == LV_BTN_STATE_CHECKED_PRESSED ||
lv_btn_get_state(obj) == LV_BTN_STATE_CHECKED_RELEASED;
guiCheckSleep();
hasp_send_obj_attribute_val(obj, toggled);
guiCheckSleep(); // wakeup?
hasp_send_obj_attribute_val(obj, lv_checkbox_is_checked(obj));
}
}
@ -364,7 +377,10 @@ void IRAM_ATTR toggle_event_handler(lv_obj_t * obj, lv_event_t event)
*/
static void switch_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) hasp_send_obj_attribute_val(obj, lv_switch_get_state(obj));
if(event == LV_EVENT_VALUE_CHANGED) {
guiCheckSleep(); // wakeup?
hasp_send_obj_attribute_val(obj, lv_switch_get_state(obj));
}
}
/**
@ -435,7 +451,7 @@ static void roller_event_handler(lv_obj_t * obj, lv_event_t event)
// Used in the dispatcher & hasp_new_object
void hasp_process_attribute(uint8_t pageid, uint8_t objid, const char * attr, const char * payload)
{
if(lv_obj_t * obj = hasp_find_obj_from_id(pageid, objid)) {
if(lv_obj_t * obj = hasp_find_obj_from_parent_id(get_page_obj(pageid), objid)) {
hasp_process_obj_attribute(obj, attr, payload, strlen(payload) > 0);
} else {
Log.warning(TAG_HASP, F("Unknown object p[%d].b[%d]"), pageid, objid);
@ -453,7 +469,8 @@ void hasp_process_attribute(uint8_t pageid, uint8_t objid, const char * attr, co
void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
{
/* Validate page */
uint8_t pageid = config[F("page")].isNull() ? haspGetPage() : config[F("page")].as<uint8_t>();
// uint8_t pageid = config[F("page")].isNull() ? haspGetPage() : config[F("page")].as<uint8_t>();
uint8_t pageid = config[F("page")].isNull() ? saved_page_id : config[F("page")].as<uint8_t>();
/* Page selection */
lv_obj_t * page = get_page_obj(pageid);
@ -469,7 +486,7 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
lv_obj_t * parent_obj = page;
if(!config[F("parentid")].isNull()) {
uint8_t parentid = config[F("parentid")].as<uint8_t>();
parent_obj = hasp_find_obj_from_id(page, parentid);
parent_obj = hasp_find_obj_from_parent_id(page, parentid);
if(!parent_obj) {
return Log.warning(TAG_HASP, F("Parent ID p[%u].b[%u] not found, skipping..."), pageid, parentid);
// parent_obj = page; // don't create on the page instead ??
@ -478,11 +495,12 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
}
}
uint8_t groupid = config[F("groupid")].as<uint8_t>();
uint8_t objid = config[F("objid")].as<uint8_t>();
uint8_t id = config[F("id")].as<uint8_t>();
/* Define Objects*/
lv_obj_t * obj = hasp_find_obj_from_id(parent_obj, id);
lv_obj_t * obj = hasp_find_obj_from_parent_id(parent_obj, id);
if(obj) {
return Log.warning(TAG_HASP, F("Object ID %u already exists!"), id);
}
@ -502,7 +520,11 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
obj = lv_btn_create(parent_obj, NULL);
if(obj) {
lv_obj_t * lbl = lv_label_create(obj, NULL);
if(lbl) lv_label_set_text(lbl, "");
if(lbl) {
lv_label_set_text(lbl, "");
lbl->user_data.objid = LV_HASP_LABEL;
lv_obj_align(lbl, NULL, LV_ALIGN_CENTER, 0, 0);
}
lv_obj_set_event_cb(obj, btn_event_handler);
}
break;
@ -552,13 +574,49 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
// No event handler for pages
break;
}
#if LV_USE_WIN
#if LV_USE_WIN && LVGL_VERSION_MAJOR == 7
case LV_HASP_WINDOW: {
obj = lv_win_create(parent_obj, NULL);
// No event handler for pages
break;
}
#endif
#if LVGL_VERSION_MAJOR == 8
case LV_HASP_LED: {
obj = lv_led_create(parent_obj);
if(obj) lv_obj_set_event_cb(obj, btn_event_handler);
break;
}
case LV_HASP_TILEVIEW: {
obj = lv_tileview_create(parent_obj);
// No event handler for tileviews
break;
}
case LV_HASP_TABVIEW: {
obj = lv_tabview_create(parent_obj, LV_DIR_TOP, 100);
// No event handler for tabs
if(obj) {
lv_obj_t * tab;
tab = lv_tabview_add_tab(obj, "tab 1");
// lv_obj_set_user_data(tab, id + 1);
tab = lv_tabview_add_tab(obj, "tab 2");
// lv_obj_set_user_data(tab, id + 2);
tab = lv_tabview_add_tab(obj, "tab 3");
// lv_obj_set_user_data(tab, id + 3);
}
break;
}
#else
case LV_HASP_LED: {
obj = lv_led_create(parent_obj, NULL);
if(obj) lv_obj_set_event_cb(obj, btn_event_handler);
break;
}
case LV_HASP_TILEVIEW: {
obj = lv_tileview_create(parent_obj, NULL);
// No event handler for tileviews
break;
}
case LV_HASP_TABVIEW: {
obj = lv_tabview_create(parent_obj, NULL);
// No event handler for tabs
@ -573,11 +631,7 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
}
break;
}
case LV_HASP_TILEVIEW: {
obj = lv_tileview_create(parent_obj, NULL);
// No event handler for tileviews
break;
}
#endif
/* ----- Color Objects ------ */
case LV_HASP_CPICKER: {
obj = lv_cpicker_create(parent_obj, NULL);
@ -651,11 +705,6 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
if(obj) lv_obj_set_event_cb(obj, switch_event_handler);
break;
}
case LV_HASP_LED: {
obj = lv_led_create(parent_obj, NULL);
if(obj) lv_obj_set_event_cb(obj, btn_event_handler);
break;
}
/* ----- List Object ------- */
case LV_HASP_DDLIST: {
obj = lv_dropdown_create(parent_obj, NULL);
@ -689,7 +738,10 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
}
/* id tag the object */
lv_obj_set_user_data(obj, id);
// lv_obj_set_user_data(obj, id);
obj->user_data.id = id;
obj->user_data.objid = objid; //& 0b11111;
obj->user_data.groupid = groupid; // & 0b111;
/* do not process these attributes */
config.remove(F("page"));
@ -706,7 +758,7 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
}
/** testing start **/
lv_obj_user_data_t temp;
uint8_t temp;
if(!hasp_find_id_from_obj(obj, &pageid, &temp)) {
return Log.error(TAG_HASP, F("Lost track of the created object, not found!"));
}
@ -717,7 +769,7 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
Log.verbose(TAG_HASP, F(" * p[%u].b[%u] = %s"), pageid, temp, list.type[0]);
/* test double-check */
lv_obj_t * test = hasp_find_obj_from_id(pageid, (uint8_t)temp);
lv_obj_t * test = hasp_find_obj_from_parent_id(get_page_obj(pageid), (uint8_t)temp);
if(test != obj) {
return Log.error(TAG_HASP, F("Objects DO NOT match!"));
}

View File

@ -50,10 +50,10 @@ enum lv_hasp_obj_type_t {
void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id);
lv_obj_t * hasp_find_obj_from_id(lv_obj_t * parent, uint8_t objid);
lv_obj_t * hasp_find_obj_from_id(uint8_t pageid, uint8_t objid);
bool hasp_find_id_from_obj(lv_obj_t * obj, uint8_t * pageid, lv_obj_user_data_t * objid);
bool check_obj_type(const char * lvobjtype, lv_hasp_obj_type_t haspobjtype);
lv_obj_t * hasp_find_obj_from_parent_id(lv_obj_t * parent, uint8_t objid);
// lv_obj_t * hasp_find_obj_from_page_id(uint8_t pageid, uint8_t objid);
bool hasp_find_id_from_obj(lv_obj_t * obj, uint8_t * pageid, uint8_t * objid);
bool check_obj_type_str(const char * lvobjtype, lv_hasp_obj_type_t haspobjtype);
bool check_obj_type(lv_obj_t * obj, lv_hasp_obj_type_t haspobjtype);
void hasp_object_tree(lv_obj_t * parent, uint8_t pageid, uint16_t level);
@ -64,5 +64,6 @@ void hasp_process_attribute(uint8_t pageid, uint8_t objid, const char * attr, co
void IRAM_ATTR btn_event_handler(lv_obj_t * obj, lv_event_t event);
void IRAM_ATTR toggle_event_handler(lv_obj_t * obj, lv_event_t event);
void wakeup_event_handler(lv_obj_t * obj, lv_event_t event);
#endif

View File

@ -7,6 +7,9 @@
#include "ArduinoLog.h"
#include "lvgl.h"
#if LVGL_VERSION_MAJOR != 7
#include "../lv_components.h"
#endif
#include "hasp_object.h"
#include "hasp_gui.h"
@ -59,14 +62,14 @@ static void kb_event_cb(lv_obj_t * event_kb, lv_event_t event)
char pass[32];
lv_obj_t * obj;
obj = hasp_find_obj_from_id(oobepage[1], 10);
obj = hasp_find_obj_from_parent_id(oobepage[1], (uint8_t)10);
if(obj) {
strncpy(ssid, lv_textarea_get_text(obj), sizeof(ssid));
settings[FPSTR(F_CONFIG_SSID)] = ssid;
if(oobekb != NULL) lv_keyboard_set_textarea(oobekb, obj);
}
obj = hasp_find_obj_from_id(oobepage[1], 20);
obj = hasp_find_obj_from_parent_id(oobepage[1],(uint8_t) 20);
if(obj) {
strncpy(pass, lv_textarea_get_text(obj), sizeof(pass));
settings[FPSTR(F_CONFIG_PASS)] = pass;
@ -103,9 +106,9 @@ static void ta_event_cb(lv_obj_t * ta, lv_event_t event)
if(str[0] == '\n') {
lv_obj_t * obj;
obj = hasp_find_obj_from_id(oobepage[1], 10);
obj = hasp_find_obj_from_parent_id(oobepage[1], (uint8_t)10);
if(ta == obj) { // now ssid, goto pass
obj = hasp_find_obj_from_id(oobepage[1], 20);
obj = hasp_find_obj_from_parent_id(oobepage[1], (uint8_t)20);
}
if(oobekb && obj) {
@ -219,7 +222,8 @@ static void oobeSetupSsid(void)
lv_textarea_set_pwd_mode(pwd_ta, true);
lv_textarea_set_one_line(pwd_ta, true);
lv_textarea_set_cursor_hidden(pwd_ta, true);
lv_obj_set_user_data(pwd_ta, 20);
lv_obj_user_data_t udata = (lv_obj_user_data_t){20, 1, 0};
lv_obj_set_user_data(pwd_ta, udata);
lv_obj_set_width(pwd_ta, disp->driver.hor_res - leftmargin - 20 - lv_obj_get_height(pwd_ta));
lv_obj_set_event_cb(pwd_ta, ta_event_cb);
lv_obj_align(pwd_ta, NULL, LV_ALIGN_CENTER, leftmargin / 2 - lv_obj_get_height(pwd_ta) / 2, topmargin - voffset);
@ -239,7 +243,7 @@ static void oobeSetupSsid(void)
lv_obj_set_style_local_text_font(oneline_ta, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, defaultfont);
lv_textarea_set_pwd_mode(oneline_ta, false);
lv_obj_set_user_data(oneline_ta, 10);
lv_obj_set_user_data(oneline_ta, (lv_obj_user_data_t){10, 1, 0});
lv_obj_align(oneline_ta, pwd_ta, LV_ALIGN_OUT_TOP_MID, 0, topmargin);
/* Create a label and position it above the text box */
@ -255,7 +259,11 @@ static void oobeSetupSsid(void)
lv_obj_align(oneline_label, oneline_ta, labelpos, 0, 0);
/* Create a keyboard and make it fill the width of the above text areas */
#if LVGL_VERSION_MAJOR == 8
oobekb = lv_keyboard_create(oobepage[1]);
#else
oobekb = lv_keyboard_create(oobepage[1], NULL);
#endif
lv_obj_set_style_local_pad_inner(oobekb, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 0);
lv_obj_set_style_local_border_width(oobekb, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 0);

View File

@ -2,10 +2,10 @@
For full license information read the LICENSE file in the project folder */
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
#include <Arduino.h>
#include <ArduinoOTA.h>
#include "ArduinoJson.h"
#include "ArduinoLog.h"
#include "hasp_conf.h"
@ -98,7 +98,6 @@ void otaSetup(void)
Log.error(TAG_OTA, F("%s failed (%s)"), buffer, error);
haspProgressMsg(F("ESP OTA FAILED"));
// delay(5000);
// haspSendCmd("page " + String(nextionActivePage));
});
#if HASP_USE_MQTT > 0
@ -154,30 +153,27 @@ void otaHttpUpdate(const char * espOtaUrl)
HTTPUpdate httpUpdate;
#endif
httpUpdate.rebootOnUpdate(false);
httpUpdate.rebootOnUpdate(false); // We do that ourselves
t_httpUpdate_return returnCode = httpUpdate.update(otaClient, espOtaUrl);
switch(returnCode) {
case HTTP_UPDATE_FAILED:
Log.error(TAG_FWUP, F("HTTP_UPDATE_FAILED error %i %s"), httpUpdate.getLastError(),
httpUpdate.getLastErrorString().c_str());
// nextionSetAttr("p[0].b[1].txt", "\"HTTP Update\\rFAILED\"");
break;
case HTTP_UPDATE_NO_UPDATES:
Log.notice(TAG_FWUP, F("HTTP_UPDATE_NO_UPDATES"));
// nextionSetAttr("p[0].b[1].txt", "\"HTTP Update\\rNo update\"");
break;
case HTTP_UPDATE_OK:
Log.notice(TAG_FWUP, F("HTTP_UPDATE_OK"));
// nextionSetAttr("p[0].b[1].txt", "\"HTTP Update\\rcomplete!\\r\\rRestarting.\"");
dispatch_reboot(true);
}
#if HASP_USE_MDNS > 0
mdnsStart();
#endif
// nextionSendCmd("page " + String(nextionActivePage));
#endif // HASP_USE_MDNS
}
#endif
#endif // ARDUINO_ARCH_ESP8266 || ARDUINO_ARCH_ESP32

View File

@ -9,6 +9,9 @@
#include "lvgl.h" /*To see all the widgets*/
#include "lv_conf.h" /*To see all the widgets*/
#include "lv_theme_hasp.h" /*To see all the widgets*/
#if LVGL_VERSION_MAJOR != 7
#include "../lv_components.h"
#endif
//#if LV_USE_THEME_HASP
@ -157,8 +160,8 @@ typedef struct
lv_style_t mbox_bg;
#endif
#if LV_USE_PAGE
lv_style_t sb;
#if LV_USE_PAGE
#if LV_USE_ANIMATION
lv_style_t edge_flash;
#endif
@ -366,7 +369,9 @@ static void basic_init(void)
lv_style_set_pad_right(&styles->btn, LV_STATE_DEFAULT, LV_DPX(40));
lv_style_set_pad_top(&styles->btn, LV_STATE_DEFAULT, LV_DPX(15));
lv_style_set_pad_bottom(&styles->btn, LV_STATE_DEFAULT, LV_DPX(15));
#if LVGL_VERSION_MAJOR == 7
lv_style_set_pad_inner(&styles->btn, LV_STATE_DEFAULT, LV_DPX(20));
#endif
lv_style_set_outline_width(&styles->btn, LV_STATE_DEFAULT, OUTLINE_WIDTH);
if(!NO_FOCUS) {
@ -384,13 +389,17 @@ static void basic_init(void)
lv_style_set_transition_delay(&styles->btn, LV_STATE_PRESSED, 0);
style_init_reset(&styles->pad_inner);
#if LVGL_VERSION_MAJOR == 7
lv_style_set_pad_inner(&styles->pad_inner, LV_STATE_DEFAULT,
lv_disp_get_size_category(NULL) <= LV_DISP_MEDIUM_LIMIT ? LV_DPX(20) : LV_DPX(40));
#endif
style_init_reset(&styles->pad_small);
lv_style_int_t pad_small_value = lv_disp_get_size_category(NULL) <= LV_DISP_MEDIUM_LIMIT ? LV_DPX(10) : LV_DPX(20);
lv_style_set_pad_all(&styles->pad_small, LV_STATE_DEFAULT, pad_small_value);
#if LVGL_VERSION_MAJOR == 7
lv_style_set_pad_inner(&styles->pad_small, LV_STATE_DEFAULT, pad_small_value);
#endif
#if LV_USE_DROPDOWN || LV_USE_ROLLER
style_init_reset(&styles->line_space);
@ -530,7 +539,9 @@ static void linemeter_init(void)
lv_style_set_pad_left(&styles->lmeter, LV_STATE_DEFAULT, LV_DPX(20));
lv_style_set_pad_right(&styles->lmeter, LV_STATE_DEFAULT, LV_DPX(20));
lv_style_set_pad_top(&styles->lmeter, LV_STATE_DEFAULT, LV_DPX(20));
#if LVGL_VERSION_MAJOR == 7
lv_style_set_pad_inner(&styles->lmeter, LV_STATE_DEFAULT, LV_DPX(30));
#endif
lv_style_set_scale_width(&styles->lmeter, LV_STATE_DEFAULT, LV_DPX(25));
lv_style_set_line_color(&styles->lmeter, LV_STATE_DEFAULT, theme.color_primary);
@ -555,7 +566,9 @@ static void gauge_init(void)
lv_style_set_pad_left(&styles->gauge_main, LV_STATE_DEFAULT, LV_DPX(20)); // left margin
lv_style_set_pad_right(&styles->gauge_main, LV_STATE_DEFAULT, LV_DPX(20)); // right margin
lv_style_set_pad_top(&styles->gauge_main, LV_STATE_DEFAULT, LV_DPX(20)); // top margin
#if LVGL_VERSION_MAJOR == 7
lv_style_set_pad_inner(&styles->gauge_main, LV_STATE_DEFAULT, LV_DPX(15)); // position of the labels
#endif
lv_style_set_scale_width(&styles->gauge_main, LV_STATE_DEFAULT, LV_DPX(10)); // minor thick length
lv_style_set_radius(&styles->gauge_main, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
@ -575,8 +588,11 @@ static void gauge_init(void)
lv_style_set_bg_color(&styles->gauge_needle, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x464b5b) : LV_COLOR_WHITE);
lv_style_set_radius(&styles->gauge_needle, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
lv_style_set_size(&styles->gauge_needle, LV_STATE_DEFAULT, LV_DPX(30));
#if LVGL_VERSION_MAJOR == 7
lv_style_set_pad_inner(&styles->gauge_needle, LV_STATE_DEFAULT, LV_DPX(10));
#endif
#endif
}
static void arc_init(void)
@ -631,7 +647,9 @@ static void chart_init(void)
style_init_reset(&styles->chart_series);
lv_style_set_line_width(&styles->chart_series, LV_STATE_DEFAULT, LV_DPX(3));
lv_style_set_size(&styles->chart_series, LV_STATE_DEFAULT, LV_DPX(4));
#if LVGL_VERSION_MAJOR == 7
lv_style_set_pad_inner(&styles->chart_series, LV_STATE_DEFAULT, LV_DPX(2)); /*Space between columns*/
#endif
lv_style_set_radius(&styles->chart_series, LV_STATE_DEFAULT, LV_DPX(1));
#endif
@ -674,7 +692,9 @@ static void calendar_init(void)
lv_style_set_border_width(&styles->calendar_date_nums, LV_STATE_CHECKED, 2);
lv_style_set_border_side(&styles->calendar_date_nums, LV_STATE_CHECKED, LV_BORDER_SIDE_LEFT);
lv_style_set_border_color(&styles->calendar_date_nums, LV_STATE_CHECKED, theme.color_primary);
#if LVGL_VERSION_MAJOR == 7
lv_style_set_pad_inner(&styles->calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(3));
#endif
lv_style_set_pad_left(&styles->calendar_date_nums, LV_STATE_DEFAULT, PAD_DEF);
lv_style_set_pad_right(&styles->calendar_date_nums, LV_STATE_DEFAULT, PAD_DEF);
lv_style_set_pad_bottom(&styles->calendar_date_nums, LV_STATE_DEFAULT, PAD_DEF);
@ -688,7 +708,9 @@ static void cpicker_init(void)
lv_style_set_scale_width(&styles->cpicker_bg, LV_STATE_DEFAULT, LV_DPX(30));
lv_style_set_bg_opa(&styles->cpicker_bg, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_bg_color(&styles->cpicker_bg, LV_STATE_DEFAULT, COLOR_SCR);
#if LVGL_VERSION_MAJOR == 7
lv_style_set_pad_inner(&styles->cpicker_bg, LV_STATE_DEFAULT, LV_DPX(20));
#endif
lv_style_set_radius(&styles->cpicker_bg, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
style_init_reset(&styles->cpicker_indic);
@ -752,8 +774,11 @@ static void keyboard_init(void)
lv_style_set_pad_right(&styles->kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
lv_style_set_pad_top(&styles->kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
lv_style_set_pad_bottom(&styles->kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
#if LVGL_VERSION_MAJOR == 7
lv_style_set_pad_inner(&styles->kb_bg, LV_STATE_DEFAULT, LV_DPX(3));
#endif
#endif
}
static void msgbox_init(void)
@ -855,7 +880,9 @@ static void list_init(void)
lv_style_set_pad_right(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
lv_style_set_pad_top(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
lv_style_set_pad_bottom(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
#if LVGL_VERSION_MAJOR == 7
lv_style_set_pad_inner(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
#endif
lv_style_set_transform_width(&styles->list_btn, LV_STATE_DEFAULT, -PAD_DEF);
lv_style_set_transform_width(&styles->list_btn, LV_STATE_PRESSED, -BORDER_WIDTH);
@ -968,8 +995,11 @@ static void tabview_win_shared_init(void)
lv_style_set_pad_bottom(&styles->tabview_page_scrl, LV_STATE_DEFAULT, PAD_DEF);
lv_style_set_pad_left(&styles->tabview_page_scrl, LV_STATE_DEFAULT, PAD_DEF);
lv_style_set_pad_right(&styles->tabview_page_scrl, LV_STATE_DEFAULT, PAD_DEF);
#if LVGL_VERSION_MAJOR == 7
lv_style_set_pad_inner(&styles->tabview_page_scrl, LV_STATE_DEFAULT, PAD_DEF);
#endif
#endif
}
/**********************
@ -1071,7 +1101,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
_lv_style_list_add_style(list, &styles->pretty);
break;
#if LV_USE_CONT
#if LV_USE_CONT && LVGL_VERSION_MAJOR == 7
case LV_THEME_CONT:
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
_lv_style_list_add_style(list, &styles->transparent);
@ -1099,7 +1129,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
#endif
#if LV_USE_KEYBOARD
#if LV_USE_KEYBOARD && LVGL_VERSION_MAJOR == 7
case LV_THEME_KEYBOARD:
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
_lv_style_list_add_style(list, &styles->pretty);
@ -1179,7 +1209,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
#endif
#if LV_USE_SPINNER
#if LV_USE_SPINNER && LVGL_VERSION_MAJOR == 7
case LV_THEME_SPINNER:
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
_lv_style_list_add_style(list, &styles->pretty);
@ -1215,7 +1245,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
#endif
#if LV_USE_MSGBOX
#if LV_USE_MSGBOX && LVGL_VERSION_MAJOR == 7
case LV_THEME_MSGBOX:
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
_lv_style_list_add_style(list, &styles->pretty);
@ -1232,7 +1262,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
#endif
#if LV_USE_LED
#if LV_USE_LED && LVGL_VERSION_MAJOR == 7
case LV_THEME_LED:
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
_lv_style_list_add_style(list, &styles->led);
@ -1255,7 +1285,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
break;
#endif
#if LV_USE_TABVIEW
#if LV_USE_TABVIEW && LVGL_VERSION_MAJOR == 7
case LV_THEME_TABVIEW:
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
_lv_style_list_add_style(list, &styles->pretty);
@ -1277,7 +1307,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
#endif
#if LV_USE_TILEVIEW
#if LV_USE_TILEVIEW && LVGL_VERSION_MAJOR == 7
case LV_THEME_TILEVIEW:
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
_lv_style_list_add_style(list, &styles->pretty);
@ -1311,7 +1341,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
#endif
#if LV_USE_LIST
#if LV_USE_LIST && LVGL_VERSION_MAJOR == 7
case LV_THEME_LIST:
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
_lv_style_list_add_style(list, &styles->pretty);
@ -1384,7 +1414,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
}
#endif
#if LV_USE_WIN
#if LV_USE_WIN && LVGL_VERSION_MAJOR == 7
case LV_THEME_WIN:
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
_lv_style_list_add_style(list, &styles->pretty);
@ -1423,7 +1453,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
#if LV_USE_SPINBOX
#if LV_USE_SPINBOX && LVGL_VERSION_MAJOR == 7
case LV_THEME_SPINBOX:
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
_lv_style_list_add_style(list, &styles->pretty);
@ -1440,7 +1470,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
#endif
#if LV_USE_CALENDAR
#if LV_USE_CALENDAR && LVGL_VERSION_MAJOR == 7
case LV_THEME_CALENDAR:
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
_lv_style_list_add_style(list, &styles->pretty);

69
tools/copy_partitions.py Normal file
View File

@ -0,0 +1,69 @@
#This script is based on the Tasmota rename-firmware.py script. https://github.com/arendst/Tasmota
Import('env')
import os
import shutil
buildFlags = env.ParseFlags(env['BUILD_FLAGS'])
OUTPUT_DIR = "build_output{}".format(os.path.sep)
platform = env.PioPlatform()
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32")
FRAMEWORK_DIR = "{}{}".format(FRAMEWORK_DIR, os.path.sep)
def copy_boot_partitions(source, target, env):
# check if output directories exist and create if necessary
if not os.path.isdir(OUTPUT_DIR):
os.mkdir(OUTPUT_DIR)
for d in ['firmware', 'map']:
if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)):
os.mkdir("{}{}".format(OUTPUT_DIR, d))
# create string with location and file names based on variant
src = str(target[0])
dst = "{}firmware{}{}".format(OUTPUT_DIR, os.path.sep, "partitions.bin")
print(src)
print(dst)
# check if new target files exist and remove if necessary
for f in [dst]:
if os.path.isfile(f):
os.remove(f)
# copy firmware.bin to firmware/<variant>.bin
shutil.copy(src,dst)
# create string with location and file names based on variant
src = "{}tools{}partitions{}boot_app0.bin".format(FRAMEWORK_DIR, os.path.sep, os.path.sep, os.path.sep)
dst = "{}firmware{}{}".format(OUTPUT_DIR, os.path.sep, "boot_app0.bin")
print(src)
print(dst)
# check if new target files exist and remove if necessary
for f in [dst]:
if os.path.isfile(f):
os.remove(f)
# copy firmware.bin to firmware/<variant>.bin
shutil.copy(src,dst)
# create string with location and file names based on variant
src = "{}tools{}sdk{}bin{}bootloader_dio_40m.bin".format(FRAMEWORK_DIR, os.path.sep, os.path.sep, os.path.sep, os.path.sep)
dst = "{}firmware{}{}".format(OUTPUT_DIR, os.path.sep, "bootloader_dio_40m.bin")
print(src)
print(dst)
# check if new target files exist and remove if necessary
for f in [dst]:
if os.path.isfile(f):
os.remove(f)
# copy firmware.bin to firmware/<variant>.bin
shutil.copy(src,dst)
env.AddPostAction("$BUILD_DIR/partitions.bin", [copy_boot_partitions])

View File

@ -6,7 +6,9 @@
;***************************************************;
[env:d1-mini-esp32_ili9341]
platform = espressif32@^2.0.0
platform = espressif32
platform_packages = framework-arduinoespressif32
framework = arduino
board = wemos_d1_mini32
;upload_port = COM5 ; To change the port, use platform_override.ini
;monitor_port = COM5 ; To change the port, use platform_override.ini
@ -37,3 +39,6 @@ lib_ignore =
${esp32.lib_ignore}
;endregion
extra_scripts =
${env.extra_scripts}
${esp32.extra_scripts}

View File

@ -5,7 +5,7 @@
;***************************************************;
[env:d132-unoshield]
platform = espressif32@^2.0.0
platform = espressif32
board = esp32dev
upload_port = COM4 ; To change the port, use platform_override.ini
monitor_port = COM4 ; To change the port, use platform_override.ini

View File

@ -5,7 +5,7 @@
;***************************************************;
[env:esp32dev-ili9488]
platform = espressif32@^2.0.0
platform = espressif32 @ ^2.0.0
board = esp32dev
upload_port = COM2 ; To change the port, use platform_override.ini
monitor_port = COM2 ; To change the port, use platform_override.ini

Some files were not shown because too many files have changed in this diff Show More