mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 07:53:34 +08:00
Fixed adc sim formatting
This commit is contained in:
committed by
Mark Charlebois
parent
d9a7dd04a4
commit
2ec6363f67
@@ -146,11 +146,11 @@ ssize_t
|
|||||||
ADCSIM::devRead(void *buffer, size_t len)
|
ADCSIM::devRead(void *buffer, size_t len)
|
||||||
{
|
{
|
||||||
const size_t maxsize = sizeof(adc_msg_s) * _channel_count;
|
const size_t maxsize = sizeof(adc_msg_s) * _channel_count;
|
||||||
|
|
||||||
if (len > maxsize) {
|
if (len > maxsize) {
|
||||||
len = maxsize;
|
len = maxsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* block interrupts while copying samples to avoid racing with an update */
|
/* block interrupts while copying samples to avoid racing with an update */
|
||||||
m_lock.lock();
|
m_lock.lock();
|
||||||
memcpy(buffer, _samples, len);
|
memcpy(buffer, _samples, len);
|
||||||
@@ -163,10 +163,12 @@ void
|
|||||||
ADCSIM::_measure()
|
ADCSIM::_measure()
|
||||||
{
|
{
|
||||||
m_lock.lock();
|
m_lock.lock();
|
||||||
|
|
||||||
/* scan the channel set and sample each */
|
/* scan the channel set and sample each */
|
||||||
for (unsigned i = 0; i < _channel_count; i++) {
|
for (unsigned i = 0; i < _channel_count; i++) {
|
||||||
_samples[i].am_data = _sample(_samples[i].am_channel);
|
_samples[i].am_data = _sample(_samples[i].am_channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lock.unlock();
|
m_lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user