Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:27 06 Jun 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MMBasic V6.03.00 release candidates

     Page 15 of 20    
Author Message
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 370
Posted: 11:05am 02 Jun 2026
Copy link to clipboard 
Print this post

G'day Peter,
Sadly no joy, report indicates multi-touch detected as before but no touch events  

A mouse click does cause a continuous string of:

512   300
512   300
512   300
512   300
512   300
...

Until the program exits. this is MM.HRES/2 x MM.VRES/2 with 1024 x 600 monitor.

Also test report result attached for ELECROW 10" RES Touch Monitor, just in case you are looking for more results. This unit doesn't work with either firmware.

Regards, Lyle.

Elecrow_RES_Touch_Info.zip
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11435
Posted: 11:08am 02 Jun 2026
Copy link to clipboard 
Print this post

Have you got both a mouse and the touch display plugged in at the same time? If so please try one at a time.
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 370
Posted: 11:22am 02 Jun 2026
Copy link to clipboard 
Print this post

Hi Peter,
Still no joy  

With Touch only no events triggered.

With Keyboard/Mouse a mouse click causes:

512   300
512   300
etc

Program used:
> list
'prog to test USB touch

Option default integer

GUI Cursor on
'GUI Cursor Link Mouse
GUI interrupt TouchDown,TouchUp

Do
 If Touch(down)=1 Then
   Print Touch(x),Touch(y)
 EndIf
Loop Until Inkey$<>""

End

Sub TouchDown
 Print "Touched"
End Sub

Sub TouchUp
 Print "Untouched"
End Sub
>


Have tried Cursor Link Mouse enabled / disabled as well.

Regards, Lyle.
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 370
Posted: 11:44am 02 Jun 2026
Copy link to clipboard 
Print this post

Peter,
My mistake, if I set OPTION MOUSE SENSITIVITY 0.5 the mouse works as expected, forgot to set this on firmware update.

Sadly still no touch screen events.

Regards, Lyle.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11435
Posted: 01:32pm 02 Jun 2026
Copy link to clipboard 
Print this post

Lyle

Please try this on the elecrow. Should give single touch but not multi-touch

PicoMite.zip

Also, please report the enhanced diagnostic for the first screen

Homa: please run this version and report findings
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 370
Posted: 02:09pm 02 Jun 2026
Copy link to clipboard 
Print this post

Peter,
Good news, Elecrow RES touch now reporting co-ordinates    and working in conjunction with mouse as well.

Not currently seeing Touch-Down or Touch-UP interrupts but not sure if you have got that far yet.

See attached ZIP for extended data on Waveshare Cap Touch.

Thanks again this is awesome  

Regards, Lyle.

WS_Touch_Info_EXT.zip
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11435
Posted: 02:31pm 02 Jun 2026
Copy link to clipboard 
Print this post

