Skip to content

Commit

Permalink
Merge pull request #18 from c5n/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
c5n authored Mar 17, 2021
2 parents 55dc667 + 1324491 commit e66abfd
Show file tree
Hide file tree
Showing 14 changed files with 904 additions and 731 deletions.
33 changes: 20 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,22 @@ Sitemaps for the OhEzTouch can contain the following elements:
- Slider
- Switch
- Text
- Default

Example sitemap (```oheztouch.sitemap```):
```
sitemap oheztouch label="OhEzTouch Test"
{
Switch item=OHEZTOUCH_Switch
Selection item=OHEZTOUCH_Select mappings=["SEL1"="Selection 1", "SEL2"="Selection 2", "SEL3"="Selection 3", "SEL4"="Selection 4", "SEL5"="Selection 5", "SEL6"="Selection 6"]
Setpoint item=OHEZTOUCH_Number label="Setpoint" minValue=5 maxValue=180 step=5
Slider item=OHEZTOUCH_Number label="Slider" minValue=5 maxValue=180 step=5
Colorpicker item=OHEZTOUCH_Color
Selection item=OHEZTOUCH_Switch mappings=[OFF="Off", ON="On"]
Selection item=OHEZTOUCH_Select mappings=["SEL1"="Selection 1", "SEL2"="Selection 2", "SEL3"="Selection 3"]
Default item=OHEZTOUCH_Player
Default item=OHEZTOUCH_Rollershutter
Text label="Submenu" icon="settings"
{
Switch item=OHEZTOUCH_Switch
Setpoint item=OHEZTOUCH_Number label="Setpoint" minValue=5 maxValue=180 step=5
Slider item=OHEZTOUCH_Number label="Slider" minValue=5 maxValue=180 step=5
Setpoint item=OHEZTOUCH_Number label="Setpoint" minValue=-10 maxValue=10 step=0.5
Slider item=OHEZTOUCH_Number label="Slider" minValue=-10 maxValue=10 step=1
Text item=OHEZTOUCH_Number label="Text"
Colorpicker item=OHEZTOUCH_Color
}
Expand All @@ -148,11 +149,14 @@ sitemap oheztouch label="OhEzTouch Test"
```
Items for example sitemap:
```
String OHEZTOUCH_Select "Selection" <fan>
String OHEZTOUCH_String "String" <text>
Switch OHEZTOUCH_Switch "Switch" <switch>
Number OHEZTOUCH_Number "Number [%d sec]" <time>
Color OHEZTOUCH_Color "Color [%s]" <colorlight>
String OHEZTOUCH_Select "Selection" <fan>
String OHEZTOUCH_String "String" <text>
Switch OHEZTOUCH_Switch "Switch" <switch>
Number OHEZTOUCH_Number "Number [%.1f °C]" <temperature>
Color OHEZTOUCH_Color "Color [%s]" <colorlight>
Player OHEZTOUCH_Player "Player" <receiver>
Rollershutter OHEZTOUCH_Rollershutter "Rollershutter" <blinds>
```

### Power up
Expand All @@ -170,7 +174,10 @@ In the upper right is the menu. Select "Configure new AP".

![browser_wlanconfig](doc/img/browser_wlanconfig.png)

Fill in your WLAN credentials and click Apply. The ArduiTouch will try to connect. If everything went well, the IP received from your DHCP server will be shown on the display.
Fill in your WLAN credentials and click Apply. The ArduiTouch will try to connect.

#### Systeminfo
The IP received from your DHCP server and other information can be obtained by touching the upper bar on the screen.

#### OpenHAB Settings
![browser_openhabconfig](doc/img/browser_openhabconfig.png)
Expand Down
88 changes: 57 additions & 31 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
; https://docs.platformio.org/page/projectconf.html

[platformio]
src_dir = src
src_dir = src
include_dir = src


[common]
lib_deps =
lv_arduino @ 2.1.5
Expand All @@ -21,10 +20,10 @@ lib_deps =
AutoConnect @ 1.1.7
yiannisbourkelis/Uptime Library @ ^1.0.0
bodmer/TFT_eSPI @ 2.3.58

