Skip to content

Commit

Permalink
add a space after //
Browse files Browse the repository at this point in the history
  • Loading branch information
SeirenTDoi committed Oct 4, 2023
1 parent bb9754f commit e5994a3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 33 deletions.
22 changes: 11 additions & 11 deletions src/src_user/Applications/DriverInstances/di_cubewheel.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static void DI_CUBEWHEEL_update_(void)
APP_ANOMALY_IDX idx = (APP_ANOMALY_IDX)(APP_ANOMALY_IDX_COMM_RWX + i);
if (APP_ANOMALY_SET_LAST_RESULT(idx, (DS_CMD_ERR_CODE)last_result) == APP_ANOMALY_STATE_TO_ON)
{
//Printf("to initial by RW(%d) comm error.\n", i);App内のPrintは避ける
// Printf("to initial by RW(%d) comm error.\n", i);App内のPrintは避ける
APP_ANOMALY_TRANSITION_TO_INITIAL();
}
}
Expand Down Expand Up @@ -192,7 +192,7 @@ CCP_EXEC_STS Cmd_DI_CUBEWHEEL_SetSpeed(const CTCP* packet)

CUBEWHEEL_SetReferenceSpeed(&cubewheel_driver_[cubewheel_idx], speed);

//return DS_conv_cmd_err_to_ccp_exec_sts(ret);
// return DS_conv_cmd_err_to_ccp_exec_sts(ret);
return CCP_EXEC_SUCCESS;

}
Expand Down Expand Up @@ -221,7 +221,7 @@ CCP_EXEC_STS Cmd_DI_CUBEWHEEL_SetDutyCycle(const CTCP* packet)

CUBEWHEEL_SetDutyCycle(&cubewheel_driver_[cubewheel_idx], duty);

//return DS_conv_cmd_err_to_ccp_exec_sts(ret);
// return DS_conv_cmd_err_to_ccp_exec_sts(ret);
return CCP_EXEC_SUCCESS;
}

Expand All @@ -240,7 +240,7 @@ CCP_EXEC_STS Cmd_DI_CUBEWHEEL_SetControlMode(const CTCP* packet)

CUBEWHEEL_SetControlMode(&cubewheel_driver_[cubewheel_idx], control_mode);

//return DS_conv_cmd_err_to_ccp_exec_sts(ret);
// return DS_conv_cmd_err_to_ccp_exec_sts(ret);
return CCP_EXEC_SUCCESS;
}

Expand All @@ -260,7 +260,7 @@ CCP_EXEC_STS Cmd_DI_CUBEWHEEL_SetPwmGain(const CTCP* packet)

CUBEWHEEL_SetPwmGain(&cubewheel_driver_[cubewheel_idx], Ki, KiMultiplier);

//return DS_conv_cmd_err_to_ccp_exec_sts(ret);
// return DS_conv_cmd_err_to_ccp_exec_sts(ret);
return CCP_EXEC_SUCCESS;
}

Expand All @@ -284,7 +284,7 @@ CCP_EXEC_STS Cmd_DI_CUBEWHEEL_SetMainGain(const CTCP* packet)



//return DS_conv_cmd_err_to_ccp_exec_sts(ret);
// return DS_conv_cmd_err_to_ccp_exec_sts(ret);
return CCP_EXEC_SUCCESS;
}

Expand All @@ -301,7 +301,7 @@ CCP_EXEC_STS Cmd_DI_CUBEWHEEL_GetStatus(const CTCP* packet)
ret = CUBEWHEEL_GetStatus(&cubewheel_driver_[idx]);
}

//return DS_conv_cmd_err_to_ccp_exec_sts(ret);
// return DS_conv_cmd_err_to_ccp_exec_sts(ret);
return CCP_EXEC_SUCCESS;
}

Expand All @@ -321,7 +321,7 @@ CCP_EXEC_STS Cmd_DI_CUBEWHEEL_SetBackupmode(const CTCP* packet)

CUBEWHEEL_SetBackupmode(&cubewheel_driver_[cubewheel_idx], enable_status);

//return DS_conv_cmd_err_to_ccp_exec_sts(ret);
// return DS_conv_cmd_err_to_ccp_exec_sts(ret);
return CCP_EXEC_SUCCESS;
}

Expand All @@ -341,7 +341,7 @@ CCP_EXEC_STS Cmd_DI_CUBEWHEEL_EnableEncoder(const CTCP* packet)

CUBEWHEEL_EnableEncoder(&cubewheel_driver_[cubewheel_idx], enable_status);

//return DS_conv_cmd_err_to_ccp_exec_sts(ret);
// return DS_conv_cmd_err_to_ccp_exec_sts(ret);
return CCP_EXEC_SUCCESS;
}

Expand All @@ -361,7 +361,7 @@ CCP_EXEC_STS Cmd_DI_CUBEWHEEL_EnableHallsensor(const CTCP* packet)

CUBEWHEEL_EnableHallsensor(&cubewheel_driver_[cubewheel_idx], enable_status);

