Updated SPATZ to ignore TICK() when disabled

This commit is contained in:
dario 2024-10-09 16:09:37 +02:00
parent b79279dcbc
commit 86b72a2efd
2 changed files with 10 additions and 3 deletions

View File

@ -45,7 +45,7 @@ namespace sta
* @param buffer The float buffer to write the data to.
* @param length The number of floats to request.
*/
void request(uint8_t id, float * buffer, size_t length);
bool request(uint8_t id, float * buffer, size_t length);
/**
* @brief Request doubles for a specific sensor id via the printable.
@ -80,6 +80,8 @@ namespace sta
#define STA_SPATZ_INIT(mutex, signal) ((void)0)
#define STA_SPATZ_TICK() ((void)0)
#endif // STA_SPATZ_ENABLED
#endif // STA_CORE_SPATZ_HPP

View File

@ -47,15 +47,20 @@ namespace sta
mutex_->release();
}
void request(uint8_t id, float * buffer, size_t length)
bool request(uint8_t id, float * buffer, size_t length)
{
mutex_->acquire();
HAL_UART_Receive_IT(&huart1, reinterpret_cast<uint8_t*>(buffer), length * sizeof(float));
Debug->printf("%d", id);
signal_->wait(0x01, 100);
if (signal_->wait(0x01, 100) != 0x01)
{
mutex_->release();
return false;
}
mutex_->release();
return true;
}
void request(uint8_t id, double * buffer, size_t length)