build_flags=-Os
build_flags =
-Os
!echo '-DVERSION_GIT_HASH=\"'$(git log |head -1 |cut -c8-)'\"'
-DCORE_DEBUG_LEVEL=0
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_INFO
-DUSER_SETUP_LOADED=1
-DLV_USE_DEBUG=0
-DLV_CONF_INCLUDE_SIMPLE=1
Expand All @@ -35,12 +34,41 @@ build_flags=-Os
-DLODEPNG_NO_COMPILE_ENCODER=1
-DLODEPNG_NO_COMPILE_ALLOCATORS=1
-DAC_DEBUG=0
-I ./src/

[env]
framework = arduino
platform_packages = platformio/framework-arduinoespressif32
build_flags = ${common.build_flags}
lib_deps = ${common.lib_deps}

[env:debug]
platform = espressif32
board = esp32dev
board_build.partitions = min_spiffs.csv
build_type = debug
build_flags =
${common.build_flags}
-DTARGET_NAME=\"ArduiTouchJTAG\"
-DILI9341_DRIVER=1
-DTFT_MISO=19
-DTFT_MOSI=23
-DTFT_SCLK=18
-DTFT_CS=5
-DTFT_DC=4
-DTFT_RST=22
-DTFT_RD=2
-DTFT_WR=4
-DTFT_TOUCH_FLIP=1
-DTFT_BACKLIGHT_PIN=16
-DTOUCH_CS=26
-DSPI_FREQUENCY=40000000
-DDEBUG_LODEPNG_MALLOC=0
-DDEBUG_AC_MAIN=0
-DDEBUG_AC_SETTINGS=0
-DDEBUG_BACKLIGHT_CONTROL=0
-DDEBUG_BEEPER_CONTROL=0
-DDEBUG_CONFIG=0
-DDEBUG_LODEPNG_MALLOC=0
-DDEBUG_WLAN_STATES=0
-DDEBUG_DISPLAY_TOUCH=0
-DDEBUG_OPENHAB_CONNECTOR=0
Expand All @@ -50,20 +78,18 @@ build_flags=-Os
-DDEBUG_OPENHAB_UI=0
-DDEBUG_UI_INFOLABEL=0
-DDEBUG_UI_SECURITY_PIN=0
-I ./src/

[env]
framework = arduino
platform_packages = platformio/framework-arduinoespressif32
build_flags = ${common.build_flags}
lib_deps = ${common.lib_deps}
upload_port = /dev/ttyUSB0
upload_speed = 921600
monitor_port = /dev/ttyUSB0
monitor_speed = 115200
debug_tool = esp-prog

[env:ArduiTouch]
platform = espressif32
board = esp32dev
platform = espressif32
board = esp32dev
board_build.partitions = min_spiffs.csv

build_flags = ${common.build_flags}
build_flags =
${common.build_flags}
-DTARGET_NAME=\"ArduiTouch\"
-DILI9341_DRIVER=1
-DTFT_MISO=19
Expand All @@ -75,18 +101,17 @@ build_flags = ${common.build_flags}
-DTFT_TOUCH_FLIP=1
-DTOUCH_CS=14
-DSPI_FREQUENCY=40000000

upload_port = /dev/ttyUSB0
upload_speed = 921600
monitor_port = /dev/ttyUSB0
monitor_speed = 115200
upload_port = /dev/ttyUSB0
upload_speed = 921600
monitor_port = /dev/ttyUSB0
monitor_speed = 115200

[env:ArduiTouch28]
platform = espressif32
board = esp32dev
platform = espressif32
board = esp32dev
board_build.partitions = min_spiffs.csv

build_flags = ${common.build_flags}
build_flags =
${common.build_flags}
-DTARGET_NAME=\"ArduiTouch28\"
-DILI9341_DRIVER=1
-DTFT_MISO=19
Expand All @@ -95,11 +120,12 @@ build_flags = ${common.build_flags}
-DTFT_CS=5
-DTFT_DC=4
-DTFT_RST=22
-DTFT_RD=2
-DTFT_WR=4
-DTFT_TOUCH_FLIP=0
-DTOUCH_CS=14
-DSPI_FREQUENCY=40000000

