Skip to content

Commit 9d251e9

Browse files
committed
Merge branch 'develop'
2 parents 633a2ea + 400c306 commit 9d251e9

File tree

10 files changed

+59
-32
lines changed

10 files changed

+59
-32
lines changed

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@
3838

3939
#pio
4040
/.pio/
41-
42-
#VsCode
43-
/.vscode/
41+
/.vscode
4442

4543
# Doxygen
4644
/html
45+
/doc/html
46+
47+
#Emacs
48+
\#*#
4749

4850
#
4951
debug.cfg

README.ja.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
[English](README.md)
66

77
## 概要
8-
物理ボタン、タッチボタンを持たない CoreS3 上にタッチボタンを追加し、 M5.BtnX 経由で状態を取得できるようにしたライブラリです。
8+
物理ボタン、タッチボタンを持たない CoreS3、Tough 上にソフトウェアタッチボタンを追加し、 M5.BtnX 経由で状態を取得できるようにしたライブラリです。
99
将来的に [M5Unified](https://github.com/m5stack/M5Unified) に同様の機能がつくまでの暫定としてお使いください。
10-
CoreS3 以外では処理をしないので、Basic, Gray, Core2 と共通のソースで作っている方にも有用です。
10+
11+
CoreS3、Tough 以外では処理をしないので、Basic, Gray, Core2 等と共通のソースで作っている方にも有用です。
12+
13+
なお CoreS3SE では M5Unified を使用していればも画面外の部分が Core2 同様にボタンとして機能します。(CoreS3 ではその部分はタッチとして機能しません)
14+
1115

1216
## 必要なもの
13-
* [M5Unified](https://github.com/m5stack/M5Unified)
14-
* [M5GFX](https://github.com/m5stack/M5GFX)
17+
* [M5Unified](https://github.com/m5stack/M5Unified) 0.1.16 以降
18+
* [M5GFX](https://github.com/m5stack/M5GFX) 0.1.16 以降
1519

1620
**M5Unified 前提ですので、 M5Core3.h を使用した物には適用できません。**
1721

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
![gob_unifiedButton](https://github.com/GOB52/gob_unifiedButton/assets/26270227/590cde0d-f4b6-4fe6-8cae-e25d27b32f8b)
66

77
## Overview
8-
This library adds touch buttons on CoreS3, which does not have physical buttons or touch buttons, and enables the user to acquire the status via M5.BtnX.
8+
This library adds software touch buttons on CoreS3 and Tough, which does not have physical buttons or touch buttons, and enables the user to acquire the status via M5.BtnX.
99
Please use this as an interim feature until a similar feature is added to [M5Unified](https://github.com/m5stack/M5Unified) in the future.
10-
It is also useful for those who are making a common source for Basic, Gray, and Core2, as it does not process anything other than CoreS3.
10+
11+
It is also useful for those who are making a common source for Basic, Gray, Core2 and more, as it does not process anything other than CoreS3 and Tough.
12+
13+
In CoreS3SE, if M5Unified is used, the off-screen part functions as a button, as in Core2 .(In CoreS3, that part does not function as touch)
1114

1215
## Required libraries
13-
* [M5Unified](https://github.com/m5stack/M5Unified)
14-
* [M5GFX](https://github.com/m5stack/M5GFX)
16+
* [M5Unified](https://github.com/m5stack/M5Unified) 0.1.16 or later
17+
* [M5GFX](https://github.com/m5stack/M5GFX) 0.1.16 or later
1518

1619
**M5Unified is assumed, so it cannot be applied to those using M5Core3.h.**
1720

examples/rotation/rotation_main.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ void setup()
1212
{
1313
M5.begin();
1414
unifiedButton.begin(&display);
15+
//unifiedButton.begin(&display, goblib::UnifiedButton::appearance_t::top);
1516
display.clear(TFT_DARKGREEN);
1617
unifiedButton.getButtonA()->setLabelText("ROTATE");
1718
}
@@ -40,8 +41,8 @@ void loop()
4041
force = true;
4142
}
4243

43-
display.setCursor(16, 32);
44+
display.setCursor(16, 64);
4445
display.printf("R:%u W:%d H:%d\n", display.getRotation(), display.width(), display.height());
45-
display.printf("Click A to rotate random");
46+
display.printf("Click A to rotate buttons");
4647
unifiedButton.draw(force);
4748
}

library.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "gob_unifiedButton",
3-
"description": "Add touch buttons for CoreS3 and commonality with conventional buttons (M5.BtnX)",
4-
"keywords": "M5Stack-CoreS3, M5Stack, M5Unified, M5GFX",
3+
"description": "Add touch buttons for CoreS3 / Tough and commonality with conventional buttons (M5.BtnX)",
4+
"keywords": "CoreS3, M5Tough, M5Stack, M5Unified, M5GFX",
55
"authors": {
66
"name": "GOB",
77
"url": "https://github.com/GOB52",
@@ -11,12 +11,19 @@
1111
"type": "git",
1212
"url": "https://github.com/GOB52/gob_unifiedButton.git"
1313
},
14-
"version": "0.1.4",
14+
"version": "0.1.5",
1515
"headers": "gob_unifiedButton.hpp",
1616
"license": "MIT",
1717
"platforms": "espressif32",
1818
"frameworks": "arduino",
1919
"dependencies": {
20-
"m5stack/M5Unified": "^0.1.13"
20+
"m5stack/M5Unified": "^0.1.16"
21+
},
22+
"export": {
23+
"exclude":
24+
[
25+
"doc/html"
26+
]
2127
}
22-
}
28+
}
29+

library.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name=gob_unifiedButton
2-
version=0.1.4
2+
version=0.1.5
33
author=GOB
44
maintainer=GOB
5-
sentence=Add touch buttons for CoreS3 and commonality with conventional buttons (M5.BtnX)
6-
paragraph=M5Stack CoreS3
5+
sentence=Add touch buttons for CoreS3 / Tough and commonality with conventional buttons (M5.BtnX)
6+
paragraph=M5Stack CoreS3 Tough
77
category=Other
88
url=https://github.com/GOB52/gob_unifiedButton.git
99
architectures=esp32,esp32s3
1010
includes=gob_unifiedButton.hpp
11-
depends=M5Unified (>=0.1.13)
11+
depends=M5Unified (>=0.1.16)

platformio.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
platform = espressif32
66
framework = arduino
77

8-
lib_deps = m5stack/M5Unified
8+
lib_deps = m5stack/M5Unified @^0.1.16
9+
;lib_deps = https://github.com/m5stack/M5Unified.git#develop
10+
; https://github.com/m5stack/M5GFX.git#develop
11+
912
lib_ldf_mode = deep
1013

1114
monitor_speed = 115200

src/gob_unifiedButton.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
@file gob_unifiedButton.cpp
3-
@brief Add touch buttons for CoreS3 and commonality with conventional buttons (M5.BtnX)
3+
@brief Library main source
44
@author GOB @GOB_52_GOB https://twitter.com/GOB_52_GOB
55
*/
66
#include <M5Unified.h>
@@ -24,9 +24,17 @@ void UnifiedButton::begin(LovyanGFX* gfx, const appearance_t app)
2424
_appearance = app;
2525
_dirty = true;
2626
_font = gfx->getFont();
27-
_enable = M5.getBoard() == m5::board_t::board_M5StackCoreS3 && M5.Touch.isEnabled();
27+
28+
auto bd = M5.getBoard();
29+
_enable = (bd == m5::board_t::board_M5StackCoreS3 || bd == m5::board_t::board_M5Tough)
30+
&& M5.Touch.isEnabled();
2831
_rotation = _gfx->getRotation();
2932
if(_enable) { create_buttons(_appearance); }
33+
34+
if(M5.Touch.isEnabled() && !_enable)
35+
{
36+
M5_LOGW("Unsupported devices. getBoard() %u\n", bd);
37+
}
3038
}
3139

3240
void UnifiedButton::create_buttons(const appearance_t app)
@@ -39,20 +47,18 @@ void UnifiedButton::create_buttons(const appearance_t app)
3947
{
4048
case appearance_t::bottom:
4149
case appearance_t::transparent_bottom:
42-
top = _gfx->height() - h/2;
50+
top = _gfx->height() - h;
4351
break;
4452
case appearance_t::top:
4553
case appearance_t::transparent_top:
46-
top = h/2;
4754
break;
4855
default: // transparent_all
4956
h = _gfx->height();
50-
top = h/2;
5157
break;
5258
}
5359
for(uint_fast8_t i = 0; i < 3; ++i)
5460
{
55-
_btns[i].initButton(_gfx, left + w * i + w / 2, top, w, h, olClr, TFT_DARKGRAY, TFT_BLACK,label_table[i]);
61+
_btns[i].initButtonUL(_gfx, left + w * i, top, w, h, olClr, TFT_DARKGRAY, TFT_BLACK,label_table[i]);
5662
}
5763
}
5864

@@ -104,6 +110,7 @@ void UnifiedButton::update()
104110
{
105111
btn_bits |= (_btns[i].contains(x, y) << i);
106112
}
113+
//M5_LOGI("%d,%d : %x", x, y, btn_bits);
107114
_press_bits = btn_bits;
108115
}
109116
}

src/gob_unifiedButton.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*!
22
@file gob_unifiedButton.hpp
3-
@brief Add touch buttons for CoreS3 and commonality with conventional buttons (M5.BtnX)
3+
@brief Library main header
44
55
@mainpage gob_unifiedButton
6-
Add touch buttons for CoreS3 and commonality with conventional buttons (M5.BtnX)
6+
This library adds software touch buttons on CoreS3 and Tough, which does not have physical buttons or touch buttons, and enables the user to acquire the status via M5.BtnX.
77
88
@author GOB / GitHub:<a href="https://github.com/GOB52/">GOB52</a> / X:<a href="https://twitter.com/gob_52_gob">@GOB_52_GOB</a>
99

src/gob_unifiedButton_version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#define GOBLIB_UNIFIED_BUTTON_VERSION_MAJOR 0
55
#define GOBLIB_UNIFIED_BUTTON_VERSION_MINOR 1
6-
#define GOBLIB_UNIFIED_BUTTON_VERSION_PATCH 4
6+
#define GOBLIB_UNIFIED_BUTTON_VERSION_PATCH 5
77

88
#define GOBLIB_UNIFIED_BUTTON_VERSION_STRINGIFY_AGAIN(x) #x
99
#define GOBLIB_UNIFIED_BUTTON_VERSION_STRINGIFY(x) GOBLIB_UNIFIED_BUTTON_VERSION_STRINGIFY_AGAIN(x)

0 commit comments

Comments
 (0)