Home > Forum > Operator terminals (Weintek) > Publish automatic images from a USB stick
- This topic has 4 replies, 2 participants and was last updated 4 years, 11 months ago da Marcello.
-
AuthorPost
-
May 4, 2019 at 7: 16 am #47394MarcelloParticipant
On an MT8070IER panel I would like to run images loaded on the USB stick as a screensaver. I used the image viewer object and through a macro I change the images in time.
So far so good unfortunately I have to upload images all with the same name, extension and with a variable part such as img (1) .jpg, img (2) .jpg etc ...
This is quite annoying so I thought of using the Browse object and select one by one the files that interest me by loading them on a recipe since the Browse object does not behave like the Options List object and has no reference addresses to select them automatically.
I created a macro that captures with RecipeQuery the number of records in the recipe, then a GetData that captures the name of the file selected (manually) on the Browse and finally through RecipeSetData write the name of the file on the recipe. While writing the macro I noticed that the "RecipeSetData" is not highlighted in blue and when I started the program the macro proved not to be effective. How can I do?
I could go through a PLC SlimLine but it seems incredible to me to have to create an Ftp connection and then pass the file name back to the HMI via Modbus master on the reference LW of the viewer.
There are suggestions ...
May 4, 2019 at 8: 19 am #47397Sergio BertanaAdministrator ForumYou should see how you did the macro and recipe structure to understand the steps used.
Having said that as a suggestion you could use setdata to write the data on a recipe register then to save.
Alternatively, without going through the macro you could select the file from the browser, then confirm with a combo key to transfer from LW browser to recipe (indexed) and increase the pointer to go to the next image to be entered.
At the end of the confirmation button that does nothing but save the sequence in the recipe database.
May 7, 2019 at 9: 11 am #47399MarcelloParticipantI attach the macro to understand where it may be wrong:
macro_command main ()
int nrRec
char Filename [40]
bool ok
ok = RecipeQuery ("SELECT * FROM Images", nrRec) // get the number of items in the recipe
if ok == true then
GetData (Filename [0], "Local HMI", LW, 11320,40) // get file name
ok = RecipeSetData (NomeFile [0], “Images.IMG”, nrRec) // write the name of the file on the recipe
end ifend macro_command
The recipe is initialized with ASCII values from 20 word. This macro is activated by a function key.
May 7, 2019 at 9: 13 am #47401Sergio BertanaAdministrator ForumWhat surely doesn't come back to me is the use of nrRec in the RecipeSetData function:
Because the function goes to write in the image recipe the IMG data corresponding to the recipe number nrREC, but nrREC is calculated in the RecipeQuery row as number of present recipes, so if for example we have a recipe of the type:
0
1
2
3
4nrRec applies to 5, so the RecipeSetData tries to write to an "5" recipe that does not exist in the database.
May 13, 2019 at 3: 46 pm #47402MarcelloParticipantI understood that RecipeSetData could add elements to the recipe. I opted for: Browse Object + the “Data Transfer” button using OFF notification with Follow as command to add (the combo manages data transfer on cMTs).
Too bad there is no possibility to access the name of the files on the stick by macro.
-
AuthorPost
- You must be logged in to reply to this topic.