mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-22 06:14:14 +08:00
ocpoc_adc: handle return from fscanf
This commit is contained in:
committed by
Lorenz Meier
parent
d01150990b
commit
d5cbbba341
@@ -154,7 +154,12 @@ int OcpocADC::read(px4_adc_msg_t(*buf)[PX4_MAX_ADC_CHANNELS], unsigned int len)
|
||||
FILE *xadc_fd = fopen(ADC_VOLTAGE_PATH, "r");
|
||||
|
||||
if (xadc_fd != NULL) {
|
||||
fscanf(xadc_fd, "%d", buff);
|
||||
int ret_tmp = fscanf(xadc_fd, "%d", buff);
|
||||
|
||||
if (ret_tmp < 0) {
|
||||
ret = ret_tmp;
|
||||
}
|
||||
|
||||
fclose(xadc_fd);
|
||||
|
||||
(*buf)[0].am_data = buff[0];
|
||||
|
||||
Reference in New Issue
Block a user