Browse Source

LFS: small tweaks to docs and examples (#2454)

Nathaniel Wesley Filardo 5 years ago
parent
commit
e896face0c
3 changed files with 14 additions and 13 deletions
  1. 7 3
      docs/en/lfs.md
  2. 4 7
      lua_examples/lfs/_init.lua
  3. 3 3
      lua_examples/lfs/lfs_fragments.lua

File diff suppressed because it is too large
+ 7 - 3
docs/en/lfs.md


+ 4 - 7
lua_examples/lfs/_init.lua

@@ -21,7 +21,7 @@
                gives you the parameter to use in the luac.cross -a option.
 
   LFS._list    This returns a table of the LFS modules, hence
-                 print(table.concat(LFS._list),'\n')
+                 print(table.concat(LFS._list,'\n'))
                gives you a single column listing of all modules in the LFS.
 
 ---------------------------------------------------------------------------------]]               
@@ -62,17 +62,14 @@ G.LFS = setmetatable(lfs_t,lfs_t)
   have jean.lc or jean.lua in SPIFFS, then this SPIFFS version will get loaded into 
   RAM instead of using. (Useful, for development).
 
-  Note that if you want LFS to take a higher priority than SPIFFS, the use the [2]
-  slot for loaders.  If you want to reverse these in your init.lua or interactively
-  for debugging, then use
+  See docs/en/lfs.md and the 'loaders' array in app/lua/loadlib.c for more details.
 
-  do local pl = package.loaders; pl[2],pl[4] = pl[4],pl[2]; end
 ---------------------------------------------------------------------------------]]
 
-package.loaders[4] = function(module) -- loader_flash
+table.insert(package.loaders,function(module) -- loader_flash
   local fn, ba = index(module)
   return ba and "Module not in LFS" or fn 
-end
+end)
 
 --[[-------------------------------------------------------------------------------
   You can add any other initialisation here, for example a couple of the globals

+ 3 - 3
lua_examples/lfs/lfs_fragments.lua

@@ -47,10 +47,10 @@ $ESPTOOL --port $USB --baud 460800  write_flash -fm dio 0x100000 \
 -- delay or a GPIO pin during development, so that you as developer can break into 
 -- the boot sequence if there is a problem with the _init bootstrap that is causing
 -- a panic loop.  Here is one example of how you might do this.  You have a second
--- to inject tmr.stop(0) into UART0.  Extend this dealy if your reactions can't 
--- meet this.
+-- to inject tmr.stop(0) into UART0.  Extend this delay if needed.
 --
--- You also want to do autoload the LFS, for example by adding the following:
+-- This example will also attempt to automatically load the LFS block from a SPIFFS
+-- file named 'flash.img'.
 --
 if node.flashindex() == nil then 
   node.flashreload('flash.img') 

Some files were not shown because too many files changed in this diff