Fixed compiler warnings
This commit is contained in:
Submodule bobbycar-protocol updated: 964acb82f0...2e0f97d6dd
35
main.cpp
35
main.cpp
@ -109,6 +109,8 @@ CAN_HandleTypeDef CanHandle;
|
|||||||
#define CANx_RX_IRQHandler USB_LP_CAN1_RX0_IRQHandler
|
#define CANx_RX_IRQHandler USB_LP_CAN1_RX0_IRQHandler
|
||||||
#define CANx_TX_IRQn USB_HP_CAN1_TX_IRQn
|
#define CANx_TX_IRQn USB_HP_CAN1_TX_IRQn
|
||||||
#define CANx_TX_IRQHandler USB_HP_CAN1_TX_IRQHandler
|
#define CANx_TX_IRQHandler USB_HP_CAN1_TX_IRQHandler
|
||||||
|
|
||||||
|
constexpr bool doDelayWithCanPoll = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LOG_TO_SERIAL
|
#ifdef LOG_TO_SERIAL
|
||||||
@ -360,23 +362,27 @@ int main()
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
#ifdef FEATURE_CAN
|
#ifdef FEATURE_CAN
|
||||||
constexpr auto DELAY_WITH_CAN_POLL = [](uint32_t Delay){
|
if constexpr (doDelayWithCanPoll)
|
||||||
uint32_t tickstart = HAL_GetTick();
|
{
|
||||||
uint32_t wait = Delay;
|
constexpr auto DELAY_WITH_CAN_POLL = [](uint32_t Delay){
|
||||||
|
uint32_t tickstart = HAL_GetTick();
|
||||||
|
uint32_t wait = Delay;
|
||||||
|
|
||||||
/* Add a freq to guarantee minimum wait */
|
/* Add a freq to guarantee minimum wait */
|
||||||
if (wait < HAL_MAX_DELAY)
|
if (wait < HAL_MAX_DELAY)
|
||||||
{
|
{
|
||||||
wait += (uint32_t)(uwTickFreq);
|
wait += (uint32_t)(uwTickFreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((HAL_GetTick() - tickstart) < wait)
|
while ((HAL_GetTick() - tickstart) < wait)
|
||||||
{
|
{
|
||||||
applyIncomingCanMessage();
|
applyIncomingCanMessage();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//DELAY_WITH_CAN_POLL(5); //delay in ms
|
DELAY_WITH_CAN_POLL(5); //delay in ms
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
HAL_Delay(5); //delay in ms
|
HAL_Delay(5); //delay in ms
|
||||||
|
|
||||||
@ -1364,6 +1370,7 @@ void poweroff()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
[[maybe_unused]]
|
||||||
void communicationTimeout()
|
void communicationTimeout()
|
||||||
{
|
{
|
||||||
applyDefaultSettings();
|
applyDefaultSettings();
|
||||||
|
Reference in New Issue
Block a user