Skip to content

Commit

Permalink
Add silent timeout macro for ESP32 debug error check (#801)
Browse files Browse the repository at this point in the history
  • Loading branch information
Makuna authored Apr 25, 2024
1 parent e40289f commit 89a6a8b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
18 changes: 18 additions & 0 deletions src/internal/NeoUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,24 @@ License along with NeoPixel. If not, see

#pragma once

#ifdef ARDUINO_ARCH_ESP32
#if defined NDEBUG || defined CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT
#define ESP_ERROR_CHECK_WITHOUT_ABORT_SILENT_TIMEOUT(x) ({ \
esp_err_t err_rc_ = (x); \
err_rc_; \
})
#else
#define ESP_ERROR_CHECK_WITHOUT_ABORT_SILENT_TIMEOUT(x) ({ \
esp_err_t err_rc_ = (x); \
if (unlikely(err_rc_ != ESP_OK && err_rc_ != ESP_ERR_TIMEOUT)) { \
_esp_error_check_failed_without_abort(err_rc_, __FILE__, __LINE__, \
__ASSERT_FUNC, #x); \
} \
err_rc_; \
})
#endif // NDEBUG
#endif // ARDUINO_ARCH_ESP32

// some platforms do not come with STL or properly defined one, specifically functional
// if you see...
// undefined reference to `std::__throw_bad_function_call()'
Expand Down
3 changes: 1 addition & 2 deletions src/internal/methods/NeoEsp32RmtMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,9 @@ template<typename T_SPEED, typename T_CHANNEL> class NeoEsp32RmtMethodBase
free(_dataSending);
}


bool IsReadyToUpdate() const
{
return (ESP_OK == ESP_ERROR_CHECK_WITHOUT_ABORT(rmt_wait_tx_done(_channel.RmtChannelNumber, 0)));
return (ESP_OK == ESP_ERROR_CHECK_WITHOUT_ABORT_SILENT_TIMEOUT(rmt_wait_tx_done(_channel.RmtChannelNumber, 0)));
}

void Initialize()
Expand Down

0 comments on commit 89a6a8b

Please sign in to comment.