mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 15:01:36 +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");
|
FILE *xadc_fd = fopen(ADC_VOLTAGE_PATH, "r");
|
||||||
|
|
||||||
if (xadc_fd != NULL) {
|
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);
|
fclose(xadc_fd);
|
||||||
|
|
||||||
(*buf)[0].am_data = buff[0];
|
(*buf)[0].am_data = buff[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user