ralphwetzel / node-red-mcu-plugin

Plugin to support the Node-RED implementation for microcontrollers
MIT License
35 stars 9 forks source link

Dashboard not appearing in LCD #50

Open spillz-dxb opened 5 months ago

spillz-dxb commented 5 months ago

Hi,

Been playing with this great piece of work, however ran into a small problem. While the flows work perfectly , except for some errors in xsbug, the dashboard dont appear on my m5stack fire and m5stack core2.

The environment is 
Welcome to Node-RED
===================

16 Apr 16:28:30 - [info] Node-RED version: v3.1.7
16 Apr 16:28:30 - [info] Node.js  version: v20.11.1
16 Apr 16:28:30 - [info] Windows_NT 10.0.22631 x64 LE
16 Apr 16:28:32 - [info] Loading palette nodes
16 Apr 16:28:34 - [info] Node-RED MCU Edition Runtime Version: #a02cd43
16 Apr 16:28:34 - [info] Node-RED MCU Edition Plugin  Version: v1.5.0
16 Apr 16:28:37 - [info] Moddable SDK Version: v4.6.0-0-g298fe72 (x86)
16 Apr 16:28:40 - [info] Dashboard version 3.6.5 started at /ui
16 Apr 16:28:41 - [info] Settings file  : C:\Users\sande\.node-red\settings.js
16 Apr 16:28:41 - [info] Context store  : 'default' [module=memory]
16 Apr 16:28:41 - [info] User directory : \Users\sande\.node-red
16 Apr 16:28:41 - [warn] Projects disabled : editorTheme.projects.enabled=false
16 Apr 16:28:41 - [info] Flows file     : \Users\sande\.node-red\flows.json

Error is `C:\Users\sande\Downloads\node-red-mcu-main\node-red-mcu-main\nodered.js (86) # Break: util.getSetting: cannot coerce undefined to object!`

Console output is 

