Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:09 13 May 2025 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 : Newie got a few questions

     Page 22 of 25    
Author Message
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 12:29pm 26 Jul 2020
Copy link to clipboard 
Print this post

I thought I'd have one last go before I give up for good

I installed this version of Stretch "2018-04-18-raspbian-stretch.img" The Zip 1.7G image from here
and THIS WORKING MMBASIC.zip version of Pi-Cromite

I can't tell what version it actually is other than it "says" it's 5.4.25 when I run sudo ./mmbasic
I renamed the Zip file so I knew which one actually worked

The triangles work, but they just draw one on top of the other ARGHH!

test1.bas in the zip test1.zip
Edited 2020-07-26 22:32 by lew247
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10071
Posted: 12:33pm 26 Jul 2020
Copy link to clipboard 
Print this post

Not at home so I can't test anything. Will look at the Buster version in a couple of weeks.
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 01:09pm 26 Jul 2020
Copy link to clipboard 
Print this post

Thanks Peter
if it helps this 2017-10-30_185448_mmbasicstretch.zip is the last version of pi-cromite that works perfectly with the triangles and 2018-04-18-raspbian-stretch.img
It draws the screen really slowly, but it works  
Edited 2020-07-26 23:12 by lew247
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 01:16pm 04 Dec 2020
Copy link to clipboard 
Print this post

I'm trying to convert my codes to use MM.HRES and MM.VRES instead of pixels so I can use them on different screens

Is there an easy way to convert or do I have to try and guess each one till I get it right?

For example  
RBox 00,00,MM.HRES/8,MM.HRES/8,15, RGB(WHITE), RGB(BLACK)  
RBox MM.HRES/8,00,MM.HRES/8,MM.HRES/8,15, RGB(WHITE), RGB(BLACK)  
was
 RBox 00,00,396,100,15, RGB(136,184,62), RGB(12,26,8)  
 RBox 400,00,400,98,15, RGB(200,148,77), RGB(22,20,15)
I got those by experimenting but it took a long time and they aren't exact


I have loads of text's that need converting
example
 Text 475,360, "MPH", LM,4, 1, RGB(215,255,119),RGB(34,49,22)  
 Text 415,296,  "Wind" , LM, 2, 1, RGB(12,26,8),RGB(215,255,119)  

I've also got some circles to resize

Please tell me there's an easy way to do it rather than trial and error?
Edited 2020-12-05 00:42 by lew247
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1122
Posted: 06:02pm 04 Dec 2020
Copy link to clipboard 
Print this post

  lew247 said  I'm trying to convert my codes to use MM.HRES and MM.VRES

was
 RBox 00,00,396,100,15, RGB(136,184,62), RGB(12,26,8)  

What was the original screen resolution?

For the case of '396', the new value can be calculated as

newval = 396 * MM.HRES / OLD.HORIZONTAL.RESOLUTION
Visit Vegipete's *Mite Library for cool programs.
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 10:26pm 04 Dec 2020
Copy link to clipboard 
Print this post

800 * 480
However would I have to do  
RBox 00,00,396*MM.HRES/800,100*MM.VRES/480,15, RGB(136,184,62), RGB(12,26,8)  
RBox 400,00,400*MM.HRES/800,98*MM.VRES/480,,15, RGB(200,148,77), RGB(22,20,15)
for every single value in the code?
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6221
Posted: 12:45am 05 Dec 2020
Copy link to clipboard 
Print this post

I would define two global variables.

dim float s_x = mm.hres/800
dim float s_y = mm.vres/480


That makes life easier.

you still have to put it in everywhere you draw stuff.

Jim
VK7JH
MMedit
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 08:42am 05 Dec 2020
Copy link to clipboard 
Print this post

brilliant, Thanks  
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 12:33pm 16 Dec 2020
Copy link to clipboard 
Print this post

Todays question which might sound dead simple to most of you but I've spent the past 6 hours since 6am trying to figure it out
I have this in a string
"conditions":"Rain Likely"
I remove the first bit with  condhour1$ = MID$(condhour1$,15) which leaves Rain Likely"
How can I remove the last " from the string?
If the length of the string was fixed it would be easy using mid$
Is there a way when the length of the string varies but always ends with "
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10071
Posted: 12:37pm 16 Dec 2020
Copy link to clipboard 
Print this post

Left$(len(string)-1)
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 12:39pm 16 Dec 2020
Copy link to clipboard 
Print this post

