repair ch4 test

This commit is contained in:
Wang_Weigen 2021-12-14 14:07:09 +08:00
parent e366c8817c
commit 4a8ac7c02b
4 changed files with 12 additions and 8 deletions

View File

@ -29,6 +29,7 @@ extern int Hs300xTemperatureInit(void);
extern int Hs300xHumidityInit(void);
extern int Ps5308Pm1_0Init(void);
extern int Zg09Co2Init(void);
extern int As830Ch4Init(void);
typedef int (*InitFunc)(void);
struct InitDesc
@ -89,6 +90,10 @@ static struct InitDesc sensor_desc[] =
{ "zg09_co2", Zg09Co2Init },
#endif
#ifdef SENSOR_AS830
{ "ch4_as830", As830Ch4Init },
#endif
{ "NULL", NULL },
};

View File

@ -17,16 +17,13 @@
extern int FrameworkInit();
extern void ApplicationOtaTaskInit(void);
extern void ShowMemory(void);
extern long ShowTask(void);
int main(void)
{
printf("Hello, world! Running on gapuino board.\n");
printf("Hello, world! \n");
FrameworkInit();
#ifdef APPLICATION_OTA
ApplicationOtaTaskInit();
#endif
Ch4As830();
return 0;
}
// int cppmain(void);

View File

@ -25,11 +25,11 @@ config SENSOR_AS830
if SENSOR_AS830_DRIVER_EXTUART
config SENSOR_DEVICE_AS830_DEV
string "as830 device extra uart path"
default "/dev/extuart_dev4"
default "/dev/extuart_dev1"
config SENSOR_DEVICE_AS830_DEV_EXT_PORT
int "if AS830 device using extuart, choose port"
default "4"
default "1"
endif
endif

View File

@ -39,6 +39,10 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
int result = 0;
sdev->fd = PrivOpen(SENSOR_DEVICE_AS830_DEV, O_RDWR);
if (sdev->fd < 0) {
printf("open %s error\n", SENSOR_DEVICE_AS830_DEV);
return -1;
}
struct SerialDataCfg cfg;
cfg.serial_baud_rate = BAUD_RATE_9600;
@ -58,8 +62,6 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
ioctl_cfg.args = &cfg;
result = PrivIoctl(sdev->fd, OPE_INT, &ioctl_cfg);
sdev->done->ioctl(sdev, SENSOR_DEVICE_PASSIVE);
return result;
}