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

Fix upload, print to support IDF v3 and v4 (and Lua 5.3) #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tomsci
Copy link

@tomsci tomsci commented Nov 19, 2022

Specifically:

  • Handle file.open (IDF v3) vs io.open (v4)
  • Removed DOWNLOAD_FILE (wasn't used anywhere)
  • Removed incorrect inclusions in LUA_FUNCTIONS which guaranteed that function reuse would never occur.
  • Replaced file.read() (old API, no longer supported in IDF v4) with fd:read()
  • Removed unnecessary d:sub(1,-2) which had no effect, in recv_name
  • Fix typo in download_file
  • Support 'print' command for files larger than 1024 bytes - this meant switching from using print() to uart.write()
  • Better error handling in 'download' if the file doesn't exist

Note, the 'download' command seems to be broken on esp32 even with Lua 5.1 and IDF v3 because of line ending conversion, and I haven't fixed that here.

Tested on esp8266 (with some old Lua 5.1 ROM on it), esp32 with IDF v3 and Lua 5.1 (from dev-esp32 branch); and esp32 with v4 and Lua 5.3 (from dev-esp32-idf4 branch). IDF v4 with Lua 5.1 should work fine too. 'download' command only tested successfully on esp8266.

Specifically:
* Handle file.open (IDF v3) vs io.open (v4)
* Removed DOWNLOAD_FILE (wasn't used anywhere)
* Removed incorrect inclusions in LUA_FUNCTIONS which guaranteed that
  function reuse would never occur.
* Replaced file.read() (old API, no longer supported in IDF v4)
  with fd:read()
* Removed unnecessary d:sub(1,-2) which had no effect, in recv_name
* Fix typo in download_file
* Support 'print' command for files larger than 1024 bytes - this
  meant switching from using print() to uart.write()
* Better error handling in 'download' if the file doesn't exist
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

Successfully merging this pull request may close these issues.

None yet

1 participant