PIN.TOUCH and streaming

Here we can discuss about the problem found
Post Reply
AndyGadget
Posts: 222
Joined: Mon Feb 15, 2021 1:44 pm
Has thanked: 125 times
Been thanked: 132 times

PIN.TOUCH and streaming

Post by AndyGadget »

I've been away from Annex for a while other things have been taking up my time but looking to pick up a couple of projects soon.
(No reflection on Annex - I still think it's the best development environment for ESP32 by far :¬)

Just wondering Francesco, did you look at the bug I reported in Fernando's TTGO radio thread about TOUCH on the GPIO pins not working when the ESP32 was streaming?

From the thread :
I'm polling three pins with the pin.touch command every 200ms (I've tried less frequently too) and I'm reading values of around 90 when not touched and less than 20 when touched on each pin (actually connected to drawing pins as domed circular buttons) before the command to start the stream.
After the PLAY.STREAM command, it appears that one read is made of the pin and then will return that same value despite further touch / release.
I've proven this by (correctly) reading the pins several times on startup then including a pause before streaming during which I'll untouch the button. The read immediately after the stream command will return the untouched value.
After a PLAY.STOP the touch pins work correctly again.

This was the routine I was using to test :

Code: [Local Link Removed for Guests]

pause 500

nl$ = chr$(10) + chr$(13)
wlog nl$;nl$;nl$

PLAY.SETUP 1,50
play.stop
play.volume 10

for x = 1 to 50
  wlog pin.touch(12),
  wlog pin.touch(13),
  wlog pin.touch(15)
  pause 200
next x

pause 5000
wlog nl$;nl$

PLAY.STREAM"http://162.252.85.85:7858",50000,,1

for x = 1 to 50
  wlog pin.touch(12),
  wlog pin.touch(13),
  wlog pin.touch(15)
  pause 200
next x

pause 20000
wlog nl$;nl$

play.stop

for x = 1 to 50
  wlog pin.touch(12),
  wlog pin.touch(13),
  wlog pin.touch(15)
  pause 200
next x

pause 5000


User avatar
cicciocb
Site Admin
Posts: 2069
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 441 times
Been thanked: 1364 times
Contact:

Re: PIN.TOUCH and streaming

Post by cicciocb »

HI,
I need to check as this point should be already fixed.

Need to setup an esp32
AndyGadget
Posts: 222
Joined: Mon Feb 15, 2021 1:44 pm
Has thanked: 125 times
Been thanked: 132 times

Re: PIN.TOUCH and streaming

Post by AndyGadget »

I haven't tried this with a more recent release so you may already have sorted this.
I don't have access to my workroom (what my wife calls the 'guest room' ) at the moment.
Not urgent so I'll try it in a couple of days to save you the trouble of setting one up.
User avatar
cicciocb
Site Admin
Posts: 2069
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 441 times
Been thanked: 1364 times
Contact:

Re: PIN.TOUCH and streaming

Post by cicciocb »

Problem fixed in the version 1.48.3
AndyGadget
Posts: 222
Joined: Mon Feb 15, 2021 1:44 pm
Has thanked: 125 times
Been thanked: 132 times

Re: PIN.TOUCH and streaming

Post by AndyGadget »

This still appears to be an issue in 1.51.1 and is present for any stream; radio or MP3 as the test program below shows.
This is running on a TTGO Display ESP32 board with an I2S decoder / amp attached.
The wlog will only show correct PIN.TOUCH values after the stream has ended.

Code: [Local Link Removed for Guests]

pause 500
pin.mode 35, input, pullup
interrupt 35, stopall,2

Vol = 2
PLAY.VOLUME Vol
s$ = "http://162.252.85.85:7858"

wlog "Starting stream"
'PLAY.STREAM S$,50000

PLAY.MP3 "/3C.mp3"

do 
  t12 = pin.touch(12)
  t13 = pin.touch(13)
  t15 = pin.touch(15)
  wlog t12, t13, t15
  pause 1000
loop

wait
User avatar
cicciocb
Site Admin
Posts: 2069
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 441 times
Been thanked: 1364 times
Contact:

Re: PIN.TOUCH and streaming

Post by cicciocb »

Sorry, I did the wrong answer previously.
Ok, now I understand, you are talking about the pin.touch (there was a problem with the touchscreen too when the sound was playing that I fixed previously).
Post Reply