Skip to content

Commit

Permalink
Merge pull request #82 from RoboTeamTwente/fix/hot-fix-floating-uart-pin
Browse files Browse the repository at this point in the history
Allow for disabling UART PC connection with FT2 switch
  • Loading branch information
emielsteerneman authored Jul 4, 2023
2 parents 90f2950 + f696765 commit 16ed1e6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Core/Src/robot.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@

uint8_t ROBOT_ID;
WIRELESS_CHANNEL ROBOT_CHANNEL;

/* Whether the robot should accept an uart connection from the PC */
volatile bool ENABLE_UART_PC = true;

volatile bool IS_RUNNING_TEST = false;
volatile bool ROBOT_INITIALIZED = false;

Expand Down Expand Up @@ -305,6 +309,7 @@ void init(void){
ROBOT_ID = get_Id();
ROBOT_CHANNEL = read_Pin(FT1_pin) == GPIO_PIN_SET ? BLUE_CHANNEL : YELLOW_CHANNEL;
IS_RUNNING_TEST = read_Pin(FT0_pin);
ENABLE_UART_PC = read_Pin(FT2_pin);


initPacketHeader((REM_Packet*) &activeRobotCommand, ROBOT_ID, ROBOT_CHANNEL, REM_PACKET_TYPE_REM_ROBOT_COMMAND);
Expand Down Expand Up @@ -344,8 +349,13 @@ void init(void){
}
#endif

/* === Wired communication with robot; Can now receive RobotCommands (and other REM packets) via UART */
REM_UARTinit(UART_PC);
// Sometimes the UART pin for the programmer is floating, causing the robot to not boot.
// As a temporary fix one can disable the uart initialization with the FT_2 switch on the robot.
// TODO: This will need a proper fix later on.
if (ENABLE_UART_PC) {
/* === Wired communication with robot; Can now receive RobotCommands (and other REM packets) via UART */
REM_UARTinit(UART_PC);
}
}

set_Pin(LED1_pin, 1);
Expand Down

0 comments on commit 16ed1e6

Please sign in to comment.