|
Post by alexfish on Nov 17, 2023 23:42:00 GMT 1
Q: from a conversation today: how long have you be programming... A: 47 years , most of it BASIC , although I know others Q: Why BASIC A: it is easy to remember ... Q: Can you program in javascript , everyone says it be the future A: NO. but you are correct in, it be the future, since it take 50 years to learn it and understand it Filling the grimy details ref to the above . WHY: easy to use ?
|
|
|
Post by alexfish on Nov 18, 2023 10:41:25 GMT 1
Post look a bit bitty here on pi I got a problem mouse,keyboard reactions , at times none responsive + the browser freezes , then need to reboot had whilst posting the task manager bits in short look at this picky browser has 2 tabs open UPDATED As a work around and if have other devices with low memory Install chromium-shellcall by http IE: chromium-shell http://basic-converter.org/ This PI4 with 4GB and shell running = total CPU mem of 300GB BR Alex Attachments:
|
|
|
Post by alexfish on Nov 18, 2023 22:50:41 GMT 1
To round up on the gcode demo
I was looking for a constant accuracy step of 0.001 of a mm on interpolation
the arc can be a pitter
how ever this is a final result of working with the finess(e) values 0.5 to 1 =
finess = finess * 0.0625
measure wise Error at quadrant 90 deg = 0.027 , but if circle then step again = over 0.014 think for normal usage = fair
test results
part one end of one arc to the next
G3 X50.002 Y199.327 G3 X50.002 Y199.358 G3 X50.002 Y199.389 G3 X50.002 Y199.420 G3 X50.002 Y199.452 G3 X50.001 Y199.483 G3 X50.001 Y199.514 G3 X50.001 Y199.545 G3 X50.001 Y199.577 G3 X50.001 Y199.608 G3 X50.001 Y199.639 G3 X50.001 Y199.670 G3 X50.000 Y199.702 G3 X50.000 Y199.733 G3 X50.000 Y199.764 G3 X50.000 Y199.795 G3 X50.000 Y199.827 G3 X50.000 Y199.858 G3 X50.000 Y199.889 G3 X50.000 Y199.920 G3 X50.000 Y199.952 G3 X50.000 Y199.983 << note this bit = 0.027 off block-[2] G0 X150.000 Y100.000 G2 X150.031 Y100.000 G2 X150.062 Y100.000 G2 X150.094 Y100.000 G2 X150.125 Y100.000 G2 X150.156 Y100.000 G2 X150.188 Y100.000 G2 X150.219 Y100.000 G2 X150.250 Y100.000 G2 X150.281 Y100.000 G2 X150.312 Y100.000 G2 X150.344 Y100.001 G2 X150.375 Y100.001 G2 X150.406 Y100.001 G2 X150.438 Y100.001 G2 X150.469 Y100.001 G2 X150.500 Y100.001 G2 X150.531 Y100.001 G2 X150.562 Y100.002 G2 X150.594 Y100.002 G2 X150.625 Y100.002 G2 X150.656 Y100.002 G2 X150.687 Y100.002 G2 X150.719 Y100.003 G2 X150.750 Y100.003 G2 X150.781 Y100.003 G2 X150.812 Y100.003 G2 X150.844 Y100.004
next step transition at 90
G3 X50.000 Y200.014 block-[2] G0 X150.000 Y100.000
Splitting Hairs
|
|
|
Post by alexfish on Nov 19, 2023 0:49:30 GMT 1
and the why 0.0625 stepper motor + driver with micro stepper
stepper motor mm lead steps step 1 0.04 8 200 half 0.02 8 400 quarter 0.01 8 800 eighth 0.005 8 1600 sixteenth 0.00025 8 32000
a for loop of 0.0625
1 0.0625 times 2 0.125 times 3 0.1875 times 4 0.25 times 5 0.3125 times 6 0.375 times 7 0.4375 times 8 0.5 times 9 0.5625 times 10 0.625 times 11 0.6875 times 12 0.75 times 13 0.8125 times 14 0.875 times 15 0.9375 times 16 1 times 17 1.0625 times 18 1.125 times 19 1.1875 times 20 1.25 times 21 1.3125 times 22 1.375 times 23 1.4375 times 24 1.5 times 25 1.5625 times 26 1.625 times 27 1.6875 times 28 1.75 times 29 1.8125 times 30 1.875 times 31 1.9375 times 32 2 times 33 2.0625 times 34 2.125 times 35 2.1875 times 36 2.25 times 37 2.3125 times 38 2.375 times 39 2.4375 times 40 2.5 times
IF use standard ballscrew lead of 5:then things change : self explanatory
step 1 0.025 5 200 half 0.0125 5 400 quarter 0.00625 5 800 eighth 0.003125 5 1600 sixteenth 0.0015625 5 3200
|
|
|
Post by alexfish on Nov 22, 2023 16:08:02 GMT 1
Instance CIRCLE: ref above posts Relevance HUG imager 5.2
in HUG imager 5.2 is distance GEOSPACIAL here adapted to put Diameter the referencing lat,lon at two sets of coords (rel GPS PLOTTING) (3D PLOTTING) with arc deg and circ(circumference)
DEF FN DEG2RAD(deg) = (deg * M_PI / 180.0) DEF FN RAD2DEG(rad) = (rad / M_PI * 180.0) ' ========================================================= 'geospacial FUNCTION GET_DISTANCE (double dia,double lat1, double lon1, double lat2, double lon2) TYPE float ' =========================================================
LOCAL distance = 0 TYPE double LOCAL tmp TYPE double
tmp = sin(DEG2RAD(lat1)) * sin(DEG2RAD(lat2)) + cos(DEG2RAD(lat1)) * cos(DEG2RAD(lat2)) * cos(DEG2RAD(lon2) - DEG2RAD(lon1))
distance = (dia * acos(tmp))
RETURN distance
END FUNCTION
LOCAL DIST TYPE double DIST = GET_DISTANCE(600,0,0,90,90) REM math wise circumference = diameter*PI PRINT 600.0 * PI/2 PRINT DIST
BR Alex
|
|
|
Post by alexfish on Nov 25, 2023 22:35:56 GMT 1
After applying the fixes for Gcoding in the trouble shooting thread (floats and doubles trouble) end of block looks good G3 X151.047 Y100.002 G3 X150.524 Y100.001 [b]G3 X150.000 Y100.000[/b] << this bit
In bCNC Gcode is very finely Draw , very different from previous Attempts Arc Wise the line is very faint The Picky:: The fat line = GOTO, each bit of grid is 10mm square Attachments:
|
|
|
Post by alexfish on Nov 26, 2023 19:51:57 GMT 1
In Progress Debugging + added some new features of SCROLLABLE WINDOW :: GTK3 window 'gtk_window_set_resizable(win, 0)' does not work if widgets are outside of bounds of window Hence WINDOW will resize to the bounds of the Widget It is Especially Problematic for CANVAS GOO (BOUNDS) also Very useful for Devices having small screens Fixes CANVAS CAIRO : CIRCLE, ARC General improvements to CANVAS : can now have opengl Area as a Widget hence can have 3D overlays to main 2D canvases In Old Money can call them 3d sprites Updated Include Libs: Hershey_fonts (requires libhersheyfont-dev), VTE-TERMINAL, SEDIT & WEBKIT Update will be in January 2024 BR Alex sample code:: not all will work in present LIB INCLUDE "hug353B.bac" HUGOPTIONS("CANVAS CAIRO") HUGOPTIONS("NOSCALING")
SUB Draw(NUMBER widget) CAIRO_FONT_SIZE = 16 SQUARE("000000",0,0,1200,1000,1) CIRCLE("#0000FF",100,0,400,400,1) CIRCLE("#FF00FF",0,200,600,200,0) CIRCLE("#FFFF00A0",585,285,30,30,1) CAIRO_LINE_WIDTH =2 CIRCLE("#FF0000",585-2,285-2,30,30,0) CAIRO_LINE_WIDTH =1 OUT("CIRCLE FILL","#00FFFF","#0000FF",170,100) OUT("ELLIPSE STROKE","#00FFFFFF","#0000FF",230,300) CAIRO_FONT_SIZE = 100 OUT("CAIRO Text","#0000FFFF","#0000FF",40,500) CAIRO_FONT_SIZE = 16 END SUB REM WINDOW title, width, height,scrollable win = WINDOW("Scrolled Win",906,739,1) box = BOX(900-16,30) but = BUTTON("Quit",100,30) PACKEND(box,but) CALLBACK(but,QUIT) TOOLTIP(but,"Exit") ATTACH(win,box,3,3)
can = CANVAS(1200,1000) ATTACH(win,can,3,36) CALLBACK(can,Draw) OUT("CLICK ME","#0000FFFF","#0000FF",40,300) DISPLAY
Attachments:
|
|
|
Post by alexfish on Nov 26, 2023 22:43:26 GMT 1
To Come vte353.bac one of the why's 'cant get weather as png' wttr So one use for the terminal vte has a BASH command example of weather INCLUDE hug353B.bac INCLUDE vte353.bac
SUB Weather
BASH(term,"curl wttr.in/oslo")
END SUB
win = WINDOW("Term",900,600,1) but = BUTTON("Weather",100,30) ATTACH(win,but,3,3) CALLBACK(but,Weather) term = TERMINAL(1200,570) ATTACH(win,term,3,33) DISPLAY
A little bit of BaCon INCLUDE hug353B.bac INCLUDE vte353.bac
SUB bash
BASH(term,"bacon -e test.bac")
END SUB
win = WINDOW("Term",900,600,1) but = BUTTON("bash",100,30) ATTACH(win,but,3,3) CALLBACK(but,bash) term = TERMINAL(1200,570) ATTACH(win,term,3,33) DISPLAY save the weather and cat it INCLUDE hug353B.bac INCLUDE vte353.bac
SUB Weather
BASH(term,"curl wttr.in/oslo >weather.txt") BASH(term,"cat weather.txt")
END SUB
win = WINDOW("Term",900,600,1) but = BUTTON("Weather",100,30) ATTACH(win,but,3,3) CALLBACK(but,Weather) term = TERMINAL(1200,570) ATTACH(win,term,3,33) DISPLAY Attachments:
|
|
|
Post by alexfish on Nov 27, 2023 2:11:18 GMT 1
The Update vte-terminal added TERMFONTSIZE here is the weather bit INCLUDE hug353B.bac INCLUDE vte353.bac
SUB Weather
BASH(term,"curl wttr.in/oslo >weather.txt") BASH(term,"cat weather.txt")
END SUB
win = WINDOW("Term",900,600,1) but = BUTTON("Weather",100,30) ATTACH(win,but,3,3) CALLBACK(but,Weather) term = TERMINAL(1200,1000,0) TERMFONTSIZE(term,8) ATTACH(win,term,3,50) FOCUS(term) DISPLAY Frrrrrrrosted Picky Attachments:
|
|
|
Post by alexfish on Nov 27, 2023 2:52:34 GMT 1
The updated SEDIT to come Since The New Lib is graphics oriented + has new KEYWORDS for SEDIT can configure to the NEW API The hug.lang INCLUDE hug353.bac INCLUDE sedit353.bac
win = WINDOW("Sedit",600,400) sed = SEDIT("hug",600,400,80) FONT(sed,"monospace 18px") ATTACH(win,sed,3,3) svg$ = LOAD$("/home/pi/blur.svg") TEXT(sed ,svg$) DISPLAY The Pick is of the TERMINAL app Code another Picky : Did a compile of older BaconGui : change the lang spec to 'hug' Attachments:
|
|
|
Post by alexfish on Nov 28, 2023 3:17:32 GMT 1
Alt the bits are in Last Post till Update Released Update : Testing a 1020x600 screen :the main scrolled window works out well Second Picky If not noticed this small screen is on the PI4 hdmi port : part of the CNC router project the GPIO pins are been used by the PI4 IE: the Motion Controller BR Alex Picky Attachments:
|
|
|
Post by alexfish on Dec 5, 2023 18:39:48 GMT 1
HUG.3.5.3 Final
See First & Second Posts
And the hershey.bac
PRAGMA INCLUDE <hersheyfont.h> PRAGMA LDFLAGS -lhersheyfont OPTION PARSE FALSE
SUB HERSHEYTEXT(hug_text$,hug_font$, hug_coulor$,int hug_xpos, int hug_ypos,double hug_scale) IF HUG_CANVAS_TYPE = 1 THEN EXIT pix = hug_gui_properties.canvas ebox = hug_widget_ebox(STR$(pix))
LOCAL hershey_font *hf = hershey_font_load(hug_font$) TYPE struct LOCAL p TYPE const char *
LOCAL i, t, ch, x_render_pos = 0 LOCAL x,y,xx,yy TYPE double
IF ( NOT(hf) ) THEN perror(hug_font$) END END IF
CAIRO_SCALE = hug_scale FOR t = 1 TO LEN(hug_text$)
ch = ASC(MID$(hug_text$, t, 1)) LOCAL hershey_glyph *hg = hershey_font_glyph(hf, ch) TYPE struct IF ( hg->width == 0 ) THEN CONTINUE
LOCAL hershey_path *hp TYPE struct for ( hp=hg->paths; hp; hp=hp->next ) {
for ( i=0; i<hp->nverts -1; i++ ) { x = hp->verts[i].x + x_render_pos y = 0- hp->verts[i].y
xx = hp->verts[i+1].x + x_render_pos yy = 0- hp->verts[i+1].y
LINE(hug_coulor$,x+hug_xpos,y+hug_ypos,xx+hug_xpos,yy+hug_ypos)
} } INCR x_render_pos , hg->width
NEXT
hershey_font_free(hf) CAIRO_SCALE = 1.0
END SUB
/* if want hersheyfont
sudo apt install libhersheyfont-dev'
usage HERSHEYTEXT("STRING$ ","STRINGFONT$",COLOUR ",XPOX,YPOS,SCALE) COLOUR in HEX example "0xFF00FF" SCALE is double so can be 1.5 best values 1 TO 4 FONT NAMES astrology cursive cyrilc_1 cyrillic futural futuram gothgbt gothgrt gothiceng gothicger gothicita gothitt greek greekc greeks japanese markers mathlow mathupp meteorology music rowmand rowmans rowmant scriptc scripts symbolic timesg timesi timesib timesr timesrb */
BR Alex
|
|
|
Post by alexfish on Dec 5, 2023 23:01:11 GMT 1
Follow up of DEMO code Post #1 MARK with Callback INCLUDE "hug353.bac"
SUB GetLink() LOCAL link$ LOCAL link link$ = GETLINK$(mk) PRINT link$ END SUB
win= WINDOW("Mark",900,900,1) mytxt$= " BaCon uses <a href='http://www.fossil-scm.org/'>Fossil</a> for its software versioning" mk = MARK(mytxt$,-1,-1) ATTACH(win,mk,0,0) MARKSELECT(mk,TRUE) GLINK(mk,GetLink)
DISPLAY
version 2 INCLUDE "hug353.bac"
SUB GetLink() LOCAL link$ LOCAL link link$ = GETLINK$(mk) TEXT(ent, INBETWEEN$(link$,"'","'") ) END SUB
win= WINDOW("Mark",800,400,1) mytxt$= " BaCon uses <a href='http://www.fossil-scm.org/'>Fossil</a> for its software versioning" mk = MARK(mytxt$,-1,-1) ATTACH(win,mk,0,0) MARKSELECT(mk,TRUE) GLINK(mk,GetLink) ent = ENTRY("link",400,30) ATTACH(win,ent,3,35)
DISPLAY
BR Alex Attachments:
|
|
|
Post by alexfish on Dec 5, 2023 23:43:33 GMT 1
Also did a Hack on earlier version bacon legacy using the converted bacon.lang to hug.lang PICKY Attachments:
|
|
|
Post by alexfish on Dec 24, 2023 14:27:38 GMT 1
GTK HUG 3.5.3 Notification :: Bug in Cairo First time seen 24/Dec/2023 Affects Cairo and Goo Canvas ::Rect, Line & polyline Cause:: unknown RGB & RGBA colours show as ALPHA , level of alpha unknown Tests on CANVAS CAIRO, CANVAS GOO and CANVAS GLAREA Best shown by the screen shots , Cairo.png and GL.png Alex Attachments:
|
|