What happens if you run my GUI demo? Does the elecrow work? remove the mouse for testing
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Pump-control GUI demo for MMBasic builds with GUI CONTROLS
' -----------------------------------------------------------------
' Demonstrates the standard GUI widgets (caption, switch, displaybox,
' frame, radio, numberbox, button, LED, checkbox, textbox, spinbox)
' driven by whichever input methods the firmware happens to expose:
'
'   Touch screen .... via GUI INTERRUPT TouchDown, TouchUp
'   USB mouse ....... via GUI CURSOR LINK MOUSE
'   Keyboard ........ via INKEY$ + GUI CURSOR / GUI CLICK
'
' All three routes end up in the same TouchDown / TouchUp subs, so the
' program contains no per-input-source branching: each control is
' handled once, regardless of where the click came from.
'
' Layout is hand-placed for a 320x240 canvas so the program runs on
' the smallest LCD panels; on VGA/HDMI builds the program switches to
' MODE 2 (320x240) to keep the layout intact.
'
' Geoff Graham, October 2015 (original)
' Modified for ILI9341 by Phil23
' Refactored for multi-firmware input by Peter Mather, 2026
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
' ----- control reference numbers ---------------------------------
Const c_head     = 1,  c_pmp     = 2,  sw_pmp    = 3
Const c_flow     = 4,  tb_flow   = 5
Const led_run    = 6,  led_alarm = 7
Const frm_alarm  = 20, nbr_hi    = 21, nbr_lo    = 22, pb_test = 23
Const c_hi       = 24, c_lo      = 25
Const frm_pump   = 30, r_econ    = 31, r_norm    = 32, r_hi    = 33
Const frm_log    = 40, cb_enabled= 41, c_fname   = 42, tb_fname= 43
Const c_log      = 44, cb_flow   = 45, cb_pwr    = 46, cb_warn = 47
Const cb_alarm   = 48, c_bright  = 49, sb_bright = 50
' ----- layout constants ------------------------------------------
Const ledsX = 125              ' x column shared by both LEDs
Const stepx = 4                ' keyboard cursor step in pixels
' ----- runtime state ---------------------------------------------
Dim Integer cw, ch             ' canvas width / height
Dim Integer mx, my             ' soft-cursor position
Dim Integer ledsY              ' running y while stacking the LEDs
Dim Integer held               ' 1 while GUI CLICK DOWN is in effect
Dim String  k$
' =================================================================
' Display + input device setup
' =================================================================
Colour RGB(white), RGB(black)
CLS
' VGA/HDMI firmware boots in a larger mode; force 320x240 so the
' hard-coded coordinates below land in the right place.
If Instr(MM.DEVICE$, "VGA") Or Instr(MM.DEVICE$, "HDMI") Then
 MODE 3
