Hello Guest it is April 25, 2024, 02:47:40 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - joeaverage

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 »
5391
Mach4 General Discussion / Re: Offsets, probing and operation manual
« on: February 04, 2018, 03:17:54 AM »
Hi,
welcome to Mach4 and CNC.....you poor sick little puppy...LOL

What manual are you reading? Can you post a link?

It is one of the persistent bug-bears of Mach4 that the documentation falls well behind where Mach is and often the documents are incomplete and if not
wrong....out of date. NFS doesn't have the resources to devote to the task. As a consequence the forum has become the goto place to get info.
Perhaps not ideal but it is what it is.

There is a good video about the new probing functions, absolute must see. I'll try to find a link for you.

Craig

5392
Mach4 General Discussion / Re: Mach4 Button OFFLINE
« on: February 04, 2018, 02:58:52 AM »
Hi,
OK I've got a solution that has improved the function a lot.

Code: [Select]
function OfflineButton()
local inst=mc.mcGetInstance()
local hsigenable=mc.mcSignalGetHandle(inst,mc.OSIG_ENABLE0)
local hsigbuttonstate=mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT2)
if (mc.mcSignalGetState(hsigenable)==1) then
    if (mc.mcSignalGetState(hsigbuttonstate)==1) then
        -- Mach is enabled and the servos are 'online'
        -- Need to save current position and set servos 'offline'
        local state=mc.mcCntlGetState(inst)
        if (state ~=0)then
            mc.mcCntlCycleStop(inst)
        end
        local Xpos=mc.mcAxisGetMachinePos(inst,mc.X_AXIS)
        local Zpos=mc.mcAxisGetMachinePos(inst,mc.Z_AXIS)
        mc.mcCntlSetPoundVar(inst,500,Xpos)
        mc.mcCntlSetPoundVar(inst,501,Zpos)
        mc.mcSignalSetState(hsigbuttonstate,0)
    else
        --Mach enabled but servos 'offline'
        --Need to restore current position and reset servos 'online'
        local state=mc.mcCntlGetState(inst)
        if (state ~=0)then
            mc.mcCntlCycleStop(inst)
        end
        local Xpos=mc.mcCntlGetPoundVar(inst,500)
        local Zpos=mc.mcCntlGetPoundVar(inst,501)     
        local rc=mc.mcCntlGcodeExecuteWait(inst,'g53 g0 x'..Xpos..' z'..Zpos)
        if (rc ~=0) then
                mc.mcCntlEnable(inst,0)
                mc.mcCntlEnable(inst,1)
                rc=mc.mcCntlGcodeExecuteWait(inst,'g53 g0 x'..Xpos..' z'..Zpos)
        end
        if (rc==0) then mc.mcSignalSetState(hsigbuttonstate,1) end
    end
else
    --Mach disabled....do nothing
end
end
if ( mc.mcInEditor()==1) then
    OfflineButton()
end

Note Dany this is the complete fuction code intended to be put in a folder that you may use your new found editor/debug skills!
Once youv've got it running to your satisfaction then strip off the last mc.mcInEditor test lines at the end ans put the remainder in the screen load script.
Note also that I think you have attached the function as 'clicked button' script which is not correct. Attach the function as 'Left up' script.

The changes over my original code all relate to the function performing when using Gcode files. You will note that this group of lines occur in two different
places. It purpose is to test if the controller is at idle before you attempt any thing else. If you do attempt to do something with the control state other than
idle will crash Mach.

        local state=mc.mcCntlGetState(inst)
        if (state ~=0)then                -- state==0 measns control state=idle
            mc.mcCntlCycleStop(inst)  -- A CycleStop will ensure the control state is idle
        end

The second change relates to the difficulty I note and posted in my previous post in this thread. The issue is that if you have a Gcode job loaded and running, even with
the job stopped or EVEN closed, the Gcode interpreter is unavailable to accept a fresh MDI command embedded in the GcodeExecuteWait() API call. The only way I could
find which would ensure that the Gcode interpreter was ready to accept a fresh MDI command was to disable and then enable Mach. This cycle in addition to freeing
the interpreter of code allows the Gcode job as loaded is preserved at its correct line number. I am a little unsure how it handles modals yet but it seems to work on
my laptop.

        local rc=mc.mcCntlGcodeExecuteWait(inst,'g53 g0 x'..Xpos..' z'..Zpos)
        if (rc ~=0) then
                mc.mcCntlEnable(inst,0)
                mc.mcCntlEnable(inst,1)
                rc=mc.mcCntlGcodeExecuteWait(inst,'g53 g0 x'..Xpos..' z'..Zpos)
        end
        if (rc==0) then mc.mcSignalSetState(hsigbuttonstate,1) end

The code works this way: the GcodeExecuteWait() API is attempted. If the return code is zero then the call succeeded. If the call failed the return code will be other than
zero. The two CntlEnable() calls first disable Mach and then enable Mach again. The GcodeExexcuteWait() call should now succeed. If it does as evidenced by a return
code of zero then  OSIG_OUTPUT2 can be set to reinstate the servos.

Still not quite sure why with the control state at idle the GcodeExecuteWait() API wont progress...that's subject to further investigation and another thread. In the mean
time this should go close to what Dany has wanted from the start.

Craig

5393
Hi,
have done a little more experimenting and found a workaround.

The problem is that if a Gcode file has been loaded and run, then stopped in cycle that an API call which requires MDI support to execute fails.
Closing the Gcode file does not restore MDI functionality. It requires either a RegenToolpath or a MachDisable/MachEnable cycle.

A Disable/Enable cycle preserves the Gcode file at its current line and is therefore suitable for my purpose.

