Skip to content

Commit e59068c

Browse files
committed
Issue #17: correction of parameters
1 parent 82289af commit e59068c

3 files changed

Lines changed: 4 additions & 23 deletions

File tree

KPI_Rover/Motors/PCA9685.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "stm32f4xx_hal.h"
33

44
/* I2C Handle defined in main.c */
5-
extern I2C_HandleTypeDef hi2c1;
5+
extern I2C_HandleTypeDef hi2c3;
66

77
/* PCA9685 I2C address */
88
/* 0x40 is the 7-bit address. HAL requires it shifted left by 1 (0x80) */
@@ -18,7 +18,7 @@ extern I2C_HandleTypeDef hi2c1;
1818
*/
1919
static void pca9685_write(uint8_t reg, uint8_t data)
2020
{
21-
HAL_I2C_Mem_Write(&hi2c1,
21+
HAL_I2C_Mem_Write(&hi2c3,
2222
PCA9685_ADDR,
2323
reg,
2424
I2C_MEMADD_SIZE_8BIT,
@@ -40,7 +40,7 @@ static void pca9685_write4(uint8_t reg, uint16_t on, uint16_t off)
4040
buf[2] = off & 0xFF; // OFF_L
4141
buf[3] = off >> 8; // OFF_H
4242

43-
HAL_I2C_Mem_Write(&hi2c1,
43+
HAL_I2C_Mem_Write(&hi2c3,
4444
PCA9685_ADDR,
4545
reg,
4646
I2C_MEMADD_SIZE_8BIT,

KPI_Rover/Motors/ulMotorsController.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,6 @@ void ulMotorsController_Init(ulMotorsController_t* ctrl)
160160

161161
void ulMotorsController_Run(ulMotorsController_t* ctrl)
162162
{
163-
static char teleplot_buf[512];
164-
teleplot_buf[0] = '\0';
165163
const float MAX_RPM_CONST = 250.0f;
166164

167165
for (int i = 0; i < ULMOTORS_NUM_MOTORS; i++) {
@@ -210,24 +208,6 @@ void ulMotorsController_Run(ulMotorsController_t* ctrl)
210208
&ctrl->pids[i].kp,
211209
&ctrl->pids[i].ki
212210
);
213-
214-
215-
// TELEPLOT
216-
char tmp[64];
217-
snprintf(tmp, sizeof(tmp), ">M%d_SP:%d\n>M%d_RPM:%d\n>M%d_PWM:%lu\n>M%d_P:%.4f\n>M%d_I:%.4f\n",
218-
i, (int)sp,
219-
i, (int)rpm,
220-
i, pwm_hw,
221-
i, ctrl->pids[i].kp,
222-
i, ctrl->pids[i].ki);
223-
224-
if (strlen(teleplot_buf) + strlen(tmp) < sizeof(teleplot_buf) - 1) {
225-
strcat(teleplot_buf, tmp);
226-
}
227-
}
228-
229-
if (strlen(teleplot_buf) > 0) {
230-
CDC_Transmit_FS((uint8_t*)teleplot_buf, strlen(teleplot_buf));
231211
}
232212
}
233213

KPI_Rover/Motors/ulMotorsController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ typedef enum
3030
MOTORS_STATE_INIT = 0,
3131
MOTORS_STATE_IDLE,
3232
MOTORS_STATE_RUN,
33+
MOTORS_STATE_TEST, // TEST
3334
MOTORS_STATE_ERROR
3435
} MotorsCtrlState_t;
3536

0 commit comments

Comments
 (0)