Ah, un altra cosa, dato che NON mi piacciono i "warning" (... ed il "core" Arduino UNO R4 se ne porta dietro già troppi
) , se in testa alla Wire che ho modificato NON si include Arduino_FreeRTOS.h (perché non si deve lavorare in ambiente FreeRTOS™ e quindi NON si necessita della modifica), si ha una inutile variabile definita (schedulerIsSupended), per cui ... ho apportato una semplice piccola "condizione":
/* -------------------------------------------------------------------- gpb01 */
#if defined (INC_ARDUINO_FREERTOS_H) || defined (INC_FREERTOS_H)
static uint32_t schedulerIsSupended = 0; /* Most efficient data type */
#endif
static inline void disableScheduler (void) {
#if defined (INC_ARDUINO_FREERTOS_H) || defined (INC_FREERTOS_H)
if ( xTaskGetSchedulerState( ) == taskSCHEDULER_RUNNING ) {
schedulerIsSupended = 0xffffffff;
vTaskSuspendAll();
return;
} else return;
#else
return;
#endif
}
static inline void resumeScheduler (void) {
#if defined (INC_ARDUINO_FREERTOS_H) || defined (INC_FREERTOS_H)
if ( schedulerIsSupended != 0 ) {
schedulerIsSupended = 0;
if( !xTaskResumeAll() ) {
taskYIELD ();
}
return;
} else return;
#else
return;
#endif
}
/* -------------------------------------------------------------------- gpb01 */
facendo così in modo che la definizione della variabile 'schedulerIsSupended' venga fatta solo se si è inclusa la libreria Arduino_FreeRTOS ![]()