Callum and Adel's changes on 12/02/19
Dependencies: Crypto
Revision 54:bd5b586aa2e1, committed 2019-03-22
- Comitter:
- iachinweze1
- Date:
- Fri Mar 22 23:47:51 2019 +0000
- Parent:
- 53:89d16b398615
- Child:
- 55:e8b15b4b875f
- Commit message:
- Final commit
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Mar 22 23:42:55 2019 +0000 +++ b/main.cpp Fri Mar 22 23:47:51 2019 +0000 @@ -137,7 +137,6 @@ _motor_pos = 0; - _modeBitField = 0x01; // Default velocity mode _pc.printf("\n\r%s %d\n\r>", "Welcome", _MAXCMDLENGTH ); // Welcome @@ -181,8 +180,6 @@ _inCharIndex = 0; // Reset index cmdParser(); - - // _tCommIn.signal_wait(0x01); } } } @@ -400,8 +397,6 @@ }; -// char Comm::_inCharQ[] = {'.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','\0'}; // Static member must be defined outside class -//Mutex Comm::_newKeyMutex; class Motor { @@ -411,24 +406,27 @@ _stateList[6], // All possible rotor states stored _lead; // Phase _lead to make motor spin + int8_t old_rotor_state; + uint8_t _theStates[3], // The Key states - _stateCount[3]; // State Counter + _stateCount[3], // State Counter + encState; + uint32_t _mtrPeriod, // Motor period - _MAXPWM_PRD; + _MAXPWM_PRD, + quadratureStates, + MINPWM_PRD, + maxEncCount, + encCount, + encTotal, + badEdges; + float _dutyC; // 1 = 100% bool _RUN; Comm* _pComm; Thread _tMotorCtrl; // Thread for motor Control - int8_t old_rotor_state; - uint8_t encState; - uint32_t quadratureStates; - uint32_t MINPWM_PRD; - uint32_t maxEncCount; - uint32_t encCount; - uint32_t encTotal; - uint32_t badEdges; public: //-- Default Constructor With Thread Object Constructor -------------------------------------------------------------// @@ -835,7 +833,7 @@ pwmCtrl.pulsewidth_us(torque); // _pComm->_pc.printf("EError:%.4f, tot:%d, encRemain:%.4f || RError:%.4f || SError:%.4f, CSpeed:%f, Torque:%i\r\n", eError, encTotal, encRemain, rError, sError, (cur_speed/6.0f), torque); //_pComm->_pc.printf("EError:%.4f, remain:%.4f, tot%d || RError:%.4f || Torque:%i \r\n", eError, encRemain, encTotal, rError, torque); - _pComm->_pc.printf("RError:%.4f\r\n", rError); + // _pComm->_pc.printf("RError:%.4f\r\n", rError); // Give the motor a kick