1
1
var interval_status = - 1 ;
2
2
var probe_progress_status = 0 ;
3
- var surface_progress_status = 0 ;
4
3
var grbl_error_msg = "" ;
5
4
var gotWCO = false ;
6
5
var WCOx = 0 ;
@@ -125,24 +124,6 @@ function onprobetouchplatethicknessChange() {
125
124
return true ;
126
125
}
127
126
128
- function onsurfacewidthChange ( ) {
129
- var travel = parseFloat ( document . getElementById ( 'surfacewidth' ) . value ) ;
130
- if ( travel > 9999 || travel <= 0 || isNaN ( travel ) || ( travel === null ) ) {
131
- alertdlg ( translate_text_item ( "Out of range" ) , translate_text_item ( "Value of surface width must be between 1 mm and 9999 mm !" ) ) ;
132
- return false ;
133
- }
134
- return true ;
135
- }
136
-
137
- function onsurfacelengthChange ( ) {
138
- var travel = parseFloat ( document . getElementById ( 'surfacelength' ) . value ) ;
139
- if ( travel > 9999 || travel <= 0 || isNaN ( travel ) || ( travel === null ) ) {
140
- alertdlg ( translate_text_item ( "Out of range" ) , translate_text_item ( "Value of surface length must be between 1 mm and 9999 mm !" ) ) ;
141
- return false ;
142
- }
143
- return true ;
144
- }
145
-
146
127
function on_autocheck_status ( use_value ) {
147
128
if ( probe_progress_status != 0 ) {
148
129
document . getElementById ( 'autocheck_status' ) . checked = true ;
@@ -308,9 +289,6 @@ function process_grbl_status(response) {
308
289
if ( probe_progress_status != 0 ) {
309
290
probe_failed_notification ( ) ;
310
291
}
311
- if ( surface_progress_status != 0 ) {
312
- surface_failed_notification ( ) ;
313
- }
314
292
//grbl_error_msg = "";
315
293
//check we are printing or not
316
294
if ( response . indexOf ( "|SD:" ) != - 1 ) {
@@ -325,10 +303,6 @@ function process_grbl_status(response) {
325
303
document . getElementById ( 'sd_reset_btn' ) . style . display = "none" ;
326
304
}
327
305
if ( tab2 . toLowerCase ( ) . startsWith ( "idle" ) ) {
328
-
329
- if ( surface_progress_status == 100 ) {
330
- finalize_surfacing ( ) ;
331
- }
332
306
grbl_error_msg = "" ;
333
307
}
334
308
document . getElementById ( 'grbl_status_text' ) . innerHTML = translate_text_item ( grbl_error_msg ) ;
@@ -343,16 +317,6 @@ function finalize_probing() {
343
317
document . getElementById ( "probingtext" ) . style . display = "none" ;
344
318
document . getElementById ( 'sd_pause_btn' ) . style . display = "none" ;
345
319
document . getElementById ( 'sd_resume_btn' ) . style . display = "none" ;
346
- document . getElementById ( 'sd_reset_btn' ) . style . display = "none" ;
347
- }
348
-
349
- function finalize_surfacing ( ) {
350
- surface_progress_status = 0 ;
351
- grbl_error_msg = "" ;
352
- document . getElementById ( "surfacebtn" ) . style . display = "table-row" ;
353
- document . getElementById ( "surfacingtext" ) . style . display = "none" ;
354
- document . getElementById ( 'sd_pause_btn' ) . style . display = "none" ;
355
- document . getElementById ( 'sd_resume_btn' ) . style . display = "none" ;
356
320
document . getElementById ( 'sd_reset_btn' ) . style . display = "none" ;
357
321
}
358
322
@@ -370,9 +334,6 @@ function process_grbl_SD(response) {
370
334
progress = progress . replace ( ">" , "" ) ;
371
335
}
372
336
document . getElementById ( 'grbl_SD_status' ) . innerHTML = sdname + " <progress id='print_prg' value=" + progress + " max='100'></progress>" + progress + "%" ;
373
- if ( progress == 100 & surface_progress_status != 0 ) {
374
- surface_progress_status = progress ;
375
- }
376
337
} else { //no SD printing
377
338
//TODO
378
339
document . getElementById ( 'grbl_SD_status' ) . innerHTML = "" ;
@@ -414,7 +375,6 @@ function grbl_process_msg(response) {
414
375
415
376
function grbl_reset ( ) {
416
377
if ( probe_progress_status != 0 ) probe_failed_notification ( ) ;
417
- if ( surface_progress_status != 0 ) surface_failed_notification ( ) ;
418
378
SendRealtimeCmd ( String . fromCharCode ( 0x18 ) ) ;
419
379
}
420
380
@@ -450,15 +410,8 @@ function probe_failed_notification() {
450
410
beep ( 70 , 261 ) ;
451
411
}
452
412
453
- function surface_failed_notification ( ) {
454
- finalize_surfacing ( ) ;
455
- alertdlg ( translate_text_item ( "Error" ) , translate_text_item ( "Surfacing failed !" ) ) ;
456
- beep ( 70 , 261 ) ;
457
- }
458
-
459
413
function StartProbeProcess ( ) {
460
414
var cmd = "G38.2 G91 Z-" ;
461
-
462
415
if ( ! onprobemaxtravelChange ( ) ||
463
416
! onprobefeedrateChange ( ) ||
464
417
! onprobetouchplatethicknessChange ( ) ) {
@@ -474,78 +427,3 @@ function StartProbeProcess() {
474
427
grbl_error_msg = "" ;
475
428
document . getElementById ( 'grbl_status_text' ) . innerHTML = grbl_error_msg ;
476
429
}
477
-
478
- function StartSurfaceProcess ( ) {
479
- var path = "/" ;
480
- var dirname = "SurfaceWizard" ;
481
-
482
- var bitdiam = document . getElementById ( 'surfacebitdiam' ) . value ; ;
483
- var stepover = document . getElementById ( 'surfacestepover' ) . value ; ;
484
- var feedrate = document . getElementById ( 'surfacefeedrate' ) . value ; ;
485
- var surfacewidth = document . getElementById ( 'surfacewidth' ) . value ;
486
- var surfacelength = document . getElementById ( 'surfacelength' ) . value ;
487
- var Zdepth = document . getElementById ( 'surfacezdepth' ) . value ; ;
488
- var spindle = document . getElementById ( 'surfacespindle' ) . value ; ;
489
-
490
- ncProg = CreateSurfaceProgram ( bitdiam , stepover , feedrate , surfacewidth , surfacelength , Zdepth , spindle ) ;
491
-
492
- filename = "Surface" + "_X" + surfacewidth + "_Y" + surfacelength + "_Z-" + Zdepth + ".nc" ;
493
-
494
- var blob = new Blob ( [ ncProg ] , { type : "txt" } ) ;
495
-
496
- files = [ ] ;
497
- files . push ( new File ( [ blob ] , filename ) ) ;
498
-
499
- files_start_upload2 ( files , "/" + dirname + "/" )
500
-
501
- surface_progress_status = 1 ;
502
- on_autocheck_status ( true ) ;
503
- files_print_filename ( path + dirname + "/" + filename ) ;
504
- document . getElementById ( "surfacebtn" ) . style . display = "none" ;
505
- document . getElementById ( "surfacingtext" ) . style . display = "table-row" ;
506
- //grbl_error_msg = "";
507
- //document.getElementById('grbl_status_text').innerHTML = grbl_error_msg;
508
- //finalize_surfacing()
509
- }
510
-
511
- function CreateSurfaceProgram ( bitdiam , stepover , feedrate , surfacewidth , surfacelength , Zdepth , spindle ) {
512
- var crlf = "\n" ;
513
-
514
- effectiveCuttingWidth = Math . round ( 1000 * ( bitdiam * ( 1 - stepover / 100 ) ) ) / 1000 ;
515
- nPasses = Math . floor ( surfacelength / effectiveCuttingWidth ) ;
516
- lastPassWidth = surfacelength % effectiveCuttingWidth ;
517
-
518
- ncProg = "G21" + crlf ; // Unit = mm
519
- ncProg += "G90" + crlf ; // Absolute Positioning
520
- ncProg += "G53 G0 Z-5" + crlf ; // Move spindle to safe height
521
- ncProg += "G54" + crlf ; // Work Coordinates
522
- ncProg += "M3 S" + spindle + crlf ; // Set spindle speed
523
- ncProg += "G4 P1.8" + crlf ; // Spindle delay
524
- ncProg += "G1 F" + feedrate + crlf ; // Set feedrate
525
- ncProg += "G0 X0 Y0" + crlf ; // Move to XY origin at Z-safe height
526
- ncProg += "G1 Z-" + Zdepth + crlf ; // Move to Z origin (while starting to cut)
527
-
528
- var Xend = 0 ;
529
- for ( var i = 0 ; i <= nPasses ; i ++ ) {
530
- Xend == 0 ? Xend = surfacewidth : Xend = 0 ; // alternate X (passes are in X direction)
531
- cmd = "G1 X" + Xend + " Y" + i * effectiveCuttingWidth + " Z-" + Zdepth ;
532
- ncProg += cmd + crlf ;
533
- if ( i < nPasses ) {
534
- cmd = "G1 Y" + ( i + 1 ) * effectiveCuttingWidth ; // increment Y at each pass
535
- ncProg += cmd + crlf ;
536
- }
537
- }
538
-
539
- if ( lastPassWidth > 0 ) {
540
- Xend == 0 ? Xend = surfacewidth : Xend = 0 ; // alternate X
541
- cmd = "G1 Y" + surfacelength ;
542
- ncProg += cmd + crlf ;
543
- cmd = "G1 X" + Xend + " Y" + surfacelength + " Z-" + Zdepth ;
544
- ncProg += cmd + crlf ;
545
- }
546
-
547
- ncProg += "G53 G0 Z-5" + crlf ; // Move spindle to safe height
548
- ncProg += "M5 S0" + crlf ; // Spindle off
549
-
550
- return ncProg ;
551
- }
0 commit comments