From 4a8ac7c02b8ed49d4d5b56d677c1a0443b52b066 Mon Sep 17 00:00:00 2001 From: Wang_Weigen Date: Tue, 14 Dec 2021 14:07:09 +0800 Subject: [PATCH] repair ch4 test --- APP_Framework/Applications/framework_init.c | 5 +++++ APP_Framework/Applications/main.c | 5 +---- APP_Framework/Framework/sensor/ch4/Kconfig | 4 ++-- APP_Framework/Framework/sensor/ch4/as830/as830.c | 6 ++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/APP_Framework/Applications/framework_init.c b/APP_Framework/Applications/framework_init.c index f060dbab1..cc95d6152 100644 --- a/APP_Framework/Applications/framework_init.c +++ b/APP_Framework/Applications/framework_init.c @@ -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 }, }; diff --git a/APP_Framework/Applications/main.c b/APP_Framework/Applications/main.c index 6cd956945..b10557a97 100644 --- a/APP_Framework/Applications/main.c +++ b/APP_Framework/Applications/main.c @@ -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); diff --git a/APP_Framework/Framework/sensor/ch4/Kconfig b/APP_Framework/Framework/sensor/ch4/Kconfig index 7f3ef3d23..f973600dc 100644 --- a/APP_Framework/Framework/sensor/ch4/Kconfig +++ b/APP_Framework/Framework/sensor/ch4/Kconfig @@ -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 diff --git a/APP_Framework/Framework/sensor/ch4/as830/as830.c b/APP_Framework/Framework/sensor/ch4/as830/as830.c index 1a5d90201..edd7f6d8c 100644 --- a/APP_Framework/Framework/sensor/ch4/as830/as830.c +++ b/APP_Framework/Framework/sensor/ch4/as830/as830.c @@ -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; }