mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Fix CAN API timing out incorrectly (#1497)
HAL_GetFPGATime returns 0 if it starts with a non zero status. Always use monotonic clock for CAN times, rather then trying to sync FPGA. Change timeout from 50 ms to 100 ms.
This commit is contained in:
committed by
Peter Johnson
parent
300eeb330d
commit
d46ce13ffe
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "frc/PowerDistributionPanel.h" // NOLINT(build/include_order)
|
||||
|
||||
#include <hal/Ports.h>
|
||||
|
||||
#include "TestBench.h"
|
||||
#include "frc/Jaguar.h"
|
||||
#include "frc/Talon.h"
|
||||
@@ -40,6 +42,20 @@ class PowerDistributionPanelTest : public testing::Test {
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(PowerDistributionPanelTest, CheckRepeatedCalls) {
|
||||
auto numChannels = HAL_GetNumPDPChannels();
|
||||
// 1 second
|
||||
for (int i = 0; i < 50; i++) {
|
||||
for (int j = 0; j < numChannels; j++) {
|
||||
m_pdp->GetCurrent(j);
|
||||
ASSERT_TRUE(m_pdp->GetError().GetCode() == 0);
|
||||
}
|
||||
m_pdp->GetVoltage();
|
||||
ASSERT_TRUE(m_pdp->GetError().GetCode() == 0);
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the current changes when the motor is driven using a talon
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user