Skip to content

Commit

Permalink
[LOWCAR] Merge pull request #268 from pioneers/rst-fix
Browse files Browse the repository at this point in the history
[LOWCAR] fixes compilation error for lowcar
  • Loading branch information
ipleung authored Jul 19, 2023
2 parents 8cd01d6 + 4c9fca9 commit 9d16be8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
9 changes: 5 additions & 4 deletions lowcar/devices/Device/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ void Device::loop() {
if (this->enabled && (this->timeout > 0) && (this->curr_time - this->last_received_ping_time >= this->timeout)) {
device_reset();
this->enabled = FALSE;
// Send RST message
this->curr_msg->message_id = MessageID::RST;
this->curr_msg->payload_length = 0;
memset(this->curr_msg->payload, 0, MAX_PAYLOAD_SIZE);

//Send RST message
this->curr_msg.message_id = MessageID::RST;
this->curr_msg.payload_length = 0;
memset(this->curr_msg.payload, 0, MAX_PAYLOAD_SIZE);
this->msngr->send_message(MessageID::RST, &(this->curr_msg));
}

Expand Down
5 changes: 1 addition & 4 deletions lowcar/devices/ServoControl/ServoControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@ size_t ServoControl::device_write(uint8_t param, uint8_t* data_buf) {
servos[param].attach(this->pins[param]);
}
this->positions[param] = value;
servos[param].writeMicroseconds(ServoControl::SERVO_CENTER + (this->positions[param] * ServoControl::SERVO_RANGE / 2.0));
servos[param].writeMicroseconds(ServoControl::SERVO_CENTER + (this->positions[param] * ServoControl::SERVO_RANGE));
return sizeof(float);
} else {
return 0;
}
this->positions[param] = value;
servos[param].writeMicroseconds(ServoControl::SERVO_CENTER + (this->positions[param] * ServoControl::SERVO_RANGE));
return sizeof(float);
}

void ServoControl::device_reset() {
Expand Down

0 comments on commit 9d16be8

Please sign in to comment.