Foobler's "Getting Started" notes

You’re correct – PicoMite and WebMite were not made with a device like the PicoCalc in mind, and the active users and developer on TheBackShed have little to no interest in supporting the PicoCalc. Largely that’s due to the way Clockwork simply took their software without asking or notifying them, did a somewhat quick and dirty port, and released it as part of the PicoCalc without proper attribution/license. I think the license/attribution thing has been resolved since, but there have been discussions on TheBackShed about how they should make and sell a better device to compete with the PicoCalc, and even an initial discussion of how they considered purposely making the firmware incompatible or difficult to use on PicoCalc. TLDR: there’s been drama.

Since Clockwork rarely does any kind of ongoing software with their devices, and since I wanted to try the newest versions of PicoMite/WebMite on the PicoCalc (rather than the arguably ancient and buggy one that was officially ported by Clockwork), and since it seemed most other development was focusing on MicroPython, uLisp, and Forth, I decided to try to update the PicoMite/WebMite port and created a clean fork from the official git repo.

Functionally it should be the same as the latest official PicoMite or WebMite, but the WebMite firmware for PicoCalc has one “hidden” feature. It actually includes the GUI controls from PicoMite. (The official manual will claim WebMite doesn’t have GUI controls, which is true outside of PicoCalc.) There was interest on the forums here to include them and they seemed to work so I kept them in all PicoCalc builds. GUI controls do seem to be deprecated in the official release though, so maybe it was a mistake for me to include them in WebMite. They also seem to be a bit buggy, and I don’t get the impression they were ever used much or tested well.

It’s worth noting that WebMite seems to be hardly used by enthusiasts on TheBackShed, and seems to be largely considered something to use as a headless webserver and for collecting simple forms of data via unencrypted connections (It doesn’t support HTTPS or SSL, and likely never will.) MMBasic users over there seem to have little interest or use in wireless access or usage via their Pico modules, and PicoMite seems to mostly be used as an offline “retro computer” or “game console” most often connected to a display via HDMI or VGA.

All of this has made the PicoCalc port of PicoMite (and especially WebMite) a curious beast. And since I am just an enthusiast and PicoCalc owner myself, and not connected to Clockwork or TheBackShed in any other way, it makes supporting the “unofficial” PicoCalc port difficult. It will probably never gain some useful features for the PicoCalc hardware (like Bluetooth) since the developer and enthusiasts on TheBackShed have no interest or use in such things. WebMite will probably always have unfortunate tradeoffs like the lower CPU speed for sake of stability compared to PicoMite which can be clocked faster but has no wireless capability. And the bulk of graphics programs written in MMBasic will use commands like TILE and SPRITE which are not supported on anything other than HDMI and VGA displays, which means they won’t work on PicoCalc.

Sorry for the long off-topic digression, but I figured the GUI controls info and HDMI/VGA graphics info were relevant, and unfortunately it required a lot of context to make any sense.

It’s really cool to see the code you’ve been posting, and other people’s code sharing posts here and on git repos! I hope the PicoCalc continues to be fun for everyone with PicoMite/WebMite though I wanted to be honest about the state of things, and I have the feeling that to get the most use out of the hardware it’s necessary to consider using one of the more fully featured (and perhaps supported) options like MicroPython, uLisp, Forth, or Arduino development on the PicoCalc. I don’t plan to abandon the PicoCalc port of PicoMite/WebMite any time soon, but it’s unlikely to ever be more than just a port of the official release with support for the custom hardware (keyboard, display, pin assignments) of the PicoCalc.

EDIT: added links to various referenced topics

6 Likes

Also, note that the latest version of the (draft) manual is available for PicoMite/WebMite V6.00.02.

PicoCalc versions can’t use anything marked as “only for” HDMI or VGA, but LCD related display stuff should work. There are various PicoMite things that are unsupported in WebMite (for instance background FRAMEBUFFER copy). So reading the docs is kind of a puzzle, to figure out what is actually supported on the PicoCalc, and it depends on whether you use PicoMite or Webmite. While it would nice to have a PicoCalc version of the documentation, it probably isn’t feasible since the official version is a moving target and the documentation is… extensive.

The PicoCalc version currently has a few extra commands. I’ll keep these updated on the git repo if they change or more are added. There’s a known issue related to the battery charging indicator – it has a bit of a delay. This is due to how often the internal STM32 updates that information.

Information Command Decription
MM.INFO(BATTERY) PICOCALC ONLY
Returns the current battery level percentage (0-100).
MM.INFO(CHARGING) PICOCALC ONLY
Returns 1 if battery is charging on external power, 0 if battery is not charging.
Option Command Decription
OPTION BACKLIGHT KB brightness PICOCALC ONLY
Sets the brightness of the keyboard backlight. ‘brightness’ is a value between 0 (backlight off) and 255 (maximum brightness).
1 Like

The community on TheBackShed’s always been a bit 'ornery and defensive, and while ClockworkPi definitely put their noses out of joint, they also make it tricky to do right by them in the first place. Best to treat them with full respect, but keep your limbs well away from their teeth. I’d actually recommend not posting questions there unless you happen to own an actual MaxiMite.

1 Like

I’m pretty sure sprites are fully supported on the LCD PicoMite/WebMite but only on a framebuffer. Just do everything on the framebuffer and then copy to the physical screen when required. There is a demo posted https://www.thebackshed.com/forum/ViewTopic.php?TID=17906&PID=238435#238435 but I haven’t run it myself.

1 Like