EndIf
cw = MM.HRES : ch = MM.VRES
mx = cw \ 2  : my = ch \ 2
' The soft cursor is required for mouse and keyboard input. Touch-only
' firmware accepts the command and simply never moves the cursor.
GUI Cursor On
' GUI CURSOR LINK MOUSE only exists on builds with USB host support.
' "On Error Skip" lets older firmware silently continue.
On Error Skip
GUI Cursor Link Mouse
keyboard off
' Both real touches and GUI CLICK (used by the keyboard fallback)
' dispatch through this interrupt pair.
GUI Interrupt TouchDown, TouchUp
' =================================================================
' Build the pump-control display
' =================================================================
' --- heading and pump label --------------------------------------
Font 2
GUI Caption c_head, "Pump Control", 10, 0
GUI Caption c_pmp,  "Pump",         10, 25, , RGB(brown)
' --- pump ON/OFF switch ------------------------------------------
GUI Switch sw_pmp, "ON|OFF", 10, 45, 70, 30, RGB(white), RGB(brown)
CtrlVal(sw_pmp) = 1                                  ' starts ON
' --- flow-rate read-out ------------------------------------------
GUI Caption    c_flow,  "Flow Rate", 5, 75,  , RGB(brown), 0
GUI Displaybox tb_flow,              5, 100, 105, 25
CtrlVal(tb_flow) = "20.1"
' --- power-mode radio group --------------------------------------
GUI Frame frm_pump, "Power", 5, 140, 105, 90, RGB(200,20,255)
Font 1
GUI Radio r_econ, "Economy", 20, 160, 10, RGB(230,230,255)
GUI Radio r_norm, "Normal",  20, 185
GUI Radio r_hi,   "High",    20, 210
CtrlVal(r_norm) = 1                                  ' default mode
' --- alarm frame: Hi/Lo number boxes + TEST button ---------------
Font 2 : GUI Frame frm_alarm, "Alarm", 115, 115, 90, 115, RGB(green)
Font 1
GUI Caption   c_hi,    "Hi:", 120, 150, LT, RGB(yellow)
GUI Numberbox nbr_hi,         150, MM.VPOS-6, 40, MM.FONTHEIGHT+6, RGB(yellow), RGB(64,64,64)
GUI Caption   c_lo,    "Lo:", 120, 175, LT, RGB(yellow), 0
GUI Numberbox nbr_lo,         150, MM.VPOS-6, 40, MM.FONTHEIGHT+6, RGB(yellow), RGB(64,64,64)
GUI Button    pb_test, "TEST", 125, 200, 70, 25, RGB(yellow), RGB(red)
CtrlVal(nbr_hi) = 35.5
CtrlVal(nbr_lo) = 15.7
' --- two status LEDs, stacked vertically -------------------------
ledsY = 50         : GUI LED led_run,   "Running", ledsX, ledsY, 8, RGB(green)
ledsY = ledsY + 25 : GUI LED led_alarm, "Alarm",   ledsX, ledsY, 8, RGB(red)
CtrlVal(led_run) = 1                                 ' tracks the switch
' --- logging frame: enable, file name, per-event check boxes -----
Colour RGB(cyan), 0
GUI Frame    frm_log,    "Log File",  210, 10,  110, 160, RGB(green)
GUI Checkbox cb_enabled, "Log On",    215, 20,  20, RGB(cyan)
GUI Caption  c_fname,    "File Name", 215, 45
GUI Textbox  tb_fname,                215, 60,  100, 20, RGB(cyan), RGB(64,64,64)
GUI Caption  c_log,      "Record:",   215, 85,  , RGB(cyan), 0
GUI Checkbox cb_flow,    "Flow",      220, 100, 20
GUI Checkbox cb_alarm,   "Alarms",    220, 120, 20
GUI Checkbox cb_warn,    "Warnings",  220, 140, 20
CtrlVal(cb_enabled) = 1
CtrlVal(tb_fname)   = "LOGFILE.TXT"
' --- backlight spinbox -------------------------------------------
GUI Caption c_bright, "Back Light", 230, 190, , RGB(200,200,255), 0
GUI Spinbox sb_bright,              210, 210, 110, 25, , , 10, 10,100
CtrlVal(sb_bright) = 60
' =================================================================
' Main loop: keyboard fallback for builds with no touch and no mouse
'
' Touch and mouse events go straight to TouchDown / TouchUp via the
' GUI interrupt, so nothing here has to handle them. The loop only
' translates keys into cursor moves and synthetic clicks:
'
'   arrow keys -- move the soft cursor stepx px
'   SPACE      -- momentary click at the current cursor
'   D / d      -- press-and-hold (useful for drag tests)
'   U / u      -- release a held click
'   ESC / Q    -- quit cleanly
' =================================================================
held = 0
Do
 k$ = Inkey$
 If k$ <> "" Then
   Select Case Asc(k$)
   Case &H82                       ' LEFT
     mx = mx - stepx
   Case &H83                       ' RIGHT
     mx = mx + stepx
   Case &H80                       ' UP
     my = my - stepx
   Case &H81                       ' DOWN
     my = my + stepx
   Case 32                         ' SPACE -- momentary click
     '      GUI cursor mx, my
     '      GUI click down
     '      Pause 10
     '      GUI click up
     GUI click mx,my
   Case 100, 68                    ' 'd' / 'D' -- press and hold
     If held = 0 Then
       GUI Cursor mx, my
       GUI Click Down
       held = 1
     EndIf
   Case 117, 85                    ' 'u' / 'U' -- release
     If held = 1 Then
       GUI Click Up
       held = 0
     EndIf
   Case 27, 113, 81                ' ESC / 'q' / 'Q' -- quit
     Exit Do
   End Select
   ' Keep the cursor inside the visible canvas.
   If mx < 0      Then mx = 0
   If my < 0      Then my = 0
   If mx > cw - 1 Then mx = cw - 1
   If my > ch - 1 Then my = ch - 1
   GUI Cursor mx, my
 EndIf
 Pause 5
