Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cwrapper/scrutiny_cwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ extern "C"
return reinterpret_cast<scrutiny_c_loop_handler_ff_t *>(new (mem) scrutiny::FixedFrequencyLoopHandler(timestep_100ns, name)); // Placement new
}

void scrutiny_c_loop_handler_fixed_freq_process(scrutiny_c_loop_handler_ff_t *loop_handler)
void scrutiny_c_loop_handler_fixed_freq_process(scrutiny_c_loop_handler_ff_t *loop_handler, scrutiny_c_timediff_t const timestep_100n)
{
get_loop_handler_ff(loop_handler)->process();
get_loop_handler_ff(loop_handler)->process(timestep_100n);
}

scrutiny_c_loop_handler_vf_t *scrutiny_c_loop_handler_variable_freq_construct(void *mem, size_t const size, char const *name)
Expand Down
3 changes: 2 additions & 1 deletion cwrapper/scrutiny_cwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ extern "C"
/// @brief Wrapper for `FixedFrequencyLoopHandler::process()`
/// Process function be called at each iteration of the loop.
/// @param loop_handler The `FixedFrequencyLoopHandler` object to work on
void scrutiny_c_loop_handler_fixed_freq_process(scrutiny_c_loop_handler_ff_t *loop_handler);
/// @param timestep_100n The real, used when graphing with MeasuredTime
void scrutiny_c_loop_handler_fixed_freq_process(scrutiny_c_loop_handler_ff_t *loop_handler, scrutiny_c_timediff_t const timestep_100n);

/// @brief Wrapper for `VariableFrequencyLoopHandler::VariableFrequencyLoopHandler()`.
/// Construct `scrutiny::VariableFrequencyLoopHandler` object at a given address. Fails if `mem` is NULL or if the size is not big enough.
Expand Down
9 changes: 7 additions & 2 deletions lib/inc/scrutiny_loop_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,13 @@ namespace scrutiny
m_timestep_100ns(timestep_100ns)
{
}

/// @brief Process function be called at each iteration of the loop.
void process();

/// @brief Process function be called at each iteration of the loop.
void process(void);
/// @param timestep_100ns Time delta since last call to process() in multiple of 100ns
void process(timediff_t const timestep_100ns);

/// @brief Return the type of loop handler
virtual LoopType loop_type(void) const override { return LoopType::FIXED_FREQ; }
Expand Down Expand Up @@ -185,7 +190,7 @@ namespace scrutiny

/// @brief Process function be called at each iteration of the loop.
/// @param timestep_100ns Time delta since last call to process() in multiple of 100ns
void process(timediff_t timestep_100ns);
void process(timediff_t const timestep_100ns);

/// @brief Return the type of loop handler
virtual LoopType loop_type(void) const override { return LoopType::VARIABLE_FREQ; }
Expand Down
7 changes: 6 additions & 1 deletion lib/src/scrutiny_loop_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,14 @@ namespace scrutiny
{
process_common(m_timestep_100ns);
}
void VariableFrequencyLoopHandler::process(timediff_t const timestep_100ns)

void FixedFrequencyLoopHandler::process(timediff_t const timestep_100ns)
{
process_common(timestep_100ns);
}

void VariableFrequencyLoopHandler::process(timediff_t const timestep_100ns)
{
process_common(timestep_100ns);
}
}
7 changes: 4 additions & 3 deletions projects/c_testapp/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,10 @@ void process_scrutiny_lib(comm_channel_interface_t *channel)
}
printf("\n");
}

scrutiny_c_loop_handler_variable_freq_process(vf_loop, timestep_us*10);
scrutiny_c_loop_handler_fixed_freq_process(ff_loop);

uint32_t const timestep_100ns = timestep_us*10;
scrutiny_c_loop_handler_variable_freq_process(vf_loop, timestep_100ns);
scrutiny_c_loop_handler_fixed_freq_process(ff_loop, timestep_100ns);
#if SCRUTINY_BUILD_WINDOWS
Sleep(10);
#else
Expand Down
2 changes: 1 addition & 1 deletion projects/testapp/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ void process_scrutiny_lib(AbstractCommChannel *channel)
}

vf_loop.process(timestep_us * 10);
ff_loop.process();
ff_loop.process(timestep_us * 10);
#if SCRUTINY_BUILD_WINDOWS
Sleep(10);
#else
Expand Down