Changeset 678
- Timestamp:
- 07/15/09 19:49:46 (4 years ago)
- Location:
- branches/atorf/NXC/MotorControl2
- Files:
-
- 3 added
- 3 modified
-
Controller.nxc (modified) (2 diffs)
-
ControllerCore.nxc (modified) (10 diffs)
-
DebugLoggingServer.m (added)
-
GUI_DebugLoggingServer.fig (added)
-
GUI_DebugLoggingServer.m (added)
-
MotorControl20.nxc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/atorf/NXC/MotorControl2/Controller.nxc
r664 r678 107 107 //#define ENABLEDEBUGGING_LCD 108 108 //#define ENABLEDEBUGGING_WAITAFTERLCD 109 #define ENABLEDEBUGGING_LCD_SLOW_ANTIBUG109 //#define ENABLEDEBUGGING_LCD_SLOW_ANTIBUG 110 110 //#define ENABLEDEBUGGING_REMOTE 111 111 //#define ENABLEDEBUGGING_ACOUSTIC 112 112 //#define ENABLEDEBUGGING_ACOUSTICPROTOCOL 113 113 //#define ENABLEDEBUGGING_OLDLCDTIMING 114 //#define ENABLEDEBUGGING_REMOTELOGGING 114 115 // --------------------------------- 115 116 … … 121 122 #endif 122 123 124 125 #ifdef ENABLEDEBUGGING_REMOTELOGGING 126 //long debugStartTick = CurrentTick(); 127 long remoteDebugMsgCounter = 0; 128 safecall void SendDebugMessage(const byte &port, const string msg) { 129 //string time = NumToStr(CurrentTick() - FirstTick()); 130 string p = NumToStr(port); 131 string n = NumToStr(remoteDebugMsgCounter); 132 //string data = StrCat(time, "|", n, "|", p, ":", msg); 133 string data = StrCat(n, "|", p, ":", msg); 134 remoteDebugMsgCounter++; 135 136 SendMessage(DEBUG_OUTBOX, data); 137 }//end void 138 #endif 123 139 124 140 -
branches/atorf/NXC/MotorControl2/ControllerCore.nxc
r664 r678 247 247 #ifdef ENABLEDEBUGGING_ACOUSTIC 248 248 PlayTone(300,100); 249 #endif 250 251 #ifdef ENABLEDEBUGGING_REMOTELOGGING 252 SendDebugMessage(port, "Entering main loop"); 249 253 #endif 250 254 … … 452 456 TextOut(0, DebugLinePos[port], "BRAKING:top "); 453 457 #endif 458 #ifdef ENABLEDEBUGGING_REMOTELOGGING 459 SendDebugMessage(port, "Braking: Beginning"); 460 #endif 454 461 455 462 #ifdef ENABLEDEBUGGING_REMOTE … … 471 478 TextOut(0, DebugLinePos[port], "BRAKING:speed/err "); 472 479 #endif 480 //#ifdef ENABLEDEBUGGING_REMOTELOGGING 481 // SendDebugMessage(port, "Braking: IdealSpeed / error calced"); 482 //#endif 473 483 474 484 … … 502 512 #endif 503 513 514 //#ifdef ENABLEDEBUGGING_REMOTELOGGING 515 // SendDebugMessage(port, "Braking: PID calc done, clipping power"); 516 //#endif 517 504 518 505 519 // downscaling … … 516 530 TextOut(0, DebugLinePos[port], "BRAKING:PwrCalced "); 517 531 #endif 532 #ifdef ENABLEDEBUGGING_REMOTELOGGING 533 SendDebugMessage(port, "Braking: Setting new power"); 534 #endif 535 518 536 519 537 … … 604 622 TextOut(0, DebugLinePos2[port], " "); 605 623 #endif 624 #ifdef ENABLEDEBUGGING_REMOTELOGGING 625 SendDebugMessage(port, "Wait-loop done"); 626 #endif 606 627 607 628 // * if SPECIAL ENDGAME BRAKING … … 616 637 SendMessage(OUTBOX, "-300|0|0"); 617 638 #endif// - - - - - - - - - - 639 #ifdef ENABLEDEBUGGING_REMOTELOGGING 640 SendDebugMessage(port, "Endgame begins"); 641 #endif 618 642 619 643 … … 676 700 #endif 677 701 702 #ifdef ENABLEDEBUGGING_REMOTELOGGING 703 if (endgameSuccessful) { 704 SendDebugMessage(port, "Endgame successful"); 705 } else { 706 SendDebugMessage(port, "Endgame timed out"); 707 }//end if 708 #endif 709 678 710 // and this control process is finally over! 679 711 break; … … 701 733 // mess up our current motor state, maybe that's not too bad... 702 734 735 #ifdef ENABLEDEBUGGING_REMOTELOGGING 736 SendDebugMessage(port, "Waiting for Motorstop"); 737 #endif 703 738 704 739 WaitUntilMotorStopped(port); … … 716 751 Wait(3); 717 752 753 754 #ifdef ENABLEDEBUGGING_REMOTELOGGING 755 SendDebugMessage(port, "Finished!"); 756 #endif 757 718 758 #ifdef ENABLEDEBUGGING_REMOTE 719 759 SendMessage(OUTBOX, "-480|0|0"); 720 760 #endif// - - - - - - - - - - 721 722 761 723 762 724 763 // --- Display Debug Info if necessary -
branches/atorf/NXC/MotorControl2/MotorControl20.nxc
r664 r678 36 36 #define PROGRAM_VERSION "2.0" 37 37 38 #define INBOX 1 39 #define OUTBOX 0 38 #define INBOX 1 39 #define OUTBOX 0 40 #define DEBUG_OUTBOX 2 40 41 41 42 // Protocol constants … … 134 135 135 136 #ifdef ENABLEDEBUGGING_LCD_SLOW_ANTIBUG 136 TextOut(0, LCD_LINE8, "SLOW ANTIBUG ON ", true);137 TextOut(0, LCD_LINE8, "SLOW ANTIBUG ON ", true); 137 138 #endif// - - - - - - - 138 139 139 140 }//end void 140 141 142 143 141 144 142 … … 413 411 ReceiveRemoteString(OUTBOX, true, in); 414 412 }//end while 415 416 413 #ifdef ENABLEDEBUGGING_REMOTELOGGING 414 in = "..."; 415 while(StrLen(in) > 0) { 416 ReceiveRemoteString(DEBUG_OUTBOX, true, in); 417 }//end while 418 #endif 419 420 in = ""; 421 422 423 #ifdef ENABLEDEBUGGING_REMOTELOGGING 424 SendDebugMessage(99, "Remote logging enabled!"); 425 #endif 417 426 418 427 while(true){