Right, the framebuffer can be used as a workaround, but the “SPRITE” command, which I was referring to in my post is not supported, as the official manual indicates. Lots of graphics example code uses the SPRITE command on TheBackShed, so if those examples were to run on the PicoCalc, they’d need to be partially rewritten.

1 Like

The example I posted a link to uses the Sprite command and runs on an LCD PicoMite. Just tested on an ILI9488 480x320 Pico2. Try it.

Option console serial
FRAMEBUFFER create
FRAMEBUFFER write f
CLS
'brownian motion demo using sprites
Dim integer x(32),y(32),c(32)
Dim float direction(32)
Dim integer i,j,k, collision=0
Dim string q$
For i=1 To 32
direction(i)=Rnd*360 'establish the starting direction For each atom
c(i)=RGB(Rnd*255,Rnd*255,Rnd*255) 'give each atom a colour
Circle 9,9,9,1,,RGB(white),c(i) 'draw the atom
Sprite read i,0,0,19,19 'read it in as a sprite
Next i
CLS RGB(myrtle)
Box 1,1,MM.HRES-2,MM.VRES-2
k=1
For i=MM.HRES\9 To MM.HRES\9*8 Step MM.HRES\9
For j=MM.VRES\9 To MM.VRES\9*8 Step MM.VRES\5
  Sprite show k,i,j,1
  x(k)=i
  y(k)=j
  vector k,direction(k), 0, x(k), y(k) 'load up the vector move
  k=k+1
Next j
Next i
'
Do
For i=1 To 32
  vector i, direction(i), 1, x(i), y(i)
  Sprite show i,x(i),y(i),1
  If sprite(S,i)<>-1 Then
    break_collision i
  EndIf
Next i
FRAMEBUFFER copy f,n
Print Timer:Timer =0
Loop
'
Sub vector(myobj As integer, angle As float, distance As float, x_new As integer, y_new As integer)
Static float y_move(32), x_move(32)
Static float x_last(32), y_last(32)
Static float last_angle(32)
If distance=0 Then
  x_last(myobj)=x_new
  y_last(myobj)=y_new
EndIf
If angle<>last_angle(myobj) Then
  y_move(myobj)=-Cos(Rad(angle))
  x_move(myobj)=Sin(Rad(angle))
  last_angle(myobj)=angle
EndIf
x_last(myobj) = x_last(myobj) + distance * x_move(myobj)
y_last(myobj) = y_last(myobj) + distance * y_move(myobj)
x_new=Cint(x_last(myobj))
y_new=Cint(y_last(myobj))
Return

' keep doing stuff until we break the collisions
Sub break_collision(atom As integer)
Local integer j=1
Local float current_angle=direction(atom)
'start by a simple bounce to break the collision
If sprite(e,atom)=1 Then
  'collision with left of screen
  current_angle=360-current_angle
ElseIf sprite(e,atom)=2 Then
  'collision with top of screen

current_angle=((540-current_angle) Mod 360 )
ElseIf sprite(e,atom)=4 Then
  'collision with right of screen
  current_angle=360-current_angle
ElseIf sprite(e,atom)=8 Then
  'collision with bottom of screen
  current_angle=((540-current_angle) Mod 360)
Else
  'collision with another sprite or with a corner
  current_angle = current_angle+180
EndIf
direction(atom)=current_angle
vector atom,direction(atom),j,x(atom),y(atom) 'break the collision
Sprite show atom,x(atom),y(atom),1
'if the simple bounce didn't work try a random bounce
Do While (sprite(t,atom) Or sprite(e,atom)) And j<10
  Do
    direction(atom)= Rnd*360
    vector atom,direction(atom),j,x(atom),y(atom) 'break the collision
    j=j+1
  Loop Until x(atom)>=0 And x(atom)<=MM.HRES-sprite(w,atom) And y(atom)>=0 And y(atom)<=MM.VRES-sprite(h,atom)
  Sprite show atom,x(atom),y(atom),1
Loop
' if that didn't work then place the atom randomly
Do While (sprite(t,atom) Or sprite(e,atom))
  direction(atom)= Rnd*360
  x(atom)=Rnd*(MM.HRES-sprite(w,atom))
  y(atom)=Rnd*(MM.VRES-sprite(h,atom))
  vector atom,direction(atom),0,x(atom),y(atom) 'break the collision
  Sprite show atom,x(atom),y(atom),1
Loop
End Sub
3 Likes

Interesting! It does work!

I guess the documentation in the manual is wrong.

3 Likes

What a very detailed and helpful reply! Thank you. It is quite useful to hear the history and backstory that explain our current PicoCalc situation.

I am happy to have a PicoCalc and to explore Basic on it. I’d be happy to see similar devices emerge from other sources. I’d be happy to try out other firmware. I wonder if I should find a ZIF socket for core modules.

My intent with this thread is to encourage and educate others, and to gain and share knowledge, maybe learn new things myself.

1 Like

Wow, that’s cool! The sprite code worked on the PicoCalc, no problem!

Getting programs directly from Android onto the PicoCalc:

Browsed this forum post in this thread using the Android phone, found and then copied the Brownian Motion code to the phone’s clipboard.

Used “Simple Text Editor” app to save the copied code into a text file, “t2.bas”.

Then used the “Serial USB Terminal” app to connect to the PicoCalc with a cable with USB-C connectors on each end. 115200, 8N1 for the serial connection. Sent an “Enter” and got back a “>” prompt.

In the “Serial USB Terminal” app’s menu, chose “Upload file”, “xmodem”, then selected the file to begin the transmission.

On the PicoCalc, started a XMODEM RECEIVE "t2.bas", and got the file.

Good evening lads, got some more apps out today :slight_smile: Calculators

2 Likes