Skip to content

Commit

Permalink
[BUILD] Merge branch 'master' into makefile_tests_new
Browse files Browse the repository at this point in the history
- Bring in changes from Device Reset fixes
  • Loading branch information
benliao1 committed Jul 21, 2023
2 parents 486715d + 9d16be8 commit ce0e068
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 4 additions & 3 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);
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 @@ -41,14 +41,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 ce0e068

Please sign in to comment.