Commit d91da11c authored by lyong's avatar lyong

fix:整体优化产测

parent f0064cfc
...@@ -62,6 +62,8 @@ function onCreate(uri) { ...@@ -62,6 +62,8 @@ function onCreate(uri) {
} }
// require("factory_autoFactoryTest.js").autoFactoryTestTimer(); // require("factory_autoFactoryTest.js").autoFactoryTestTimer();
var global = require("factory_dataStorage.js");
global.loadFromDiskOnce();
} }
// function onKeyEvent(code) { // function onKeyEvent(code) {
......
No preview for this file type
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
var lvgl = require("@native.lvgl7"); var lvgl = require("@native.lvgl7");
var bglight = require("bglight.js"); var bglight = require("bglight.js");
var global = require("factory_dataStorage.js");
var value = 0; var value = 0;
var flage = 0; var flage = 0;
export default { export default {
...@@ -73,7 +74,7 @@ ...@@ -73,7 +74,7 @@
onShow: function () { onShow: function () {
this.initSatte(); this.initSatte();
// document.setAttribute('id_enableWLANPageList', 'list-set-edge-flash', false); // document.setAttribute('id_enableWLANPageList', 'list-set-edge-flash', false);
// wifiEventJS.connect_wifi(initWifissid, initWifipwd);
// wifiEventJS.enableWLANSwitch(); // wifiEventJS.enableWLANSwitch();
brightnessAutoValue = 100; brightnessAutoValue = 100;
this.testTimer = this.$setInterval(this.InterValTime, 10, [], this); this.testTimer = this.$setInterval(this.InterValTime, 10, [], this);
...@@ -118,24 +119,34 @@ ...@@ -118,24 +119,34 @@
this.$clearInterval(this.testTimer); this.$clearInterval(this.testTimer);
}, },
checkAutoFactory: function (node, topNode, x, y) { checkAutoFactory: function (node, topNode, x, y) {
if (global.getFactoryData("autoStart") == 1) {
this.clearTimer();
}
require("factory_testAuto.js").autoFactoryNextPage("factoryTestBright"); require("factory_testAuto.js").autoFactoryNextPage("factoryTestBright");
}, },
touchedYesButton: function (node, topNode, x, y) { touchedYesButton: function (node, topNode, x, y) {
//globalThis.factoryTest.bright = 1;
global.setFactoryData("bright", 1);
this.checkAutoFactory(); this.checkAutoFactory();
if (globalThis.factoryTest.autoStart == 1) if (global.getFactoryData("autoStart") == 1)
return; return;
globalThis.factoryTest.bright = 1;
var yesJumpPage = require("factoryYesJumpPage.js"); var yesJumpPage = require("factoryYesJumpPage.js");
//console.log("=====yesJumpPage.yesGoToNextPage(factoryTestBright);") //console.log("=====yesJumpPage.yesGoToNextPage(factoryTestBright);")
yesJumpPage.yesGoToNextPage("factoryTestBright"); yesJumpPage.yesGoToNextPage("factoryTestBright");
}, },
touchedNGButton: function (node, topNode, x, y) { touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.bright = 2; //globalThis.factoryTest.bright = 2;
global.setFactoryData("bright", 2);
router.push({ router.push({
path: "factory_testList", path: "factory_testList",
}); });
}, },
touchedBackButton: function (node, topNode, x, y) { touchedBackButton: function (node, topNode, x, y) {
// var global = require("factory_dataStorage.js");
// global.setFactoryData("bright", 3);
router.push({ router.push({
path: "factory_testList", path: "factory_testList",
}); });
......
...@@ -145,6 +145,8 @@ ...@@ -145,6 +145,8 @@
}, },
touchedNGButton: function (node, topNode, x, y) { touchedNGButton: function (node, topNode, x, y) {
// globalThis.factoryTest.color = 2 // globalThis.factoryTest.color = 2
router.push({ router.push({
path: "factory_testList" path: "factory_testList"
}); });
......
...@@ -131,7 +131,9 @@ ...@@ -131,7 +131,9 @@
}, },
touchedYesButton: function (node, topNode, x, y) { 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({ // router.push({
// path: "factory_testList" // path: "factory_testList"
// } // }
...@@ -142,14 +144,17 @@ ...@@ -142,14 +144,17 @@
}, },
touchedNGButton: function (node, topNode, x, y) { 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({ router.push({
path: "factory_testList" path: "factory_testList"
}); });
}, },
touchedBackButton: function (node, topNode, x, y) { touchedBackButton: function (node, topNode, x, y) {
//var global = require("factory_dataStorage.js");
// global.setFactoryData("color", 3);
router.push({ router.push({
path: "factory_testList" path: "factory_testList"
}); });
......
...@@ -57,10 +57,10 @@ ...@@ -57,10 +57,10 @@
onShow: function () { onShow: function () {
// this.crtBrightnessValue = "点击开始测试播放"; this.crtBrightnessValue = "已注册!"
// this.$hide("id_yes"); this.$setY("id_yes", -480);
// document.setAttribute('id_enableWLANPageList', 'list-set-edge-flash', false); // document.setAttribute('id_enableWLANPageList', 'list-set-edge-flash', false);
// wifiEventJS.connect_wifi(initWifissid, initWifipwd);
// wifiEventJS.enableWLANSwitch(); // wifiEventJS.enableWLANSwitch();
// this.testTimer = this.$setTimeout(this.InterValTime, 5000, [], this); // this.testTimer = this.$setTimeout(this.InterValTime, 5000, [], this);
this.checkLisense(); this.checkLisense();
...@@ -80,18 +80,24 @@ ...@@ -80,18 +80,24 @@
}, },
touchedYesButton: function (node, topNode, x, y) { 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"); var yesJumpPage = require("factoryYesJumpPage.js");
//console.log("=====yesJumpPage.yesGoToNextPage(factoryTestLicenseAuthor);") //console.log("=====yesJumpPage.yesGoToNextPage(factoryTestLicenseAuthor);")
yesJumpPage.yesGoToNextPage("factoryTestLicenseAuthor"); yesJumpPage.yesGoToNextPage("factoryTestLicenseAuthor");
}, },
touchedNGButton: function (node, topNode, x, y) { 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({ router.push({
path: "factory_testList", path: "factory_testList",
}); });
}, },
touchedBackButton: function (node, topNode, x, y) { touchedBackButton: function (node, topNode, x, y) {
// var global = require("factory_dataStorage.js");
//global.setFactoryData("licenseAuthor", 3);
router.push({ router.push({
path: "factory_testList", path: "factory_testList",
}); });
...@@ -109,6 +115,8 @@ ...@@ -109,6 +115,8 @@
this.crtBrightnessValue = "已注册!" this.crtBrightnessValue = "已注册!"
//console.log("the " + filenm + " is exists.") //console.log("the " + filenm + " is exists.")
this.$setY("id_yes", 0); this.$setY("id_yes", 0);
var global = require("factory_dataStorage.js");
global.setFactoryData("licenseAuthor", 1);
this.checkAutoFactory(); this.checkAutoFactory();
return; return;
} }
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
data: { data: {
crtLocalTime: "NA", crtLocalTime: "NA",
crtTextRtcText: "NA", crtTextRtcText: "NA",
crtfilesLocalTime:"NA", crtfilesLocalTime: "NA",
imgCnt: 0, imgCnt: 0,
pngCnt: 0, pngCnt: 0,
gifIconSrc: "", gifIconSrc: "",
...@@ -77,20 +77,27 @@ ...@@ -77,20 +77,27 @@
touchedYesButton: function (node, topNode, x, y) { touchedYesButton: function (node, topNode, x, y) {
this.checkAutoFactory(); this.checkAutoFactory();
if (globalThis.factoryTest.autoStart == 1) var global = require("factory_dataStorage.js");
//if (globalThis.factoryTest.autoStart == 1)
if (global.getFactoryData("autoStart") == 1)
return; return;
globalThis.factoryTest.rtc = 1; //globalThis.factoryTest.rtc = 1;
global.setFactoryData("rtc", 1);
var yesJumpPage = require("factoryYesJumpPage.js"); var yesJumpPage = require("factoryYesJumpPage.js");
//console.log("=====yesJumpPage.yesGoToNextPage(factoryTestSound);") //console.log("=====yesJumpPage.yesGoToNextPage(factoryTestSound);")
yesJumpPage.yesGoToNextPage("factoryTestRtc"); yesJumpPage.yesGoToNextPage("factoryTestRtc");
}, },
touchedNGButton: function (node, topNode, x, y) { 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({ router.push({
path: "factory_testList", path: "factory_testList",
}); });
}, },
touchedBackButton: function (node, topNode, x, y) { touchedBackButton: function (node, topNode, x, y) {
// var global = require("factory_dataStorage.js");
//global.setFactoryData("rtc", 3);
router.push({ router.push({
path: "factory_testList", path: "factory_testList",
}); });
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
// this.crtBrightnessValue = "点击开始测试播放"; // this.crtBrightnessValue = "点击开始测试播放";
// this.$hide("id_yes"); // this.$hide("id_yes");
// document.setAttribute('id_enableWLANPageList', 'list-set-edge-flash', false); // document.setAttribute('id_enableWLANPageList', 'list-set-edge-flash', false);
// wifiEventJS.connect_wifi(initWifissid, initWifipwd);
// wifiEventJS.enableWLANSwitch(); // wifiEventJS.enableWLANSwitch();
// this.testTimer = this.$setTimeout(this.InterValTime, 5000, [], this); // this.testTimer = this.$setTimeout(this.InterValTime, 5000, [], this);
...@@ -80,22 +80,29 @@ ...@@ -80,22 +80,29 @@
}, },
touchedYesButton: function (node, topNode, x, y) { 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(); this.checkAutoFactory();
if (globalThis.factoryTest.autoStart == 1) if (global.getFactoryData("autoStart") == 1)
return; return;
globalThis.factoryTest.sound = 1;
var yesJumpPage = require("factoryYesJumpPage.js"); var yesJumpPage = require("factoryYesJumpPage.js");
//console.log("=====yesJumpPage.yesGoToNextPage(factoryTestSound);") //console.log("=====yesJumpPage.yesGoToNextPage(factoryTestSound);")
yesJumpPage.yesGoToNextPage("factoryTestSound"); yesJumpPage.yesGoToNextPage("factoryTestSound");
}, },
touchedNGButton: function (node, topNode, x, y) { 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({ router.push({
path: "factory_testList", path: "factory_testList",
}); });
}, },
touchedBackButton: function (node, topNode, x, y) { touchedBackButton: function (node, topNode, x, y) {
// var global = require("factory_dataStorage.js");
// global.setFactoryData("sound", 3);
router.push({ router.push({
path: "factory_testList", path: "factory_testList",
}); });
......
...@@ -396,8 +396,8 @@ ...@@ -396,8 +396,8 @@
}); });
}, },
touchedBackButton: function (node, topNode, x, y) { touchedBackButton: function (node, topNode, x, y) {
var global = require("factory_dataStorage.js"); //var global = require("factory_dataStorage.js");
global.setFactoryData("touch", 3); //global.setFactoryData("touch", 3);
this.exit(); this.exit();
router.push({ router.push({
path: "factory_testList", path: "factory_testList",
......
...@@ -94,6 +94,10 @@ ...@@ -94,6 +94,10 @@
this.$setTextColor("id_humidity", "#00ff00"); this.$setTextColor("id_humidity", "#00ff00");
}, },
checkAutoFactory: function (node, topNode, x, y) { checkAutoFactory: function (node, topNode, x, y) {
if (global.getFactoryData("autoStart") == 1) {
this.clearTimer();
}
require("factory_testAuto.js").autoFactoryNextPage("factoryTestTvoc"); require("factory_testAuto.js").autoFactoryNextPage("factoryTestTvoc");
}, },
InterValTime: function () { InterValTime: function () {
...@@ -105,9 +109,9 @@ ...@@ -105,9 +109,9 @@
if (t > 0 && h > 0) { if (t > 0 && h > 0) {
this.setValue(t, h); this.setValue(t, h);
var global = require("factory_dataStorage.js");
global.setFactoryData("tvoc", 1);
this.checkAutoFactory(); this.checkAutoFactory();
if (globalThis.factoryTest.autoStart == 1)
return;
} }
else { else {
this.naValueSet(); this.naValueSet();
...@@ -116,6 +120,7 @@ ...@@ -116,6 +120,7 @@
onShow: function () { onShow: function () {
//this.$setY("id_yes", -480); //this.$setY("id_yes", -480);
this.$setY("id_yes", -480);
this.InterValTime(); this.InterValTime();
this.testTimer = this.$setInterval(this.InterValTime, 3000, [], this); this.testTimer = this.$setInterval(this.InterValTime, 3000, [], this);
...@@ -134,13 +139,18 @@ ...@@ -134,13 +139,18 @@
}, },
touchedYesButton: function (node, topNode, x, y) { 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"); var yesJumpPage = require("factoryYesJumpPage.js");
yesJumpPage.yesGoToNextPage("factoryTestTvoc"); yesJumpPage.yesGoToNextPage("factoryTestTvoc");
}, },
touchedNGButton: function (node, topNode, x, y) { 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({ router.push({
path: "factory_testList", path: "factory_testList",
}); });
......
...@@ -1108,6 +1108,8 @@ ...@@ -1108,6 +1108,8 @@
console.log("okok"); console.log("okok");
this.wifiInfoState_TEXT = "WIFI测试成功" this.wifiInfoState_TEXT = "WIFI测试成功"
this.$setY("id_yes", 0); this.$setY("id_yes", 0);
var global = require("factory_dataStorage.js");
global.setFactoryData("wifi", 1);
this.checkAutoFactory(); this.checkAutoFactory();
return; return;
} else { } else {
...@@ -1136,7 +1138,7 @@ ...@@ -1136,7 +1138,7 @@
this.goToConnectWifi(); this.goToConnectWifi();
}, },
onShow: function () { onShow: function () {
this.$setY("id_yes", -480);
this.$setOpacity("id_startscanWifiHide", 0.7) this.$setOpacity("id_startscanWifiHide", 0.7)
this.$setOpacity("id_startscanWifi_List_hide", 0.5) this.$setOpacity("id_startscanWifi_List_hide", 0.5)
......
...@@ -150,8 +150,8 @@ ...@@ -150,8 +150,8 @@
onShow: function () { onShow: function () {
for(var i = 1; i <= 3; i++){ for (var i = 1; i <= 3; i++) {
for(var j = 1; j <= 5; j++){ for (var j = 1; j <= 5; j++) {
this.$setOpacity("systemId" + i + "_TextHeader" + j, 0.5) this.$setOpacity("systemId" + i + "_TextHeader" + j, 0.5)
} }
this.$setOpacity("systemId" + i + "_TextTips", 0.5) this.$setOpacity("systemId" + i + "_TextTips", 0.5)
...@@ -213,19 +213,15 @@ ...@@ -213,19 +213,15 @@
}, },
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.systemCheck = 2;
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) { touchedBackButton: function (node, topNode, x, y) {
this.movePage("systemId"+this.pagecnt, "systemId1"); this.movePage("systemId" + this.pagecnt, "systemId1");
this.pagecnt = 1; 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); //console.log("=====globalThis.factoryTest.systemCheck:"+globalThis.factoryTest.systemCheck);
var yesJumpPage = require("factoryYesJumpPage.js"); var yesJumpPage = require("factoryYesJumpPage.js");
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
// var systemCtrl = require("systemCtrl.js"); // var systemCtrl = require("systemCtrl.js");
var systemCtrl = require("systemCtrl.js"); var systemCtrl = require("systemCtrl.js");
var yesJumpPage = require("factoryYesJumpPage.js"); var yesJumpPage = require("factoryYesJumpPage.js");
var global = require("factory_dataStorage.js");
var onestart = 1; var onestart = 1;
// var _userdata = require("userdata.js"); // var _userdata = require("userdata.js");
...@@ -184,46 +185,13 @@ ...@@ -184,46 +185,13 @@
}, },
/*************** struct ***************/ /*************** struct ***************/
onInit: function () { onInit() {
//this.activePage= "id_languageBasicPage"; // 首次运行把磁盘数据一次性搬进内存
this.onlyOnceFlag = 0; global.loadFromDiskOnce();
if (globalThis.factoryTest == undefined) { global.setFactoryData("autoStart", 0);
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();
}, },
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 () { snShow: function () {
// var sysVersion = libwifi.getSysVersion("get"); // var sysVersion = libwifi.getSysVersion("get");
var sysVersion = "The code has been annotated" var sysVersion = "The code has been annotated"
...@@ -237,39 +205,25 @@ ...@@ -237,39 +205,25 @@
yesJumpPage.initPage(this.appItem); yesJumpPage.initPage(this.appItem);
yesJumpPage.testCode(this) yesJumpPage.testCode(this)
}, },
initShow: function () { initShow: function () {
this.snShow(); this.snShow();
this.timerSet(); 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 () { onShow: function () {
//lvgl.lv_set_screen_transparent(false); //lvgl.lv_set_screen_transparent(false);
//console.log(this.$uri + "===========onShow============="); //console.log(this.$uri + "===========onShow=============");
if (global.getFactoryData("autoStart") == 1) {
global.setFactoryData("autoStart", 0); // 确保设置 autoStart 为 0
}
if (userData.factoryFlag != 1) { if (userData.factoryFlag != 1) {
userData.factoryFlag = 1; userData.factoryFlag = 1;
} }
//console.log("wifiEventJS.enableWLANScanValue()================================================1"); //console.log("wifiEventJS.enableWLANScanValue()================================================1");
if (onestart) { if (onestart) {
var wifiEventJS = require("factory_testWifi.js"); var wifiEventJS = require("factory_testWifi.js");
if(globalThis.factoryTest.wifi != 0) if (globalThis.factoryTest.wifi != 0)
wifiEventJS.enableWLANScanValue(); wifiEventJS.enableWLANScanValue();
//console.log("wifiEventJS.enableWLANScanValue()================================================2"); //console.log("wifiEventJS.enableWLANScanValue()================================================2");
onestart = 0; onestart = 0;
...@@ -294,21 +248,6 @@ ...@@ -294,21 +248,6 @@
require("factory_testBurnIn.js").exStopagainMp4(); //从老测测试退出重新执行一次退出视频,防止卡图层 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 () { onHide: function () {
...@@ -348,18 +287,21 @@ ...@@ -348,18 +287,21 @@
return; return;
} }
if (url == "factoryTestClearAll") { if (url == "factoryTestClearAll") {
this.clearValue() global.clearFactoryData();
this.testStatus();
//console.log("==============factoryTestClearAll================"); //console.log("==============factoryTestClearAll================");
this.initShow(); this.initShow();
return; return;
} }
if (url == "factoryTestStart") { if (url == "factoryTestStart") {
//console.log("==============factoryTestStart================"); //console.log("==============factoryTestStart================");
globalThis.factoryTest.autoStart = 1; //globalThis.factoryTest.autoStart = 1;
global.setFactoryData("autoStart", 1);
url = "factoryTestColor"; url = "factoryTestColor";
} }
else{ else {
globalThis.factoryTest.autoStart = 2; //globalThis.factoryTest.autoStart = 2;
global.setFactoryData("autoStart", 2);
} }
if (url == "factoryTestExit") { if (url == "factoryTestExit") {
var systemCtrl = require("systemCtrl.js"); var systemCtrl = require("systemCtrl.js");
...@@ -374,38 +316,35 @@ ...@@ -374,38 +316,35 @@
blockColorChange: function (relId, val) { blockColorChange: function (relId, val) {
//console.log("relId:" + relId + " val:" + val); //console.log("relId:" + relId + " val:" + val);
const colors = [0x9E9E9E, 0x4CB050, 0xF44236]; 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 () { },
testStatus() {
const testMappings = [ const ID_KEY_MAP = {
{ index: 0, property: "color" }, 'id_factoryTestColor': 'color',
{ index: 1, property: "touch" }, 'id_factoryTestTouch': 'touch',
{ index: 2, property: "wifi" }, 'id_factoryTestWifi': 'wifi',
{ index: 3, property: "sound" }, 'id_factoryTestSound': 'sound',
{ index: 4, property: "uartComm" }, 'id_factory_testUartComm': 'uartComm',
{ index: 5, property: "bright" }, 'id_factoryTestBright': 'bright',
{ index: 6, property: "licenseAuthor" }, 'id_factoryTestLicenseAuthor': 'licenseAuthor',
{ index: 7, property: "rtc" }, 'id_factoryTestRtc': 'rtc',
{ index: 8, property: "tvoc" }, 'id_factoryTestTvoc': 'tvoc',
{ index: 9, property: "burnIn" }, 'id_factoryTestBurnIn': 'burnIn',
{ index: 10, property: "systemCheck" }, 'id_factoryTestsystemCheck': 'systemCheck',
{ index: 11, property: "clearAll" }, 'id_factoryTestClearAll': 'clearAll',
// { index: 9, property: "pcba" }, 'id_factoryTestStart': 'start'
{ index: 12, property: "start" }, }
];
testMappings.forEach(mapping => { this.appItem.forEach(item => {
const appItem = this.appItem[mapping.index]; const key = ID_KEY_MAP[item.id]
if (appItem) { if (key) {
this.blockColorChange(appItem.id, globalThis.factoryTest[mapping.property]); const val = globalThis.factoryTest[key]
this.blockColorChange(item.id, val)
} }
}); })
}, },
touchedBg: function (node, topnode, x, y) { touchedBg: function (node, topnode, x, y) {
...@@ -419,69 +358,7 @@ ...@@ -419,69 +358,7 @@
this.beepTimerOutId = this.$setTimeout(this.beepTimerOut, 500, [], this); 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 () { beepTimerOut: function () {
// rd190_factory.pwm(0); // rd190_factory.pwm(0);
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
var _userdata = require("userdata.js"); var _userdata = require("userdata.js");
var userData = _userdata.userData; var userData = _userdata.userData;
var serialManager = require("serialmanager.js"); var serialManager = require("serialmanager.js");
var sendValue = 0;
export default { export default {
data: { data: {
...@@ -58,21 +57,28 @@ ...@@ -58,21 +57,28 @@
recvCommValueText: "0" recvCommValueText: "0"
}, },
onInit() { onInit() {
this.sendValue = 0;
}, },
InterValTime: function () { InterValTime: function () {
//console.log("sendValue:" + sendValue); //console.log("this.sendValue:" + this.sendValue);
sendValue += 1; this.sendValue += 1;
packet_cmd.pack_cmd_packet_0x50(); packet_cmd.pack_cmd_packet_0x50();
console.log("userData.factoryFlag:" + userData.factoryFlag); console.log("userData.factoryFlag:" + userData.factoryFlag);
this.sendCommValueText = "" + sendValue; this.sendCommValueText = "" + this.sendValue;
this.recvCommValueText = "" + userData.factoryRecvCnt; this.recvCommValueText = "" + userData.factoryRecvCnt;
if (userData.factoryRecvCnt > 0) { if (userData.factoryRecvCnt > 0) {
this.$setY("id_yes", 0); this.$setY("id_yes", 0);
var global = require("factory_dataStorage.js");
global.setFactoryData("uartComm", 1);
this.checkAutoFactory(); this.checkAutoFactory();
} }
}, },
checkAutoFactory: function (node, topNode, x, y) { 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 () { uartComm: function () {
console.log("uartComm"); console.log("uartComm");
...@@ -115,23 +121,32 @@ ...@@ -115,23 +121,32 @@
clearTimer: function () { clearTimer: function () {
serialManager.close(); serialManager.close();
this.$clearInterval(this.testTimer); this.$clearInterval(this.testTimer);
userData.factoryRecvCnt = 0;
}, },
touchedYesButton: function (node, topNode, x, y) { touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.uartComm = 1; //globalThis.factoryTest.uartComm = 1;
userData.factoryRecvCnt = 0; this.clearTimer();
var global = require("factory_dataStorage.js");
global.setFactoryData("uartComm", 1);
var yesJumpPage = require("factoryYesJumpPage.js"); var yesJumpPage = require("factoryYesJumpPage.js");
//console.log("=====yesJumpPage.yesGoToNextPage(factoryTestUartComm);") //console.log("=====yesJumpPage.yesGoToNextPage(factory_testUartComm);")
yesJumpPage.yesGoToNextPage("factoryTestUartComm"); yesJumpPage.yesGoToNextPage("factory_testUartComm");
}, },
touchedNGButton: function (node, topNode, x, y) { 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({ router.push({
path: "factory_testList", path: "factory_testList",
}); });
}, },
touchedBackButton: function (node, topNode, x, y) { touchedBackButton: function (node, topNode, x, y) {
// var global = require("factory_dataStorage.js");
// global.setFactoryData("uartComm", 3);
router.push({ router.push({
path: "factory_testList", 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"); ...@@ -5,6 +5,7 @@ const fs = require("@system.fs");
var systemCtrl = require("systemCtrl.js"); var systemCtrl = require("systemCtrl.js");
var lvgl = require("@native.lvgl7"); var lvgl = require("@native.lvgl7");
var router = require("@system.router"); var router = require("@system.router");
var global = require("factory_dataStorage.js");
var id_testRtcTimer = null; var id_testRtcTimer = null;
var that; var that;
var thatList var thatList
...@@ -21,8 +22,8 @@ var flageMap = { ...@@ -21,8 +22,8 @@ var flageMap = {
"factoryTestLicenseAuthor": "licenseAuthor", "factoryTestLicenseAuthor": "licenseAuthor",
"factoryTestRtc": "rtc", "factoryTestRtc": "rtc",
"factoryTestTvoc": "tvoc", "factoryTestTvoc": "tvoc",
"factoryTestBurnIn": "burnIn",
"factoryTestsystemCheck": "systemCheck", "factoryTestsystemCheck": "systemCheck",
"factoryTestBurnIn": "burnIn",
"factoryTestClearAll": "clearAll", "factoryTestClearAll": "clearAll",
"factoryTestStart": "start", "factoryTestStart": "start",
"factoryTestExit": "exit" "factoryTestExit": "exit"
...@@ -38,13 +39,13 @@ var autoMovePage = [ ...@@ -38,13 +39,13 @@ var autoMovePage = [
"factoryTestLicenseAuthor", "factoryTestLicenseAuthor",
"factoryTestRtc", "factoryTestRtc",
"factoryTestTvoc", "factoryTestTvoc",
// "factoryTestBurnIn",
"factoryTestsystemCheck", "factoryTestsystemCheck",
// "factoryTestBurnIn",
// "factoryTestClearAll", // "factoryTestClearAll",
// "factoryTestStart" // "factoryTestStart"
]; ];
var exitNextPage = "factory_testList"; var exitNextPage = "factoryTestBurnIn";
// ✅ 获取下一个测试页面 // ✅ 获取下一个测试页面
...@@ -60,24 +61,29 @@ function autoFactoryNextPage(curPageName) { ...@@ -60,24 +61,29 @@ function autoFactoryNextPage(curPageName) {
if (!curPageName) return; if (!curPageName) return;
console.log("[autoFactoryNextPage] 当前页面:" + curPageName); console.log("[autoFactoryNextPage] 当前页面:" + curPageName);
console.log("[autoFactoryNextPage] autoStart状态:" + globalThis.factoryTest.autoStart); console.log("[autoFactoryNextPage] autoStart状态:" + global.getFactoryData("autoStart"));
if (globalThis.factoryTest.autoStart == 1) { // if (globalThis.factoryTest.autoStart == 1) {
if (global.getFactoryData("autoStart") == 1) {
// if (1) { // if (1) {
var testKey = flageMap[curPageName]; var testKey = flageMap[curPageName];
if (!testKey) { if (!testKey) {
console.warn("[autoFactoryNextPage] 未映射的页面:" + curPageName); console.warn("[autoFactoryNextPage] 未映射的页面:" + curPageName);
return; return;
} }
globalThis.factoryTest[testKey] = 1; //globalThis.factoryTest[testKey] = 1;
if (globalThis.factoryTest[testKey] === 1) { global.setFactoryData(testKey, 1);
// if (globalThis.factoryTest[testKey] === 1) {
if (global.getFactoryData(testKey) === 1) {
var nextPage = getNextTest(curPageName); var nextPage = getNextTest(curPageName);
if (nextPage) { if (nextPage) {
console.log("[autoFactoryNextPage] 自动跳转到:" + nextPage); console.log("[autoFactoryNextPage] 自动跳转到:" + nextPage);
router.push({ path: nextPage }); router.push({ path: nextPage });
} else { } else {
console.log("[autoFactoryNextPage] 已到达最后一页,跳转结束。"); console.log("[autoFactoryNextPage] 已到达最后一页,跳转结束。");
globalThis.factoryTest.autoStart = 0; // 可选:停止自动流程 //globalThis.factoryTest.autoStart = 0; // 可选:停止自动流程
global.setFactoryData("autoStart", 0);
router.push({ path: exitNextPage }); router.push({ path: exitNextPage });
} }
} else { } else {
......
...@@ -8,6 +8,7 @@ var id_testBurnInTimer = null; ...@@ -8,6 +8,7 @@ var id_testBurnInTimer = null;
var that; var that;
var strMemtesterCnt = 0; // 初始化测试掩码计数器 var strMemtesterCnt = 0; // 初始化测试掩码计数器
var exStopagainMp4Flag = false; var exStopagainMp4Flag = false;
var testVal;
// 测试掩码映射表 // 测试掩码映射表
const testMaskMap = { const testMaskMap = {
"0x1": "Compare XOR", "0x1": "Compare XOR",
...@@ -53,6 +54,11 @@ function initFactoryTestBurnIn(obj) { ...@@ -53,6 +54,11 @@ function initFactoryTestBurnIn(obj) {
} }
function quitFactoryTestBurnIn() { function quitFactoryTestBurnIn() {
var global = require("factory_dataStorage.js");
global.setFactoryData("burnIn", testVal);
system("killall -9 memtester 2>/dev/null") system("killall -9 memtester 2>/dev/null")
//console.log("quitFactoryTestBurnIn"); //console.log("quitFactoryTestBurnIn");
if (id_testBurnInTimer != null) { if (id_testBurnInTimer != null) {
...@@ -61,7 +67,6 @@ function quitFactoryTestBurnIn() { ...@@ -61,7 +67,6 @@ function quitFactoryTestBurnIn() {
} }
exitMp4(); exitMp4();
} }
...@@ -192,7 +197,9 @@ function updateBurnInInfo() { ...@@ -192,7 +197,9 @@ function updateBurnInInfo() {
var values = [that.crtCPUModel, that.crtCPUCores, that.crtCurrentFrequency, that.crtCpuLoad, that.crtMemoryTotal, that.crtMemoryUsed, 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"); 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() { ...@@ -107,7 +107,8 @@ function updateRtcInfo() {
var state = 0; var state = 0;
that.crtTextRtcText = state ? "测试通过" : "测试失败"; that.crtTextRtcText = state ? "测试通过" : "测试失败";
setTextColorByText(that, 'id_crtTextRtcText', that.crtTextRtcText); 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); that.$setY("id_yes", state ? 0 : -480);
console.log("[RTC] 测试完成,最终状态:" + (state ? "通过" : "失败")); console.log("[RTC] 测试完成,最终状态:" + (state ? "通过" : "失败"));
} else { } else {
...@@ -118,10 +119,15 @@ function updateRtcInfo() { ...@@ -118,10 +119,15 @@ function updateRtcInfo() {
var state = 1; var state = 1;
that.crtTextRtcText = state ? "测试通过" : "测试失败"; that.crtTextRtcText = state ? "测试通过" : "测试失败";
setTextColorByText(that, 'id_crtTextRtcText', that.crtTextRtcText); 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); that.$setY("id_yes", state ? 0 : -480);
console.log("[RTC] 测试完成,最终状态:" + (state ? "通过" : "失败")); 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 { } else {
oneTest(); oneTest();
} }
......
...@@ -64,13 +64,20 @@ function setTextColorByValue(that, fullKey, value) { ...@@ -64,13 +64,20 @@ function setTextColorByValue(that, fullKey, value) {
if (checkedCount == textValueKeys.length) { if (checkedCount == textValueKeys.length) {
that.factoryTestSystemCheck = (ngCount == 0) ? 1 : 2; that.factoryTestSystemCheck = (ngCount == 0) ? 1 : 2;
if(that.factoryTestSystemCheck == 1){
checkAutoFactory();
}
// 重置计数器,方便下次调用 // 重置计数器,方便下次调用
checkedCount = 0; checkedCount = 0;
ngCount = 0; ngCount = 0;
} }
} }
function checkAutoFactory() {
var global = require("factory_dataStorage.js");
global.setFactoryData("systemCheck", 1);
stopSystemInfoTimer();
require("factory_testAuto.js").autoFactoryNextPage("factoryTestsystemCheck");
}
// 获取系统信息 // 获取系统信息
function updateSystemInfo() { 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