Commit d91da11c authored by lyong's avatar lyong

fix:整体优化产测

parent f0064cfc
......@@ -61,7 +61,9 @@ function onCreate(uri) {
gc();
}
// require("factory_autoFactoryTest.js").autoFactoryTestTimer();
// require("factory_autoFactoryTest.js").autoFactoryTestTimer();
var global = require("factory_dataStorage.js");
global.loadFromDiskOnce();
}
// function onKeyEvent(code) {
......
No preview for this file type
......@@ -49,6 +49,7 @@
var lvgl = require("@native.lvgl7");
var bglight = require("bglight.js");
var global = require("factory_dataStorage.js");
var value = 0;
var flage = 0;
export default {
......@@ -73,7 +74,7 @@
onShow: function () {
this.initSatte();
// document.setAttribute('id_enableWLANPageList', 'list-set-edge-flash', false);
// wifiEventJS.connect_wifi(initWifissid, initWifipwd);
// wifiEventJS.enableWLANSwitch();
brightnessAutoValue = 100;
this.testTimer = this.$setInterval(this.InterValTime, 10, [], this);
......@@ -118,24 +119,34 @@
this.$clearInterval(this.testTimer);
},
checkAutoFactory: function (node, topNode, x, y) {
if (global.getFactoryData("autoStart") == 1) {
this.clearTimer();
}
require("factory_testAuto.js").autoFactoryNextPage("factoryTestBright");
},
touchedYesButton: function (node, topNode, x, y) {
//globalThis.factoryTest.bright = 1;
global.setFactoryData("bright", 1);
this.checkAutoFactory();
if (globalThis.factoryTest.autoStart == 1)
if (global.getFactoryData("autoStart") == 1)
return;
globalThis.factoryTest.bright = 1;
var yesJumpPage = require("factoryYesJumpPage.js");
//console.log("=====yesJumpPage.yesGoToNextPage(factoryTestBright);")
yesJumpPage.yesGoToNextPage("factoryTestBright");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.bright = 2;
//globalThis.factoryTest.bright = 2;
global.setFactoryData("bright", 2);
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
// var global = require("factory_dataStorage.js");
// global.setFactoryData("bright", 3);
router.push({
path: "factory_testList",
});
......
......@@ -87,7 +87,7 @@
},
/*************** struct ***************/
onInit: function () {
//this.$setImageForceUpdate(true);
......@@ -145,6 +145,8 @@
},
touchedNGButton: function (node, topNode, x, y) {
// globalThis.factoryTest.color = 2
router.push({
path: "factory_testList"
});
......
......@@ -131,7 +131,9 @@
},
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.color = 1
//globalThis.factoryTest.color = 1
var global = require("factory_dataStorage.js");
global.setFactoryData("color", 1);
// router.push({
// path: "factory_testList"
// }
......@@ -142,14 +144,17 @@
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.color = 2
//globalThis.factoryTest.color = 2
var global = require("factory_dataStorage.js");
global.setFactoryData("color", 2);
router.push({
path: "factory_testList"
});
},
touchedBackButton: function (node, topNode, x, y) {
//var global = require("factory_dataStorage.js");
// global.setFactoryData("color", 3);
router.push({
path: "factory_testList"
});
......
......@@ -57,10 +57,10 @@
onShow: function () {
// this.crtBrightnessValue = "点击开始测试播放";
// this.$hide("id_yes");
this.crtBrightnessValue = "已注册!"
this.$setY("id_yes", -480);
// document.setAttribute('id_enableWLANPageList', 'list-set-edge-flash', false);
// wifiEventJS.connect_wifi(initWifissid, initWifipwd);
// wifiEventJS.enableWLANSwitch();
// this.testTimer = this.$setTimeout(this.InterValTime, 5000, [], this);
this.checkLisense();
......@@ -80,18 +80,24 @@
},
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.licenseAuthor = 1;
// globalThis.factoryTest.licenseAuthor = 1;
var global = require("factory_dataStorage.js");
global.setFactoryData("licenseAuthor", 1);
var yesJumpPage = require("factoryYesJumpPage.js");
//console.log("=====yesJumpPage.yesGoToNextPage(factoryTestLicenseAuthor);")
yesJumpPage.yesGoToNextPage("factoryTestLicenseAuthor");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.licenseAuthor = 2;
//globalThis.factoryTest.licenseAuthor = 2;
var global = require("factory_dataStorage.js");
global.setFactoryData("licenseAuthor", 2);
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
// var global = require("factory_dataStorage.js");
//global.setFactoryData("licenseAuthor", 3);
router.push({
path: "factory_testList",
});
......@@ -109,6 +115,8 @@
this.crtBrightnessValue = "已注册!"
//console.log("the " + filenm + " is exists.")
this.$setY("id_yes", 0);
var global = require("factory_dataStorage.js");
global.setFactoryData("licenseAuthor", 1);
this.checkAutoFactory();
return;
}
......
......@@ -10,11 +10,11 @@
<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" 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: 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>
<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="fontsize24" id="id_crtTextRtcText" style="left:0;top: 160;text-align: center ;width: 480;height:80;">{{crtTextRtcText}}</text>
......@@ -49,7 +49,7 @@
data: {
crtLocalTime: "NA",
crtTextRtcText: "NA",
crtfilesLocalTime:"NA",
crtfilesLocalTime: "NA",
imgCnt: 0,
pngCnt: 0,
gifIconSrc: "",
......@@ -77,20 +77,27 @@
touchedYesButton: function (node, topNode, x, y) {
this.checkAutoFactory();
if (globalThis.factoryTest.autoStart == 1)
var global = require("factory_dataStorage.js");
//if (globalThis.factoryTest.autoStart == 1)
if (global.getFactoryData("autoStart") == 1)
return;
globalThis.factoryTest.rtc = 1;
//globalThis.factoryTest.rtc = 1;
global.setFactoryData("rtc", 1);
var yesJumpPage = require("factoryYesJumpPage.js");
//console.log("=====yesJumpPage.yesGoToNextPage(factoryTestSound);")
yesJumpPage.yesGoToNextPage("factoryTestRtc");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.rtc = 2;
//globalThis.factoryTest.rtc = 2;
var global = require("factory_dataStorage.js");
global.setFactoryData("rtc", 2);
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
// var global = require("factory_dataStorage.js");
//global.setFactoryData("rtc", 3);
router.push({
path: "factory_testList",
});
......
......@@ -60,7 +60,7 @@
// this.crtBrightnessValue = "点击开始测试播放";
// this.$hide("id_yes");
// document.setAttribute('id_enableWLANPageList', 'list-set-edge-flash', false);
// wifiEventJS.connect_wifi(initWifissid, initWifipwd);
// wifiEventJS.enableWLANSwitch();
// this.testTimer = this.$setTimeout(this.InterValTime, 5000, [], this);
......@@ -80,22 +80,29 @@
},
touchedYesButton: function (node, topNode, x, y) {
var global = require("factory_dataStorage.js");
//if (globalThis.factoryTest.autoStart == 1)
//globalThis.factoryTest.sound = 1;
global.setFactoryData("sound", 1);
this.checkAutoFactory();
if (globalThis.factoryTest.autoStart == 1)
if (global.getFactoryData("autoStart") == 1)
return;
globalThis.factoryTest.sound = 1;
var yesJumpPage = require("factoryYesJumpPage.js");
//console.log("=====yesJumpPage.yesGoToNextPage(factoryTestSound);")
yesJumpPage.yesGoToNextPage("factoryTestSound");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.sound = 2;
//globalThis.factoryTest.sound = 2;
var global = require("factory_dataStorage.js");
global.setFactoryData("sound", 2);
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
// var global = require("factory_dataStorage.js");
// global.setFactoryData("sound", 3);
router.push({
path: "factory_testList",
});
......
......@@ -396,8 +396,8 @@
});
},
touchedBackButton: function (node, topNode, x, y) {
var global = require("factory_dataStorage.js");
global.setFactoryData("touch", 3);
//var global = require("factory_dataStorage.js");
//global.setFactoryData("touch", 3);
this.exit();
router.push({
path: "factory_testList",
......
......@@ -94,6 +94,10 @@
this.$setTextColor("id_humidity", "#00ff00");
},
checkAutoFactory: function (node, topNode, x, y) {
if (global.getFactoryData("autoStart") == 1) {
this.clearTimer();
}
require("factory_testAuto.js").autoFactoryNextPage("factoryTestTvoc");
},
InterValTime: function () {
......@@ -105,9 +109,9 @@
if (t > 0 && h > 0) {
this.setValue(t, h);
var global = require("factory_dataStorage.js");
global.setFactoryData("tvoc", 1);
this.checkAutoFactory();
if (globalThis.factoryTest.autoStart == 1)
return;
}
else {
this.naValueSet();
......@@ -116,6 +120,7 @@
onShow: function () {
//this.$setY("id_yes", -480);
this.$setY("id_yes", -480);
this.InterValTime();
this.testTimer = this.$setInterval(this.InterValTime, 3000, [], this);
......@@ -134,13 +139,18 @@
},
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.tvoc = 1;
// globalThis.factoryTest.tvoc = 1;
this.clearTimer();
var global = require("factory_dataStorage.js");
global.setFactoryData("tvoc", 1);
var yesJumpPage = require("factoryYesJumpPage.js");
yesJumpPage.yesGoToNextPage("factoryTestTvoc");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.tvoc = 2;
this.clearTimer();
// globalThis.factoryTest.tvoc = 2;
var global = require("factory_dataStorage.js");
global.setFactoryData("tvoc", 1);
router.push({
path: "factory_testList",
});
......
......@@ -1108,6 +1108,8 @@
console.log("okok");
this.wifiInfoState_TEXT = "WIFI测试成功"
this.$setY("id_yes", 0);
var global = require("factory_dataStorage.js");
global.setFactoryData("wifi", 1);
this.checkAutoFactory();
return;
} else {
......@@ -1136,7 +1138,7 @@
this.goToConnectWifi();
},
onShow: function () {
this.$setY("id_yes", -480);
this.$setOpacity("id_startscanWifiHide", 0.7)
this.$setOpacity("id_startscanWifi_List_hide", 0.5)
......@@ -1311,7 +1313,7 @@
setTimeout(() => {
this.hideShowConnectbutton(1);
var wifiInfo = wifiEventJS.getWifiInfo(this.initWifissid, best ? best.bssid : undefined);
var wifiInfo = wifiEventJS.getWifiInfo(this.initWifissid, best ? best.bssid : undefined);
this.updateMainConnectWifiShowUI(wifiInfo);
connectWifiFlag = false; // 解锁,允许再次点击
}, 5000);
......
......@@ -10,7 +10,7 @@
</div>
<text class="fontsize24" id="systemId1_TextHeader1" style="top: 60;color: rgb(0, 0, 0);text-align: left;width: 200;">{{crtsystemId1_TextHeader1}}</text>
<div style="left:0;top: 75;width: 200;height: 366;">
<text class="fontsize24" id="systemId1_TextHeader2" style=" top: 45;color: rgb(0, 0, 0);text-align: left;width: 200;">{{crtsystemId1_TextHeader2}}</text>
<text class="fontsize24" id="systemId1_TextHeader3" style="top: 90;color: rgb(0, 0, 0);text-align: left;width: 200;">{{crtsystemId1_TextHeader3}}</text>
<text class="fontsize24" id="systemId1_TextHeader4" style="top: 135;color: rgb(0, 0, 0);text-align: left;width: 200;">{{crtsystemId1_TextHeader4}}</text>
......@@ -136,9 +136,9 @@
crtsystemId3_TextValue3: "NG",
crtsystemId3_TextValue4: "NG",
crtsystemId3_TextValue5: "NG",
crtsystemId1_crtTextTips: "绿色代表通过,红色代表不通过",
crtsystemId2_crtTextTips: "绿色代表通过,红色代表不通过",
crtsystemId3_crtTextTips: "该页信息不作判定",
crtsystemId1_crtTextTips: "绿色代表通过,红色代表不通过",
crtsystemId2_crtTextTips: "绿色代表通过,红色代表不通过",
crtsystemId3_crtTextTips: "该页信息不作判定",
pagecnt: 1,
factoryTestSystemCheck: 0,
......@@ -150,8 +150,8 @@
onShow: function () {
for(var i = 1; i <= 3; i++){
for(var j = 1; j <= 5; j++){
for (var i = 1; i <= 3; i++) {
for (var j = 1; j <= 5; j++) {
this.$setOpacity("systemId" + i + "_TextHeader" + j, 0.5)
}
this.$setOpacity("systemId" + i + "_TextTips", 0.5)
......@@ -161,22 +161,22 @@
factory_testSystemInfo.startSystemInfoTimer(this);
},
onHide: function () {
//console.log(this.$uri + "===========onHide=============");
this.clearTimer();
},
onQuit: function () {
//console.log(this.$uri + "===========onQuit=============");
this.clearTimer();
},
clearTimer: function () {
factory_testSystemInfo.stopSystemInfoTimer();
factory_testSystemInfo.stopSystemInfoTimer();
// this.$clearTimeout(this.testTimer);
},
......@@ -213,22 +213,18 @@
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.systemCheck = 2;
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
this.movePage("systemId"+this.pagecnt, "systemId1");
this.pagecnt = 1;
this.movePage("systemId" + this.pagecnt, "systemId1");
this.pagecnt = 1;
//添加检查全绿为测试功能
globalThis.factoryTest.systemCheck = this.factoryTestSystemCheck;
// globalThis.factoryTest.systemCheck = this.factoryTestSystemCheck;
var global = require("factory_dataStorage.js");
global.setFactoryData("systemCheck", this.factoryTestSystemCheck);
//console.log("=====globalThis.factoryTest.systemCheck:"+globalThis.factoryTest.systemCheck);
var yesJumpPage = require("factoryYesJumpPage.js");
var yesJumpPage = require("factoryYesJumpPage.js");
//console.log("=====yesJumpPage.yesGoToNextPage(factoryTestsystemCheck);")
yesJumpPage.yesGoToNextPage("factoryTestsystemCheck");
},
......
......@@ -26,6 +26,7 @@
// var systemCtrl = require("systemCtrl.js");
var systemCtrl = require("systemCtrl.js");
var yesJumpPage = require("factoryYesJumpPage.js");
var global = require("factory_dataStorage.js");
var onestart = 1;
// var _userdata = require("userdata.js");
......@@ -184,46 +185,13 @@
},
/*************** struct ***************/
onInit: function () {
//this.activePage= "id_languageBasicPage";
this.onlyOnceFlag = 0;
if (globalThis.factoryTest == undefined) {
var obj = {
color: 0,
touch: 0,
wifi: 0,
sound: 0,
uartComm: 0,
bright: 0,
licenseAuthor: 0,
rtc: 0,
tvoc: 0,
burnIn: 0,
systemCheck: 0,
clearAll: 0,
start: 0,
};
globalThis.factoryTest = obj;
}
this.initializeFactoryTestProperties();
onInit() {
// 首次运行把磁盘数据一次性搬进内存
global.loadFromDiskOnce();
global.setFactoryData("autoStart", 0);
},
initializeFactoryTestProperties: function () {
const properties = [
"color", "touch", "wifi", "sound",
"uartComm", "bright", "licenseAuthor", "rtc","tvoc",
"burnIn", "systemCheck", "clearAll", "start"
];
properties.forEach(prop => {
if (globalThis.factoryTest[prop] === undefined) {
globalThis.factoryTest[prop] = 0;
}
});
},
snShow: function () {
// var sysVersion = libwifi.getSysVersion("get");
var sysVersion = "The code has been annotated"
......@@ -232,45 +200,31 @@
//console.log("sysVersion=" + sysVersion);
//console.log("appVersion=" + appVersion);
//this.crtSNValue = sysVersion + "-" + appVersion;
// this.crtSNValue = userData.aboutSNValue || "NG"
// this.crtSNValue = userData.aboutSNValue || "NG"
this.crtSNValue = require("handleSNDataBinFile.js").readStrFromBinFile() || "NG";
yesJumpPage.initPage(this.appItem);
yesJumpPage.testCode(this)
},
initShow: function () {
this.snShow();
this.timerSet();
if (this.onlyOnceFlag == 0) {
var obj = file.read("product_res.json", "json");
if (obj == undefined) {
//console.log("product_res.json is not exist,creat it!");
file.create("product_res.json");
this.saveValue();
return;
}
//console.log("product_res.json is exist,continue!");
this.restoreFactoryTestValues(obj);
this.onlyOnceFlag = 1;
}
//console.log("save data to product_res.json!");
this.saveValue();
},
onShow: function () {
//lvgl.lv_set_screen_transparent(false);
//console.log(this.$uri + "===========onShow=============");
if (global.getFactoryData("autoStart") == 1) {
global.setFactoryData("autoStart", 0); // 确保设置 autoStart 为 0
}
if (userData.factoryFlag != 1) {
userData.factoryFlag = 1;
}
//console.log("wifiEventJS.enableWLANScanValue()================================================1");
if (onestart) {
var wifiEventJS = require("factory_testWifi.js");
if(globalThis.factoryTest.wifi != 0)
wifiEventJS.enableWLANScanValue();
if (globalThis.factoryTest.wifi != 0)
wifiEventJS.enableWLANScanValue();
//console.log("wifiEventJS.enableWLANScanValue()================================================2");
onestart = 0;
}
......@@ -294,21 +248,6 @@
require("factory_testBurnIn.js").exStopagainMp4(); //从老测测试退出重新执行一次退出视频,防止卡图层
},
restoreFactoryTestValues: function (obj) {
const properties = [
"color", "touch", "wifi", "sound",
"uartComm", "bright", "licenseAuthor", "rtc","tvoc",
"burnIn", "systemCheck", "clearAll", "start"
];
properties.forEach(prop => {
if (obj[prop] !== undefined) {
globalThis.factoryTest[prop] = obj[prop];
}
});
},
onHide: function () {
......@@ -348,18 +287,21 @@
return;
}
if (url == "factoryTestClearAll") {
this.clearValue()
global.clearFactoryData();
this.testStatus();
//console.log("==============factoryTestClearAll================");
this.initShow();
return;
}
if (url == "factoryTestStart") {
//console.log("==============factoryTestStart================");
globalThis.factoryTest.autoStart = 1;
//globalThis.factoryTest.autoStart = 1;
global.setFactoryData("autoStart", 1);
url = "factoryTestColor";
}
else{
globalThis.factoryTest.autoStart = 2;
else {
//globalThis.factoryTest.autoStart = 2;
global.setFactoryData("autoStart", 2);
}
if (url == "factoryTestExit") {
var systemCtrl = require("systemCtrl.js");
......@@ -374,38 +316,35 @@
blockColorChange: function (relId, val) {
//console.log("relId:" + relId + " val:" + val);
const colors = [0x9E9E9E, 0x4CB050, 0xF44236];
this.$setBackgroundColor(relId, colors[Math.min(val, 2)]);
const idx = val > 2 ? 0 : val; // ≥3 一律灰色
this.$setBackgroundColor(relId, colors[idx]);
//this.$setBackgroundColor(relId, colors[Math.min(val, 2)]);
},
testStatus: function () {
const testMappings = [
{ index: 0, property: "color" },
{ index: 1, property: "touch" },
{ index: 2, property: "wifi" },
{ index: 3, property: "sound" },
{ index: 4, property: "uartComm" },
{ index: 5, property: "bright" },
{ index: 6, property: "licenseAuthor" },
{ index: 7, property: "rtc" },
{ index: 8, property: "tvoc" },
{ index: 9, property: "burnIn" },
{ index: 10, property: "systemCheck" },
{ index: 11, property: "clearAll" },
// { index: 9, property: "pcba" },
{ index: 12, property: "start" },
];
testStatus() {
const ID_KEY_MAP = {
'id_factoryTestColor': 'color',
'id_factoryTestTouch': 'touch',
'id_factoryTestWifi': 'wifi',
'id_factoryTestSound': 'sound',
'id_factory_testUartComm': 'uartComm',
'id_factoryTestBright': 'bright',
'id_factoryTestLicenseAuthor': 'licenseAuthor',
'id_factoryTestRtc': 'rtc',
'id_factoryTestTvoc': 'tvoc',
'id_factoryTestBurnIn': 'burnIn',
'id_factoryTestsystemCheck': 'systemCheck',
'id_factoryTestClearAll': 'clearAll',
'id_factoryTestStart': 'start'
}
testMappings.forEach(mapping => {
const appItem = this.appItem[mapping.index];
if (appItem) {
this.blockColorChange(appItem.id, globalThis.factoryTest[mapping.property]);
this.appItem.forEach(item => {
const key = ID_KEY_MAP[item.id]
if (key) {
const val = globalThis.factoryTest[key]
this.blockColorChange(item.id, val)
}
});
})
},
touchedBg: function (node, topnode, x, y) {
......@@ -419,69 +358,7 @@
this.beepTimerOutId = this.$setTimeout(this.beepTimerOut, 500, [], this);
},
clearValue: function () {
globalThis.factoryTest.color = 0;
globalThis.factoryTest.touch = 0;
globalThis.factoryTest.wifi = 0;
globalThis.factoryTest.sound = 0;
globalThis.factoryTest.uartComm = 0;
globalThis.factoryTest.bright = 0;
globalThis.factoryTest.licenseAuthor = 0;
globalThis.factoryTest.rtc = 0;
globalThis.factoryTest.tvoc = 0;
globalThis.factoryTest.burnIn = 0;
globalThis.factoryTest.systemCheck = 0;
globalThis.factoryTest.clearAll = 0;
globalThis.factoryTest.start = 0;
const saveObj = {
color: globalThis.factoryTest.color,
touch: globalThis.factoryTest.touch,
wifi: globalThis.factoryTest.wifi,
sound: globalThis.factoryTest.sound,
// ble: globalThis.factoryTest.ble,
uartComm: globalThis.factoryTest.uartComm,
bright: globalThis.factoryTest.bright,
licenseAuthor: globalThis.factoryTest.licenseAuthor,
rtc: globalThis.factoryTest.rtc,
tvoc: globalThis.factoryTest.tvoc,
burnIn: globalThis.factoryTest.burnIn,
systemCheck: globalThis.factoryTest.systemCheck,
clearAll: globalThis.factoryTest.clearAll,
// pcba: globalThis.factoryTest.pcba,
start: globalThis.factoryTest.start,
};
//console.log(saveObj);
file.write("product_res.json", saveObj);
// libwifi.syncSave("save");
},
saveValue: function () {
const saveObj = {
color: globalThis.factoryTest.color,
touch: globalThis.factoryTest.touch,
wifi: globalThis.factoryTest.wifi,
sound: globalThis.factoryTest.sound,
// ble: globalThis.factoryTest.ble,
uartComm: globalThis.factoryTest.uartComm,
bright: globalThis.factoryTest.bright,
licenseAuthor: globalThis.factoryTest.licenseAuthor,
rtc: globalThis.factoryTest.rtc,
tvoc: globalThis.factoryTest.tvoc,
burnIn: globalThis.factoryTest.burnIn,
systemCheck: globalThis.factoryTest.systemCheck,
clearAll: globalThis.factoryTest.clearAll,
// pcba: globalThis.factoryTest.pcba,
start: globalThis.factoryTest.start,
};
//console.log(saveObj);
file.write("product_res.json", saveObj);
// libwifi.syncSave("save");
},
beepTimerOut: function () {
// rd190_factory.pwm(0);
......
......@@ -49,7 +49,6 @@
var _userdata = require("userdata.js");
var userData = _userdata.userData;
var serialManager = require("serialmanager.js");
var sendValue = 0;
export default {
data: {
......@@ -58,21 +57,28 @@
recvCommValueText: "0"
},
onInit() {
this.sendValue = 0;
},
InterValTime: function () {
//console.log("sendValue:" + sendValue);
sendValue += 1;
//console.log("this.sendValue:" + this.sendValue);
this.sendValue += 1;
packet_cmd.pack_cmd_packet_0x50();
console.log("userData.factoryFlag:" + userData.factoryFlag);
this.sendCommValueText = "" + sendValue;
this.sendCommValueText = "" + this.sendValue;
this.recvCommValueText = "" + userData.factoryRecvCnt;
if (userData.factoryRecvCnt > 0) {
this.$setY("id_yes", 0);
var global = require("factory_dataStorage.js");
global.setFactoryData("uartComm", 1);
this.checkAutoFactory();
}
},
checkAutoFactory: function (node, topNode, x, y) {
require("factory_testAuto.js").autoFactoryNextPage("factoryTestUartComm");
var global = require("factory_dataStorage.js");
if (global.getFactoryData("autoStart") == 1) {
this.clearTimer();
}
require("factory_testAuto.js").autoFactoryNextPage("factory_testUartComm");
},
uartComm: function () {
console.log("uartComm");
......@@ -115,23 +121,32 @@
clearTimer: function () {
serialManager.close();
this.$clearInterval(this.testTimer);
userData.factoryRecvCnt = 0;
},
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.uartComm = 1;
userData.factoryRecvCnt = 0;
//globalThis.factoryTest.uartComm = 1;
this.clearTimer();
var global = require("factory_dataStorage.js");
global.setFactoryData("uartComm", 1);
var yesJumpPage = require("factoryYesJumpPage.js");
//console.log("=====yesJumpPage.yesGoToNextPage(factoryTestUartComm);")
yesJumpPage.yesGoToNextPage("factoryTestUartComm");
//console.log("=====yesJumpPage.yesGoToNextPage(factory_testUartComm);")
yesJumpPage.yesGoToNextPage("factory_testUartComm");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.uartComm = 2;
this.clearTimer();
//globalThis.factoryTest.uartComm = 2;
var global = require("factory_dataStorage.js");
global.setFactoryData("uartComm", 2);
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
// var global = require("factory_dataStorage.js");
// global.setFactoryData("uartComm", 3);
router.push({
path: "factory_testList",
});
......
/**
* factory_dataStorage.js
* 对 globalThis.factoryTest 的持久化读写
* 提供三个 API:
* setFactoryData(key, value)
* getFactoryData(key)
* clearFactoryData()
*
* 数据落盘文件:product_res.json
*/
const file = require('file.js');
/* ---------- 内部常量 ---------- */
const STORAGE_FILE = 'product_res.json';
/* 13 个工厂测试属性,保持与原有代码一致 */
const KEYS = [
'color', 'touch', 'wifi', 'sound',
'uartComm', 'bright', 'licenseAuthor',
'rtc', 'tvoc', 'burnIn',
'systemCheck', 'clearAll', 'start','autoStart'
];
function ensureFile() {
if (file.read(STORAGE_FILE, 'json') === undefined) {
file.create(STORAGE_FILE);
file.write(STORAGE_FILE, {});
}
}
function loadFromDiskOnce() {
console.log('loadFromDiskOnce');
if (globalThis.factoryTest !== undefined) return; // 已装载直接返回
ensureFile();
const disk = file.read(STORAGE_FILE, 'json') || {};
globalThis.factoryTest = {};
KEYS.forEach(k => {
globalThis.factoryTest[k] = (disk && disk[k] !== undefined) ? disk[k] : 0;
});
}
// 把内存快照立即写盘
function flush() {
ensureFile();
const toSave = {};
KEYS.forEach(k => { toSave[k] = globalThis.factoryTest[k]; });
file.write(STORAGE_FILE, toSave);
}
/* ---------- 对外 API ---------- */
function setFactoryData(key, value) {
if (!KEYS.includes(key)) throw new Error(`invalid key: ${key}`);
loadFromDiskOnce();
globalThis.factoryTest[key] = value;
flush();
}
function getFactoryData(key) {
if (!KEYS.includes(key)) throw new Error(`invalid key: ${key}`);
loadFromDiskOnce();
return globalThis.factoryTest[key];
}
function clearFactoryData() {
loadFromDiskOnce();
KEYS.forEach(k => { globalThis.factoryTest[k] = 0; });
flush();
}
/* ---------- 模块导出 ---------- */
module.exports = {
setFactoryData: setFactoryData,
getFactoryData: getFactoryData,
clearFactoryData: clearFactoryData,
loadFromDiskOnce: loadFromDiskOnce,
KEYS: KEYS
};
......@@ -5,6 +5,7 @@ const fs = require("@system.fs");
var systemCtrl = require("systemCtrl.js");
var lvgl = require("@native.lvgl7");
var router = require("@system.router");
var global = require("factory_dataStorage.js");
var id_testRtcTimer = null;
var that;
var thatList
......@@ -21,8 +22,8 @@ var flageMap = {
"factoryTestLicenseAuthor": "licenseAuthor",
"factoryTestRtc": "rtc",
"factoryTestTvoc": "tvoc",
"factoryTestBurnIn": "burnIn",
"factoryTestsystemCheck": "systemCheck",
"factoryTestBurnIn": "burnIn",
"factoryTestClearAll": "clearAll",
"factoryTestStart": "start",
"factoryTestExit": "exit"
......@@ -38,13 +39,13 @@ var autoMovePage = [
"factoryTestLicenseAuthor",
"factoryTestRtc",
"factoryTestTvoc",
// "factoryTestBurnIn",
"factoryTestsystemCheck",
// "factoryTestBurnIn",
// "factoryTestClearAll",
// "factoryTestStart"
];
var exitNextPage = "factory_testList";
var exitNextPage = "factoryTestBurnIn";
// ✅ 获取下一个测试页面
......@@ -60,24 +61,29 @@ function autoFactoryNextPage(curPageName) {
if (!curPageName) return;
console.log("[autoFactoryNextPage] 当前页面:" + curPageName);
console.log("[autoFactoryNextPage] autoStart状态:" + globalThis.factoryTest.autoStart);
console.log("[autoFactoryNextPage] autoStart状态:" + global.getFactoryData("autoStart"));
if (globalThis.factoryTest.autoStart == 1) {
// if (1) {
// if (globalThis.factoryTest.autoStart == 1) {
if (global.getFactoryData("autoStart") == 1) {
// if (1) {
var testKey = flageMap[curPageName];
if (!testKey) {
console.warn("[autoFactoryNextPage] 未映射的页面:" + curPageName);
return;
}
globalThis.factoryTest[testKey] = 1;
if (globalThis.factoryTest[testKey] === 1) {
//globalThis.factoryTest[testKey] = 1;
global.setFactoryData(testKey, 1);
// if (globalThis.factoryTest[testKey] === 1) {
if (global.getFactoryData(testKey) === 1) {
var nextPage = getNextTest(curPageName);
if (nextPage) {
console.log("[autoFactoryNextPage] 自动跳转到:" + nextPage);
router.push({ path: nextPage });
} else {
console.log("[autoFactoryNextPage] 已到达最后一页,跳转结束。");
globalThis.factoryTest.autoStart = 0; // 可选:停止自动流程
//globalThis.factoryTest.autoStart = 0; // 可选:停止自动流程
global.setFactoryData("autoStart", 0);
router.push({ path: exitNextPage });
}
} else {
......
......@@ -8,6 +8,7 @@ var id_testBurnInTimer = null;
var that;
var strMemtesterCnt = 0; // 初始化测试掩码计数器
var exStopagainMp4Flag = false;
var testVal;
// 测试掩码映射表
const testMaskMap = {
"0x1": "Compare XOR",
......@@ -53,6 +54,11 @@ function initFactoryTestBurnIn(obj) {
}
function quitFactoryTestBurnIn() {
var global = require("factory_dataStorage.js");
global.setFactoryData("burnIn", testVal);
system("killall -9 memtester 2>/dev/null")
//console.log("quitFactoryTestBurnIn");
if (id_testBurnInTimer != null) {
......@@ -61,7 +67,6 @@ function quitFactoryTestBurnIn() {
}
exitMp4();
}
......@@ -192,7 +197,9 @@ function updateBurnInInfo() {
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;
//globalThis.factoryTest.burnIn = allValuesValid ? 1 : 2;
testVal = allValuesValid ? 1 : 2;
}
......
......@@ -107,7 +107,8 @@ function updateRtcInfo() {
var state = 0;
that.crtTextRtcText = state ? "测试通过" : "测试失败";
setTextColorByText(that, 'id_crtTextRtcText', that.crtTextRtcText);
globalThis.factoryTest.rtc = state ? 1 : 2;
//globalThis.factoryTest.rtc = state ? 1 : 2;
var testVal = state ? 1 : 2;
that.$setY("id_yes", state ? 0 : -480);
console.log("[RTC] 测试完成,最终状态:" + (state ? "通过" : "失败"));
} else {
......@@ -118,10 +119,15 @@ function updateRtcInfo() {
var state = 1;
that.crtTextRtcText = state ? "测试通过" : "测试失败";
setTextColorByText(that, 'id_crtTextRtcText', that.crtTextRtcText);
globalThis.factoryTest.rtc = state ? 1 : 2;
//globalThis.factoryTest.rtc = state ? 1 : 2;
var testVal = state ? 1 : 2;
that.$setY("id_yes", state ? 0 : -480);
console.log("[RTC] 测试完成,最终状态:" + (state ? "通过" : "失败"));
var global = require("factory_dataStorage.js");
global.setFactoryData("rtc", 1);
}
var global = require("factory_dataStorage.js");
global.setFactoryData("rtc", testVal);
} else {
oneTest();
}
......
......@@ -64,13 +64,20 @@ function setTextColorByValue(that, fullKey, value) {
if (checkedCount == textValueKeys.length) {
that.factoryTestSystemCheck = (ngCount == 0) ? 1 : 2;
if(that.factoryTestSystemCheck == 1){
checkAutoFactory();
}
// 重置计数器,方便下次调用
checkedCount = 0;
ngCount = 0;
}
}
function checkAutoFactory() {
var global = require("factory_dataStorage.js");
global.setFactoryData("systemCheck", 1);
stopSystemInfoTimer();
require("factory_testAuto.js").autoFactoryNextPage("factoryTestsystemCheck");
}
// 获取系统信息
function updateSystemInfo() {
......
var systemCtrl = require("systemCtrl.js");
// WPA
function retStrByWpa(ssid, psw, bssid) {
const bssidLine = bssid ? ` bssid=${bssid}\n` : '';
return `ctrl_interface=/tmp/wpa_supplicant/sockets\nupdate_config=1\nnetwork={\n ssid="${ssid}"\n psk="${psw}"\n${bssidLine}}`;
}
// WEP
function retStrByWep(ssid, psw, bssid) {
const bssidLine = bssid ? ` bssid=${bssid}\n` : '';
return `ctrl_interface=/tmp/wpa_supplicant/sockets\nupdate_config=1\npmf=1\nnetwork={\n ssid="${ssid}"\n key_mgmt=NONE\n auth_alg=OPEN SHARED\n wep_key0=${psw}\n${bssidLine}}`;
}
// Open
function retStrByOpen(ssid, psw, bssid) {
const bssidLine = bssid ? ` bssid=${bssid}\n` : '';
return `ctrl_interface=/tmp/wpa_supplicant/sockets\nupdate_config=1\npmf=1\nnetwork={\n ssid="${ssid}"\n key_mgmt=NONE\n${bssidLine}}`;
}
function set(ssid, psw, mode, bssid) {
// 参数兜底
if (typeof ssid !== 'string' || !ssid) ssid = '12345678';
if (typeof psw !== 'string' || !psw) psw = '12345678';
let rule = '';
switch (mode) {
case 'WPA':
case 'WPA2':
case 'WPA3':
rule = retStrByWpa(ssid, psw, bssid);
break;
case 'WEP':
rule = retStrByWep(ssid, psw, bssid);
break;
case 'Open':
rule = retStrByOpen(ssid, psw, bssid);
break;
default:
rule = retStrByWpa(ssid, psw, bssid);
}
const shellCmd = `echo -e '${rule}' > /tmp/wpa_supplicant.conf`;
systemCtrl.executeSystemCommand(shellCmd);
systemCtrl.executePrint(shellCmd);
}
module.exports = {
set: set,
};
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