more fancy

This commit is contained in:
rusefillc 2022-11-06 00:10:50 -04:00
parent ce55171d8d
commit 6c8325c0c2
3 changed files with 8 additions and 8 deletions

View File

@ -839,11 +839,11 @@ uint32_t TriggerDecoderBase::findTriggerZeroEventIndex(
TriggerStimulatorHelper helper; TriggerStimulatorHelper helper;
uint32_t syncIndex = helper.findTriggerSyncPoint(shape, expected<uint32_t> syncIndex = helper.findTriggerSyncPoint(shape,
triggerConfiguration, triggerConfiguration,
*this); *this);
if (syncIndex == EFI_ERROR_CODE) { if (!syncIndex) {
return syncIndex; return EFI_ERROR_CODE;
} }
// Assert that we found the sync point on the very first revolution // Assert that we found the sync point on the very first revolution
@ -856,9 +856,9 @@ uint32_t TriggerDecoderBase::findTriggerZeroEventIndex(
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */
helper.assertSyncPosition(triggerConfiguration, helper.assertSyncPosition(triggerConfiguration,
syncIndex, *this, shape); syncIndex.Value, *this, shape);
return syncIndex % shape.getSize(); return syncIndex.Value % shape.getSize();
} }
#endif /* EFI_SHAFT_POSITION_INPUT */ #endif /* EFI_SHAFT_POSITION_INPUT */

View File

@ -127,7 +127,7 @@ void TriggerStimulatorHelper::assertSyncPosition(
/** /**
* @return trigger synchronization point index, or error code if not found * @return trigger synchronization point index, or error code if not found
*/ */
uint32_t TriggerStimulatorHelper::findTriggerSyncPoint( expected<uint32_t> TriggerStimulatorHelper::findTriggerSyncPoint(
TriggerWaveform& shape, TriggerWaveform& shape,
const TriggerConfiguration& triggerConfiguration, const TriggerConfiguration& triggerConfiguration,
TriggerDecoderBase& state) { TriggerDecoderBase& state) {
@ -140,5 +140,5 @@ uint32_t TriggerStimulatorHelper::findTriggerSyncPoint(
} }
shape.setShapeDefinitionError(true); shape.setShapeDefinitionError(true);
warning(CUSTOM_ERR_TRIGGER_SYNC, "findTriggerZeroEventIndex() failed"); warning(CUSTOM_ERR_TRIGGER_SYNC, "findTriggerZeroEventIndex() failed");
return EFI_ERROR_CODE; return unexpected;
} }

View File

@ -17,7 +17,7 @@ int getSimulatedEventTime(const TriggerWaveform& shape, int i);
class TriggerStimulatorHelper { class TriggerStimulatorHelper {
public: public:
uint32_t findTriggerSyncPoint( expected<uint32_t> findTriggerSyncPoint(
TriggerWaveform& shape, TriggerWaveform& shape,
const TriggerConfiguration& triggerConfiguration, const TriggerConfiguration& triggerConfiguration,
TriggerDecoderBase& state); TriggerDecoderBase& state);