2.8. LuaSrcDiet

ESPresso uses LuaScrDiet to compress files you upload to ESP8266 on the fly.

Compressing Lua files is recommended since it saves limited ESP8266 resources. ESPresso on the fly compression is done right before file upload (system temp directory is used) so you can keep your source *.lua files intact.

2.8.1. Prerequisites

To start compressing files on the fly:

  1. Make sure you have correctly configured Lua interpreter (see Lua interpreter) and LuaScrDiet (see LuaSrcDiet),
  2. Toggle Diet switch on (located between local and remote panes). If diet switch is grayed out after ESP connection is established verify your configuration.

2.8.2. Extra LuaSrcDiet parameters

It’s possible to pass additional parameters to LuaSrcDiet by entering them under [DIET]/options section of ESPresso.ini.

2.8.3. Firmware dependent LuaSrcDiet parameters

By default LuaScrDiet compression changes large integers into its exponential representation (saving some bytes of source code, i.e.: 60000 becomes 6e4). This however is unreadable for NodeMCU integer firmware. Therefore if you have integer firmware installed on your ESP no integer optimizations should be done by LuaScrDiet.

ESPresso checks for firmware type every time a connection is established (it sends =1/3 command and reads the result - 0 is expected on integer firmware). According to this check, firmware dependent parameters may be passed to LuaScrDiet. These are configured in ESPresso.ini:

Section Key Description Default value
[DIET] options_int Options for integer firmware --noopt-numbers
[DIET] options_float Options for float firmware --opt-numbers

Default values simply turn off integer optimization for integer firmware so in most cases no configuration is necessary.