I'm developing an application to run in Raspberry Pi 3 that logs data from I2C sensors and store the values in a file.
I've structured the application using 3 blocks:
- One block (BLOCK1) that runs in the first frame and opens the file (using fopen mode 'a') and writes a header to it; this block outputs the 'fid' to be used by the next 2 blocks
- One block (BLOCK2) that runs at every frame, that uses 'fid' returned by BLOCK1 and writes sensor data to the file
- One block (BLOCK3) that runs at the last frame, that closes the file using 'fid' returned by BLOCK1
When I run this model in Normal mode, in Windows, everything is OK. But, when I run it in External Mode, the Raspberry Pi correclty executes only the first block, i.e., it opens the file and write the header. It seems to be something to do with the 'fid' argument passing.
I tried something that worked: to have the following 2 blocks:
- The same BLOCK1 above, but it closes the file and do not return the 'fid'
- The same BLOCK2 above, but it opens the file, writes the data, and then closes the file.
I'm willing to do the 1st manner in order not to pay the overhead of opening and closing the file at every frame.
Did anyone have a similar problem?