flow: fix process_pixel

This commit is contained in:
Romain Bazile 2021-11-03 12:08:23 +01:00
parent e6ea8cc6af
commit 2d2ed20bdf

View file

@ -59,7 +59,7 @@
"id": "f21ba04.c26266",
"type": "tab",
"label": "WIFI Management",
"disabled": true,
"disabled": false,
"info": ""
},
{
@ -699,7 +699,6 @@
{
"id": "1b49ae0f.602d6a",
"type": "ui_tab",
"d": true,
"name": "Wifi",
"icon": "wifi",
"order": 8,
@ -4596,7 +4595,7 @@
"type": "function",
"z": "baa1e3d9.cb29d",
"name": "imaged volume calc",
"func": "camera = global.get(\"acq_camera\");\ncell = global.get(\"acq_celltype\");\nnb_frame = global.get(\"nb_frame\");\nglobal.get(\"process_pixel\",process_pixel);\n\nvar volume = 0\nif (camera == \"HQ Camera\"){\n volume = nb_frame * (process_pixel*4056*process_pixel*3040*cell/1000000000) / 1000;\n}\nelse if (camera == \"Camera v2.1\"){\n volume = nb_frame * (process_pixel*3280*process_pixel*2464*cell/1000000000) / 1000;\n}\nelse{\n msg.payload = \"The camera is not known to this system\";\n return msg;\n}\n\nglobal.set(\"acq_imaged_volume\", volume.toFixed(4))\n\nmsg.payload = volume.toFixed(2) + \" mL\"\nreturn msg;",
"func": "camera = global.get(\"acq_camera\");\ncell = global.get(\"acq_celltype\");\nnb_frame = global.get(\"nb_frame\");\nprocess_pixel = global.get(\"process_pixel\");\n\nvar volume = 0\nif (camera == \"HQ Camera\"){\n volume = nb_frame * (process_pixel*4056*process_pixel*3040*cell/1000000000) / 1000;\n}\nelse if (camera == \"Camera v2.1\"){\n volume = nb_frame * (process_pixel*3280*process_pixel*2464*cell/1000000000) / 1000;\n}\nelse{\n msg.payload = \"The camera is not known to this system\";\n return msg;\n}\n\nglobal.set(\"acq_imaged_volume\", volume.toFixed(4))\n\nmsg.payload = volume.toFixed(2) + \" mL\"\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
@ -5229,10 +5228,9 @@
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "getInfo",
"x": 460,
"x": 450,
"y": 180,
"wires": [
[
@ -5247,7 +5245,7 @@
"type": "function",
"z": "f21ba04.c26266",
"name": "parse IP Info",
"func": "var ip = \"\";\nvar broadcast = \"\";\nvar iface = \"\";\nvar iface_up = false;\n\nif (msg.rc.code === 0){\n payload = msg.payload\n for (let info in payload) {\n if (payload[info].operstate === \"UP\") {\n \tif (iface_up){\n \t// We have two concurrent interfaces up\n // We need to deactivate one\n ip = \"Remove Ethernet cable or disconnect wifi\"\n broadcast = \"Remove Ethernet cable or disconnect wifi\"\n iface = \"Remove Ethernet cable or disconnect wifi\"\n break\n }\n if (payload[info].ifname === \"eth0\") {\n iface = \"Ethernet\"\n } else if (payload[info].ifname === \"wifi0\") {\n iface = \"Wifi\"\n }\n ip = payload[info].addr_info[0].local;\n broadcast = payload[info].addr_info[0].broadcast;\n iface_up = true;\n }\n }\n}\n\nif (iface_up) {\n return([{\n topic: 'interface',\n payload: iface\n }, {\n topic: 'ip',\n payload: ip\n }, {\n topic: 'broadcast',\n payload: broadcast\n }])\n}\n",
"func": "var ip = \"\";\nvar broadcast = \"\";\nvar iface = \"\";\nvar iface_up = false;\n\nif (msg.rc.code === 0){\n payload = msg.payload\n for (let info in payload) {\n if (payload[info].operstate === \"UP\") {\n \tif (iface_up){\n \t// We have two concurrent interfaces up\n // We need to deactivate one\n ip = \"Remove Ethernet cable or disconnect wifi\"\n broadcast = \"Remove Ethernet cable or disconnect wifi\"\n iface = \"Remove Ethernet cable or disconnect wifi\"\n break\n }\n if (payload[info].ifname === \"eth0\") {\n iface = \"Ethernet\"\n } else if (payload[info].ifname === \"wifi0\" || payload[info].ifname === \"wlan0\") {\n iface = \"Wifi\"\n }\n ip = payload[info].addr_info[0].local;\n broadcast = payload[info].addr_info[0].broadcast;\n iface_up = true;\n }\n }\n}\n\nif (iface_up) {\n return([{\n topic: 'interface',\n payload: iface\n }, {\n topic: 'ip',\n payload: ip\n }, {\n topic: 'broadcast',\n payload: broadcast\n }])\n}\n",
"outputs": 3,
"noerr": 0,
"initialize": "",
@ -5385,7 +5383,7 @@
"id": "448b4c37.be50bc",
"type": "exec",
"z": "f21ba04.c26266",
"command": "iwgetid",
"command": "iw dev wlan0 info",
"addpay": false,
"append": "",
"useSpawn": "false",
@ -5423,7 +5421,7 @@
"type": "function",
"z": "f21ba04.c26266",
"name": "parse SSID",
"func": "var ssid = \"\"\n\nif (msg.rc.code === 0){\n ssid = msg.payload.match(/ESSID:\"([^\"]+)\"/)[1];\n return({topic: 'ssid', payload: ssid})\n}\n",
"func": "var ssid = \"\"\n\nif (msg.rc.code === 0){\n ssid = msg.payload.match(/\\sssid (.+)/)[1];\n return({topic: 'ssid', payload: ssid})\n}\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
@ -10909,10 +10907,10 @@
"vt": "str"
}
],
"repeat": "",
"repeat": "60",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"onceDelay": "2",
"topic": "",
"payload": "",
"payloadType": "date",