start/stop timeplot and save file with new name each cycle

Support forum for MegunoLink
Post Reply
ms63
Posts: 3
Joined: Sat Jun 12, 2021 8:40 pm

Sun Jun 13, 2021 4:14 am

Hello,

I am trying to figure out whether MegunoLink can do what I need. I have designed a TimePlot UI with MegunoLink which is graphing sensor data acquired with an Arduino - that has undergone some mathematical operations. I have a text box that displays the current value, and I have a message logger and message monitor to capture the data. All of which is great.

I would like to be able to start and stop the TimePlot (e.g. the data recording) and upon starting the TimePlot each time prompt the user to name the file that the data is saved to. As the goal is to have the systems at multiple locations running multiple tests each day- it makes sense to be able to name the files upon commencing recording. Of course the Arduino will be incessantly looping which is for all intents and purposes irrelevant to us.

Currently I have it so that it starts logging automatically upon connection and I am using the date (hours/minutes) as the file name; I disconnect when done and reconnect each time I start a "run". This is workable , but makes the data labeling less useful than we would like. I am probably simply missing the forest for the trees here - but I didn't see a mechanism by which to start and stop MegunoLink nor to put a command/prompt to name the file. Any and all help greatly appreciated!

MS
ms63
Posts: 3
Joined: Sat Jun 12, 2021 8:40 pm

Mon Jun 14, 2021 6:31 pm

Update:

I have been able to start and stop the scrolling of the TimePlot and the message monitor with an "IPButton" though had to break the Arduino loop to do this. I can clear the message monitor at the end of the loop but so far not the TimePlot;


I am still having issue figuring out how to give each message monitor file a new name after each cycle without having to go through a convoluted process of disabling and enabling the the button on the message logger "Enable logging". Again - any input would be greatly appreciated.
philr
Posts: 371
Joined: Mon May 26, 2014 10:58 am

Thu Jun 17, 2021 7:33 am

Hi, I think you should be able to use the stop logging function. Then generate a new filename and start logging again. This page has details
https://www.megunolink.com/documentatio ... ge-logger/

You can see the library file here
https://github.com/Megunolink/MLP/blob/ ... /Message.h

Any luck?
Cheers
Phil
ms63
Posts: 3
Joined: Sat Jun 12, 2021 8:40 pm

Fri Jun 18, 2021 1:27 am

Hi Phil,

Thank you - yes, the example helped greatly; I wish I had seen that link much earlier......

I have switched to an XY Plot as not being Aramaic - I read left to right, I can now clear the messages and the plot, and just have a few details to work out on the file naming/saving and that will be put to rest. I used Plot.Clear() to clear the plot which is great -but I am still working out how to re-set the clock to time 0 but that seems more like an Arduino code "feature" than a MegunoLink issue.

Thank you again for your help.

MS
philr
Posts: 371
Joined: Mon May 26, 2014 10:58 am

Fri Jun 18, 2021 2:17 am

Nice work! One way is just to store the current millis time when you start a run and use millis()-StoredTime as your time base. That way it will always start at zero.

Phil
Post Reply