upload_port = /dev/ttyUSB0
upload_speed = 921600
monitor_port = /dev/ttyUSB0
monitor_speed = 115200
upload_port = /dev/ttyUSB0
upload_speed = 921600
monitor_port = /dev/ttyUSB0
monitor_speed = 115200
36 changes: 18 additions & 18 deletions src/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Config
{
config_filename = filename;

Serial.printf("loadConfig file: %s\n", filename.c_str());
Serial.printf("loadConfig file: %s\r\n", filename.c_str());

File configFile = SPIFFS.open(filename, "r");
if (!configFile)
Expand Down Expand Up @@ -121,22 +121,22 @@ class Config
strlcpy(item.openhab.sensors.bme280.items.pressure, doc["openhab"]["sensors"]["bme280"]["items"]["pressure"] | "", sizeof(item.openhab.sensors.bme280.items.pressure));
#if DEBUG_CONFIG
Serial.println("Config::loadConfig: Loaded Values");
Serial.printf(" item.general.hostname: %s\n", item.general.hostname);
Serial.printf(" item.ntp.hostname: %s\n", item.ntp.hostname);
Serial.printf(" item.ntp.gmt_offset: %d\n", item.ntp.gmt_offset);
Serial.printf(" item.ntp.daylightsaving: %d\n", item.ntp.daylightsaving);
Serial.printf(" item.backlight.activity_timeout: %s\n", item.backlight.activity_timeout);
Serial.printf(" item.backlight.normal_brightness: %s\n", item.backlight.normal_brightness);
Serial.printf(" item.backlight.dim_brightness: %s\n", item.backlight.dim_brightness);
Serial.printf(" item.beeper.enabled: %d\n", item.beeper.enabled);
Serial.printf(" item.openhab.hostname: %s\n", item.openhab.hostname);
Serial.printf(" item.openhab.port: %d\n", item.openhab.port);
Serial.printf(" item.openhab.sitemap: %s\n", item.openhab.sitemap);
Serial.printf(" item.openhab.sensors.bme280.use: %d\n", item.openhab.sensors.bme280.use);
Serial.printf(" item.openhab.sensors.bme280.interval: %d\n", item.openhab.sensors.bme280.interval);
Serial.printf(" item.openhab.sensors.bme280.items.temperature: %s\n", item.openhab.sensors.bme280.items.temperature);
Serial.printf(" item.openhab.sensors.bme280.items.humidity: %s\n", item.openhab.sensors.bme280.items.humidity);
Serial.printf(" item.openhab.sensors.bme280.items.pressure: %s\n", item.openhab.sensors.bme280.items.pressure);
Serial.printf(" item.general.hostname: %s\r\n", item.general.hostname);
Serial.printf(" item.ntp.hostname: %s\r\n", item.ntp.hostname);
Serial.printf(" item.ntp.gmt_offset: %d\r\n", item.ntp.gmt_offset);
Serial.printf(" item.ntp.daylightsaving: %d\r\n", item.ntp.daylightsaving);
Serial.printf(" item.backlight.activity_timeout: %s\r\n", item.backlight.activity_timeout);
Serial.printf(" item.backlight.normal_brightness: %s\r\n", item.backlight.normal_brightness);
Serial.printf(" item.backlight.dim_brightness: %s\r\n", item.backlight.dim_brightness);
Serial.printf(" item.beeper.enabled: %d\r\n", item.beeper.enabled);
Serial.printf(" item.openhab.hostname: %s\r\n", item.openhab.hostname);
Serial.printf(" item.openhab.port: %d\r\n", item.openhab.port);
Serial.printf(" item.openhab.sitemap: %s\r\n", item.openhab.sitemap);
Serial.printf(" item.openhab.sensors.bme280.use: %d\r\n", item.openhab.sensors.bme280.use);
Serial.printf(" item.openhab.sensors.bme280.interval: %d\r\n", item.openhab.sensors.bme280.interval);
Serial.printf(" item.openhab.sensors.bme280.items.temperature: %s\r\n", item.openhab.sensors.bme280.items.temperature);
Serial.printf(" item.openhab.sensors.bme280.items.humidity: %s\r\n", item.openhab.sensors.bme280.items.humidity);
Serial.printf(" item.openhab.sensors.bme280.items.pressure: %s\r\n", item.openhab.sensors.bme280.items.pressure);
#endif
return true;
}
Expand All @@ -146,7 +146,7 @@ class Config
if (config_filename.isEmpty())
return false;

