Skip to content

Commit

Permalink
Merge pull request #9 from tinymovr/develop
Browse files Browse the repository at this point in the history
Version 1.6.0
  • Loading branch information
yconst committed Sep 10, 2023
2 parents 70444e5 + ed248fa commit 2cc2d14
Show file tree
Hide file tree
Showing 16 changed files with 222 additions and 202 deletions.
12 changes: 6 additions & 6 deletions src/can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
uint32_t Can_::get_rate(void)
{
uint32_t value = 0;
this->send(41, this->_data, 0, true);
if (this->recv(41, this->_data, &(this->_dlc), this->delay_us_value))
this->send(42, this->_data, 0, true);
if (this->recv(42, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -22,14 +22,14 @@ uint32_t Can_::get_rate(void)
void Can_::set_rate(uint32_t value)
{
write_le(value, this->_data);
this->send(41, this->_data, sizeof(uint32_t), false);
this->send(42, this->_data, sizeof(uint32_t), false);
}

uint32_t Can_::get_id(void)
{
uint32_t value = 0;
this->send(42, this->_data, 0, true);
if (this->recv(42, this->_data, &(this->_dlc), this->delay_us_value))
this->send(43, this->_data, 0, true);
if (this->recv(43, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -39,7 +39,7 @@ uint32_t Can_::get_id(void)
void Can_::set_id(uint32_t value)
{
write_le(value, this->_data);
this->send(42, this->_data, sizeof(uint32_t), false);
this->send(43, this->_data, sizeof(uint32_t), false);
}


Expand Down
32 changes: 16 additions & 16 deletions src/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
uint8_t Controller_::get_state(void)
{
uint8_t value = 0;
this->send(14, this->_data, 0, true);
if (this->recv(14, this->_data, &(this->_dlc), this->delay_us_value))
this->send(15, this->_data, 0, true);
if (this->recv(15, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -22,14 +22,14 @@ uint8_t Controller_::get_state(void)
void Controller_::set_state(uint8_t value)
{
write_le(value, this->_data);
this->send(14, this->_data, sizeof(uint8_t), false);
this->send(15, this->_data, sizeof(uint8_t), false);
}

uint8_t Controller_::get_mode(void)
{
uint8_t value = 0;
this->send(15, this->_data, 0, true);
if (this->recv(15, this->_data, &(this->_dlc), this->delay_us_value))
this->send(16, this->_data, 0, true);
if (this->recv(16, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -39,14 +39,14 @@ uint8_t Controller_::get_mode(void)
void Controller_::set_mode(uint8_t value)
{
write_le(value, this->_data);
this->send(15, this->_data, sizeof(uint8_t), false);
this->send(16, this->_data, sizeof(uint8_t), false);
}

uint8_t Controller_::get_warnings(void)
{
uint8_t value = 0;
this->send(16, this->_data, 0, true);
if (this->recv(16, this->_data, &(this->_dlc), this->delay_us_value))
this->send(17, this->_data, 0, true);
if (this->recv(17, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -56,8 +56,8 @@ uint8_t Controller_::get_warnings(void)
uint8_t Controller_::get_errors(void)
{
uint8_t value = 0;
this->send(17, this->_data, 0, true);
if (this->recv(17, this->_data, &(this->_dlc), this->delay_us_value))
this->send(18, this->_data, 0, true);
if (this->recv(18, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -67,27 +67,27 @@ uint8_t Controller_::get_errors(void)

void Controller_::calibrate()
{
this->send(35, this->_data, 0, true);
this->send(36, this->_data, 0, true);
}

void Controller_::idle()
{
this->send(36, this->_data, 0, true);
this->send(37, this->_data, 0, true);
}

void Controller_::position_mode()
{
this->send(37, this->_data, 0, true);
this->send(38, this->_data, 0, true);
}

void Controller_::velocity_mode()
{
this->send(38, this->_data, 0, true);
this->send(39, this->_data, 0, true);
}

void Controller_::current_mode()
{
this->send(39, this->_data, 0, true);
this->send(40, this->_data, 0, true);
}

float Controller_::set_pos_vel_setpoints(float pos_setpoint, float vel_setpoint)
Expand All @@ -98,7 +98,7 @@ float Controller_::set_pos_vel_setpoints(float pos_setpoint, float vel_setpoint)
write_le(vel_setpoint, this->_data + data_len);
data_len += sizeof(vel_setpoint);

this->send(40, this->_data, data_len, false);
this->send(41, this->_data, data_len, false);
float value = 0;
this->send(17, this->_data, 0, true);
if (this->recv(17, this->_data, &(this->_dlc), this->delay_us_value))
Expand Down
42 changes: 21 additions & 21 deletions src/current.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
float Current_::get_Iq_setpoint(void)
{
float value = 0;
this->send(26, this->_data, 0, true);
if (this->recv(26, this->_data, &(this->_dlc), this->delay_us_value))
this->send(27, this->_data, 0, true);
if (this->recv(27, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -22,14 +22,14 @@ float Current_::get_Iq_setpoint(void)
void Current_::set_Iq_setpoint(float value)
{
write_le(value, this->_data);
this->send(26, this->_data, sizeof(float), false);
this->send(27, this->_data, sizeof(float), false);
}

float Current_::get_Id_setpoint(void)
{
float value = 0;
this->send(27, this->_data, 0, true);
if (this->recv(27, this->_data, &(this->_dlc), this->delay_us_value))
this->send(28, this->_data, 0, true);
if (this->recv(28, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -39,8 +39,8 @@ float Current_::get_Id_setpoint(void)
float Current_::get_Iq_limit(void)
{
float value = 0;
this->send(28, this->_data, 0, true);
if (this->recv(28, this->_data, &(this->_dlc), this->delay_us_value))
this->send(29, this->_data, 0, true);
if (this->recv(29, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -50,14 +50,14 @@ float Current_::get_Iq_limit(void)
void Current_::set_Iq_limit(float value)
{
write_le(value, this->_data);
this->send(28, this->_data, sizeof(float), false);
this->send(29, this->_data, sizeof(float), false);
}

float Current_::get_Iq_estimate(void)
{
float value = 0;
this->send(29, this->_data, 0, true);
if (this->recv(29, this->_data, &(this->_dlc), this->delay_us_value))
this->send(30, this->_data, 0, true);
if (this->recv(30, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -67,8 +67,8 @@ float Current_::get_Iq_estimate(void)
float Current_::get_bandwidth(void)
{
float value = 0;
this->send(30, this->_data, 0, true);
if (this->recv(30, this->_data, &(this->_dlc), this->delay_us_value))
this->send(31, this->_data, 0, true);
if (this->recv(31, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -78,14 +78,14 @@ float Current_::get_bandwidth(void)
void Current_::set_bandwidth(float value)
{
write_le(value, this->_data);
this->send(30, this->_data, sizeof(float), false);
this->send(31, this->_data, sizeof(float), false);
}

float Current_::get_Iq_p_gain(void)
{
float value = 0;
this->send(31, this->_data, 0, true);
if (this->recv(31, this->_data, &(this->_dlc), this->delay_us_value))
this->send(32, this->_data, 0, true);
if (this->recv(32, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -95,8 +95,8 @@ float Current_::get_Iq_p_gain(void)
float Current_::get_max_Ibus_regen(void)
{
float value = 0;
this->send(32, this->_data, 0, true);
if (this->recv(32, this->_data, &(this->_dlc), this->delay_us_value))
this->send(33, this->_data, 0, true);
if (this->recv(33, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -106,14 +106,14 @@ float Current_::get_max_Ibus_regen(void)
void Current_::set_max_Ibus_regen(float value)
{
write_le(value, this->_data);
this->send(32, this->_data, sizeof(float), false);
this->send(33, this->_data, sizeof(float), false);
}

float Current_::get_max_Ibrake(void)
{
float value = 0;
this->send(33, this->_data, 0, true);
if (this->recv(33, this->_data, &(this->_dlc), this->delay_us_value))
this->send(34, this->_data, 0, true);
if (this->recv(34, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -123,7 +123,7 @@ float Current_::get_max_Ibrake(void)
void Current_::set_max_Ibrake(float value)
{
write_le(value, this->_data);
this->send(33, this->_data, sizeof(float), false);
this->send(34, this->_data, sizeof(float), false);
}


Expand Down
28 changes: 14 additions & 14 deletions src/encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
float Encoder_::get_position_estimate(void)
{
float value = 0;
this->send(52, this->_data, 0, true);
if (this->recv(52, this->_data, &(this->_dlc), this->delay_us_value))
this->send(53, this->_data, 0, true);
if (this->recv(53, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -22,8 +22,8 @@ float Encoder_::get_position_estimate(void)
float Encoder_::get_velocity_estimate(void)
{
float value = 0;
this->send(53, this->_data, 0, true);
if (this->recv(53, this->_data, &(this->_dlc), this->delay_us_value))
this->send(54, this->_data, 0, true);
if (this->recv(54, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -33,8 +33,8 @@ float Encoder_::get_velocity_estimate(void)
uint8_t Encoder_::get_type(void)
{
uint8_t value = 0;
this->send(54, this->_data, 0, true);
if (this->recv(54, this->_data, &(this->_dlc), this->delay_us_value))
this->send(55, this->_data, 0, true);
if (this->recv(55, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -44,14 +44,14 @@ uint8_t Encoder_::get_type(void)
void Encoder_::set_type(uint8_t value)
{
write_le(value, this->_data);
this->send(54, this->_data, sizeof(uint8_t), false);
this->send(55, this->_data, sizeof(uint8_t), false);
}

float Encoder_::get_bandwidth(void)
{
float value = 0;
this->send(55, this->_data, 0, true);
if (this->recv(55, this->_data, &(this->_dlc), this->delay_us_value))
this->send(56, this->_data, 0, true);
if (this->recv(56, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -61,14 +61,14 @@ float Encoder_::get_bandwidth(void)
void Encoder_::set_bandwidth(float value)
{
write_le(value, this->_data);
this->send(55, this->_data, sizeof(float), false);
this->send(56, this->_data, sizeof(float), false);
}

bool Encoder_::get_calibrated(void)
{
bool value = 0;
this->send(56, this->_data, 0, true);
if (this->recv(56, this->_data, &(this->_dlc), this->delay_us_value))
this->send(57, this->_data, 0, true);
if (this->recv(57, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand All @@ -78,8 +78,8 @@ bool Encoder_::get_calibrated(void)
uint8_t Encoder_::get_errors(void)
{
uint8_t value = 0;
this->send(57, this->_data, 0, true);
if (this->recv(57, this->_data, &(this->_dlc), this->delay_us_value))
this->send(58, this->_data, 0, true);
if (this->recv(58, this->_data, &(this->_dlc), this->delay_us_value))
{
read_le(&value, this->_data);
}
Expand Down
Loading

0 comments on commit 2cc2d14

Please sign in to comment.