Skip to content
This repository was archived by the owner on Jan 26, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant