From: SnickerSun Date: Tue, 31 Dec 2024 10:24:25 +0000 (+0800) Subject: 开启GNSS定位,延长定位超时时间 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=659db6b8f0faaca6ae8baa6af2882acb52c560bf;p=mirrors%2FFD230.git 开启GNSS定位,延长定位超时时间 --- diff --git a/code/sdk/zhihui/services/gnss/sample/gnss_sample/gnss_sample.c b/code/sdk/zhihui/services/gnss/sample/gnss_sample/gnss_sample.c index 296ad89c3..14481f8b8 100644 --- a/code/sdk/zhihui/services/gnss/sample/gnss_sample/gnss_sample.c +++ b/code/sdk/zhihui/services/gnss/sample/gnss_sample/gnss_sample.c @@ -19,7 +19,7 @@ #define MSG_CONTENT_IDX 2 #define MSG_TYPE_BINRY 0 #define MSG_TYPE_ASCII 1 -#define LISTEN_DATA_MAX_LINES 1000 +#define LISTEN_DATA_MAX_LINES 10000 #define REPORT_MAX_BYTES 10000 #define LISTEN_TIME_THR 1000 @@ -39,8 +39,18 @@ const uint8_t CFG_ACQ_LPW_ENABLE[] = {0x03 ,0x00 ,0x09 ,0x00 ,0x00 ,0x00 ,0x06 , const uint8_t CFG_ACQ_LPW_DISABLE[] = {0x03 ,0x00 ,0x06 ,0x00 ,0x00 ,0x00 ,0x06 ,0x00 ,0x04 ,0x00 ,0x02 ,0x00 ,0x00 ,0x00}; +//定位模式自动,冷启动,热启动 +const uint8_t cfgAutoStartCmd[] = {0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00}; +const uint8_t cfgAltCstrCmd[] = {0x03, 0x00, 0x23, 0x00, 0x00, 0x00, 0x05, 0x00, 0x12, 0x10, 0x01, 0x00, 0x00}; +const uint8_t cfgColdStartCmd[] = {0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01}; +//配置定位使用的卫星系统 +const uint8_t cfgFixModeGpsCmd[] = {0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00}; +const uint8_t cfgFixModeAllCmd[] = {0x03, 0x00, 0x23, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00}; +//配置NMEA显示内容 +const uint8_t cfgNmeaDefaultCmd[] = {0x03, 0x00, 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x03, 0x00, 0x02, 0x00, 0x11, 0x00}; +const uint8_t cfgNmeaAllCmd[] = {0x03, 0x00, 0x04, 0x01, 0x00, 0x00, 0x06, 0x00, 0x03, 0x00, 0x02, 0x00, 0xff, 0x00}; typedef struct { uint16_t sampleId; @@ -49,11 +59,7 @@ typedef struct { int32_t CfgColdStartFixModeGpsNmeaAll(tiot_handle handle) { - const uint8_t cfgColdStartCmd[] = {0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01}; - const uint8_t cfgFixModeGpsCmd[] = {0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, - 0x00, 0x00, 0x00}; - const uint8_t cfgNmeaAllCmd[] = {0x03, 0x00, 0x04, 0x01, 0x00, 0x00, 0x06, 0x00, 0x03, 0x00, 0x02, 0x00, 0xff, - 0x00}; + // 配置启动模式:冷启动模式。 int32_t ret = tiot_service_write(handle, cfgColdStartCmd, sizeof(cfgColdStartCmd)); if (ret < 0) { @@ -62,9 +68,9 @@ int32_t CfgColdStartFixModeGpsNmeaAll(tiot_handle handle) } // 配置使能的GNSS星座:GPS。 - ret = tiot_service_write(handle, cfgFixModeGpsCmd, sizeof(cfgFixModeGpsCmd)); + ret = tiot_service_write(handle, cfgFixModeAllCmd, sizeof(cfgFixModeAllCmd)); if (ret < 0) { - printf("\nerror: cfgFixModeGpsCmd error: %d\n", ret); + printf("\nerror: cfgFixModeAllCmd error: %d\n", ret); return 0; } @@ -92,14 +98,7 @@ int32_t CfgColdStartFixModeGpsNmeaAll(tiot_handle handle) // 如果有历史信息,自动模式启动会切换到热启动模式,如果无历史信息,则自动模式启动仍然为冷启动 int32_t CfgAutoStartFixModeAllNmeaDefault(tiot_handle handle) { - const uint8_t cfgFixModeAllCmd[] = {0x03, 0x00, 0x23, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x1f, - 0x00, 0x00, 0x00}; - const uint8_t cfgAutoStartCmd[] = {0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00}; - const uint8_t cfgNmeaDefaultCmd[] = {0x03, 0x00, 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x03, 0x00, 0x02, 0x00, 0x11, - 0x00}; - - const uint8_t cfgAltCstrCmd[] = {0x03, 0x00, 0x23, 0x00, 0x00, 0x00, 0x05, 0x00, 0x12, 0x10, 0x01, 0x00, 0x00}; - + // 配置启动模式:自动模式。 int32_t ret = tiot_service_write(handle, cfgAutoStartCmd, sizeof(cfgAutoStartCmd)); @@ -149,8 +148,8 @@ static int32_t QryVersion(tiot_handle handle) } static const GnssSamplesCfgTable g_gnssSamplesCfg[] = { - {COLDSTART_FIXMODEGPS_NMEAALL_SAMPLE, CfgColdStartFixModeGpsNmeaAll}, - // {AUTOSTART_FIXMODEALL_NMEADEF_SAMPLE, CfgAutoStartFixModeAllNmeaDefault} + // {COLDSTART_FIXMODEGPS_NMEAALL_SAMPLE, CfgColdStartFixModeGpsNmeaAll}, + {AUTOSTART_FIXMODEALL_NMEADEF_SAMPLE, CfgAutoStartFixModeAllNmeaDefault} }; static int32_t StartGnss(tiot_handle handle)