From b6e3449c567cc793eb00f29e03f1fba0a73d26aa Mon Sep 17 00:00:00 2001 From: chengjinsong2 Date: Tue, 6 Dec 2022 02:52:55 -0800 Subject: [PATCH] =?UTF-8?q?lite-m=20=E4=B8=8Aparam=5Fservice=E5=AE=9E?= =?UTF-8?q?=E6=97=B6=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chengjinsong2 --- services/param/liteos/param_hal.c | 7 ++++++- services/param/liteos/param_service.c | 12 ------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/services/param/liteos/param_hal.c b/services/param/liteos/param_hal.c index 0b72ec8c..7bad5c01 100644 --- a/services/param/liteos/param_hal.c +++ b/services/param/liteos/param_hal.c @@ -141,12 +141,17 @@ static int LoadPersistParam(void) PARAM_CHECK(ret >= 0, break, "Failed to read file %s", path); uint32_t currLen = 0; + char *tmp = buffer; while (currLen < fileSize) { if (buffer[currLen] == '\n') { // split line buffer[currLen] = '\0'; - ret = SplitParamString(buffer, NULL, 0, LoadOnePersistParam_, NULL); + ret = SplitParamString(tmp, NULL, 0, LoadOnePersistParam_, NULL); PARAM_CHECK(ret == 0, continue, "Failed to set param %d %s", ret, buffer); paramNum++; + if (currLen + 1 >= fileSize) { + break; + } + tmp = buffer + currLen + 1; } currLen++; } diff --git a/services/param/liteos/param_service.c b/services/param/liteos/param_service.c index 946e4063..1b3f6cb9 100644 --- a/services/param/liteos/param_service.c +++ b/services/param/liteos/param_service.c @@ -138,18 +138,6 @@ void LiteParamService(void) InitParamService(); // get persist param LoadPersistParams(); - osThreadAttr_t attr; - attr.name = "ParamServiceTask"; - attr.attr_bits = 0U; - attr.cb_mem = NULL; - attr.cb_size = 0U; - attr.stack_mem = NULL; - attr.stack_size = 0; - attr.priority = osPriorityBelowNormal; - - if (osThreadNew((osThreadFunc_t)ParamServiceTask, NULL, &attr) == NULL) { - PARAM_LOGE("Failed to create ParamServiceTask! %d", errno); - } } CORE_INIT(LiteParamService); #endif \ No newline at end of file -- GitLab