Revision 3a4c95b0
devices/DiWheelDrive/DiWheelDrive.cpp | ||
---|---|---|
2 | 2 |
#include "hal.h" |
3 | 3 |
#include "qei.h" |
4 | 4 |
#include "DiWheelDrive.h" |
5 |
// #include <chprintf.h> |
|
6 |
|
|
7 | 5 |
|
8 | 6 |
#include <global.hpp> |
9 | 7 |
|
... | ... | |
150 | 148 |
case CAN::POWER_STATUS_ID: |
151 | 149 |
if (frame->DLC == 6) { |
152 | 150 |
// The power status is evaluated by inherited ControllerAreaNetworkRx object, but depending on the flags the power path controller needs to enabled or disabled. |
153 |
|
|
154 | 151 |
types::power_status::ChargingState charging_flags; |
155 | 152 |
charging_flags.value = frame->data8[0]; |
156 | 153 |
global.ltc4412.enable(charging_flags.content.diwheeldrive_enable_power_path); |
157 |
|
|
158 | 154 |
// Do not return with RDY_OK, or the inherited ControllerAreaNetworkRx object would not evaluate the rest of this message. |
159 | 155 |
} |
160 | 156 |
break; |
... | ... | |
201 | 197 |
this->transmitMessage(&frame); |
202 | 198 |
} |
203 | 199 |
|
200 |
void DiWheelDrive::transmitState(uint8_t state){ |
|
201 |
CANTxFrame frame; |
|
202 |
frame.SID = 0; |
|
203 |
this->encodeDeviceId(&frame, CAN::TRANSMIT_LINE_FOLLOW_STATE); |
|
204 |
frame.data8[0] = state; |
|
205 |
frame.DLC = 1; |
|
206 |
this->transmitMessage(&frame); |
|
207 |
} |
|
208 |
|
|
204 | 209 |
void DiWheelDrive::periodicBroadcast() { |
205 | 210 |
CANTxFrame frame; |
206 | 211 |
frame.SID = 0; |
... | ... | |
265 | 270 |
frame.DLC = 6; |
266 | 271 |
this->transmitMessage(&frame); |
267 | 272 |
|
268 |
|
|
269 |
|
|
270 | 273 |
// Send the board ID (board ID of DiWheelDrive = Robot ID) |
271 | 274 |
if (this->bcCounter % 10 == 0) { |
272 | 275 |
frame.SID = 0; |
devices/DiWheelDrive/DiWheelDrive.h | ||
---|---|---|
31 | 31 |
* @param power 0 to disable, 1 to enable |
32 | 32 |
*/ |
33 | 33 |
void requestCharging(uint8_t power); |
34 |
void transmitState(uint8_t state); |
|
34 | 35 |
|
35 | 36 |
protected: |
36 | 37 |
virtual msg_t receiveMessage(CANRxFrame *frame); |
37 | 38 |
virtual msg_t updateSensorVal(); |
38 | 39 |
virtual void periodicBroadcast(); |
39 | 40 |
|
40 |
|
|
41 |
|
|
42 | 41 |
void calibrateProximityFloorValues(); |
43 | 42 |
|
44 | 43 |
private: |
Also available in: Unified diff