mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +00:00
[hal] Fixes for making PWM drive (#7528)
* Increase connection timeout, fix ld path, properly initialize smart io. * Also fix HAL_GetSystemTimeValid, so DataLogManager doesn't throw errors.
This commit is contained in:
@@ -77,6 +77,7 @@ void InitializeHAL() {
|
||||
InitializePWM();
|
||||
InitializeRelay();
|
||||
InitializeSerialPort();
|
||||
InitializeSmartIo();
|
||||
InitializeSPI();
|
||||
InitializeThreads();
|
||||
}
|
||||
@@ -311,7 +312,6 @@ HAL_Bool HAL_GetRSLState(int32_t* status) {
|
||||
}
|
||||
|
||||
HAL_Bool HAL_GetSystemTimeValid(int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ extern void InitializePower();
|
||||
extern void InitializePWM();
|
||||
extern void InitializeRelay();
|
||||
extern void InitializeSerialPort();
|
||||
extern void InitializeSmartIo();
|
||||
extern void InitializeSPI();
|
||||
extern void InitializeThreads();
|
||||
} // namespace hal::init
|
||||
|
||||
@@ -43,7 +43,7 @@ int32_t SmartIo::InitializeMode(SmartIoMode mode) {
|
||||
inst.GetDoubleTopic("/io/valset" + channelString).Publish(options);
|
||||
setPublisher.Set(0);
|
||||
pwmMinPublisher =
|
||||
inst.GetDoubleTopic("/io/pwmmim" + channelString).Publish();
|
||||
inst.GetDoubleTopic("/io/pwmmin" + channelString).Publish();
|
||||
pwmMinPublisher.Set(0);
|
||||
pwmMaxPublisher =
|
||||
inst.GetDoubleTopic("/io/pwmmax" + channelString).Publish();
|
||||
@@ -63,8 +63,8 @@ int32_t SmartIo::SetPwmMicroseconds(uint16_t microseconds) {
|
||||
|
||||
// TODO(thad) add support for always on signal
|
||||
|
||||
if (microseconds > 4096) {
|
||||
microseconds = 4096;
|
||||
if (microseconds > 4095) {
|
||||
microseconds = 4095;
|
||||
}
|
||||
|
||||
// Scale from 0-4096 to 0.0-2.0, then to -1.0-1.0
|
||||
|
||||
Reference in New Issue
Block a user