Commit bdd32985 authored by lyong's avatar lyong

增加产测RTC 和老化测试

parent 2267164b
<html>
<div class="screen" onpress="onChildLockPress" onrelease="onChildLockRelease">
<div style="left:0;top:0;width:480;height:30; background-color:rgb(0, 0, 0);" id="tipDiv">
<text class="fontsize22Left" style="left:1;top: 0;text-align: center ;width: 240;height:30;background-color:rgb(224, 76, 12);">长按退出</text>
<div style="left:240;top: 0;text-align: left;width: 240;height:30;background-color:#FFFFFF; opacity: 0.7;">
<div class="yLine" style="left:0;background-color:#000000;"></div>
<text class="fontsize22Left" style="left:3;top: 0;text-align: left;width: 80;color: #000000; ">{{crtMousemoveX}}</text>
<div class="yLine" style="left:80;background-color:#000000;"></div>
<text class="fontsize22Left" style="left:83;top: 0;text-align: left;width: 80;color: #000000;">{{crtMousemoveY}}</text>
<div class="yLine" style="left:169;background-color:#000000;"></div>
</div>
</div>
<div style="left:0;top:31;width:240;height:240; background-color:rgb(0, 0, 0);" id="tipDiv">
<text class="fontsize22" style="left:1;top: 0;text-align: left;width: 460;height:45;">CPU:</text>
<div style="left:20;top:40;width:220;height:205;">
<text class="fontsize22" style="top: 0;text-align: left;width: 460;height:45;">CPU型号:</text>
<text class="fontsize22" style="top:45;text-align: left;width: 460;height:45;">CPU核数:</text>
<text class="fontsize22" style="top: 90;text-align: left;width: 460;height:45;">当前频率:</text>
<text class="fontsize22" style="top: 135;text-align: left;width: 460;height:45;">CPU负载:</text>
</div>
<div style="left:120;top:40;width:110;height:205;">
<text class="fontsize22" id="id_crtCPUModel" style="left:5;top: 0;text-align: left;width: 110;height:45;">{{crtCPUModel}}</text>
<text class="fontsize22" id="id_crtCPUCores" style="left:5;top:45;text-align: left;width: 110;height:45;">{{crtCPUCores}}</text>
<text class="fontsize22" id="id_crtCurrentFrequency" style="left:5;top: 90;text-align: left;width: 110;height:45;">{{crtCurrentFrequency}}</text>
<text class="fontsize22" id="id_crtCpuLoad" style="left:5;top: 135;text-align: left;width: 110;height:45;">{{crtCpuLoad}}</text>
</div>
</div>
<div style="left:240;top:31;width:240;height:240; background-color:rgb(0, 0, 0);">
<text class="fontsize22" style="left: 1;text-align: left;width: 460;height:45;">Memory:</text>
<div style="left:20;top:40;width:120;height:205;">
<text class="fontsize22" style="top: 0;text-align: left;width: 120;height:200;">内存总量:</text>
<text class="fontsize22" style="top: 45;text-align: left ;width: 120;height:200;">使用总量:</text>
<text class="fontsize22" style="top: 90;text-align: left ;width: 120;height:200;">空闲总量:</text>
<text class="fontsize22" style="top: 135;text-align: left ;width: 120;height:200;">压力测试:</text>
</div>
<div style="left:120;top:40;width:110;height:205;">
<text class="fontsize22" id="id_crtMemoryTotal" style="left:5;top: 0;text-align: left ;width: 110;height:110;">{{crtMemoryTotal}}</text>
<text class="fontsize22" id="id_crtMemoryUsed" style="left:5;top: 45;text-align: left ;width: 110;height:110;">{{crtMemoryUsed}}</text>
<text class="fontsize22" id="id_crtMemoryAvailable" style="left:5;top: 90;text-align: left ;width: 110;height:110;">{{crtMemoryAvailable}}</text>
<text class="fontsize18" id="id_crtMemorycrtMemtester" style="left:5;top: 120;text-align: left ;width: 110;height:110;">{{crtMemorycrtMemtester}}</text>
</div>
</div>
<div style="left:0;top:240;width:480;height:240;">
</div>
<div class="xLine" style="top:0;"></div>
<div class="yLine" style="left:0;"></div>
<div class="xLine" style="top:30;"></div>
<div class="xLine" style="top:240;"></div>
<div class="yhalfLine" style="left:240;"></div>
<div class="xLine" style="top:479;"></div>
<div class="yLine" style="left:479;"></div>
<!-- <div id="id_color"></div>
<image style="left:0;top:0" id="id_testPng" :src="gifIconSrc">{{gifIconSrc}}</image>
<text class="testReturn" id="id_yes" onpress="touchedScreen" onclick="touchedYesButton" style="top: 300;left:364;color: #000000;background-color: #FF9700;">PASS</text>
<text class="testReturn" id="id_ng" onpress="touchedScreen" onclick="touchedNGButton" style="top: 300;left:14 ;color: #F44236;background-color: #858282;">NG</text>
<text class="testReturn" id="id_back" onpress="touchedScreen" onclick="touchedBackButton" style="top: 300;left:189;color: #000000;background-color: #858282;">back</text> -->
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var factory_testBurnIn = require("factory_testBurnIn.js");
export default {
data: {
crtCPUModel: "NA",
crtCPUCores: "NA",
crtCurrentFrequency: "NA",
crtCpuLoad: "NA",
crtMemoryTotal: "NA",
crtMemoryUsed: "NA",
crtMemoryAvailable: "NA",
crtMemorycrtMemtester: "NA",
crtMousemoveX: "X:",
crtMousemoveY: "Y:"
},
/*************** struct ***************/
onInit: function () {
//this.$setImageForceUpdate(true);
},
onShow: function () {
this.$enableMouseMoveEvent(true);
//console.log(this.$uri + "===========onShow=============")
factory_testBurnIn.initFactoryTestBurnIn(this);
},
onHide: function () {
//console.log(this.$uri + "===========onHide=============")
this.clearTimer()
//factory_testBurnIn.quitFactoryTestBurnIn();
},
onQuit: function () {
//console.log(this.$uri + "===========onQuit=============")
this.clearTimer()
this.$enableMouseMoveEvent(false);
factory_testBurnIn.quitFactoryTestBurnIn();
},
quitEvent: function () {
this.$enableMouseMoveEvent(false);
factory_testBurnIn.quitFactoryTestBurnIn();
},
/*************** timer ***************/
timerSet: function () {
// this.timerColor = this.$setInterval(this.normalTimerOut, 1000, [], this);
},
normalTimerOut: function () {
},
clearTimer: function () {
},
/*************** connect ***************/
/*************** event ***************/
shortDelay: function () {
},
touchedScreen: function (node, topNode, x, y) {
},
touchedYesButton: function (node, topNode, x, y) {
// globalThis.factoryTest.color = 1
},
touchedNGButton: function (node, topNode, x, y) {
// globalThis.factoryTest.color = 2
router.push({
path: "factory_testList"
});
},
onChildLockRelease: function (node, topNode, x, y) {
document.stopLongPress();
},
onChildLockPress: function (node, topNode, x, y) {
var that = this;
document.startLongPress(function () {
//userData.childLockSwitchFlag = 0;
that.quitEvent();
router.push({
path: "factory_testList"
});
//that.proxy.setChildLock(userData.childLockSwitchFlag);
}, 3000);
},
/*************** gesture ***************/
onGestureEvent: function (dir, x, y) {
//console.log(dir + " " + x + " " + y);
},
onmousemove: function (gx, gy, topNode, x, y) {
////console.log("onmousemove--->gx:" + gx + " gy:" + gy);
if (gx > 480 || gy > 480)
return;
this.crtMousemoveX = "X:" + gx;
this.crtMousemoveY = "Y:" + gy;
},
/*************** work ***************/
}
</script>
<style>
.screen {
left: 0px;
top: 0px;
width: 480;
height: 480;
background-color: rgb(0, 0, 0);
}
/*********************************/
#id_color {
width: 480;
height: 480;
background-color: black;
}
#reminderText {
top: 40;
width: 500;
height: 100;
border-radius: 10;
border-width: 2;
border-color: white;
text-align: left;
/* text-overflow: ellipsis; */
font-size: 60;
color: white;
background-color: transparent;
}
.class_msg {
top: 240;
width: 200;
height: 100;
border-radius: 10;
border-width: 2;
border-color: white;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: red;
background-color: gainsboro;
}
#id_yes {
bottom: 20px;
left: 20px;
}
#id_ng {
bottom: 20px;
right: 20px;
}
#id_back {
bottom: 20px;
right: 20px;
}
.testReturn {
position: absolute;
width: 96;
height: 64;
text-align: center;
text-overflow: ellipsis;
font-size: 44;
}
.xLine {
left: 0;
width: 480;
height: 1;
background-color: #0699DA;
}
.yLine {
left: 0;
height: 480;
width: 1;
background-color: #0699DA;
}
.yhalfLine {
left: 0;
height: 240;
width: 1;
background-color: #0699DA;
}
.titleFontsize {
left: 0;
top: 11;
width: 480;
height: 40;
text-align: center;
text-overflow: ellipsis;
font-size: 26;
color: #FFFFFF;
background-color: transparent;
}
.fontsize18 {
top: 90;
width: 200;
height: 30;
text-align: center;
text-overflow: ellipsis;
font-size: 18;
color: #FFFFFF;
background-color: transparent;
}
.fontsize18Left {
width: 200;
height: 30;
text-align: left;
text-overflow: ellipsis;
font-size: 18;
color: #b3b3b3;
background-color: transparent;
}
.fontsize22 {
width: 200;
height: 40;
text-align: center;
text-overflow: ellipsis;
font-size: 22;
color: #FFFFFF;
background-color: transparent;
}
.fontsize22Left {
left: 28;
width: 240;
height: 40;
text-align: left;
text-overflow: ellipsis;
font-size: 22;
color: #FFFFFF;
background-color: transparent;
}
.fontsize24 {
height: 35;
text-align: center;
text-overflow: ellipsis;
font-size: 24;
color: #ffffff;
background-color: transparent;
}
</style>
\ No newline at end of file
<html>
<div class="screen" onclick="touchedScreen">
<div style="left:20;top: 10;width: 440;height: 55; background-color: #99D0F7;">
<text class="fontsize40" id="title_TEXT" style="left:0;top: 0;width: 460;height: 55;text-align: center; background-color: transparent;color: black;">RTC测试</text>
</div>
<div style="left:0;top:100;width:480;height:480; " id="tipDiv">
<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>
<!-- </div> -->
</div>
<div style="left:25;top: 366;width: 460;height: 96; background-color: transparent;">
<div style="left:0 ; width: 100;height: 96;background-color: #858282;">
<text class="testReturn" id="id_back" onpress="touchedScreen" onclick="touchedBackButton" style="color: #000000; top: 15;">back</text>
</div>
<div style="left:110 ; width: 100;height: 96;background-color: #858282;">
<text class="testReturn" id="id_ng" onpress="touchedScreen" onclick="touchedNGButton" style="color: #F44236;top: 15;">NG</text>
</div>
<!-- <div style="left:220 ; width: 100;height: 96;background-color: #FF9700;">
<text class="testReturn" id="id_startTest" onpress="touchedScreen" onclick="touchedstartTestButton" style="color: #000000;top: 0;left: 0; ">开始测试</text>
</div> -->
<div id="id_yes" style=" left:330 ;top: -480; width: 100;height: 96;background-color: #FF9700;">
<text class="testReturn" onpress="touchedScreen" onclick="touchedYesButton" style="color: #000000;top: 15;left: 0; ">PASS</text>
</div>
</div>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var factory_testRtc = require("factory_testRtc.js");
export default {
data: {
crtLocalTime: "NA",
imgCnt: 0,
pngCnt: 0,
gifIconSrc: "",
},
/*************** struct ***************/
onInit: function () {
},
onShow: function () {
//console.log(this.$uri + "===========onShow=============")
factory_testRtc.factoryTestRTCInit(this);
},
onHide: function () {
},
onQuit: function () {
},
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.rtc = 1;
var yesJumpPage = require("factoryYesJumpPage.js");
//console.log("=====yesJumpPage.yesGoToNextPage(factoryTestSound);")
yesJumpPage.yesGoToNextPage("factoryTestBurnIn");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.rtc = 2;
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
router.push({
path: "factory_testList",
});
},
touchedstartTestButton: function (node, topNode, x, y) {
// var soundLevelText = "tinymix set 16 " + 7
// systemCtrl.executeSystemCommand("/mnt/app/quicknode/shell/eAplay.sh /mnt/app/voice_click.wav");
// systemCtrl.executeSystemCommand(soundLevelText);
// systemCtrl.executeSystemCommand("/mnt/app/quicknode/shell/eAplay.sh /mnt/app/voice_click.wav");
// this.crtBrightnessValue = "播放结束,点击开始测试重复播放";
// this.$setY("id_yes", 0);
},
}
</script>
<style>
.screen {
top: 0;
left: 0;
width: 480;
height: 480;
background-color: #A8A8A8;
/* color: black; */
}
/*********************************/
#id_color {
width: 480;
height: 480;
background-color: black;
}
#reminderText {
top: 40;
width: 500;
height: 100;
border-radius: 10;
border-width: 2;
border-color: white;
text-align: left;
/* text-overflow: ellipsis; */
font-size: 60;
color: white;
background-color: transparent;
}
.class_msg {
top: 240;
width: 200;
height: 100;
border-radius: 10;
border-width: 2;
border-color: white;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: red;
background-color: gainsboro;
}
#id_yes {
bottom: 20px;
left: 20px;
}
#id_ng {
bottom: 20px;
right: 20px;
}
#id_back {
bottom: 20px;
right: 20px;
}
.testReturn {
position: absolute;
width: 96;
height: 64;
text-align: center;
text-overflow: ellipsis;
font-size: 44;
}
.fontsize24 {
height: 35;
text-align: center;
text-overflow: ellipsis;
font-size: 24;
color: #ffffff;
background-color: transparent;
}
.fontsize40 {
text-align: center;
text-overflow: ellipsis;
font-size: 40;
color: #ffffff;
background-color: transparent;
}
.testReturn {
position: absolute;
width: 100;
height: 96;
text-align: center;
text-overflow: ellipsis;
font-size: 44;
}
</style>
\ No newline at end of file
...@@ -125,7 +125,6 @@ ...@@ -125,7 +125,6 @@
left: 0; left: 0;
width: 480; width: 480;
height: 480; height: 480;
background-color: #A8A8A8;
/* color: black; */ /* color: black; */
} }
......
<html> <html>
<div class="screen" onclick="touchedBg"> <div class="screen" onclick="touchedBg">
<template for="appItem" key="app" index="index"> <template for="appItem" key="app" index="index">
<div class="chooseBlock" id="app.id" :url="app.startup" :ena="app.en" :top="app.top" :left="app.left" <div class="chooseBlock" id="app.id" :url="app.startup" :ena="app.en" :top="app.top" :left="app.left" onclick="touchedBlock">
onclick="touchedBlock">
<text class="testName" :url="app.startup" :ena="app.en">{{ <text class="testName" :url="app.startup" :ena="app.en">{{
app.name app.name
}}</text> }}</text>
...@@ -117,6 +116,24 @@ ...@@ -117,6 +116,24 @@
en: 1, en: 1,
index: 7, index: 7,
}, },
{
id: "id_factoryTestRtc",
name: "RTC测试",
startup: "factoryTestRtc",
top: 100,
left: 350,
en: 1,
index: 8,
},
{
id: "id_factoryTestBurnIn",
name: "老化测试",
startup: "factoryTestBurnIn",
top: 190,
left: 20,
en: 1,
index: 9,
},
{ {
id: "id_factoryTestsystemCheck", id: "id_factoryTestsystemCheck",
name: "系统检测", name: "系统检测",
...@@ -170,6 +187,8 @@ ...@@ -170,6 +187,8 @@
uartComm: 0, uartComm: 0,
bright: 0, bright: 0,
licenseAuthor: 0, licenseAuthor: 0,
rtc: 0,
burnIn: 0,
systemCheck: 0, systemCheck: 0,
clearAll: 0, clearAll: 0,
start: 0, start: 0,
...@@ -184,8 +203,8 @@ ...@@ -184,8 +203,8 @@
const properties = [ const properties = [
"color", "touch", "wifi", "sound", "color", "touch", "wifi", "sound",
"uartComm", "bright", "licenseAuthor", "uartComm", "bright", "licenseAuthor", "rtc",
"systemCheck", "clearAll", "start" "burnIn", "systemCheck", "clearAll", "start"
]; ];
...@@ -230,6 +249,7 @@ ...@@ -230,6 +249,7 @@
}, },
onShow: function () { onShow: function () {
//lvgl.lv_set_screen_transparent(false);
//console.log(this.$uri + "===========onShow============="); //console.log(this.$uri + "===========onShow=============");
if (userData.factoryFlag != 1) { if (userData.factoryFlag != 1) {
userData.factoryFlag = 1; userData.factoryFlag = 1;
...@@ -259,8 +279,8 @@ ...@@ -259,8 +279,8 @@
const properties = [ const properties = [
"color", "touch", "wifi", "sound", "color", "touch", "wifi", "sound",
"uartComm", "bright", "licenseAuthor", "uartComm", "bright", "licenseAuthor", "rtc",
"systemCheck", "clearAll", "start" "burnIn", "systemCheck", "clearAll", "start"
]; ];
...@@ -318,9 +338,9 @@ ...@@ -318,9 +338,9 @@
//console.log("==============factoryTestStart================"); //console.log("==============factoryTestStart================");
url = "factoryTestColor"; url = "factoryTestColor";
} }
if(url == "factoryTestExit"){ if (url == "factoryTestExit") {
var systemCtrl = require("systemCtrl.js"); var systemCtrl = require("systemCtrl.js");
userData.factoryFlag = 0; userData.factoryFlag = 0;
systemCtrl.executeSystemCommand("/mnt/app/quicknode/shell/runFactory.sh 0"); systemCtrl.executeSystemCommand("/mnt/app/quicknode/shell/runFactory.sh 0");
} }
router.push({ router.push({
...@@ -345,10 +365,12 @@ ...@@ -345,10 +365,12 @@
{ index: 4, property: "uartComm" }, { index: 4, property: "uartComm" },
{ index: 5, property: "bright" }, { index: 5, property: "bright" },
{ index: 6, property: "licenseAuthor" }, { index: 6, property: "licenseAuthor" },
{ index: 7, property: "systemCheck" }, { index: 7, property: "rtc" },
{ index: 8, property: "clearAll" }, { index: 8, property: "burnIn" },
{ index: 9, property: "systemCheck" },
{ index: 10, property: "clearAll" },
// { index: 9, property: "pcba" }, // { index: 9, property: "pcba" },
{ index: 9, property: "start" }, { index: 11, property: "start" },
]; ];
...@@ -383,6 +405,8 @@ ...@@ -383,6 +405,8 @@
globalThis.factoryTest.uartComm = 0; globalThis.factoryTest.uartComm = 0;
globalThis.factoryTest.bright = 0; globalThis.factoryTest.bright = 0;
globalThis.factoryTest.licenseAuthor = 0; globalThis.factoryTest.licenseAuthor = 0;
globalThis.factoryTest.rtc = 0;
globalThis.factoryTest.burnIn = 0;
globalThis.factoryTest.systemCheck = 0; globalThis.factoryTest.systemCheck = 0;
globalThis.factoryTest.clearAll = 0; globalThis.factoryTest.clearAll = 0;
...@@ -397,6 +421,8 @@ ...@@ -397,6 +421,8 @@
uartComm: globalThis.factoryTest.uartComm, uartComm: globalThis.factoryTest.uartComm,
bright: globalThis.factoryTest.bright, bright: globalThis.factoryTest.bright,
licenseAuthor: globalThis.factoryTest.licenseAuthor, licenseAuthor: globalThis.factoryTest.licenseAuthor,
rtc: globalThis.factoryTest.rtc,
burnIn: globalThis.factoryTest.burnIn,
systemCheck: globalThis.factoryTest.systemCheck, systemCheck: globalThis.factoryTest.systemCheck,
clearAll: globalThis.factoryTest.clearAll, clearAll: globalThis.factoryTest.clearAll,
// pcba: globalThis.factoryTest.pcba, // pcba: globalThis.factoryTest.pcba,
...@@ -420,6 +446,8 @@ ...@@ -420,6 +446,8 @@
uartComm: globalThis.factoryTest.uartComm, uartComm: globalThis.factoryTest.uartComm,
bright: globalThis.factoryTest.bright, bright: globalThis.factoryTest.bright,
licenseAuthor: globalThis.factoryTest.licenseAuthor, licenseAuthor: globalThis.factoryTest.licenseAuthor,
rtc: globalThis.factoryTest.rtc,
burnIn: globalThis.factoryTest.burnIn,
systemCheck: globalThis.factoryTest.systemCheck, systemCheck: globalThis.factoryTest.systemCheck,
clearAll: globalThis.factoryTest.clearAll, clearAll: globalThis.factoryTest.clearAll,
// pcba: globalThis.factoryTest.pcba, // pcba: globalThis.factoryTest.pcba,
......
var _userdata = require("userdata.js");
var userData = _userdata.userData;
const fs = require("@system.fs");
var systemCtrl = require("systemCtrl.js");
var lvgl = require("@native.lvgl7");
var id_testBurnInTimer = null;
var that;
var strMemtesterCnt = 0; // 初始化测试掩码计数器
// 测试掩码映射表
const testMaskMap = {
"0x1": "Compare XOR",
"0x2": "Compare SUB",
"0x4": "Compare MUL",
"0x8": "Compare DIV",
"0x10": "Compare OR",
"0x20": "Compare AND",
"0x40": "Sequential Increment",
"0x80": "Solid Bits",
"0x100": "Block Sequential",
"0x200": "Checkerboard",
"0x400": "Bit Spread",
"0x800": "Bit Flip",
"0x1000": "Walking Ones",
"0x2000": "Walking Zeroes",
"0x4000": "8-bit Writes",
"0x8000": "16-bit Writes"
};
function system(str) {
systemCtrl.executeSystemCommand(str);
}
function initFactoryTestBurnIn(obj) {
that = obj;
// startMp4();
if (id_testBurnInTimer != null) {
clearInterval(id_testBurnInTimer);
id_testBurnInTimer == null;
}
updateBurnInInfo();
id_testBurnInTimer = setInterval(() => {
updateBurnInInfo();
}, 5000);
// var result = getMemtesterData2("32M");
// console.log('Memtester Result:'+ result);
// setInterval(() => {
// // 调用 getMemtesterData 函数,指定测试内存大小为 32M,并处理结果
// var result = getMemtesterData2("32M");
// console.log('Memtester Result:'+ result);
// }, 20000);
}
function quitFactoryTestBurnIn() {
// exitMp4();
console.log("quitFactoryTestBurnIn");
if (id_testBurnInTimer != null) {
clearInterval(id_testBurnInTimer);
id_testBurnInTimer == null;
}
}
function startMp4() {
// lvgl.lv_set_screen_transparent(true);
systemCtrl.executeSystemCommand("tplayerdemo /mnt/app/quicknode/tests/re860_factory/images/factory/testVideo240p.mp4 &");
// systemCtrl.executeSystemCommand("quit");
// router.push({
// path: "factoryTestBurnIn"
// });
}
function exitMp4() {
systemCtrl.executeSystemCommand("killall -9 tplayerdemo &");
// lvgl.lv_set_screen_transparent(false);
}
function setTextColorById(that, id, value) {
const color = (value === "NA") ? "#ff0000" : "#00ff00";
that.$setTextColor(id, color);
}
var cntMemtester = 2;
var testMask = 0x1;
var commFlag = 1;
function updateBurnInInfo() {
that.crtCPUModel = getCPUModel();
that.crtCPUCores = getCPUCores();
that.crtCurrentFrequency = getCPUFrequency();
that.crtCpuLoad = getCPULoad();
var logInfo = getMemoryInfo();
that.crtMemoryTotal = logInfo.total;
that.crtMemoryUsed = logInfo.used;
that.crtMemoryAvailable = logInfo.available;
cntMemtester++;
if (cntMemtester >= 2) {
if (commFlag == 1) {
var testSize = getTestMemorySize(); // 获取测试内存大小
console.log("!!testSize:" + testSize);
testMask = getTestMask();
console.log("!!testMask:" + testMask);
startCommMemtester(testSize);
commFlag = 0;
} else {
if (cntMemtester > 3) {
var memtester = getMemtester() //只能返回testMaskMap映射表的值,比如testMask为0x1,则memtester只能为值为OK 或者no
console.log("memtester:" + memtester);
cntMemtester = 0;
commFlag = 1;
that.crtMemorycrtMemtester = memtester;
}
}
}
setTextColorById(that, 'id_crtCPUModel', that.crtCPUModel);
setTextColorById(that, 'id_crtCPUCores', that.crtCPUCores);
setTextColorById(that, 'id_crtCurrentFrequency', that.crtCurrentFrequency);
setTextColorById(that, 'id_crtCpuLoad', that.crtCpuLoad);
setTextColorById(that, 'id_crtMemoryTotal', that.crtMemoryTotal);
setTextColorById(that, 'id_crtMemoryUsed', that.crtMemoryUsed);
setTextColorById(that, 'id_crtMemoryAvailable', that.crtMemoryAvailable);
var values = [that.crtCPUModel, that.crtCPUCores, that.crtCurrentFrequency, that.crtCpuLoad, that.crtMemoryTotal, that.crtMemoryUsed, that.crtMemoryAvailable];
var allValuesValid = values.every(value => value !== "NA");
// 根据检查结果设置烧录测试状态
globalThis.factoryTest.burnIn = allValuesValid ? 1 : 2;
}
// 获取 CPU 型号
function getCPUModel() {
system("cat /proc/cpuinfo > /tmp/cpuinfo.txt");
const modelStr = fs.read("/tmp/cpuinfo.txt", "r");
if (modelStr) {
const modelMatch = modelStr.match(/model name\s*: (.+)/i);
if (modelMatch) {
const fullModel = modelMatch[1].trim();
console.log("CPU Model: " + fullModel);
// 检查是否包含 "v7-M",以决定输出哪个型号
if (fullModel.includes("v7-M")) {
return fullModel; // 输出更具体的型号,如 ARMv7-M rev 5 (v7l)
} else {
return fullModel.split(' ')[0]; // 只输出架构版本,如 ARMv7
}
} else {
return "NA";
}
} else {
return "NA";
}
}
// 获取 CPU 核数
function getCPUCores() {
system("grep -c ^processor /proc/cpuinfo > /tmp/cores.txt");
const coresStr = fs.read("/tmp/cores.txt", "r");
if (coresStr) {
return coresStr.trim();
} else {
return "NA";
}
}
// 获取当前 CPU 频率
function getCPUFrequency() {
system("cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq > /tmp/cpu_freq.txt");
const freqStr = fs.read("/tmp/cpu_freq.txt", "r");
if (freqStr) {
const freqMHz = parseInt(freqStr.trim()) / 1000;
return freqMHz.toFixed(0) + " MHz";
} else {
return "NA";
}
}
// 获取 CPU 负载
function getCPULoad() {
system("uptime > /tmp/load.txt");
const loadStr = fs.read("/tmp/load.txt", "r");
if (loadStr) {
const loadMatch = loadStr.match(/load average: (\d+\.\d+), (\d+\.\d+), (\d+\.\d+)/i);
if (loadMatch) {
return loadMatch[1];
} else {
return "NA";
}
} else {
return "NA";
}
}
// 获取内存信息
function getMemoryInfo() {
system("free -h > /tmp/meminfo.txt");
const memStr = fs.read("/tmp/meminfo.txt", "r");
if (memStr) {
const lines = memStr.split('\n');
// 跳过表头
for (let i = 1; i < lines.length; i++) {
const line = lines[i].trim();
if (line.startsWith("Mem")) {
const parts = line.split(/\s+/);
if (parts.length > 1) {
const memTotal = parts[1]; // 总量
const memUsed = parts[2]; // 使用量
const memAvailable = parts[parts.length - 2]; // 可用内存通常在倒数第二个位置
//内存总量、空闲总量、使用总量
console.log('Memory Info:memTotal:' + memTotal + ' memUsed:' + memUsed + ' memAvailable:' + memAvailable);
return {
total: memTotal,
used: memUsed,
available: memAvailable
};
}
break;
}
}
return "NG";
} else {
return "NG";
}
}
function delayExecute(func, delay) {
setTimeout(func, delay);
}
var id_testBurnInTimer2 = null;
// 延迟执行函数
function delayExecute(func, delay) {
// 如果已经存在定时器,先清除
if (id_testBurnInTimer2 != null) {
clearTimeout(id_testBurnInTimer2);
id_testBurnInTimer2 = null;
}
// 设置新的定时器
id_testBurnInTimer2 = setTimeout(func, delay);
}
// function getTestMask() {
// // 生成测试掩码值
// const testMasks = [
// "0x1", // Compare XOR
// "0x2", // Compare SUB
// "0x4", // Compare MUL
// "0x8", // Compare DIV
// "0x10", // Compare OR
// "0x20", // Compare AND
// "0x40", // Sequential Increment
// "0x80", // Solid Bits
// "0x100", // Block Sequential
// "0x200", // Checkerboard
// "0x400", // Bit Spread
// "0x800", // Bit Flip
// "0x1000", // Walking Ones
// "0x2000", // Walking Zeroes
// "0x4000", // 8-bit Writes
// "0x8000" // 16-bit Writes
// ];
// // 更新计数器
// strMemtesterCnt = (strMemtesterCnt + 1) % testMasks.length;
// return testMasks[strMemtesterCnt];
// }
function getTestMask() {
const testMasks = Object.keys(testMaskMap);
strMemtesterCnt = (strMemtesterCnt + 1) % testMasks.length;
return testMasks[strMemtesterCnt];
}
function startCommMemtester(testSize) {
var testCount = 1;
var str = `memtester -m ${testMask} ${testSize} ${testCount} > /tmp/memtester.txt`;
console.log(str);
system(str);
}
function getMemtester() {
// 读取测试结果
const memtesterStr = fs.read("/tmp/memtester.txt", "r");
if (memtesterStr) {
// 解析测试结果
const lines = memtesterStr.split('\n');
const testResult = lines.find(line => line.includes(testMaskMap[testMask]));
if (testResult) {
if (testResult.includes(": ok")) {
return `${testMaskMap[testMask]}: OK`;
} else {
return `${testMaskMap[testMask]}: error`;
}
} else {
return "NA";
}
} else {
return "NA";
}
}
// 获取系统可用内存
function getAvailableMemory() {
system("free -h > /tmp/meminfo.txt");
const memStr = fs.read("/tmp/meminfo.txt", "r");
if (memStr) {
const lines = memStr.split('\n');
for (let i = 1; i < lines.length; i++) {
const line = lines[i].trim();
if (line.startsWith("Mem")) {
const parts = line.split(/\s+/);
if (parts.length > 1) {
const memAvailable = parts[6]; // 可用内存通常在第7个位置
return memAvailable;
}
}
}
}
return "NA";
}
// 根据系统可用内存设置测试内存大小
function getTestMemorySize() {
const availableMemory = getAvailableMemory();
if (availableMemory === "NA") {
console.log("Failed to get available memory");
return "64M"; // 默认值
}
const memValue = parseFloat(availableMemory);
if (isNaN(memValue)) {
console.log("Invalid memory value:", availableMemory);
return "64M"; // 默认值
}
// 将 KB 转换为 MB(1MB = 1024 KB)
const memValueInM = (memValue / 1024).toFixed(0);
console.log(`Available Memory: ${memValueInM}M`);
// 计算测试内存大小(空闲内存的 80%)
const testSizeInM = (memValueInM * 0.5).toFixed(0);
console.log(`Test Memory Size: ${testSizeInM}M`);
return testSizeInM + 'M'; // 返回 MB 单位的测试内存大小
}
function getLogInfo() {
system("dmesg | grep -i memory > /tmp/loginfo.txt");
delayExecute(() => {
const logInfoStr = fs.read("/tmp/loginfo.txt", "r");
if (logInfoStr) {
console.log('Log Info:' + logInfoStr);
return logInfoStr;
} else {
console.error('Failed to read log info');
return "NA";
}
}, 100); // 延迟100毫秒以确保文件写入完成
}
// 获取磁盘信息
function getDiskInfo() {
system("df -h > /tmp/diskinfo.txt");
delayExecute(() => {
const diskInfoStr = fs.read("/tmp/diskinfo.txt", "r");
if (diskInfoStr) {
console.log('Disk Info:' + diskInfoStr);
return diskInfoStr;
} else {
console.error('Failed to read disk info');
return "NA";
}
}, 100); // 延迟100毫秒以确保文件写入完成
}
module.exports = {
initFactoryTestBurnIn: initFactoryTestBurnIn,
quitFactoryTestBurnIn: quitFactoryTestBurnIn
}
\ No newline at end of file
var _userdata = require("userdata.js");
var userData = _userdata.userData;
const fs = require("@system.fs");
var systemCtrl = require("systemCtrl.js");
var lvgl = require("@native.lvgl7");
var id_testRtcTimer = null;
var that;
var rtcCtl = require("factory_rtc.js");
function system(str) {
systemCtrl.executeSystemCommand(str);
}
function factoryTestRTCInit(obj) {
that = obj;
if (id_testRtcTimer != null) {
clearInterval(id_testRtcTimer);
id_testRtcTimer == null;
}
updateRtcInfo();
id_testRtcTimer = setInterval(() => {
updateRtcInfo();
}, 5000);
}
function setTextColorById(that, id, value) {
const color = (value === "NA") ? "#ff0000" : "#00ff00";
that.$setTextColor(id, color);
}
function updateRtcInfo() {
var rtc = getRtcTime();
that.crtLocalTime = rtc;
console.log("hwRtc:" + rtc);
setTextColorById(that, 'id_crtLocalTime', that.crtLocalTime);
var values = [that.crtLocalTime];
var allValuesValid = values.every(value => value !== "NA");
// 根据检查结果设置烧录测试状态
globalThis.factoryTest.rtc = allValuesValid ? 1 : 2;
var Yval = allValuesValid == 1 ? 0 : -480
that.$setY("id_yes",Yval)
}
function getRtcTime() {
system("hwclock > /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";
}
}
module.exports = {
factoryTestRTCInit: factoryTestRTCInit,
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment