@@ -15,7 +15,7 @@ namespace {
1515auto & lcd = M5.Display;
1616
1717m5::unit::UnitUnified Units;
18- m5::unit::UnitGESTURE unit;
18+ m5::unit::UnitGesture unit;
1919
2020using gesture_t = m5::unit::paj7620u2::Gesture;
2121
@@ -111,7 +111,9 @@ void setup()
111111void loop ()
112112{
113113 M5.update ();
114+ auto touch = M5.Touch .getDetail ();
114115 Units.update ();
116+
115117 switch (unit.mode ()) {
116118 case m5::unit::paj7620u2::Mode::Gesture: {
117119 static uint8_t noobj{};
@@ -124,38 +126,39 @@ void loop()
124126 unit.readObjectSize (size);
125127 unit.readObjectCenter (x, y);
126128
127- M5_LOGI (" Gesture:%s noobject:%u nomotion:%u size:%u (%u,%u)" , gesture_to_string (unit.gesture ()), noobj ,
128- nomot, size, x, y);
129+ M5. Log . printf (" Gesture:%s noobject:%u nomotion:%u size:%u (%u,%u)\n " , gesture_to_string (unit.gesture ()),
130+ noobj, nomot, size, x, y);
129131 }
130132 unit.readNoObjectCount (noobj);
131133
132134 static Corner pc{};
133135 Corner c = detectCorner ();
134136 if (c != pc) {
135- M5_LOGI (" Obj:%s" , cstr[(uint8_t )c]);
137+ M5. Log . printf (" Obj:%s\n " , cstr[(uint8_t )c]);
136138 pc = c;
137139 }
138140 } break ;
139141 case m5::unit::paj7620u2::Mode::Proximity: {
140142 if (unit.updated ()) {
141- M5_LOGI (" %s brightness:%u approch:%u" , gesture_to_string (unit.gesture ()), unit.brightness (),
142- unit.approach ());
143+ M5. Log . printf (" %s brightness:%u approch:%u\n " , gesture_to_string (unit.gesture ()), unit.brightness (),
144+ unit.approach ());
143145 }
144146 } break ;
145147 case m5::unit::paj7620u2::Mode::Cursor: {
146148 if (unit.updated ()) {
147- M5_LOGI (" Cursor:%u,%u" , unit.cursorX (), unit.cursorY ());
149+ M5. Log . printf (" Cursor:%u,%u\n " , unit.cursorX (), unit.cursorY ());
148150 }
149151 delay (100 );
150152 } break ;
151153 default :
152154 break ;
153155 }
154- if (M5.BtnA .wasClicked ()) {
156+
157+ if (M5.BtnA .wasClicked () || touch.wasClicked ()) {
155158 auto prev = detection;
156159 ++detection;
157160 if (unit.writeMode (detection)) {
158- M5_LOGI (" >>> writeNMode %x" , detection);
161+ M5. Log . printf (" >> writeNMode %x\n " , detection);
159162 switch (unit.mode ()) {
160163 case m5::unit::paj7620u2::Mode::Gesture:
161164 unit.writeFrequency (Frequency::Gaming);
0 commit comments