FILE_IO_LUA_SWITCH_FILE, LJ.CheckFileFlag(), & LJ.ClearFileFlag() usage | LabJack
 

FILE_IO_LUA_SWITCH_FILE, LJ.CheckFileFlag(), & LJ.ClearFileFlag() usage

2 posts / 0 new
Last post
mikelwrnc
mikelwrnc's picture
FILE_IO_LUA_SWITCH_FILE, LJ.CheckFileFlag(), & LJ.ClearFileFlag() usage

I understand that when doing lua-based file writing and LJM-based reading of said files, the LJM app needs to set the FILE_IO_LUA_SWITCH_FILE bit to 1 in order to tell the lua app that it needs to switch files, which is watching this bit via LJ.CheckFileFlag(). But what does LJ.ClearFileFlag() do? Is there a bit somewhere that it flips that is then readable by the LJM app to confirm that it's safe for it to read the first file?

LabJack Support
labjack support's picture
That's correct. The FILE_IO

That's correct. The FILE_IO_LUA_SWITCH_FILE register is readable and writable. After writing a 1 to that register CheckFileFlag will return 1 until ClearFileFlag is called. At which point both the register and the CheckFileFlag function will return 0.