phoddie / node-red-mcu

Node-RED for microcontrollers
120 stars 18 forks source link

modify font(again PR #124) #125

Closed NW-Lab closed 3 months ago

NW-Lab commented 3 months ago

Hello

sorry. I've recreated my repository, so I'll post it again.

https://github.com/phoddie/node-red-mcu/discussions/123

This is a pull request that retrieves data from the manifest.

sample flows.json

[
    {
        "id": "2850f35f75df23f3",
        "type": "tab",
        "label": "フロー 1",
        "disabled": false,
        "info": "",
        "env": [],
        "_mcu": {
            "mcu": true
        }
    },
    {
        "id": "6f25147b3fbdcb14",
        "type": "ui_button",
        "z": "2850f35f75df23f3",
        "name": "",
        "group": "e6c51ee3d8c53c19",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "ボタンA",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "A",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "_mcu": {
            "mcu": true
        },
        "x": 200,
        "y": 100,
        "wires": [
            [
                "e21165264019e11a"
            ]
        ]
    },
    {
        "id": "e21165264019e11a",
        "type": "ui_text",
        "z": "2850f35f75df23f3",
        "group": "e6c51ee3d8c53c19",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "",
        "format": "{{msg.payload}}",
        "layout": "row-left",
        "className": "",
        "_mcu": {
            "mcu": true
        },
        "x": 370,
        "y": 140,
        "wires": []
    },
    {
        "id": "0847560dfe136935",
        "type": "ui_button",
        "z": "2850f35f75df23f3",
        "name": "",
        "group": "e6c51ee3d8c53c19",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "ボタンB",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "B",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "_mcu": {
            "mcu": true
        },
        "x": 200,
        "y": 140,
        "wires": [
            [
                "e21165264019e11a"
            ]
        ]
    },
    {
        "id": "ae4ee17869ca773b",
        "type": "comment",
        "z": "2850f35f75df23f3",
        "name": "moddable_manifest",
        "info": "{\n  \"resources\": {\n    \"*-mask\": [\"c:\\\\tmp\\\\mcu\\\\*\"]\n  },\n  \"config\": {\n    \"DASHBOARD_FONT\": \"Noto\"\n  }\n}\n",
        "_mcu": {
            "mcu": true
        },
        "x": 230,
        "y": 40,
        "wires": []
    },
    {
        "id": "e6c51ee3d8c53c19",
        "type": "ui_group",
        "name": "デフォルト",
        "tab": "9d37bb202717d924",
        "order": 1,
        "disp": false,
        "width": "6",
        "collapse": false,
        "className": "",
        "_mcu": {
            "mcu": false
        }
    },
    {
        "id": "9d37bb202717d924",
        "type": "ui_tab",
        "name": "ホーム",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false,
        "_mcu": {
            "mcu": false
        }
    }
]

Sorry for the Japanese article. https://qiita.com/NWLab/private/c50766ff7dbb5b122425

Thank you.

phoddie commented 3 months ago

@NW-Lab – this looks reasonable. Before merging, would you consider the suggestion here? Thank you.

NW-Lab commented 3 months ago

@phoddie san I saw Suggestion. This is OK. I thought about it myself. This part runs on the MCU, but I couldn't understand it because I didn't know how to set the environment variables inside the MCU. Will the PC's environment variables be inherited?

Thank you.

phoddie commented 3 months ago

because I didn't know how to set the environment variables inside the MCU. Will the PC's environment variables be inherited?

The PC's environment won't work reliably on the MCU. But, each Node-RED flow has environment variables. They are available on the MCU (nodered2mcu includes them in the generated JavaScript). Here's an example of setting an environment variable in the Node-RED Editor.

https://github.com/phoddie/node-red-mcu/assets/6856458/a3d37a59-71c9-4c42-9766-70d1e6a94824

(You can also use Groups in the Node-RED Editor to set environment variables for a set of nodes, but that isn't useful for this case....)

NW-Lab commented 3 months ago

@phoddie Thank you for teaching me how to set environment variables. This is the first time I learned that it can be set for each Flow.

thank you.

phoddie commented 3 months ago

Merged. Please close this PR. Thank you,

NW-Lab commented 3 months ago

Thank you for merging.