RSeries astromech firmware
DomeDriveSabertooth.h
Go to the documentation of this file.
1 #ifndef DomeDriveSabertooh_h
2 #define DomeDriveSabertooh_h
3 
4 #include "drive/DomeDrive.h"
6 
23 {
24 public:
31  DomeDriveSabertooth(int id, Stream& serial, JoystickController& domeStick) :
33  SabertoothDriver(id, serial),
34  fBaudRate(9600)
35  {
36  }
37 
38  // Must be called before setup()
39  void setBaudRate(unsigned baudRate)
40  {
41  fBaudRate = baudRate;
42  }
43 
44  void setAddress(uint8_t addr)
45  {
47  }
48 
49  virtual void setup() override
50  {
52  setRamping(80);
53  setTimeout(950);
54  }
55 
56  virtual void stop() override
57  {
60  }
61 
62 protected:
63  virtual void motor(float m) override
64  {
65  static bool sLastZero;
66  if (!sLastZero || m != 0)
67  {
69  VERBOSE_DOME_DEBUG_PRINTLN((int)(m * 127));
70  sLastZero = (abs(m) == 0);
71  }
72  SabertoothDriver::motor(1, m * 127);
73  }
74 
75  uint16_t fBaudRate;
76 };
77 #endif
SabertoothDriver.h
DomeDriveSabertooth::stop
virtual void stop() override
Definition: DomeDriveSabertooth.h:56
SabertoothDriver::motor
void motor(int power) const
Definition: SabertoothDriver.h:116
DomeDriveSabertooth::setup
virtual void setup() override
Subclasses must implement this function to perform any necessary setup that cannot happen in the cons...
Definition: DomeDriveSabertooth.h:49
DomeDrive::stop
virtual void stop()
Definition: DomeDrive.h:225
SabertoothDriver::setAddress
void setAddress(byte addr)
Definition: SabertoothDriver.h:59
DomeDriveSabertooth::setAddress
void setAddress(uint8_t addr)
Definition: DomeDriveSabertooth.h:44
VERBOSE_DOME_DEBUG_PRINTLN
#define VERBOSE_DOME_DEBUG_PRINTLN(s)
Definition: DomeDrive.h:38
DomeDriveSabertooth::setBaudRate
void setBaudRate(unsigned baudRate)
Definition: DomeDriveSabertooth.h:39
DomeDrive.h
DomeDriveSabertooth::motor
virtual void motor(float m) override
Definition: DomeDriveSabertooth.h:63
DomeDriveSabertooth
Definition: DomeDriveSabertooth.h:22
SabertoothDriver::setTimeout
void setTimeout(int milliseconds) const
Definition: SabertoothDriver.h:257
DomeDriveSabertooth::DomeDriveSabertooth
DomeDriveSabertooth(int id, Stream &serial, JoystickController &domeStick)
Constructor.
Definition: DomeDriveSabertooth.h:31
DomeDrive::domeStick
void domeStick(JoystickController *stick, float speedModifier)
Definition: DomeDrive.h:370
JoystickController
Definition: JoystickController.h:4
SabertoothDriver::stop
void stop() const
Definition: SabertoothDriver.h:155
SabertoothDriver::setRamping
void setRamping(byte value) const
Definition: SabertoothDriver.h:244
SabertoothDriver
Definition: SabertoothDriver.h:31
DomeDrive
Base template of automatic forwarder from i2c to CommandEvent.
Definition: DomeDrive.h:66
DomeDriveSabertooth::fBaudRate
uint16_t fBaudRate
Definition: DomeDriveSabertooth.h:75
VERBOSE_DOME_DEBUG_PRINT
#define VERBOSE_DOME_DEBUG_PRINT(s)
Definition: DomeDrive.h:37