Skip to content

Commit 53e8525

Browse files
authored
Merge pull request #18 from AugustDG/fix/add-reset-func
Add missing `reset` function implementation in `ODriveCAN.cpp`
2 parents 8044fef + ec69e9d commit 53e8525

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/ODriveCAN.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ bool ODriveCAN::getPower(Get_Powers_msg_t& msg, uint16_t timeout_ms) {
134134
return request(msg, timeout_ms);
135135
}
136136

137+
bool ODriveCAN::reset(ResetAction action)
138+
{
139+
Reboot_msg_t msg;
140+
msg.Action = action;
141+
142+
return send(msg);
143+
}
144+
137145
void ODriveCAN::onReceive(uint32_t id, uint8_t length, const uint8_t* data) {
138146
#ifdef DEBUG
139147
int byte_index = length - 1;

src/ODriveCAN.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ class ODriveCAN {
182182
*/
183183
bool getPower(Get_Powers_msg_t& msg, uint16_t timeout_ms = 10);
184184

185-
enum ResetAction {
186-
Reboot,
187-
SaveConfiguration,
188-
EraseConfiguration
185+
enum ResetAction : uint8_t {
186+
Reboot = 0,
187+
SaveConfiguration = 1,
188+
EraseConfiguration = 2,
189189
};
190190

191191
/**

0 commit comments

Comments
 (0)