Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua file functions moved to standard io module #89

Open
juju2143 opened this issue Nov 10, 2021 · 1 comment
Open

Lua file functions moved to standard io module #89

juju2143 opened this issue Nov 10, 2021 · 1 comment

Comments

@juju2143
Copy link

Checklist

  1. Can you establish a serial connection WITHOUT Nodemcu-Tool - e.g. with a serial terminal like Putty ?
    yes

  2. Does the nodemcu-tool fsinfo command work ?
    yes


Environment

  • Operating System
    Arch Linux
  • ESP Device/Revision
    ESP-WROOM-32
  • NodeMCU-Tool Version
    3.2.1
  • Node.js Version
    16.11.1
  • NodeMCU LUA Firmware Version
    latest dev-esp32-idf4 with Lua 5.3

Issue Description

Expected Behavior

You can upload files

Current Behavior

You can't upload files

Steps to Reproduce

nodemcu-tool upload something.lua

Detailed Description

The above command works, yet the file does not show up in the filesystem. This is because NodeMCU in the latest dev-esp32 branches moved file IO from the file module to the standard Lua io. The commands fails silently as if it worked, even though file.open is unavailable and returns nil.

Possible Solution

I have modified lib/lua/esp8266-commands.js to use io instead of file and so far it works very well, but of course we'll need some additional code to detect whether file or io is to be used so it works as usual on an ESP8266.

This took a while to figure out from the documentation even though the ESP32 is very unsupported, has preliminary support, the maintainers of this repo might not have an ESP32 to test on, and a casual user might think their ESP32 is broken, it's not, here's the solution :)

@serg3295
Copy link

but of course we'll need some additional code to detect whether file or io is to be used so it works as usual on an ESP8266.

I have added --io-module flag in cli to allow to choose whether io or file module is to be used.
The branch dev-esp32
The following pull requests also have been applied:

fix: upgrade prompt dep to fix non-existent property warning

Upgrade node-serialport dependency to v10 (Breaking Change)

Lua file functions moved to standard io module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants