Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LOWCAR] fixes compilation error for lowcar #268

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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