Loop
' Drop any held click so we don't leave a phantom press behind.
If held = 1 Then GUI Click Up
GUI Cursor Off
End
' =================================================================
' Interrupt handlers
'
' Called for every input source: a finger on the touch panel, a mouse
' button via GUI CURSOR LINK MOUSE, or GUI CLICK from the keyboard
' fallback above. Touch(REF) holds the control that was hit; the body
' of each Case is the actual application logic for that control.
' =================================================================
Sub TouchDown
 Local Integer tx, ty,mbox
 tx = Touch(x) : ty = Touch(y)
 If Not (tx = -1 Or ty = -1) Then
   ' Real touch -- sync the soft cursor so it follows the finger.
   GUI Cursor tx, ty
   mx = tx : my = ty
 EndIf
 Select Case Touch(REF)
 Case cb_enabled                   ' enable / disable the logging UI
   If CtrlVal(cb_enabled) Then
     GUI Restore c_fname, tb_fname, c_log, cb_flow, cb_alarm, cb_warn
   Else
     mbox=1
     On error skip
     mbox=MsgBox("Are you sure?", "YES","CANCEL")
     If mbox=1 Then
       GUI Disable c_fname, tb_fname, c_log, cb_flow, cb_alarm, cb_warn
     Else
       CtrlVal(cb_enabled)=1
     EndIf
   EndIf
 Case sb_bright                    ' brightness spinbox
   If Not (Instr(MM.DEVICE$, "VGA") Or Instr(MM.DEVICE$, "HDMI")) Then
       Backlight CtrlVal(sb_bright)
   EndIf
 Case sw_pmp                       ' pump on/off switch
   CtrlVal(led_run) = CtrlVal(sw_pmp)
   CtrlVal(tb_flow) = Str$(CtrlVal(sw_pmp) * 20.1)
   CtrlVal(r_norm)  = 1            ' snap power mode back to Normal
 Case pb_test                      ' alarm-test button (LED on while held)
   CtrlVal(led_alarm) = 1
 Case r_econ
   CtrlVal(tb_flow) = Str$(CtrlVal(sw_pmp) * 18.3)
 Case r_norm
   CtrlVal(tb_flow) = Str$(CtrlVal(sw_pmp) * 20.1)
 Case r_hi
   CtrlVal(tb_flow) = Str$(CtrlVal(sw_pmp) * 23.7)
 End Select
End Sub
Sub TouchUp
 Select Case Touch(LASTREF)
 Case pb_test                      ' release: turn the alarm LED off
   CtrlVal(led_alarm) = 0
 End Select
End Sub
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11435
Posted: 02:39pm 02 Jun 2026
Copy link to clipboard 
Print this post

Another version to test on the first panel


PicoMite.zip
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 623
Posted: 03:31pm 02 Jun 2026
Copy link to clipboard 
Print this post

  matherp said  Lyle

Please try this on the elecrow. Should give single touch but not multi-touch

PicoMite.zip

Also, please report the enhanced diagnostic for the first screen

Homa: please run this version and report findings


The work is finished. Here is the result of this version as a .txt file in a zip archive.

PicoMiteHDMI touch 2026-06-02_233112_VERSION.zip
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 623
Posted: 03:40pm 02 Jun 2026
Copy link to clipboard 
Print this post

  matherp said  Another version to test on the first panel


PicoMite.zip



lastVersion.zip
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 370
Posted: 03:40pm 02 Jun 2026
Copy link to clipboard 
Print this post

Hi Peter,
Happy to report both the Elecrow RES Touch and the Waveshare Cap Touch are now working as expected, also in conjunction with mouse    This is with your Pump GUI Demo and my test program, GUI Interrupt works much better when OPTION GUI Controls is set  

This is something I never thought we would see, my thanks once again  

Regards, Lyle.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11435
Posted: 03:41pm 02 Jun 2026
Copy link to clipboard 
Print this post

  Quote   Here is the result of this version as a .txt file in a zip archive.


After all that does it work? What happens if you run the demo above - any response?

  Quote  Happy to report both the Elecrow RES Touch and the Waveshare Cap Touch are now working as expected,


Do either or both support multi-touch?
Edited 2026-06-03 01:45 by matherp
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 623
Posted: 03:51pm 02 Jun 2026
Copy link to clipboard 
Print this post

@Peter
My MageDok T090A HDMI 9-inch IPS 1280x720 Touch also works with the Pump Control Demo! Even when using the mouse at the same time. Even if this mysterious third USB device appears and causes the Hex-Debug output. How can I properly test the multi-touch functionality?

Matthias
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 370
Posted: 03:54pm 02 Jun 2026
Copy link to clipboard 
Print this post

Peter,
The Waveshare is CAP touch and reports 10 point capability, although it uses a GT911 so I think it might really be 5.