//return DS_conv_cmd_err_to_ccp_exec_sts(ret);
// return DS_conv_cmd_err_to_ccp_exec_sts(ret);
return CCP_EXEC_SUCCESS;
}

Expand Down Expand Up @@ -400,7 +400,7 @@ int DI_CUBEWHEEL_set_torque_Nm(CUBEWHEEL_IDX idx, float torque_rw_Nm)

duty = (int)(f_duty * 100);

//set max/min limit to duty value
// set max/min limit to duty value
if (duty > 100)
{
duty = 100;
Expand Down
4 changes: 2 additions & 2 deletions src/src_user/Applications/DriverInstances/di_cubewheel.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ extern const CUBEWHEEL_Driver* const cubewheel_driver[CUBEWHEEL_IDX_MAX];
*/
AppInfo DI_CUBEWHEEL_update(void);

CCP_EXEC_STS Cmd_DI_CUBEWHEEL_Enable(const CTCP *packet);//旧 RW_startup
CCP_EXEC_STS Cmd_DI_CUBEWHEEL_Init(const CTCP* packet);//旧 RW_startup+enable
CCP_EXEC_STS Cmd_DI_CUBEWHEEL_Enable(const CTCP *packet);// 旧 RW_startup
CCP_EXEC_STS Cmd_DI_CUBEWHEEL_Init(const CTCP* packet);// 旧 RW_startup+enable
CCP_EXEC_STS Cmd_DI_CUBEWHEEL_EndProcess(const CTCP* packet);


Expand Down
32 changes: 16 additions & 16 deletions src/src_user/Drivers/Aocs/cubewheel.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const static uint8_t CUBEWHEEL_kTlmLengthGetStatusErrorFlag_ = 1;

const static uint8_t CUBEWHEEL_kConvertValueOfCurrentFactor_ = 0.48828125;

//Endianがビッグエンディアン
// Endianがビッグエンディアン

int CUBEWHEEL_init(CUBEWHEEL_Driver* CUBEWHEEL_driver, uint8_t ch, uint8_t device_address, uint8_t enable_port_no, uint8_t axis_id)
{
Expand All @@ -84,47 +84,47 @@ int CUBEWHEEL_init(CUBEWHEEL_Driver* CUBEWHEEL_driver, uint8_t ch, uint8_t devic
GPIO_set_direction(CUBEWHEEL_driver->info.enable_port_no, GPIO_OUTPUT);

CUBEWHEEL_driver->info.axis_id = axis_id;
CUBEWHEEL_driver->info.maxspeed_in_rpm = 8000; //rpm
CUBEWHEEL_driver->info.max_torque = 0.23; //mNm
CUBEWHEEL_driver->info.maxspeed_in_rpm = 8000; // rpm
CUBEWHEEL_driver->info.max_torque = 0.23; // mNm

CUBEWHEEL_driver->info.rotation_direction_b[0] = 1.0f;
CUBEWHEEL_driver->info.rotation_direction_b[1] = 0.0f;
CUBEWHEEL_driver->info.rotation_direction_b[2] = 0.0f;

CUBEWHEEL_driver->driver.i2c_write.ch = ch;
CUBEWHEEL_driver->driver.i2c_write.frequency_khz = 100;
CUBEWHEEL_driver->driver.i2c_write.device_address = (device_address << 1); //write
CUBEWHEEL_driver->driver.i2c_write.device_address = (device_address << 1); // write
CUBEWHEEL_driver->driver.i2c_write.stop_flag = 1;
CUBEWHEEL_driver->driver.i2c_write.timeout_threshold = 500;
CUBEWHEEL_driver->driver.i2c_write.rx_length = 8;

//todo: ここはreopen?
// todo: ここはreopen?
if (I2C_init(&CUBEWHEEL_driver->driver.i2c_write) != 0)
{
Printf("Error: I2C_init in i2c_rw_write_.\n");
}

CUBEWHEEL_driver->driver.i2c_read.ch = ch;
CUBEWHEEL_driver->driver.i2c_read.frequency_khz = 100;
CUBEWHEEL_driver->driver.i2c_read.device_address = (device_address << 1) + 1; //read
CUBEWHEEL_driver->driver.i2c_read.device_address = (device_address << 1) + 1; // read
CUBEWHEEL_driver->driver.i2c_read.stop_flag = 1;
CUBEWHEEL_driver->driver.i2c_read.timeout_threshold = 500;
CUBEWHEEL_driver->driver.i2c_read.rx_length = 8;

//todo: ここはreopen?
// todo: ここはreopen?
if (I2C_init(&CUBEWHEEL_driver->driver.i2c_read) != 0)
{
Printf("Error: I2C_init in i2c_rw_read_.\n");
}

CUBEWHEEL_driver->driver.i2c_slave.ch = ch;
CUBEWHEEL_driver->driver.i2c_slave.frequency_khz = 100;
CUBEWHEEL_driver->driver.i2c_slave.device_address = device_address; //slave
CUBEWHEEL_driver->driver.i2c_slave.device_address = device_address; // slave
CUBEWHEEL_driver->driver.i2c_slave.stop_flag = 1;
CUBEWHEEL_driver->driver.i2c_slave.timeout_threshold = 500;
CUBEWHEEL_driver->driver.i2c_slave.rx_length = 8;

//todo: ここはreopen?
// todo: ここはreopen?
if (I2C_init(&CUBEWHEEL_driver->driver.i2c_slave) != 0)
{
Printf("Error: I2C_init in i2c_rw_slave_.\n");
Expand Down Expand Up @@ -311,8 +311,8 @@ uint8_t CUBEWHEEL_GetWheelStatus(CUBEWHEEL_Driver* CUBEWHEEL_driver)
raw_value += data[2];
CUBEWHEEL_driver->info.runtime_in_msec = (uint16_t)raw_value;

raw_value = data[5] << 8; //reserve
raw_value += data[4]; //reserve
raw_value = data[5] << 8; // reserve
raw_value += data[4]; // reserve

raw_value = data[6];
CUBEWHEEL_driver->info.motor_mode = (uint8_t)raw_value;
Expand Down Expand Up @@ -473,7 +473,7 @@ static void WriteRegister(CUBEWHEEL_Driver* CUBEWHEEL_driver, uint8_t register_a
// Make send data
send_data_buffer[0] = register_address;

//todo error処理
// todo error処理
if (length > 10)
{
return;
Expand Down Expand Up @@ -505,7 +505,7 @@ static uint8_t ReadID(CUBEWHEEL_Driver* CUBEWHEEL_driver, uint8_t* data)
ReadRegister(CUBEWHEEL_driver, CUBEWHEEL_kCmdIdGetIdentification_, data, CUBEWHEEL_kTlmLengthGetIdentification_);

// TLM128のdata[0]は8固定。
//Printf("ReadID = %d\n", data[0]);
// Printf("ReadID = %d\n", data[0]);
if (data[0] != 0x08)
{
return(1);
Expand All @@ -520,7 +520,7 @@ static uint8_t ReadExtendedID(CUBEWHEEL_Driver* CUBEWHEEL_driver, uint8_t* data)
ReadRegister(CUBEWHEEL_driver, CUBEWHEEL_kCmdIdGetExIdentification_, data, CUBEWHEEL_kTlmLengthGetExIdentification_);

// TLM129のdata[2]はI2Cアドレス
//Printf("ReadExtendedID = %d : %d", data[2], CUBEWHEEL_driver->driver.i2c_write.device_address);
// Printf("ReadExtendedID = %d : %d", data[2], CUBEWHEEL_driver->driver.i2c_write.device_address);
if (data[2] != CUBEWHEEL_driver->driver.i2c_write.device_address)
{
return(1);
Expand All @@ -537,13 +537,13 @@ uint8_t ReadErrorFlag(CUBEWHEEL_Driver* CUBEWHEEL_driver)
ReadRegister(CUBEWHEEL_driver, CUBEWHEEL_kCmdIdGetStatusErrorFlag_, data, CUBEWHEEL_kTlmLengthGetStatusErrorFlag_);


//Printf("CubeWheel Error flag:");
// Printf("CubeWheel Error flag:");
int i;
for (i = 0; i < CUBEWHEEL_kTlmLengthGetStatusErrorFlag_; i++)
{
// Printf(data[i], HEX); Printf(" ");
}
//Printf("");
// Printf("");

return i_ret;
}
Expand Down
7 changes: 3 additions & 4 deletions src/src_user/Drivers/Aocs/cubewheel.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


#include <src_user/Settings/port_config.h>
#include <src_core//IfWrapper/I2C.h>
#include <src_core/Library/print.h>
#include <src_core/Drivers/Super/driver_super.h>
#include "../../Library/physical_constants.h"
Expand All @@ -32,7 +31,7 @@ typedef struct
uint16_t runtime;
uint16_t runtime_in_msec;
float speed_in_rpm;
float speed_backup_in_rpm;
float speed_backup_in_rpm;
float maxspeed_in_rpm;
float reference_in_rpm;
float max_torque;
Expand All @@ -50,7 +49,7 @@ typedef struct
uint8_t feedback_gain_multiplier;
uint16_t integrator_gain;
uint8_t integrator_gain_multiplier;
float rotation_direction_b[3];
float rotation_direction_b[3];

} CUBEWHEEL_Info;

Expand All @@ -73,7 +72,7 @@ typedef struct

int CUBEWHEEL_init(CUBEWHEEL_Driver* CUBEWHEEL_driver,uint8_t ch, uint8_t device_address, uint8_t enable_port_no, uint8_t axis_id);

//これは必要そう
// これは必要そう
DS_CMD_ERR_CODE CUBEWHEEL_Disable(CUBEWHEEL_Driver* CUBEWHEEL_driver);
DS_CMD_ERR_CODE CUBEWHEEL_Enable(CUBEWHEEL_Driver* CUBEWHEEL_driver);
DS_CMD_ERR_CODE CUBEWHEEL_Startup(CUBEWHEEL_Driver* CUBEWHEEL_driver);
Expand Down

0 comments on commit e5994a3

Please sign in to comment.