LUA Scripting on FlashAir 3 - Printable Version +- Apnea Board Forum - CPAP | Sleep Apnea (https://www.apneaboard.com/forums) +-- Forum: Public Area (https://www.apneaboard.com/forums/Forum-Public-Area) +--- Forum: Software Support Forum (https://www.apneaboard.com/forums/Forum-Software-Support-Forum) +--- Thread: LUA Scripting on FlashAir 3 (/Thread-LUA-Scripting-on-FlashAir-3) |
LUA Scripting on FlashAir 3 - AlanE - 05-10-2017 LUA scripting --- Scraped from http://www.lua.org/about.html What is Lua? Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description. --- FlashAir 3.0 supports some of LUA but it does have limitations due to the size of its memory. Flashair 3.0 doesn't support coroutine, OS library, math or the debug. This is flashair developers text on LUA: https://flashair-developers.com/en/documents/api/lua/ Functions that Flashair supports: https://flashair-developers.com/en/documents/api/lua/reference/ After another user here had issues locating the IP address of their DHCP enabled card, I whipped up a small script, albeit a little late, to write the IP information to a text file. Feel free to steal it if you are having issues trying to locate the card's IP. Script grabs a list of SSIDs of the wifi routers it discovered, useful to tell if your card even sees your wifi router, and the IP info of the card then writes it to a text file on the FlashAir. Copy the script below to the root of the FlashAir card (I named it wifistatus.lua) and add this line to your CONFIG: LUA_RUN_SCRIPT=/wifistatus.lua This script will run at boot up. If you put the card into your SD card reader and wait about 15 to 30 seconds, you can open the ssid.txt file that this script creates and find what IP the card was given. The chances of your card getting a different IP after that are slim and the card should have the same IP after you return it to your CPAP. If you can connect to your card through webdav you can open the file from there and find the IP as well. Here is the script: Code: --[[ This is what the script writes to the ssid.txt file: IP: 192.168.0.40 mask: 255.255.255.0 gw: 192.168.0.1 SSID list: 0: xxxxxx 1: xfinitywifi 2: X RE: LUA Scripting on FlashAir 3 - TBMx - 05-10-2017 that's actually awesome - thanks very much for sharing this. as you obviously have 'some' experience with the flash-card: how much useable RAM is there (in terms of useable from "inside" lua / cgi - not before)? and how much does it affect heat? (I'm more talking about some excessive scripts) RE: LUA Scripting on FlashAir 3 - AlanE - 05-10-2017 Not sure on the memory. I read somewhere someone did a mem dump of about 2mb. The script above runs at boot and never again until next card cycle. Never tried a script that would run continuously such as one that fires on an "event". Should try it and see how hot it gets. RE: LUA Scripting on FlashAir 3 - adrinef - 05-11-2017 Copied from the Flashair developer page: Memory size (HTTPDBUFF) "By reducing the amount of memory used in the HTTP server, you can increase the amount of memory used in Lua script execution. Note that in the case of reducing the memory of the HTTP server, the download throughput will decrease. The range of value is from 2920 to 23360. Default value is 23360." Example: Code: HTTPDBUFF=2920 RE: LUA Scripting on FlashAir 3 - TBMx - 05-12-2017 if this numbers would be KB and not Bytes that would really be promising. ... but in the end it depends a bit on the heat the scripts (can) produce. |