The Elecrow is RES touch and only single point to my knowledge.

Do you have a test for multipoint?

Regards, Lyle.

EDIT: The startup output proves it, 6 fingers but only 5 reported touch's
 -> expect 84B id=1 count=5 tip=1 x=399 y=473 active=1
Edited 2026-06-03 01:59 by mozzie
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11435
Posted: 03:58pm 02 Jun 2026
Copy link to clipboard 
Print this post

Try this version

PicoMite.zip

If multi-touch is working then GUI TEST TOUCH will allow you to draw two traces at the same time
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 623
Posted: 03:59pm 02 Jun 2026
Copy link to clipboard 
Print this post

I tried this:

  matherp said  
  Quote  Watching this thread with interest.

Coming soon
Do
 Select Case Touch(SWIPE)
   Case 1 : Print @(0,0) "swipe LEFT     "
   Case 2 : Print @(0,0) "swipe RIGHT    "
   Case 3 : Print @(0,0) "swipe UP       "
   Case 4 : Print @(0,0) "swipe DOWN     "
 End Select
 If Touch(TAP)   Then Print @(0,16) "TAP            "
 If Touch(DTAP)  Then Print @(0,16) "DOUBLE TAP     "
 If Touch(HOLD)  Then Print @(0,16) "LONG PRESS     "
 Select Case Touch(PINCH)
   Case 1 : Print @(0,32) "EXPAND         "
   Case 2 : Print @(0,32) "CONTRACT       "
 End Select
 Select Case Touch(ROTATE)
   Case 1 : Print @(0,48) "ROTATE CW      "
   Case 2 : Print @(0,48) "ROTATE CCW     "
 End Select
 If Touch(TTAP)  Then Print @(0,64) "TWO-FINGER TAP "
 Pause 50
Loop



Apart from Touch(PINCH) and Touch(ROTATE), the rest are working fine! And I receive the correct message.
So Touch (TTAP) is missing as well.
So multitouch doesn't work :-(

Matthias
Edited 2026-06-03 02:01 by homa
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 623
Posted: 04:07pm 02 Jun 2026
Copy link to clipboard 
Print this post

  matherp said  Try this version

PicoMite.zip

If multi-touch is working then GUI TEST TOUCH will allow you to draw two traces at the same time


Updated – unfortunately, only one line with two fingers.
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 623
Posted: 04:10pm 02 Jun 2026
Copy link to clipboard 
Print this post

I'll be out for a bit - I'll be back later!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11435
Posted: 04:11pm 02 Jun 2026
Copy link to clipboard 
Print this post

V6.03.00RC15

PicoMiteRP2040V6.03.00RC15.zip
PicoMiteRP2350V6.03.00RC15.zip

Fixes bug causing problems with WebMite on Pico-2W
Fixes editor bug in mark/cut/copy on long lines
Improves support for various USB touch screens
Adds standardised data flexibility for onewire, spi, i2c host and i2c slave read and write commands.

  Quote  'length' is the length of data to send or receive
'data' is the data to send or variable to receive.  The data to send (WRITE) or the destination for received data (READ) may be supplied in any one of three forms:
• A list of individual items. The number of items must equal the length parameter. For WRITE each item is a constant, variable or expression; for READ each item is a numeric variable to receive one value. Array elements such as a(3) are allowed.
• An array, specified with empty brackets, e.g. array(). It may be a floating-point or integer array and must be large enough to supply (WRITE) or hold (READ) the specified number of elements, which are taken from / stored into consecutive elements starting at the first.
• A string variable. For WRITE the first length characters are sent (the string must be at least that long); for READ the received bytes are stored as sequential characters and the string is set to that length.
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 370
Posted: 04:12pm 02 Jun 2026
Copy link to clipboard 
Print this post

Peter,
Works like a charm, two finger painting is a go  

Loving it  

Can we currently access in MMBasic or am I getting carried away as usual?

Regards, Lyle

Edit: Just tried the code Homa posted and all working  
Edited 2026-06-03 02:26 by mozzie
 
     Page 15 of 20    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026