The workaround goes something like this:
1) Try the GcodeExecuteWait() API
2) Test the return code, if rc=0 the call has succeeded. If rc=-18 then mc.mcCntlEnable(inst,0) mc.mcCntlEnable(inst,1)
3) Try the GcodeExecuteWait() API call again
4) By now the return code should be rc=0 so re-enable the servos

This sequence allows the machine coordinates to be restored and yet preserve the part completed Gcode job.

Still interested to hear an explanation for this behavior....hint...hint Daz and Smurph.

Craig

5394
Hi,
I've encountered a few situations where Mach4 did not do as I expected and thought I'd discovered a bug. In just about every case it is because I did not understand
how Mach4 works so it was not in fact a fault with Mach4 but rather my understanding/expectation that was wrong.

Would appear you've just had a lesson in the same vein.

Craig

5395
Mach4 General Discussion / MERROR_NOT_NOW from GcodeExecuteWait() API Call
« on: February 03, 2018, 06:50:45 PM »
Hi All,
have run into a problem with some code.This is a snippet, I've left the wxMessage boxes etc in there, they are for testing purposes only.

Code: [Select]
        --Mach enabled but servos 'offline'
        --Need to restore current position and reset servos 'online'
        local Xpos=mc.mcCntlGetPoundVar(inst,500)
        local Zpos=mc.mcCntlGetPoundVar(inst,501)
local state=mc.mcCntlGetState(inst)
local statename=mc.mcCntlGetStateName(inst,state)
wx.wxMessageBox(statename)
local rc=       mc.mcCntlGcodeExecuteWait(inst,'g53 g0 x'..Xpos..' z'..Zpos)
wx.wxMessageBox(tostring(rc))
        mc.mcSignalSetState(hsigbuttonstate,1)
    end

What appears to be happening if there is a Gcode file loaded and has partly run then Stopped, the control is Idle,
but when I execute the GcodeExecuteWait() statement it returns -18 or MERROR_NOT_NOW. My guess is that the Gcode interpreter is still loaded with
the Gcode file and is unavailable to execute the Gcode within my API call in MDI context?

Has anyone encountered this? Is my guess as to why the GcodeExecuteWait() API call does not complete correct? That same stament does execute correctly
under other circumstances so I am reasonably confident that its not some syntax error in my code.

If my guess is correct is there some way to shove the Gcode file out of the way, have the MDI Gcode execute, then shuffle the Gcode file back in?

Craig

5396
Mach4 General Discussion / Re: Mach4 Button OFFLINE
« on: February 03, 2018, 06:31:41 PM »
Hi,
have been doing some testing and the function works as anticipated under some circumstances but not others.

If you go 'offline' and jog or MDI when you go 'online' the machine coordinates reset to that they were prior to going offline. As anticipated.

Where it fails is if some Gcode from a Gcode job is executed between going offline and then later going back online the servos reinstate
but the machine coordinates do not (always) update.

Quote
rc = mc.mcCntlGcodeExecute(
      number mInst,
      string commands)

But the notes say:
Quote
Notes:


If the control is in the idle state, this function will execute the G code in MDI mode.


I can report that if the control is not idle when this statement is executed then you will crash.

There needs to be a test in the code that prevents the statement from running if the control is not in idle state. That's easy enough but there is a further complication
that I can't solve yet.

The return codes for this API are:
Quote
Returns: Return Code Description
MERROR_NOERROR No Error.
MERROR_INVALID_INSTANCE The mInst parameter was out of range.
MERROR_NOT_NOW The operation could not be completed at this time.
MERROR_NOT_COMPILED The macro scripts could not be compiled.

If have found that if a Gcode file is loaded but stopped (control idle) the API will not execute and comes back with a return code of -18 which corresponds to
MERROR_NOT_NOW

I don't know why this should be. I suspect that the GcodeExecuteWait() API requires MDI functionality but the loaded Gcode is already hogging the Gcode
interpreter so the MDI can't run. I feel a call being put out to Daz and Smurph about this!

Craig

5397
Mach4 General Discussion / Re: Additional Button Properties
« on: February 03, 2018, 04:23:20 PM »
Hi Russ,
thanks, worked a treat. Didn't realize that there is more than one type of button.

Craig

5398
Mach4 General Discussion / Additional Button Properties
« on: February 03, 2018, 03:38:57 PM »
Hi All,
in the screen editor when I look at the properties availble to be edited for Machs Enable button I see entries like 'Text Up' , 'Text Down'
'Button Colour Up' and 'Button Colour Down'.

I have a button on screen wish I wish to be able to change colour when active.  This button was one that was already there, I've just resused it for my purposes.
I doesn't have all the properties that the Enable button has.

How can I add those properties to my button?

Craig

5399
General Mach Discussion / Re: Steppers have no torque.
« on: February 03, 2018, 02:37:19 PM »
Hi,
it sounds to me like your drivers have lost the plot.

Testing a stepper driver is not straight forward, you really need an oscilloscope ideally with a high bandwidth current clamp. Do you have acess to
that sort of gear?

Can you tell me a little more about the steppers and the drivers, a few pics would help.

In absence of some good test gear you might be advised to beg/steal/borrow  or buy one good driver like a Gecko and hook up your stepper. If the stepper
performs it rather tells you the original drivers are faulty or just plain crap.

Craig

5400
Mach4 General Discussion / Re: Mach4 Button OFFLINE
« on: February 03, 2018, 02:26:57 PM »
Hi,

Quote
through the relay I will use a function, of which the units ignore any signal. (they still remain in position, without moving)
when the function changes state, normal use of the drives is restored

Isn't that what they are supposed to do? The trick is that when you restore the servos (so that they again respond to movement signals) is that while
they were disabled you may have jogged or MDI'ed Mach so Mach believes the servos are in one place when in fact they are where they were left
some time ago. Ergo the 'restore machine coordinate' instructions in the code.

Craig

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 »