more functions needed for hoverbrett
This commit is contained in:
parent
97630cfcff
commit
2bb9f3d672
|
@ -7,11 +7,25 @@ ESCSerialComm::ESCSerialComm(HardwareSerial &_serialRef) { //constructor
|
|||
wheelcircumference=0.5278; //8.4cm radius -> 0.084m*2*Pi
|
||||
}
|
||||
|
||||
void ESCSerialComm::init() {
|
||||
serialRef->begin(SERIAL_CONTROL_BAUD);
|
||||
}
|
||||
|
||||
void ESCSerialComm::setSpeed(int16_t uSpeedLeft, int16_t uSpeedRight)
|
||||
{
|
||||
Motorparams.cmdL=uSpeedLeft;
|
||||
Motorparams.cmdR=uSpeedRight;
|
||||
}
|
||||
int16_t ESCSerialComm::getCmdL() {
|
||||
return Motorparams.cmdL;
|
||||
}
|
||||
int16_t ESCSerialComm::getCmdR() {
|
||||
return Motorparams.cmdR;
|
||||
}
|
||||
|
||||
bool ESCSerialComm::sendPending(long millis) {
|
||||
return (millis - last_send > SENDPERIOD);
|
||||
}
|
||||
|
||||
bool ESCSerialComm::update(long millis) //returns true if something was sent or received
|
||||
{
|
||||
|
|
|
@ -8,7 +8,6 @@ int sort_desc(const void *cmp1, const void *cmp2);
|
|||
float filterMedian(int16_t* values);
|
||||
|
||||
#define SERIAL_CONTROL_BAUD 115200 // [-] Baud rate for HoverSerial (used to communicate with the hoverboard)
|
||||
#define SERIAL_BAUD 115200 // [-] Baud rate for built-in Serial (used for the Serial Monitor)
|
||||
#define START_FRAME 0xABCD // [-] Start frme definition for reliable serial communication
|
||||
|
||||
|
||||
|
@ -74,9 +73,13 @@ class ESCSerialComm
|
|||
{
|
||||
public:
|
||||
ESCSerialComm(HardwareSerial& _SerialRef); //constructor
|
||||
void init();
|
||||
bool update(long millis);
|
||||
bool feedbackAvailable();
|
||||
void setSpeed(int16_t uSpeedLeft, int16_t uSpeedRight);
|
||||
int16_t getCmdL();
|
||||
int16_t getCmdR();
|
||||
bool sendPending(long millis);
|
||||
|
||||
private:
|
||||
unsigned long loopmillis;
|
||||
|
|
Loading…
Reference in New Issue