raiden00pl opened a new pull request, #2752: URL: https://github.com/apache/nuttx-apps/pull/2752
## Summary * examples/foc: fix snprintf warning fix snprintf warning: foc_thr.c:110:39: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 7 [-Wformat-truncation=] 110 | snprintf(mqname, sizeof(mqname), "%s%d", CONTROL_MQ_MQNAME, envp->id); | ^~ foc_thr.c:110:36: note: directive argument in the range [-2147483648, 0] 110 | snprintf(mqname, sizeof(mqname), "%s%d", CONTROL_MQ_MQNAME, envp->id); | ^~~~~~ foc_thr.c:110:3: note: 'snprintf' output between 5 and 15 bytes into a destination of size 10 110 | snprintf(mqname, sizeof(mqname), "%s%d", CONTROL_MQ_MQNAME, envp->id); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * examples/foc: fix compilation error fix compilatgion error: foc_motor_f32.c: In function 'foc_motor_init': foc_motor_f32.c:1574:7: error: label 'errout' used but not defined 1574 | goto errout; * examples/foc: improve perf monitor improve FOC perf monitor: - add options to choose when perf result should be printed - measure the controller thread call period * examples/foc: fix option that disable motor controller fix some compiler error when EXAMPLES_FOC_RUN_DISABLE is enabled * examples/foc: print aling results only when verbose output enabled it is a costly operation that takes a lot of time and is not of much value * examples/foc: ignore error for align and ident routines when motor controller disabled CONFIG_EXAMPLES_FOC_RUN_DISABLE option is used for tests and benchmarks, so we don't care about wrong results for motor identification and sensor alignment routines * examples/foc: protect control loop with critical section If the controller frequency is high, system timer interrupts will eventually interrupt the controller function, thereby increasing the execution time. This may lead to skipping the control cycle, which negatively affects the control algorithm. With this option enabled, interrupts are disabled for the duration of the controller function execution. Here example results from CONFIG_EXAMPLES_FOC_PERF output for b-g431b-esc1 board with CONFIG_EXAMPLES_FOC_NOTIFIER_FREQ=10000: 1. CONFIG_EXAMPLES_FOC_CONTROL_CRITSEC=n exec ticks=5258 nsec=30929 per ticks=21268 nsec=125105 2. CONFIG_EXAMPLES_FOC_CONTROL_CRITSEC=y exec ticks=3428 nsec=20164 per ticks=19203 nsec=112958 The difference is ~12us! ## Impact various improvements for FOC example which can help verify the "hard real-time" performances of NuttX (missing the control algorithm deadlines in the case of FOC may have critical consequences for the system) ## Testing b-g431b-esc1 board -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org