Read text file in to TA widget
-
Hello,
With this I create a widget of type TAmqttClient.publish(&In[0], "|TA UID:ta1 X:84 Y:26 W:30 H:43 VIS:1 BGC:#b4c5de FGC:#121212 SHE:1 FSZ:4.5 RAD:1.5 BSZ:10 CL:1\r\n");
I have a file on SPIFFS, such as "/test.txt", to which I sometimes append a few lines of text.
The question is, how can I read only the last 10 lines of the file to place it in the ta1 widget?With BSZ:10 I can show the last 10 lines in "ta1", but the file is read from the beginning, line by line to "ta1" and after all then only shows the last 10 lines.
The reason for my question is that, as I use a GPRS modem, I would like to send as little data as possible via MQTT, in this case want send only the last 10 lines of the file.
To solve this problem, I've written some workaround code, but it's not very elegant
What could be the best solution to this?
Regards
-
@Sato You currently cannot read the file from the back. This functionality can be added though. I will see what I can do with the next release.
You can read individual lines with FAC:2 and FP: parameter (the last 10), but you need to know the number of lines in the file upfront...
Best regards,
kl3m3n -
Hello @kl3m3n,
The read how many lines exists in the files is no problem.
Next week i will see how to handle it with FAC and FPThank you
Regards