* ``timer`` -- yes
* ``wifi`` -- yes
* ``ws2812`` -- the display itself
+
+Rebuilding the Firmware
+=======================
+
+NodeMCU offers many ways to program the firmware, but the simplest way, the
+most "with the grain", if you will, is to generate three files:
+
+* The base NodeMCU firmware, which contains the above modules.
+
+* The LFS image, which will contain most of nwf's "core" Lua modules. See
+ ``mklfs.sh``
+
+* The SPIFFS image, containing the lamp's lua, drawings, and
+ configuration data. See ``mkspiffs.sh``
+
+The lamp lua is kept in SPIFFS nominally so that it's easy to tinker without
+requiring a full reprogram. In practice this only sort of works.
+
+Run the various build scripts and then program the board, for example::
+
+ ./core/firm/tools/toolchains/esptool.py write_flash \
+ --flash_size 4MB --flash_mode dio --verify \
+ 0x0 ./core/firm/bin/nodemcu_integer_lamp.bin \
+ 0x3fc000 ./core/firm/sdk/esp_iot_sdk_v3.0-e4434aa/bin/esp_init_data_default_v05.bin
+
+ ./core/firm/tools/nodemcu-partition.py \
+ --flash_size 4MB \
+ --lfs_size 131072 --lfs_file _lfs_build/luac.out \
+ --spiffs_file spiffs.img
+
lamp-lfs-strings.lua
core/cap1188/cap1188.lua
core/cap1188/cap1188-init.lua
- core/fifo/fifo.lua
- core/net/{fifosock,nwfmqtt,nwfnet*}.lua
+ core/firm/lua_modules/fifo/fifo{,sock}.lua
+ core/net/{nwfmqtt,nwfnet*}.lua
core/telnetd/telnetd{,-{diag,file}}.lua
core/tq/tq.lua
core/util/compileall.lua
core/util/diag.lua
core/util/lfs-strings.lua
+
+ init2.lua
+ init-early.lua
+ lamp-remote.lua
+ lamp-touch.lua
+ telnetd-cap.lua
+
+ draw-*.lua
)
rm -rf _lfs_build
--- /dev/null
+#!/bin/bash
+
+set -e -u -x
+
+FWSZ=$(stat --printf="%s" ./core/firm/bin/nodemcu_integer_lamp.bin)
+FWSZ=$((FWSZ + 131072)) # Pad for LFS
+
+(
+ # Init is the only core Lua that does not live in LFS.
+ echo import core/init.lua init.lua
+
+ # Configuration
+ echo import conf/test/nwfnet.conf nwfnet.conf
+ echo import conf/test/nwfmqtt.conf nwfmqtt.conf
+ echo import conf/test/nwfmqtt.subs nwfmqtt.subs
+
+ # And the LFS image with the rest of everything
+ # We could, and used to, but we now go via the nodemcu partition tool
+ # echo import _lfs_build/luac.out luac.out
+) | ./core/firm/tools/spiffsimg/spiffsimg \
+ -f spiffs.img \
+ -S 4MB -U ${FWSZ} \
+ -r /dev/fd/0
+
+ # -c 262144 \