Serial.printf("saveConfig file: %s\n", config_filename.c_str());
Serial.printf("saveConfig file: %s\r\n", config_filename.c_str());

File configFile = SPIFFS.open(config_filename, "w");
if (!configFile)
Expand Down
2 changes: 1 addition & 1 deletion src/driver/beeper_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static void beeper_task(void *parameter);
void beeper_playNote(uint16_t note, uint8_t volume, uint16_t duration, uint16_t pause)
{
#if DEBUG_BEEPER_CONTROL
Serial.printf("beeper_playNote: freq=%u Hz, duration=%u ms\n", note, duration);
Serial.printf("beeper_playNote: freq=%u Hz, duration=%u ms\r\n", note, duration);
#endif
if (xRequestQueue != 0)
{
Expand Down
33 changes: 27 additions & 6 deletions src/lodepng/lodepng_malloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ void add_ptr(void* ptr, size_t size)
{
mem_chunks[i].ptr = ptr;
mem_chunks[i].size = size;
printf("add_ptr(0x%08x, %u)\r\n", (uint32_t)ptr, size);
break;
}
}

Expand All @@ -43,6 +45,7 @@ void del_ptr(void* ptr)
{
if (mem_chunks[i].ptr == ptr)
{
printf("del_ptr(0x%08x) size=%u\r\n", (uint32_t)ptr, mem_chunks[i].size);
mem_chunks[i].ptr = NULL;
mem_chunks[i].size = 0;
break;
Expand Down Expand Up @@ -88,8 +91,15 @@ void* lodepng_malloc(size_t size)
void* ptr = malloc(size);

#if DEBUG_LODEPNG_MALLOC
add_ptr(ptr, size);
printf("lodepng_malloc: Size: %u Sum: %u Chunks: %u\n", size, get_memsize(), get_chunk_count());
if (ptr != NULL)
{
add_ptr(ptr, size);
printf("lodepng_malloc: Size: %u Sum: %u Chunks: %u Free: %u MaxBlk: %u\r\n", size, get_memsize(), get_chunk_count(), ESP.getFreeHeap(), heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT));
}
else
{
printf("lodepng_malloc failed: Size: %u Sum: %u Chunks: %u Free: %u MaxBlk: %u\r\n", size, get_memsize(), get_chunk_count(), ESP.getFreeHeap(), heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT));
}
#endif

return ptr;
Expand All @@ -98,14 +108,25 @@ void* lodepng_malloc(size_t size)
void* lodepng_realloc(void* ptr, size_t new_size)
{
#if DEBUG_LODEPNG_MALLOC
printf("lodepng_realloc: Old: %u New: %u Sum: %u\n", get_size(ptr), new_size, get_memsize());
del_ptr(ptr);
printf("lodepng_realloc: Old: %u New: %u Sum: %u\r\n", get_size(ptr), new_size, get_memsize() - get_size(ptr) + new_size);

if (ptr != NULL)
{
del_ptr(ptr);
}
#endif

void* new_ptr = realloc(ptr, new_size);

#if DEBUG_LODEPNG_MALLOC
add_ptr(new_ptr, new_size);
if (new_ptr != NULL)
{
add_ptr(new_ptr, new_size);
}
else
{
printf("lodepng_realloc failed\r\n");
}
#endif

return new_ptr;
Expand All @@ -114,7 +135,7 @@ void* lodepng_realloc(void* ptr, size_t new_size)
void lodepng_free(void* ptr)
{
#if DEBUG_LODEPNG_MALLOC
printf("lodepng_free: Size: %u Sum: %u\n", get_size(ptr), get_memsize());
printf("lodepng_free: Size: %u Sum: %u Chunks: %u Free: %u\r\n", get_size(ptr), get_memsize() - get_size(ptr), get_chunk_count(), ESP.getFreeHeap());
del_ptr(ptr);
#endif

Expand Down
Loading

0 comments on commit e66abfd

Please sign in to comment.