`Starting build process...
Host system check: Windows 11 Home
MCU Build system check: p1.5.0 + #a02cd43 @ m4.6.0-0-g298fe72 (x86)
HOME directory check: C:\Users\sande
Creating build environment for platform esp32/m5stack.
Working directory: \Users\sande\.node-red\mcu-plugin-cache\6ml1pnfdqvl
$IDF_PATH is defined: C:\Users\sande\esp-idf-5.1.2\esp-idf
$IDF_TOOLS_PATH is defined: C:\Espressif
$LOCALAPPDATA is defined: C:\Users\sande\AppData\Local
> cd \Users\sande\.node-red\mcu-plugin-cache\6ml1pnfdqvl
UPLOAD_PORT = COM5
IDF_TOOLS_EXPORT_CMD = undefined
IDF_PYTHON_ENV_PATH = undefined
OPENOCD_SCRIPTS = undefined
ESP_IDF_VERSION = undefined
Creating build batch file...
> cmd.exe build.bat

C:\Users\sande\.node-red\mcu-plugin-cache\6ml1pnfdqvl>CALL "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat" 
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.0
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'
Setting PYTHONNOUSERSITE, was not set
Using Python in C:\Espressif\python_env\idf5.1_py3.11_env\Scripts\
Python 3.11.2
Using Git in C:\Espressif\tools\idf-git\2.43.0\cmd\
git version 2.43.0.windows.1
Checking Python compatibility
Setting IDF_PATH: C:\Users\sande\esp-idf-5.1.2\esp-idf

Adding ESP-IDF tools to PATH...
Not using an unsupported version of tool cmake found in PATH: 3.28.0.
Not using an unsupported version of tool ninja found in PATH: 1.11.0.
    C:\Espressif\tools\xtensa-esp-elf-gdb\12.1_20221002\xtensa-esp-elf-gdb\bin
    C:\Espressif\tools\riscv32-esp-elf-gdb\12.1_20221002\riscv32-esp-elf-gdb\bin
    C:\Espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\bin
    C:\Espressif\tools\xtensa-esp32s2-elf\esp-12.2.0_20230208\xtensa-esp32s2-elf\bin
    C:\Espressif\tools\xtensa-esp32s3-elf\esp-12.2.0_20230208\xtensa-esp32s3-elf\bin
    C:\Espressif\tools\riscv32-esp-elf\esp-12.2.0_20230208\riscv32-esp-elf\bin
    C:\Espressif\tools\esp32ulp-elf\2.35_20220830\esp32ulp-elf\bin
    C:\Espressif\tools\cmake\3.24.0\bin
    C:\Espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\bin
    C:\Espressif\tools\ninja\1.10.2\
    C:\Espressif\tools\idf-exe\1.0.3\
    C:\Espressif\tools\ccache\4.8\ccache-4.8-windows-x86_64
    C:\Espressif\tools\dfu-util\0.11\dfu-util-0.11-win64
    C:\Users\sande\esp-idf-5.1.2\esp-idf\tools

Checking if Python packages are up to date...
Python requirements are satisfied.
Constraint file: C:\Espressif\espidf.constraints.v5.1.txt
Requirement files:
 - C:\Users\sande\esp-idf-5.1.2\esp-idf\tools\requirements\requirements.core.txt
Python being checked: C:\Espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe

Detected installed tools that are not currently used by active ESP-IDF version.
For removing old versions of idf-driver use command 'python.exe C:\Users\sande\esp-idf-5.1.2\esp-idf\tools\idf_tools.py uninstall'
For free up even more space, remove installation packages of those tools. Use option 'python.exe C:\Users\sande\esp-idf-5.1.2\esp-idf\tools\idf_tools.py uninstall --remove-archives'.

Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

  idf.py build

mcconfig -d -x localhost:5004 -m -p esp32/m5stack
C:\Espressif\tools\idf-exe\1.0.3\idf.py.exe
C:\Users\sande\esp-idf-5.1.2\esp-idf\tools\idf.py
Using recommended ESP-IDF v5.1.2
        1 file(s) copied.
        1 file(s) copied.
        1 file(s) copied.
Reconfiguring ESP-IDF...
Executing action: reconfigure
Running cmake in directory C:\Users\sande\Projects\moddable\build\tmp\esp32\m5stack\debug\6ml1pnfdqvl\xsProj-esp32\build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=C:\Espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe -DESP_PLATFORM=1 -DSDKCONFIG_DEFAULTS=C:/Users/sande/Projects/moddable/build/tmp/esp32/m5stack/debug/6ml1pnfdqvl/xsProj-esp32/sdkconfig.mc -DSDKCONFIG_HEADER=C:\Users\sande\Projects\moddable\build\tmp\esp32\m5stack\debug\6ml1pnfdqvl\xsProj-esp32\build\config\sdkconfig.h -DCMAKE_MESSAGE_LOG_LEVEL=ERROR -DDEBUGGER_SPEED=460800 -DIDF_TARGET=esp32 -DESP32_SUBCLASS=esp32 -DSDKCONFIG_DEFAULTS=C:\Users\sande\Projects\moddable\build\tmp\esp32\m5stack\debug\6ml1pnfdqvl\xsProj-esp32\sdkconfig.mc -DCCACHE_ENABLE=1 C:\Users\sande\Projects\moddable\build\tmp\esp32\m5stack\debug\6ml1pnfdqvl\xsProj-esp32"...
Loading defaults file C:/Users/sande/Projects/moddable/build/tmp/esp32/m5stack/debug/6ml1pnfdqvl/xsProj-esp32/sdkconfig.mc...

-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/sande/Projects/moddable/build/tmp/esp32/m5stack/debug/6ml1pnfdqvl/xsProj-esp32/build
        1 file(s) copied.
# nodered2mcu flows
# xsc flows.xsb
# xsc main.xsb
# xsc mc\config.xsb
NMAKE : warning U4004: too many rules for target 'C:\Users\sande\Projects\moddable\build\tmp\esp32\m5stack\debug\6ml1pnfdqvl\ftimage.h.xsi'
# xsl modules
### 2037 instances, 2882 keys, 104 colors, 0 holes
### warning: nodered: Node.prototype.send() RED.#compatibility: not frozen
### warning: nodered: Node.prototype.send() RED.build() msgQueue: no const
### warning: nodered: Node.prototype.send() RED.build() compatibilityClasses: no const
### warning: mustache: default: not frozen
### warning: mustache: default.tags: not frozen
### warning: mustache: default.clearCache() defaultWriter: not frozen
### warning: mustache: default.clearCache() defaultWriter.templateCache: not frozen
### warning: mustache: default.clearCache() defaultWriter.templateCache._cache: not frozen
### warning: ui_nodes: registerTemplate() Templates: not frozen
### warning: ui_nodes: registerThemeBuilder() ThemeBuilders: not frozen
### warning: ui_nodes: default() model: not frozen
### warning: ui_nodes: default() model.tabs: not frozen
# cc mc.xs.o (slots in flash)
# mcrez resources
Total resource size: 115777 bytes
# cc mc.resources.o (slots in flash)
# ld xs_esp32.bin
        1 file(s) copied.
        1 file(s) copied.
Executing action: all (aliases: build)
Running ninja in directory C:\Users\sande\Projects\moddable\build\tmp\esp32\m5stack\debug\6ml1pnfdqvl\xsProj-esp32\build
Executing "ninja all"...
[1/7] Performing build step for 'bootloader'

[0/1] Re-running CMake...

-- Building ESP-IDF components for target esp32
-- Project sdkconfig file C:/Users/sande/Projects/moddable/build/tmp/esp32/m5stack/debug/6ml1pnfdqvl/xsProj-esp32/sdkconfig
Compiler supported targets: xtensa-esp32-elf

-- Adding linker script C:/Users/sande/esp-idf-5.1.2/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- App "bootloader" version: v5.1.2
-- Adding linker script C:/Users/sande/esp-idf-5.1.2/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script C:/Users/sande/esp-idf-5.1.2/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script C:/Users/sande/esp-idf-5.1.2/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script C:/Users/sande/esp-idf-5.1.2/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script C:/Users/sande/esp-idf-5.1.2/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.ld
-- Adding linker script C:/Users/sande/esp-idf-5.1.2/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp_app_format esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: C:/Users/sande/esp-idf-5.1.2/esp-idf/components/bootloader C:/Users/sande/esp-idf-5.1.2/esp-idf/components/bootloader_support C:/Users/sande/esp-idf-5.1.2/esp-idf/components/efuse C:/Users/sande/esp-idf-5.1.2/esp-idf/components/esp_app_format C:/Users/sande/esp-idf-5.1.2/esp-idf/components/esp_common C:/Users/sande/esp-idf-5.1.2/esp-idf/components/esp_hw_support C:/Users/sande/esp-idf-5.1.2/esp-idf/components/esp_rom C:/Users/sande/esp-idf-5.1.2/esp-idf/components/esp_system C:/Users/sande/esp-idf-5.1.2/esp-idf/components/esptool_py C:/Users/sande/esp-idf-5.1.2/esp-idf/components/freertos C:/Users/sande/esp-idf-5.1.2/esp-idf/components/hal C:/Users/sande/esp-idf-5.1.2/esp-idf/components/log C:/Users/sande/esp-idf-5.1.2/esp-idf/components/bootloader/subproject/main C:/Users/sande/esp-idf-5.1.2/esp-idf/components/bootloader/subproject/components/micro-ecc C:/Users/sande/esp-idf-5.1.2/esp-idf/components/newlib C:/Users/sande/esp-idf-5.1.2/esp-idf/components/partition_table C:/Users/sande/esp-idf-5.1.2/esp-idf/components/soc C:/Users/sande/esp-idf-5.1.2/esp-idf/components/spi_flash C:/Users/sande/esp-idf-5.1.2/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/sande/Projects/moddable/build/tmp/esp32/m5stack/debug/6ml1pnfdqvl/xsProj-esp32/build/bootloader
[1/1] cmd.exe /C "cd /D C:\Users\sande\Projects\moddable\build\tmp\esp32\m5stack\debug\6ml1pnfdqvl\xsProj-esp32\build\bootloader\esp-idf\esptool_py && C:\Espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe C:/Users/sande/esp-idf-5.1.2/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 C:/Users/sande/Projects/moddable/build/tmp/esp32/m5stack/debug/6ml1pnfdqvl/xsProj-esp32/build/bootloader/bootloader.bin"

Bootloader binary size 0x46f0 bytes. 0x2910 bytes (37%) free.

[2/5] Generating ld/sections.ld

[3/5] Linking CXX executable xs_esp32.elf

[4/5] Generating binary image from built executable

esptool.py v4.7.0

Creating esp32 image...

Merged 27 ELF sections

Successfully created esp32 image.

Generated C:/Users/sande/Projects/moddable/build/tmp/esp32/m5stack/debug/6ml1pnfdqvl/xsProj-esp32/build/xs_esp32.bin
[5/5] cmd.exe /C "cd /D C:\Users\sande\Projects\moddable\build\tmp\esp32\m5stack\debug\6ml1pnfdqvl\xsProj-esp32\build\esp-idf\esptool_py && C:\Espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe C:/Users/sande/esp-idf-5.1.2/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 partition --type app C:/Users/sande/Projects/moddable/build/tmp/esp32/m5stack/debug/6ml1pnfdqvl/xsProj-esp32/build/partition_table/partition-table.bin C:/Users/sande/Projects/moddable/build/tmp/esp32/m5stack/debug/6ml1pnfdqvl/xsProj-esp32/build/xs_esp32.bin"

xs_esp32.bin binary size 0x1ab8d0 bytes. Smallest app partition is 0x3f0000 bytes. 0x244730 bytes (58%) free.

Executing action: flash
Running ninja in directory C:\Users\sande\Projects\moddable\build\tmp\esp32\m5stack\debug\6ml1pnfdqvl\xsProj-esp32\build
Executing "ninja flash"...
[1/5] cmd.exe /C "cd /D C:\Users\sande\Projects\moddable\build\tmp\esp32\m5stack\debug\6ml1pnfdqvl\xsProj-esp32\build\esp-idf\esptool_py && C:\Espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe C:/Users/sande/esp-idf-5.1.2/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 partition --type app C:/Users/sande/Projects/moddable/build/tmp/esp32/m5stack/debug/6ml1pnfdqvl/xsProj-esp32/build/partition_table/partition-table.bin C:/Users/sande/Projects/moddable/build/tmp/esp32/m5stack/debug/6ml1pnfdqvl/xsProj-esp32/build/xs_esp32.bin"

xs_esp32.bin binary size 0x1ab8d0 bytes. Smallest app partition is 0x3f0000 bytes. 0x244730 bytes (58%) free.

[2/5] Performing build step for 'bootloader'

[1/1] cmd.exe /C "cd /D C:\Users\sande\Projects\moddable\build\tmp\esp32\m5stack\debug\6ml1pnfdqvl\xsProj-esp32\build\bootloader\esp-idf\esptool_py && C:\Espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe C:/Users/sande/esp-idf-5.1.2/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 C:/Users/sande/Projects/moddable/build/tmp/esp32/m5stack/debug/6ml1pnfdqvl/xsProj-esp32/build/bootloader/bootloader.bin"

Bootloader binary size 0x46f0 bytes. 0x2910 bytes (37%) free.

[2/3] cmd.exe /C "cd /D C:\Users\sande\esp-idf-5.1.2\esp-idf\components\esptool_py && C:\Espressif\tools\cmake\3.24.0\bin\cmake.exe -D IDF_PATH=C:/Users/sande/esp-idf-5.1.2/esp-idf -D SERIAL_TOOL=C:/Espressif/python_env/idf5.1_py3.11_env/Scripts/python.exe;;C:/Users/sande/esp-idf-5.1.2/esp-idf/components/esptool_py/esptool/esptool.py;--chip;esp32 -D SERIAL_TOOL_ARGS=--before=default_reset;--after=hard_reset;write_flash;@flash_args -D WORKING_DIRECTORY=C:/Users/sande/Projects/moddable/build/tmp/esp32/m5stack/debug/6ml1pnfdqvl/xsProj-esp32/build -P C:/Users/sande/esp-idf-5.1.2/esp-idf/components/esptool_py/run_serial_tool.cmake"

esptool.py --chip esp32 -p COM5 -b 921600 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 bootloader/bootloader.bin 0x10000 xs_esp32.bin 0x8000 partition_table/partition-table.bin

esptool.py v4.7.0

Serial port COM5

Connecting......

Chip is ESP32-D0WDQ6-V3 (revision v3.0)

Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None

Crystal is 40MHz

MAC: 24:0a:c4:f9:99:18

Uploading stub...

Running stub...

Stub running...

Changing baud rate to 921600

Changed.

Configuring flash size...

Flash will be erased from 0x00001000 to 0x00005fff...

Flash will be erased from 0x00010000 to 0x001bbfff...

Flash will be erased from 0x00008000 to 0x00008fff...

Compressed 18160 bytes to 12651...

Writing at 0x00001000... (100 %)

Wrote 18160 bytes (12651 compressed) at 0x00001000 in 0.6 seconds (effective 242.5 kbit/s)...

Hash of data verified.

Compressed 1751248 bytes to 1023598...

Writing at 0x00010000... (1 %)

Writing at 0x0001a48e... (3 %)

Writing at 0x000248d0... (4 %)

Writing at 0x0002ea51... (6 %)

Writing at 0x0003a398... (7 %)

Writing at 0x0004374f... (9 %)

Writing at 0x0004c684... (11 %)

Writing at 0x0005623e... (12 %)

Writing at 0x00063801... (14 %)

Writing at 0x00069e71... (15 %)

Writing at 0x00073a79... (17 %)

Writing at 0x0007e060... (19 %)

Writing at 0x00082497... (20 %)

Writing at 0x000895d6... (22 %)

Writing at 0x0009b607... (23 %)

Writing at 0x000a0f65... (25 %)

Writing at 0x000a68d2... (26 %)

Writing at 0x000af100... (28 %)

Writing at 0x000b45a9... (30 %)

Writing at 0x000ba4f3... (31 %)

Writing at 0x000c0962... (33 %)

Writing at 0x000c6447... (34 %)

Writing at 0x000cc2e5... (36 %)

Writing at 0x000d22c7... (38 %)

Writing at 0x000d8ae8... (39 %)

Writing at 0x000df63f... (41 %)

Writing at 0x000e4e80... (42 %)

Writing at 0x000ead2c... (44 %)

Writing at 0x000f0f24... (46 %)

Writing at 0x000f8091... (47 %)

Writing at 0x000fe3bf... (49 %)

Writing at 0x001044b8... (50 %)

Writing at 0x0010a6d5... (52 %)

Writing at 0x0011307e... (53 %)

Writing at 0x0011a137... (55 %)

Writing at 0x00120a38... (57 %)

Writing at 0x00125ff1... (58 %)

Writing at 0x0012b891... (60 %)

Writing at 0x00130f72... (61 %)

Writing at 0x00135d86... (63 %)

Writing at 0x0013aebd... (65 %)

Writing at 0x0013feee... (66 %)

Writing at 0x00145427... (68 %)

Writing at 0x0014a9bf... (69 %)

Writing at 0x0014fe18... (71 %)

Writing at 0x00155142... (73 %)

Writing at 0x0015a5c3... (74 %)

Writing at 0x0015f944... (76 %)

Writing at 0x00164f6c... (77 %)

Writing at 0x0016a6ba... (79 %)

Writing at 0x001702e1... (80 %)

Writing at 0x0017513d... (82 %)

Writing at 0x0017a06c... (84 %)

Writing at 0x0017f727... (85 %)

Writing at 0x00184e3c... (87 %)

Writing at 0x0018a642... (88 %)

Writing at 0x0019099a... (90 %)

Writing at 0x00199744... (92 %)

Writing at 0x001a12c8... (93 %)

Writing at 0x001a665e... (95 %)

Writing at 0x001ab76e... (96 %)

Writing at 0x001b32c6... (98 %)

Writing at 0x001b8bd8... (100 %)

Wrote 1751248 bytes (1023598 compressed) at 0x00010000 in 14.9 seconds (effective 939.1 kbit/s)...

Hash of data verified.

Compressed 3072 bytes to 83...

Writing at 0x00008000... (100 %)

Wrote 3072 bytes (83 compressed) at 0x00008000 in 0.1 seconds (effective 299.7 kbit/s)...

Hash of data verified.

Leaving...

Hard resetting via RTS pin...

Done
Launching app... 
Type Ctrl-C twice after debugging app. 

i do see these as undefined , however my esp-idf doesnt throw it when i do an mconfig on the mcu-plugin-cache with my esp-idf terminal

 cd \Users\sande\.node-red\mcu-plugin-cache\6ml1pnfdqvl
UPLOAD_PORT = COM5
IDF_TOOLS_EXPORT_CMD = undefined
IDF_PYTHON_ENV_PATH = undefined
OPENOCD_SCRIPTS = undefined
ESP_IDF_VERSION = undefined
Creating build batch file...
cmd.exe build.bat

and

Not using an unsupported version of tool cmake found in PATH: 3.28.0.
Not using an unsupported version of tool ninja found in PATH: 1.11.0.

Also another point to highlight is

NMAKE : warning U4004: too many rules for target 'C:\Users\sande\Projects\moddable\build\tmp\esp32\m5stack\debug\6ml1pnfdqvl\ftimage.h.xsi'

May not be an issue though.

With this resolution im hoping to continue my tinkering!

Thanks, spillz

phoddie commented 5 months ago

This is most likely what is preventing your flow from running:

C:\Users\sande\Downloads\node-red-mcu-main\node-red-mcu-main\nodered.js (86) # Break: util.getSetting: cannot coerce undefined to object!

When that happens, xsbug should break so you can inspect the state. It would be helpful to see the JavaScript stack trace at that point.

Also, if you are able to share the JSON for a simple flow that reproduces this problem, it may help sort this out more quickly. Thank you.

spillz-dxb commented 5 months ago

hi peter, when i proceed i get this XS abort: unhandled exception C:\Users\sande\Projects\moddable\xs\platforms\esp\xsPlatform.c (279) # Break: C: xsDebugger!

And the same happens for all the flows i created and the ones in your repo examples too .The same happens when i bypass the plugin and use mcconfig on my esp-idf teminal . the flows work in my node-red enviroment.

Screenshot 2024-04-16 233602

Regards,

Spillz

phoddie commented 5 months ago

when i proceed i get this XS abort: unhandled exception

Sure, that's expected when there is an unexpected exception. I didn't suggest you proceed from the breakpoint, but that you share the JavaScript stack trace from that point.

And the same happens for all the flows i created and the ones in your repo examples too

To be certain we are looking at the same thing, it would be very helpful if you would share the JSON for a simple flow that shows the problem or, at least, reference one simple flow in the repo examples that is not working for you. Thank you.

spillz-dxb commented 5 months ago

here is the flow

[
    {
        "id": "9c48a93517202288",
        "type": "tab",
        "label": "weather map",
        "disabled": false,
        "info": "",
        "env": [],
        "_mcu": {
            "mcu": true
        }
    },
    {
        "id": "3403a3249a2ab867",
        "type": "openweathermap",
        "z": "9c48a93517202288",
        "name": "",
        "wtype": "current",
        "lon": "",
        "lat": "",
        "city": "",
        "country": "",
        "language": "en",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 260,
        "wires": [
            [
                "2aeef9be9b69b20f",
                "b6b5811bd41331b5",
                "d7eca73d6cf9f2e8"
            ]
        ]
    },
    {
        "id": "98669820fb07f988",
        "type": "ui_text",
        "z": "9c48a93517202288",
        "group": "f7e0493752f832d2",
        "order": 1,
        "width": "6",
        "height": "1",
        "name": "City",
        "label": "",
        "format": "{{msg.payload}}",
        "layout": "row-center",
        "className": "piu-text-city",
        "style": false,
        "font": "",
        "fontSize": "",
        "color": "#000000",
        "_mcu": {
            "mcu": true
        },
        "x": 530,
        "y": 60,
        "wires": []
    },
    {
        "id": "b6b5811bd41331b5",
        "type": "ui_text",
        "z": "9c48a93517202288",
        "group": "f7e0493752f832d2",
        "order": 4,
        "width": "6",
        "height": "1",
        "name": "Name",
        "label": "",
        "format": "{{msg.payload.weather}}",
        "layout": "row-center",
        "className": "piu-text-weather",
        "_mcu": {
            "mcu": true
        },
        "x": 530,
        "y": 360,
        "wires": []
    },
    {
        "id": "1854be2db7779ebb",
        "type": "ui_text",
        "z": "9c48a93517202288",
        "group": "f7e0493752f832d2",
        "order": 2,
        "width": "6",
        "height": "2",
        "name": "Temperature",
        "label": "",
        "format": "{{msg.payload.tempc}}°C",
        "layout": "row-center",
        "className": "piu-text-temperature",
        "_mcu": {
            "mcu": true
        },
        "x": 550,
        "y": 160,
        "wires": []
    },
    {
        "id": "2aeef9be9b69b20f",
        "type": "function",
        "z": "9c48a93517202288",
        "name": "prepare",
        "func": "msg.payload = \"wi-owm-\" + msg.payload.icon;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "_mcu": {
            "mcu": true
        },
        "x": 360,
        "y": 260,
        "wires": [
            [
                "b26bc0251e20efef"
            ]
        ]
    },
    {
        "id": "9002c3190e74cc27",
        "type": "function",
        "z": "9c48a93517202288",
        "name": "select",
        "func": "let locations = [\n    { city: \"Brussels\", country: \"Belgium\" },\n    { city: \"New York\", country: \"New York\" },\n    { city: \"Paris\", country: \"France\" },\n    { city: \"San Francisco\", country: \"California\" },\n    { city: \"Tokyo\", country: \"Japan\" },\n];\nlet index = globalThis.weatherIndex;\nif ((index == undefined) || (index == (locations.length - 1)))\n    index = 0;\nelse\n    index++;\nglobalThis.weatherIndex = index;\nmsg.location = locations[index];\nmsg.payload = msg.location.city;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "_mcu": {
            "mcu": true
        },
        "x": 110,
        "y": 160,
        "wires": [
            [
                "3403a3249a2ab867",
                "98669820fb07f988"
            ]
        ]
    },
    {
        "id": "fdd6a5e06db1efa1",
        "type": "inject",
        "z": "9c48a93517202288",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 60,
        "wires": [
            [
                "9002c3190e74cc27"
            ]
        ]
    },
    {
        "id": "b26bc0251e20efef",
        "type": "ui_template",
        "z": "9c48a93517202288",
        "group": "f7e0493752f832d2",
        "name": "Icon",
        "order": 3,
        "width": "6",
        "height": "4",
        "format": "<div style=\"display: flex;height: 100%;justify-content: center;align-items: center;\">\n    <i class=\"fa-4x wi {{msg.payload}}\"></i>\n</div>",
        "storeOutMessages": false,
        "fwdInMessages": false,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "piu-template-weather",
        "_mcu": {
            "mcu": true
        },
        "x": 530,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "d7eca73d6cf9f2e8",
        "type": "function",
        "z": "9c48a93517202288",
        "name": "function 1",
        "func": "msg.payload.tempc = Math.round(msg.payload.tempc);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "_mcu": {
            "mcu": true
        },
        "x": 360,
        "y": 160,
        "wires": [
            [
                "1854be2db7779ebb"
            ]
        ]
    },
    {
        "id": "f7e0493752f832d2",
        "type": "ui_group",
        "name": "Weather",
        "tab": "0c757ed72ea6be1c",
        "order": 1,
        "disp": false,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "0c757ed72ea6be1c",
        "type": "ui_tab",
        "name": "Weather",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

for this , apologize im not a developer , you will have to guide me in this.

you share the JavaScript stack trace from that point.

Regards, spillz

spillz-dxb commented 5 months ago

Another point off topic , i used these nodes and doesnt work . https://github.com/bartbutenaers/node-red-contrib-blockly This will come in handy when we can reuse blockly codes. Also MQTT works but debug give and unknown error for mqtt client . not critical , maybe we can treat it as a separate case. Regards, spillz

phoddie commented 5 months ago

As a rule, third party nodes are not supported. In any case, please do not mix issues together. It creates confusion.

phoddie commented 5 months ago

I just ran the weather example from the Node-RED MCU repository. It works just fine on ESP32. Here's what I did:

cd $NODEREDMCU/examples/dashboard/weather
mcconfig -d -m -p esp32/m5stack_fire ssid="my wifi" password="my wifi password"

In comparing the $NODEREDMCU/examples/dashboard/weather/flows.json and the flow you shared above (thank you!), there is an important difference: your flow does not contain a ui_base node. That node is required for all flows that use the dashboard to configure fonts, themes, etc. It is automatically created by the Node-RED editor when you use the dashboard.

If you are using the Node-RED MCU Plug-in to build and deploy your flow, the plug-in should automatically ensure that the ui_base node is present. If you are manually exporting the node from the Node-RED editor, you need to export all nodes, not just the node with your flow, to have the ui_base included.

ralphwetzel commented 5 months ago

Another point off topic , i used these nodes and doesnt work . https://github.com/bartbutenaers/node-red-contrib-blockly This will come in handy when we can reuse blockly codes.

Still off topic: Behind the scene, the Blockly node is "just" a fancy function node. Different UI, same runtime. I'll spend some time to check the effort of making it usable in node-red-mcu.

phoddie commented 5 months ago

(To avoid going further off topic, I've opened a Discussion for Blockly on the Node-RED MCU repository. Please continue this there.)

spillz-dxb commented 5 months ago

Hi @phoddie , My mistake , had deleled previously used , and now unused config files and since the flow checked as mcu doesnt run , the ui_base was showing as unused . Since the other day of our conversation , noticed you were using linux , so set up a linux environment and the same error occurs for node-red-mcu plugin , moddable with weather example $NODEREDMCU/examples/dashboard/weather/flows.json . as per your advice. Dont see a moddable sdk problem as the $MODDABLE\examples\piu\balls examples work .

18 Apr 14:19:25 - [info] Node-RED version: v3.1.9
18 Apr 14:19:25 - [info] Node.js  version: v20.12.2
18 Apr 14:19:25 - [info] Linux 6.5.0-27-generic x64 LE
18 Apr 14:19:26 - [info] Loading palette nodes
18 Apr 14:19:26 - [info] Node-RED MCU Edition Runtime Version: #a02cd43
18 Apr 14:19:26 - [info] Node-RED MCU Edition Plugin  Version: v1.5.1
18 Apr 14:19:26 - [info] Moddable SDK Version: v4.6.0-6-g3d6d0f8
18 Apr 14:19:26 - [info] Dashboard version 3.6.5 started at /ui
18 Apr 14:19:27 - [info] Settings file  : /home/<userName>/.node-red/settings.js
18 Apr 14:19:27 - [info] Context store  : 'default' [module=memory]
18 Apr 14:19:27 - [info] User directory : /home/<userName>/.node-red
18 Apr 14:19:27 - [warn] Projects disabled : editorTheme.projects.enabled=false
18 Apr 14:19:27 - [info] Flows file     : /home/<userName>/.node-red/flows.json
18 Apr 14:19:27 - [info] Server now running at http://127.0.0.1:1880/

Let me ask you what version of Node.js ,Node-red ,Node-red-dashboard , Node-red-mcu Plugin, Moddable SDK and ESP-IDF you are using , so that i can replicate the same and try out . Although initially this looked like a windows linux problem, since the issue was consistent, ruling out the same.

The errors from linux.

/home/<userName>/Projects/moddable/modules/drivers/mpu6050/mpu6050.js (62) # Break: bad WHO_AM_I ID for MPU-6050.!
Error initializing: bad WHO_AM_I ID for MPU-6050.
Wi-Fi connected to "GNXS-288A78"
IP address 192.168.0.100
/home/<userName>/.node-red/node_modules/@ralphwetzel/node-red-mcu-plugin/node-red-mcu/nodered.js (86) # Break: util.getSetting: cannot coerce undefined to object!

To stay in line , this time used the m5stack fire . It gives another error , guess its was discussed in some other threads, beleive its a non-issue for this case.

Next step is to downgrade the node-red-dashboard, node-red-mcu plugin to earlier versions and test as the problems comes up with UI nodes only .

Meantime any help is welcome .

Regards, Spillz

phoddie commented 5 months ago

noticed you were using linux

macOS, actually. But, the OS where Node-RED runs probably doesn't make a difference here.

From your notes, the steps you are taking to build, deploy, and run the Dashboard flows are not clear. Without that, neither @ralphwetzel nor I can reproduce the problem and so are limited in our ability to help resolve this issue. Would you share step-by-step instructions that we can follow to reproduce the issue? Thank you.

spillz-dxb commented 5 months ago

Happy to provide what i did.

Hardware Devices : M5stack Core2 , M5stack Fire , M5Atom This is just for POC as we need a bigger screen. Node-RED version: v3.1.9 Node.js version: v20.12.2 Node-RED MCU Edition Runtime Version: #a02cd43 Node-RED MCU Edition Plugin Version: v1.5.1 Moddable SDK Version: v4.6.0-6-g3d6d0f8 Dashboard version 3.6.5

Flows: https://github.com/phoddie/node-red-mcu/blob/main/examples/dashboard/weather/flows.json

Followed the documentation at moddable for installing on esp32 devices and individually tested , esp-idf ($idf_path\examples\get-started\hello_world) , moddable sdk ($moddable\examples\piu\balls) ,nod-red-mcu plugin through the node-red plugin and using mconfig in the plugin cache folder. Tried in WIndows and then switched to Linux , Downgraded node.js to V14.7 and node-red-dashboard. All compilations had no error , but the runtime threw this.

/home/User/.node-red/node_modules/@ralphwetzel/node-red-mcu-plugin/node-red-mcu/nodered.js (86) # Break: util.getSetting: cannot coerce undefined to object!

Finally ended up looking into node-red-mcu and found out nodes/dashboard/ui_templates.js calling the fonts const FONT = config.DASHBOARD_FONT ?? RED.util.getSetting(node,'DASHBOARD_FONT') ?? "Roboto" ; Deleted the call and the runtime and it works . Right now im playing with the resolution and screen sizing.

Appreciate @phoddie for willing to help out , but it seems not to be a plugin error , would you recommend shifting this to node-red-mcu repo?.

phoddie commented 5 months ago

Thanks for the additional info. I was eventually able to reproduce the problem. Simple fix. That's now committed. You just need to update/ireinstall the Node-RED MCU Plugin and you should be set.