Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions tfrog-motordriver/controlVelocity.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ typedef struct _DriverState
uint32_t velcontrol;
uint32_t ping_request;
uint32_t odom_drop;
int32_t vsrc_max;
} DriverState;

#ifdef static_assert
Expand Down
15 changes: 14 additions & 1 deletion tfrog-motordriver/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,19 @@ int main()
driver_state.ifmode = 0;
driver_state.watchdog = 0;
driver_state.odom_drop = 0;
driver_state.vsrc_max = 0x3ff;
switch (driver_state.board_version)
{
case BOARD_R6A:
case BOARD_R4:
break;
case BOARD_R6B:
#if defined(tfrog_rev5)
driver_state.vsrc_max = 0x3ff * VSRC_CONV_B;
#endif
break;
}

// Driver loop
while (1)
{
Expand Down Expand Up @@ -1012,7 +1025,7 @@ int main()
driver_state.vsrc = Filter1st_Filter(&voltf, (int32_t)(analog[7] & 0x0FFF));
ADC_Start();

if (driver_param.vsrc_rated >= 0x03FF)
if (driver_param.vsrc_rated >= driver_state.vsrc_max)
{
driver_state.vsrc_factor = 32768;
}
Expand Down