Thank you Peter
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 12:51pm 16 Dec 2020
Copy link to clipboard 
Print this post

> run "r"
[491] condhour1$ = Left$(Len(condhour1$)-1)
Error: Argument count
>

"conditions":"Rain Likely"
condhour1$ = a$(45) ' conditions *****FORECAST for next hour****
condhour1$ = MID$(condhour1$,15)
condhour1$ = Left$(len(condhour1$)-1)

Edited 2020-12-16 22:52 by lew247
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 01:06pm 16 Dec 2020
Copy link to clipboard 
Print this post

Left$(condhour1$,Len(condhour1$)-1)
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 01:11pm 16 Dec 2020
Copy link to clipboard 
Print this post

And you should first get the "Rain Likely" part:

condhour1$ = FIELD$(condhour1$, 2, ":") 'second part after :


then remove ":

condhour1$ = MID$(condhour1$, 2) 'first removed
condhour1$ = LEFT$(condhour1$, LEN(condhour1$) - 1) 'last removed

Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 01:24pm 16 Dec 2020
Copy link to clipboard 
Print this post

I did try using the field$ before but forgot to use the : has to be a string$

[495] condhour1$ = Left$(condhour1$, Len(condhour1$) - 1) 'last removed
Error: -1 is invalid (valid is 0 to 255)
>
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 03:06pm 16 Dec 2020
Copy link to clipboard 
Print this post

It looks like condhour1$ is empty, you need to test it before:

IF LEN(condhour1$) > 1  THEN 'you have at least "" as string
      condhour1$ = MID$(condhour1$, 2) 'first removed
      condhour1$ = LEFT$(condhour1$, LEN(condhour1$) - 1) 'last removed
ENDIF

Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 05:05pm 16 Dec 2020
Copy link to clipboard 
Print this post

Thank you that worked perfectly

Is there a way to get this so it will choose default.bmp if either iconhour1$ = "null" or iconhour1$ = "not found" arrives but will add .bmp to the icon name when a valid icon string such as this arrives?

  Quote  "icon":"partly-cloudy-night"



iconhour1$ = a$(46) 'icon
 print iconhour1$ 'test print
  IF iconhour1$ = "null" THEN iconhour1$ = "default"  
 IF iconhour1$ = "not found" THEN iconhour1$ = "default"
 iconhour1$ = FIELD$(iconhour1$, 2, ":")
 IF LEN(iconhour1$) > 1 THEN
    iconhour1$ = MID$(iconhour1$, 2) 'first removed
    iconhour1$ = LEFT$(iconhour1$, LEN(iconhour1$) - 1) 'last removed
 END IF  
 iconhour1$ = iconhour1$ + ".bmp 'add .bmp to icon name
 print iconhour1$ 'test print

I can get it to add the .bmp at the end of the valid icon string name but I cannot find a way to get it to do it after choosing default because I cannot find a way to  use ":"default""
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3319
Posted: 05:29pm 16 Dec 2020
Copy link to clipboard 
Print this post

Does this do what you want?

 iconhour1$ = a$(46) 'icon
 print iconhour1$ 'test print
 IF iconhour1$ = "null" THEN
   iconhour1$ = "default"  
 ELSEIF iconhour1$ = "not found" THEN
   iconhour1$ = "default"
 ELSE
   iconhour1$ = FIELD$(iconhour1$, 2, ":")
   IF LEN(iconhour1$) > 1 THEN
     iconhour1$ = MID$(iconhour1$, 2) 'first removed
     iconhour1$ = LEFT$(iconhour1$, LEN(iconhour1$) - 1) 'last removed
   ELSE
     iconhour1$ = "default"
   END IF  
 END IF  
 iconhour1$ = iconhour1$ + ".bmp 'add .bmp to icon name
 print iconhour1$ 'test print


~
Edited 2020-12-17 03:32 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 06:38pm 16 Dec 2020
Copy link to clipboard 
Print this post

Unfortunately not
> run "r.bas"
[505] iconhour1$ = iconhour1$ + ".bmp     '"add .bmp To icon
Error: Expression syntax
>

edited because I had a print icon further up the program that was working but it made it look like this bit
Edited 2020-12-17 04:43 by lew247
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 06:49pm 16 Dec 2020
Copy link to clipboard 
Print this post

I think the only way to do it is turn iconhour1$ into an array and then add the + ".bmp) but it doesn't seem possible unfortunately
 
     Page 22 of 25    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025