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

Updated the name variable to type string_view #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 6 additions & 5 deletions Drive/wheel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
#include "peripherals/lpc40xx/gpio.hpp"
//#include "../Common/gpio.hpp"
#include "devices/switches/button.hpp"
#include "string_view"

namespace sjsu::drive
{
/// Wheel class manages steering & hub motors for the rover.
class Wheel
{
public:
Wheel(std::string name,
Wheel(std::string_view name,
sjsu::RmdX & hub_motor,
sjsu::RmdX & steer_motor,
sjsu::Gpio & homing_pin)
Expand All @@ -22,7 +23,7 @@ class Wheel

void Initialize()
{
sjsu::LogInfo("Initializing %s wheel...", name_.c_str());
sjsu::LogInfo("Initializing %s wheel...", name_);
hub_motor_.Initialize();
steer_motor_.Initialize();
homing_pin_.Initialize();
Expand All @@ -31,10 +32,10 @@ class Wheel

void Print()
{
printf("%-10s%-10d%-10d\n", name_.c_str(), GetHubSpeed(), GetSteerAngle());
printf("%-10s%-10d%-10d\n", name_, GetHubSpeed(), GetSteerAngle());
}

std::string GetName() const
std::string_view GetName() const
{
return name_;
}
Expand Down Expand Up @@ -82,7 +83,7 @@ class Wheel
}

private:
std::string name_ = "";
std::string_view name_ ;
int homing_offset_angle_ = 0;
float steer_angle_ = 0;
float hub_speed_ = 0;
Expand Down