Changeset 8875 for trunk/MagicSoft/Cosy/aposs
- Timestamp:
- 02/24/08 11:26:09 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/aposs/Magic.m
r8872 r8875 216 216 /* OLD ORIGINAL VALUES: Prop=100, Div=300, Int=1000 */ 217 217 if (get cannr==1) then 218 SET KPROP 950219 SET KDER 2000220 SET KINT 0218 SET KPROP 100 /*950*/ 219 SET KDER 300 /*2000*/ 220 SET KINT 1000 /*0*/ 221 221 elseif (get cannr==2) then 222 222 SET KPROP 100 … … 329 329 kIoModule = 4*256 330 330 331 ON INT -(kIoModule+6) GOSUB DOOR_STATUS_CHANGED332 ON INT (kIoModule+6) GOSUB DOOR_STATUS_CHANGED333 334 331 /*-------------------------------------------------------------------------*/ 335 332 /* Init */ … … 350 347 351 348 init = 0 349 350 oldstate = kTRUE 352 351 353 352 gosub reset … … 361 360 else 362 361 fuse = in (kIoModule+1) 363 emcy = in (kIoModule+2) 362 emcy = in (kIoModule+2) 364 363 vltg = in (kIoModule+3) 365 364 mode = in (kIoModule+4) 366 365 door = in (kIoModule+6) 367 366 ready = in 1 368 367 369 368 if (door==0) then 370 369 preop = kTRUE 371 endif 372 373 if (preop==kTRUE) then 374 print "Door open!" 375 gosub reset 376 elseif (ready==0) and (RF==1) then 370 endif 371 372 if (ready==0) and (RF==1) then 377 373 print "DKC not ready, but RF set... setting RF=AH=0!" 378 374 gosub reset … … 438 434 endif 439 435 endif 440 436 437 if (preop==kTRUE and oldstate!=preop) then 438 print "Door switch changed state!" 439 gosub reset 440 endif 441 oldstate = preop 442 441 443 rc = CANIN sdorx -1 0 canhi canlo 442 444 goto mainloop … … 455 457 SUBPROG reset 456 458 init = 0 457 459 458 460 out 1 0 459 461 out 2 0 … … 461 463 motor off 462 464 waitt 1000 463 465 464 466 if (brake==1 and get cannr==3) then 465 467 waitt 3000 /* wait 3s for DKC to stop the motor */ … … 467 469 waitt 1000 468 470 endif 469 471 470 472 canout pdo3 (ready | (fuse<<1) | (emcy<<2) | (vltg<<3) | (mode<<4)) (rf | (brake<<1)) 471 473 return … … 482 484 PRINT "Setting Idx:", idx, "/", subidx, " to ", sdoval 483 485 */ 484 if (idx==0x1000 and subidx==1) then 485 if (sdoval==1) then 486 if (door==0) then 487 canlo = 1 488 else 489 preop = kFALSE 490 endif 491 elseif 492 preop = kTRUE 486 if (idx==0x1000 and subidx==1) then 487 preop = kTRUE 488 if (sdoval==1 and door==1) then 489 preop = kFALSE 490 else 491 canlo = 1 493 492 endif 494 493 elseif (idx==0x1003 and subidx==0 and sdoval==0) then … … 537 536 elseif (idx == 0x2003) then 538 537 if (subidx) then 539 DEC sdoval 538 /* If velocity mode active */ 539 /*if (AXEND&4) 540 DEC sdoval%4 541 else*/ 542 DEC sdoval 543 /*endif*/ 540 544 else 541 ACC sdoval 545 /*if (AXEND&4) 546 ACC sdoval%4 547 else*/ 548 ACC sdoval 549 /*endif*/ 542 550 endif 543 551 elseif (idx == 0x3000) then … … 584 592 elseif (subidx == 1) then 585 593 /* It is unclear where this arbitraty factor comes from */ 586 CVEL sdoval /4594 CVEL sdoval%4 587 595 endif 588 596 elseif (idx == 0x3007) then … … 810 818 /*-------------------------------------------------------------------------*/ 811 819 SUBPROG PROC_PDO1 812 CANOUT pdo1 (AXEND|( preop<<9)) APOS820 CANOUT pdo1 (AXEND|(((~preop)&1)<<8)) APOS 813 821 RETURN 814 822
Note:
See TracChangeset
for help on using the changeset viewer.