what's the proper way to printf timeNowUs #6434

This commit is contained in:
rusEFI LLC 2024-04-29 15:44:09 -04:00
parent d05aef168d
commit ed9ed11187
3 changed files with 6 additions and 2 deletions

View File

@ -103,7 +103,7 @@ void TriggerScheduler::scheduleEventsUntilNextTriggerTooth(int rpm,
#if SPARK_EXTREME_LOGGING
efiPrintf("time to invoke [%.1f, %.1f) %d %d",
currentPhase, nextPhase, getRevolutionCounter(), (int)getTimeNowUs());
currentPhase, nextPhase, getRevolutionCounter(), time2print(getTimeNowUs()));
#endif /* SPARK_EXTREME_LOGGING */
// In case this event was scheduled by overdwell protection, cancel it so

View File

@ -19,6 +19,10 @@
#include "port_mpu_util.h"
#endif
inline int time2print(int64_t time) {
return static_cast<int>(time);
}
// microseconds to ticks
// since only about 20 seconds of ticks fit in 32 bits this macro is casting parameter into 64 bits 'efitick_t' type
// please note that int64 <-> float is a heavy operation thus we have 'USF2NT' below

View File

@ -49,7 +49,7 @@ static void timerCallback(CallbackContext* ctx) {
if (printSchedulerDebug) {
if (ctx->scheduling->action.getCallback() == (schfunc_t)&turnInjectionPinLow) {
printf("executing cb=turnInjectionPinLow p=%d sch=%d now=%d\r\n", (int)ctx->scheduling->action.getArgument(), (int)scheduling,
(int)getTimeNowUs());
time2print(getTimeNowUs()));
} else {
// printf("exec cb=%d p=%d\r\n", (int)scheduling->callback, (int)scheduling->param);
}