Crimson 3.1 copy files to USB

ERCfarcontrol

Member
Join Date
Apr 2015
Location
Fresno, Ca
Posts
63
Does anybody have any experience with manually copying the logs directory from the SD card to USB drive? I've successfully used the CopyFiles(“C:/LOGS”, “D:/LOGS”, 1) function that is shown as the example in the reference manual, but I'm unsure how to set the flags field using the CopyFiles() function. Setting it to 1 is the only way I can get it to copy. I'm also using the GetDriveStatus() function to show the status of the usb drive to the operator as well as the EjectDrive(), and FormatDrive() functions.



I am aware you can set crimson to do it automatically upon inserting the thumbdrive, and thats nice, but there isn't any interaction or messages to let the operator know that it is transferring or safe to remove the thumbdrive.
 
I have not used that function but the reference manual explains the flags field:
Bit 0: If set, the operation will recurse into any subdirectories
Bit 1: If set, existing files will be overwritten. If clear, existing files will be left untouched.
Bit 2: If set, all files will be copied. If clear, only files that do not exist at the destination or that have newer time stamps at the source will be copied.

I use the GetDriveStatus() and GetDiskFreePercent() functions for the SD card as a standard practice. I tie these functions to a configuration page so that when the page first loads, some HMI tags are updated with fresh values. Then on the page I will have (among other items) a button to refresh the drive status and free space and a button (with confirmation) to format the SD card. I am sure you could do the same thing with simply a different drive letter assigned to the function and apply these tools to the USB drive.

For the drive status tag, I will set it up as multi-state so that the text is shown on screen instead of a number:
Data Text
0 "Empty"
1 "Invalid"
2 "Checking"
3 "Formatting"
4 "Locked"
5 "Mounted"

Then on the button for the text I will make it:
="Check SD Card Status:||"+HMI.DiskStatus.AsText
so that the status of the drive appears right on the button.
 
Yes, 'D' is the usb drive. On both drives I'm using all of that except getdiskfreepercent(). I haven't got into that yet but suppose I will. I did read that its not supposed to be constantly refreshed. I do have getdrivestatus() on the page getting refreshed. With it you can determine when it is safe to take out. When its being written/read to it says "locked". If you copy only small amounts of data over to the thumb drive it is very misleading. When you push the copy button you would expect it to say "locked" for at least a second but I suppose the transfer happens so fast that the page cant refresh from mounted to locked fast enough. I may use a getdrivestatus tag and trigger a pop-up to show the usb status and eject button or a data transfer page.


CopyFiles() works just fine with 1 as the flag. I take it that the flag tag should be a bit array and manipulate bits 0, 1, and 2?
 
I can see where you have to either assume that a short file transfer has completed, or repeatedly check the drive status until you see it has completed and neither of those are ideal.

Looking at the reference manual, I see the function GetAutoCopyStatusCode() and it applies to setting up the USB memory stick synchronization to occur automatically. Maybe you could use that function to display the status and enable automatic sync?
 
All of these are good options. I decided not use the automatic function and to go with a pop up when drive 'd' is mounted. The pop up has a copy and eject button along with the status of the drive. Also included a button to go to a page with all the features for both 'c' and 'd'. I hope this thread helps someone along the way that desires these features.



What I would like to know is how to set up that "flag" tag and how/what bits to change. I don't understand the weight column. Using "1" works, and copies/overwrites everything, but it would be nice to offer the operator the option to choose to overwrite all files, only copy newest timestamp files, or only non-existent files.



I used to use a "honeywell" g3 display. It used crimson 3 but it was branded as Honeywell station designer. I have a configuration file that has ALOT of advanced pages and features that some high level engineer created. There is a page that allows you to actually pick and choose which folders or files you want to copy. There are alot of tags associated with it. Maybe one day I'll get around to trying to make those pages on crimson. Unfortunately you can't just copy and paste from station designer, they've made it so it's not possible.
 

Similar Topics

Scenario: I have a set of tags I would like to edit with a modal popup window. I want the user to only enter a SP within a certain range of it's...
Replies
3
Views
1,647
Hey guys, hoping someone here could give me a little advice. I'm working with a CR1000-04000 in Crimson 3.1 and I was interested in adding the...
Replies
4
Views
119
Hi, I'm having an issue in crimson 3.0 when I create a programme using a case statement referencing a fault word that each bit needs to change the...
Replies
4
Views
193
How do you install update on Red Lion Crimson ver 3.1. Do I just need to run the exe file on the host server?
Replies
1
Views
107
Has anyone found a way to convert/replace/update the firmware on old Parker TS80xx series HMIs (i.e. TS8010, TS8006, etc) to accept Crimson...
Replies
0
Views
91
Back
Top Bottom