diff --git a/main.aardio b/main.aardio
index 486fc2a..71b718e 100644
--- a/main.aardio
+++ b/main.aardio
@@ -116,8 +116,9 @@ udpSend = function(d){
getStatus = function(){
+ //-1:未上电 0:离线 1:在线
var seed = string.random("Success","Fault","PowerDown")
- return {state=seed};
+ return {state={math.random(-1,1),math.random(-1,1),math.random(-1,1)}};
}
diff --git a/res/cfg.json b/res/cfg.json
index c79ac73..159e768 100644
--- a/res/cfg.json
+++ b/res/cfg.json
@@ -182,10 +182,10 @@
"data": {
"maxBarCnt":"60",
"items": [
- {"color": "#808080"},
- {"color": "#808080"},
- {"color": "#808080"},
- {"color": "#808080"},
+ //{"color": "#808080"},
+ //{"color": "#808080"},
+ //{"color": "#808080"},
+ //{"color": "#808080"},
]
},
"body": [
@@ -194,7 +194,7 @@
"name": "items",
"items": {
"type": "tpl",
- "tpl": "
",
+ "tpl": "
",
"style": {
"display": "inline-block",
"marginRight": "5px",
@@ -208,7 +208,7 @@
"actions": [
{
"actionType": "custom",
- "script": "const colorMap={'Success':'#00ff00','Fault':'#ff0000','PowerDown':'#808080'};\n const ncolor = colorMap[event.data.responseData.state];\n console.log(event.data.responseData.state,ncolor);\ncontext.props.data.items.push({'color':ncolor})\nif (context.props.data.items.length > context.props.data.maxBarCnt) {\n context.props.data.items.shift(); // Remove the oldest value\n};"
+ "script": "const colorMap=['#808080','#ff0000','#00ff00'];\n const ncolor = [colorMap[event.data.responseData.state[0]+1],colorMap[event.data.responseData.state[1]+1],colorMap[event.data.responseData.state[2]+1]];\n console.log(event.data.responseData.state,ncolor);\ncontext.props.data.items.push({'color':ncolor})\nif (context.props.data.items.length > context.props.data.maxBarCnt) {\n context.props.data.items.shift(); // Remove the oldest value\n};"
}
]
}