Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re860_factory
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
waterword
re860_factory
Commits
1e371990
Commit
1e371990
authored
Sep 29, 2025
by
lyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:优化RTC1、测试内容时间流失2、掉电保存
parent
f7e32134
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
141 additions
and
19 deletions
+141
-19
factoryTestItem/factoryTestRtc.evue
factoryTestItem/factoryTestRtc.evue
+7
-2
factoryTest_plugin/factory_autoFactoryTestUtil.js
factoryTest_plugin/factory_autoFactoryTestUtil.js
+5
-1
factoryTest_plugin/factory_testRtc.js
factoryTest_plugin/factory_testRtc.js
+129
-16
No files found.
factoryTestItem/factoryTestRtc.evue
View file @
1e371990
...
...
@@ -10,10 +10,14 @@
<text
class=
"fontsize40"
style=
"left:1;top: 0;text-align: center ;width: 480;height:80; color: black;"
>
本地时间
</text>
<!-- <div style="left:0;top:180;width:480;height:80; background-color:#000000 " id="tipDiv" > -->
<text
class=
"fontsize24"
id=
"id_crtLocalTime"
style=
"left:0;top: 80;text-align: center ;width: 480;height:80;"
>
{{crtLocalTime}}
</text>
<text
class=
"fontsize24"
style=
"left:0;top: 80;text-align: left ;width: 150;height:80;"
>
当前时间:
</text>
<text
class=
"fontsize24"
id=
"id_crtLocalTime"
style=
"left:150;top: 80;text-align: left ;width: 330;height:80;"
>
{{crtLocalTime}}
</text>
<text
class=
"fontsize24"
style=
"left:0;top: 120;text-align: left ;width: 150;height:80;"
>
记录时间:
</text>
<text
class=
"fontsize24"
id=
"id_crtfilesLocalTime"
style=
"left:150;top: 120;text-align: left ;width: 330;height:80;"
>
{{crtfilesLocalTime}}
</text>
<!-- </div> -->
<text
class=
"fontsize
40
"
id=
"id_crtTextRtcText"
style=
"left:0;top: 160;text-align: center ;width: 480;height:80;"
>
{{crtTextRtcText}}
</text>
<text
class=
"fontsize
24
"
id=
"id_crtTextRtcText"
style=
"left:0;top: 160;text-align: center ;width: 480;height:80;"
>
{{crtTextRtcText}}
</text>
</div>
...
...
@@ -45,6 +49,7 @@
data
:
{
crtLocalTime
:
"
NA
"
,
crtTextRtcText
:
"
NA
"
,
crtfilesLocalTime
:
"
NA
"
,
imgCnt
:
0
,
pngCnt
:
0
,
gifIconSrc
:
""
,
...
...
factoryTest_plugin/factory_autoFactoryTestUtil.js
View file @
1e371990
...
...
@@ -157,7 +157,11 @@ function setBright(vlaue) {
}
function
getRtcTimer
()
{
system
(
'
hwclock > /tmp/hwRtc.txt
'
);
var
partFilePath
=
"
../../../../../dev/rtc1
"
;
if
(
!
fs
.
exists
(
partFilePath
))
{
return
"
NA
"
;
}
system
(
'
hwclock -f /dev/rtc1 > /tmp/hwRtc.txt
'
);
const
raw
=
fs
.
read
(
'
/tmp/hwRtc.txt
'
);
if
(
!
raw
)
return
'
NA
'
;
...
...
factoryTest_plugin/factory_testRtc.js
View file @
1e371990
...
...
@@ -9,6 +9,10 @@ var that;
var
rtcCtl
=
require
(
"
factory_rtc.js
"
);
var
cntTime
=
0
;
var
cntSuccess
=
0
;
var
checkClockPath
=
'
../../../../../mnt/UDISK/checkClock.txt
'
;
var
checktmpClockPath
=
'
../../../../../tmp/checkClock.txt
'
;
var
Path
=
"
/mnt/UDISK/checkClock.txt
"
;
var
tmpPath
=
"
/tmp/checkClock.txt
"
;
function
system
(
str
)
{
systemCtrl
.
executeSystemCommand
(
str
);
}
...
...
@@ -68,7 +72,7 @@ function updateRtcInfo() {
console
.
log
(
"
allValuesValid:
"
+
allValuesValid
);
// 根据检查结果设置烧录测试状态
that
.
crtfilesLocalTime
=
"
NA
"
;
console
.
log
(
`[RTC] 第
${
cntTime
}
次检测,状态:
${
allValuesValid
==
true
?
"
有效
"
:
"
无效
"
}
`
);
...
...
@@ -85,37 +89,146 @@ function updateRtcInfo() {
}
// 第2次检测完成,设置最终结果
if
(
cntSuccess
>
testCnt
)
{
if
(
!
fs
.
exists
(
checktmpClockPath
))
{
if
(
fs
.
exists
(
checkClockPath
))
{
var
fileContent
=
fs
.
read
(
Path
,
"
r
"
)
if
(
fileContent
)
{
that
.
crtfilesLocalTime
=
fileContent
.
trim
();
var
fileYMD
=
parseYMDHM
(
fileContent
.
trim
());
var
currYMD
=
parseYMDHM
(
that
.
crtLocalTime
);
if
(
!
timeGT
(
currYMD
,
fileYMD
))
{
console
.
log
(
"
[RTC] 时钟未前进,测试失败
"
);
cntSuccess
=
0
;
var
state
=
0
;
that
.
crtTextRtcText
=
state
?
"
测试通过
"
:
"
测试失败
"
;
setTextColorByText
(
that
,
'
id_crtTextRtcText
'
,
that
.
crtTextRtcText
);
globalThis
.
factoryTest
.
rtc
=
state
?
1
:
2
;
that
.
$setY
(
"
id_yes
"
,
state
?
0
:
-
480
);
console
.
log
(
"
[RTC] 测试完成,最终状态:
"
+
(
state
?
"
通过
"
:
"
失败
"
));
}
else
{
console
.
log
(
"
fileYMD
"
+
fileContent
.
trim
());
console
.
log
(
"
currYMD:
"
+
that
.
crtLocalTime
);
console
.
log
(
"
[RTC] 时钟已前进,继续通过流程
"
);
system
(
"
rm -fr
"
+
Path
);
var
state
=
1
;
that
.
crtTextRtcText
=
state
?
"
测试通过
"
:
"
测试失败
"
;
setTextColorByText
(
that
,
'
id_crtTextRtcText
'
,
that
.
crtTextRtcText
);
globalThis
.
factoryTest
.
rtc
=
state
?
1
:
2
;
that
.
$setY
(
"
id_yes
"
,
state
?
0
:
-
480
);
console
.
log
(
"
[RTC] 测试完成,最终状态:
"
+
(
state
?
"
通过
"
:
"
失败
"
));
}
}
else
{
oneTest
();
}
}
else
{
oneTest
();
}
}
else
{
oneTest
();
}
exitTestRTC
();
}
// that.crtTextRtcText = cntSuccess > testCnt ? "测试通过" : "测试失败";
// setTextColorByText(that, 'id_crtTextRtcText', that.crtTextRtcText);
// globalThis.factoryTest.rtc = cntSuccess > testCnt ? 1 : 2;
// that.$setY("id_yes", cntSuccess > testCnt ? 0 : -480);
// console.log("[RTC] 测试完成,最终状态:" + (cntSuccess > testCnt ? "通过" : "失败"));
that
.
crtTextRtcText
=
cntSuccess
>
testCnt
?
"
测试通过
"
:
"
测试失败
"
;
setTextColorByText
(
that
,
'
id_crtTextRtcText
'
,
that
.
crtTextRtcText
);
globalThis
.
factoryTest
.
rtc
=
cntSuccess
>
testCnt
?
1
:
2
;
that
.
$setY
(
"
id_yes
"
,
cntSuccess
>
testCnt
?
0
:
-
480
);
console
.
log
(
"
[RTC] 测试完成,最终状态:
"
+
(
cntSuccess
>
testCnt
?
"
通过
"
:
"
失败
"
));
// cntTime = 0;
// 可选:停止定时器
// exitTestRTC();
checkAutoFactory
();
}
function
oneTest
()
{
var
iso
=
that
.
crtLocalTime
;
system
(
"
echo '
"
+
iso
+
"
' >
"
+
Path
);
system
(
"
echo '
"
+
iso
+
"
' >
"
+
tmpPath
);
system
(
"
sync
"
);
that
.
crtfilesLocalTime
=
iso
;
setTimeout
(()
=>
{
that
.
crtTextRtcText
=
"
请断电重启 测试第二阶段掉电保存
"
},
300
);
}
function
checkAutoFactory
()
{
require
(
"
factory_testAuto.js
"
).
autoFactoryNextPage
(
"
factoryTestRtc
"
);
}
function
parseYMDHM
(
str
)
{
// str = "2025-10-03T19:41:38"
var
p
=
str
.
split
(
'
T
'
);
var
d
=
p
[
0
].
split
(
'
-
'
).
map
(
Number
);
// [y, m, d]
var
t
=
p
[
1
].
split
(
'
:
'
).
map
(
Number
);
// [h, m, s]
return
{
y
:
d
[
0
],
m
:
d
[
1
],
d
:
d
[
2
],
h
:
t
[
0
],
min
:
t
[
1
],
s
:
t
[
2
]
};
}
function
timeGT
(
a
,
b
)
{
// a > b 返回 true
if
(
a
.
y
!==
b
.
y
)
return
a
.
y
>
b
.
y
;
if
(
a
.
m
!==
b
.
m
)
return
a
.
m
>
b
.
m
;
if
(
a
.
d
!==
b
.
d
)
return
a
.
d
>
b
.
d
;
if
(
a
.
h
!==
b
.
h
)
return
a
.
h
>
b
.
h
;
if
(
a
.
min
!==
b
.
min
)
return
a
.
min
>
b
.
min
;
return
a
.
s
>
b
.
s
;
}
function
getRtcTime
()
{
// hwclock -f /dev/rtc1
// /dev/rtc1
var
partFilePath
=
"
../../../../../dev/rtc1
"
;
if
(
!
fs
.
exists
(
partFilePath
))
{
return
"
NA
"
;
}
system
(
"
hwclock -f /dev/rtc1 > /tmp/hwRtc.txt
"
);
const
coresStr
=
fs
.
read
(
"
/tmp/hwRtc.txt
"
,
"
r
"
);
if
(
coresStr
)
{
return
coresStr
.
split
(
'
\n
'
);
}
else
{
// system("killall -9 /dev/rtc0");
return
"
NA
"
;
}
system
(
'
hwclock -f /dev/rtc1 > /tmp/hwRtc.txt
'
);
const
raw
=
fs
.
read
(
'
/tmp/hwRtc.txt
'
);
if
(
!
raw
)
return
'
NA
'
;
/* 典型行:Thu Jan 1 18:22:21 1970 0.000000 seconds */
var
p
=
0
;
// 星期
while
(
p
<
raw
.
length
&&
raw
[
p
]
!==
'
'
)
p
++
;
while
(
p
<
raw
.
length
&&
raw
[
p
]
===
'
'
)
p
++
;
// 月
var
monSt
=
p
;
while
(
p
<
raw
.
length
&&
raw
[
p
]
!==
'
'
)
p
++
;
var
mon
=
raw
.
slice
(
monSt
,
p
);
while
(
p
<
raw
.
length
&&
raw
[
p
]
===
'
'
)
p
++
;
// 日
var
daySt
=
p
;
while
(
p
<
raw
.
length
&&
raw
[
p
]
!==
'
'
)
p
++
;
var
day
=
raw
.
slice
(
daySt
,
p
).
trim
();
while
(
p
<
raw
.
length
&&
raw
[
p
]
===
'
'
)
p
++
;
// 时间 HH:MM:SS[.xxxxxx]
var
timeSt
=
p
;
while
(
p
<
raw
.
length
&&
raw
[
p
]
!==
'
'
)
p
++
;
var
timeFull
=
raw
.
slice
(
timeSt
,
p
);
// 可能 19:38:24.123456
var
time
=
timeFull
.
split
(
'
.
'
)[
0
];
// 只取 19:38:24
while
(
p
<
raw
.
length
&&
raw
[
p
]
===
'
'
)
p
++
;
// 年
var
yearSt
=
p
;
while
(
p
<
raw
.
length
&&
raw
[
p
]
!==
'
'
)
p
++
;
var
year
=
raw
.
slice
(
yearSt
,
p
);
const
monTbl
=
[
'
Jan
'
,
'
Feb
'
,
'
Mar
'
,
'
Apr
'
,
'
May
'
,
'
Jun
'
,
'
Jul
'
,
'
Aug
'
,
'
Sep
'
,
'
Oct
'
,
'
Nov
'
,
'
Dec
'
];
const
mo
=
monTbl
.
indexOf
(
mon
)
+
1
;
if
(
mo
===
0
)
return
'
NA
'
;
const
mm
=
String
(
mo
).
padStart
(
2
,
'
0
'
);
const
dd
=
String
(
day
).
padStart
(
2
,
'
0
'
);
return
`
${
year
}
-
${
mm
}
-
${
dd
}
T
${
time
}
:00`
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment