Consistently making space for a maximum of 12 channels, 10 channels (including reference / temperature) are used / available right now

This commit is contained in:
Lorenz Meier 2014-03-17 17:02:10 +01:00
parent 4e6e40e5d8
commit d940bdf7f6
4 changed files with 7 additions and 7 deletions

View File

@ -341,7 +341,7 @@ test(void)
err(1, "can't open ADC device"); err(1, "can't open ADC device");
for (unsigned i = 0; i < 50; i++) { for (unsigned i = 0; i < 50; i++) {
adc_msg_s data[10]; adc_msg_s data[12];
ssize_t count = read(fd, data, sizeof(data)); ssize_t count = read(fd, data, sizeof(data));
if (count < 0) if (count < 0)

View File

@ -1169,8 +1169,8 @@ Sensors::adc_poll(struct sensor_combined_s &raw)
hrt_abstime t = hrt_absolute_time(); hrt_abstime t = hrt_absolute_time();
/* rate limit to 100 Hz */ /* rate limit to 100 Hz */
if (t - _last_adc >= 10000) { if (t - _last_adc >= 10000) {
/* make space for a maximum of ten channels (to ensure reading all channels at once) */ /* make space for a maximum of twelve channels (to ensure reading all channels at once) */
struct adc_msg_s buf_adc[10]; struct adc_msg_s buf_adc[12];
/* read all channels available */ /* read all channels available */
int ret = read(_fd_adc, &buf_adc, sizeof(buf_adc)); int ret = read(_fd_adc, &buf_adc, sizeof(buf_adc));

View File

@ -99,8 +99,8 @@ struct sensor_combined_s {
float baro_pres_mbar; /**< Barometric pressure, already temp. comp. */ float baro_pres_mbar; /**< Barometric pressure, already temp. comp. */
float baro_alt_meter; /**< Altitude, already temp. comp. */ float baro_alt_meter; /**< Altitude, already temp. comp. */
float baro_temp_celcius; /**< Temperature in degrees celsius */ float baro_temp_celcius; /**< Temperature in degrees celsius */
float adc_voltage_v[9]; /**< ADC voltages of ADC Chan 10/11/12/13 or -1 */ float adc_voltage_v[10]; /**< ADC voltages of ADC Chan 10/11/12/13 or -1 */
unsigned adc_mapping[9]; /**< Channel indices of each of these values */ unsigned adc_mapping[10]; /**< Channel indices of each of these values */
float mcu_temp_celcius; /**< Internal temperature measurement of MCU */ float mcu_temp_celcius; /**< Internal temperature measurement of MCU */
uint32_t baro_counter; /**< Number of raw baro measurements taken */ uint32_t baro_counter; /**< Number of raw baro measurements taken */

View File

@ -66,8 +66,8 @@ int test_adc(int argc, char *argv[])
} }
for (unsigned i = 0; i < 5; i++) { for (unsigned i = 0; i < 5; i++) {
/* make space for a maximum of ten channels */ /* make space for a maximum of twelve channels */
struct adc_msg_s data[10]; struct adc_msg_s data[12];
/* read all channels available */ /* read all channels available */
ssize_t count = read(fd, data, sizeof(data)); ssize_t count = read(fd, data, sizeof(data));