From 3bea086b95416c7c6708e2c35ca1fbd7bcafc705 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Tue, 4 Mar 2025 00:00:43 +0800 Subject: [PATCH] fix sn format --- basic/sn.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/basic/sn.c b/basic/sn.c index 359df18..2c2b96a 100644 --- a/basic/sn.c +++ b/basic/sn.c @@ -1,9 +1,9 @@ #include "sn.h" #include +#include #include #include -#include /******************************************************************************* * EXTERN * @@ -15,15 +15,15 @@ sn_t* xs_device_info_get() { // sn_t* info = (sn_t*)DEVICE_INFO_START_ADD; m_sn = *info; - if (m_sn.year < 0) { + if (m_sn.year == 255) { m_sn.year = 0; } - if (m_sn.weak < 0) { + if (m_sn.weak == 255) { m_sn.weak = 0; } - if (m_sn.index < 0) { + if (m_sn.index == 65535) { m_sn.index = 0; } @@ -34,7 +34,6 @@ const char* sn_get_str() { sn_t* info = xs_device_info_get(); static char sn_str[32]; - sprintf(sn_str, "%s%02d%02d%04d", "SN", info->year, info->weak, info->index); return sn_str; }