Home AMX User Forum AMX General Discussion

^RAF command - loading images?

2»

Comments

  • GSLogicGSLogic Posts: 562
    Joe

    We have the same result!

    Now we just need a command to be able to load many images.
    ^RMANY-fav1...20,image1,image2,image3,...image20
    I love the command name :)

    AMX really does need to fix - that HTTP images won't load with password protection on.
  • Joe HebertJoe Hebert Posts: 2,159
    GSLogic wrote:
    AMX really does need to fix - that HTTP images won't load with password protection on.
    I hear that. :)
  • DHawthorneDHawthorne Posts: 4,584
    I am beginning to suspect the slow loading is due to a queue backlog. If it gets a request for another image before the previous is loaded, or while the connection for the previous image is still active, it goes into an error cycle that takes a while to reset. It's one of those cases where slowing the requests down would actually speed performance. This, by the way, is not unique to AMX touch panels, the master IP communications are much the same. I hate to think of all the times I have tried to establish an IP connection, only to get a "ClientOpen handle already in use" message; then, you try closing it and get "Socket Already Closed." The only thing to do is wait.

    I would guess the housekeeping done on a dropped connection takes some time, and bogs the entire connection library down meanwhile ... it's a serious flaw in the way that library is written. We shouldn't have to manage communications queues, it should be done on the firmware level for efficiency. There is no reason I should have to pace image requests, but it would seem that is the necessary workaround. I'll play with it a bit this week if I have time.
  • GSLogicGSLogic Posts: 562
    Dave

    It is a timing issue. Joe H added a timeline that seemed to help when using FTP, but it's still to slow and unreliable. I'm WAITNG to hear back from AMX.
  • Joe HebertJoe Hebert Posts: 2,159
    Here?s a summary of what I found with my test system:

    A 150ms delay between commands for HTTP (with this particular project) seems to do the trick. I increased to 200ms between commands for FTP as it seems to take a little longer for some reason via FTP, at least with my test system.

    HTTP no password protection ? Page of 8 loads in about 1.2 seconds and excellent reliability.

    HTTP password protected ? Nothing loads. :(

    FTP password protected ? Page of 8 loads a little slower than HTTP but in my mind I wouldn?t consider it too slow. But it is definitely unreliable as it misses 1 or 2 icons on some page flips. Too slow or not too slow doesn?t matter much if it?s unreliable though.

    Dave ? I agree with everything you said in your previous post.
  • viningvining Posts: 4,368
    Well I finally got around to playing with this and used Joe's code since he already had timeline to send_commands.

    Basically everything Joe, Gary & Dave posted seem to be true on my set up as well which is really a bummer. The HTTP thing makes no sense and the security section of the master just confuses me any way. I not sure if it's just cuz I'm a little stupid or the way it's laid out is counter intuituve.

    I found the FTP to be a little more reliable than the HTTP but as Joe said a liitle slower. I changed the time_line intervals to 400ms and in TPD4 resource manager I checked the box on each resource to only update on panel start up. I then used the ^RFRP coomand behind a wait after the ^RMF command to force the refresh. Although I'm using an old MVP8400 and the ^RFRP command is only documented for the i series panels it still seems to work. I tried the ^RFR command and I really don't know if there was any difference but I figured maybe the TPs don't really know what images are in focus which may be why when you leave it up to the TP to refresh or the ^RFR it doesn't always work.

    In the code below I can get it to reliably refresh and usually it's smooth and sequential but if I push the button fast and fill the masters Queue (or what ever) some times it hiccups.

    AMX really needs to do something about this problems so that it can be 100% reliable and a bit faster. They seem ed to respond to our whining when they increase the TPs RAM and came up with the ^RFRP commmand so we can refresh radar images for animated weather radar so maybe if we whine some more they can help us out with this too. Although the weather radar stuff could use some more improvements too.

    I tried this at a 250 ms timeline interval which was a little too fast and caused more hiccups so its possible that the 400ms interval can be shorten a wee bit.

    This is also running on my house system so I had to put it on port 25 so it should fair well on a master in a real job installation.

    While typing this post I've periodically pushed the refresh button and it's worked 100% on about 15 attemps. Of course having just said that I pushed agian the this last refresh the last icon on the page hung up a couple seconds longer before changing but it did finally go.
    VOLATILE LONG lIconT[]	= {400,400,400,400,400,400,400,400}
    
    TIMELINE_EVENT[nIconTL] 
    
         {
         LOCAL_VAR INTEGER nIconIDX ;
         LOCAL_VAR INTEGER i ;
         LOCAL_VAR INTEGER nLastFav ;
    
    
         i = TIMELINE.SEQUENCE
         SEND_COMMAND dvTP_FAV_ICONS, "'^RMF-FTP',ITOA(i),',%Aimages/tv_icons%F',aIconNames[i+nIconIDX]";
         wait 2
    	  {
    	  SEND_COMMAND dvTP_FAV_ICONS,"'^RFRP-FTP',ITOA(i)" ;
    	  }
         IF (i = 8) 
    	  {
    	  nIconIDX = nIconIDX + 8
    	  IF (nIconIDX > 24)
    	       {
    	       nIconIDX = 0 ;
    	       }
    	  }
       
         }
    
  • Hi all

    Here we are 3 years later, and along comes another programmer still having the same problems...

    Here is what i would like to do:
    • I have several radio and tv receiver devices.
    • For each of them i want to create a folder containing icons of the possible stations.
    • I want to create dynamic image ressources for all of them using ^RAF.
    • I should be able to set up my favourites for each device and display them on the pages of the favourites of each device.
    • When i change from one favourite page to the other i want to use the same addresses for the buttons, otherwise i quickly run out of channels and ports.
    • Therefore, the images need to load fast when changing, which is why i wanted to create ressources for all images and then load them using ^BBR instead of ^RMF.

    Here is some code of the functions creating the ressources:
    DEFINE_FUNCTION readDynamicConfigIcons(INTEGER nDevice)
    	{
    	STACK_VAR INTEGER nFileNum,i;
    	STACK_VAR SLONG nNumFiles;
    	STACK_VAR LONG nEntry;
    	STACK_VAR CHAR cFileName[_LENGTH_ICON_TEXT];
    	nFileNum = 2;
    	nNumFiles = 1;
    	nEntry = 1;
    	WHILE(nNumFiles > 0)
    		{
    		nNumFiles = FILE_DIR("_SYSTEM_DIR,_AV_DIR,cConfigPathName[nDevice]", cFileName, nEntry);
    		sendDebug(nDevice, "'AV-UI: readDynamicConfigIcons: nNumFiles: ',ITOA(nNumFiles),' path: ',_SYSTEM_DIR,_AV_DIR,cConfigPathName[nDevice],' cFileName: ',cFileName");
    		IF(FIND_STRING(cFileName, _PRESET_CONFIG_FILE_NAME, 1) == 0 && (FIND_STRING(cFileName, "'.jpg'", 1) > 0 || FIND_STRING(cFileName, "'.png'", 1) > 0))
    			{
    			sendDebug(nDevice, "'AV-UI: Add FTP Config-Icon: ',cFileName");
    			cConfigIcons[nDevice][nFileNum] = cFileName;
    			nFileNum++;
    			}
    		nEntry++;
    		}
    	SET_LENGTH_ARRAY(cConfigIcons[nDevice], nFileNum - 1);
    	FOR(i=1; i<=LENGTH_ARRAY(dvTP); i++)
    		{
    		IF(nUpdateFtpIconsTpDevice[i] == 0 || nUpdateFtpIconsTpDevice[i] > nDevice)
    			{
    			nUpdateFtpIconsTpDevice[i] = nDevice;
    			}
    		nUpdateFtpIcons[nDevice][i] = 1;
    		}
    	IF(TIMELINE_ACTIVE(_TML_STARTUP))
    		{
    		TIMELINE_KILL(_TML_STARTUP);
    		}
    	TIMELINE_CREATE(_TML_STARTUP,lTmlAction,1,TIMELINE_RELATIVE, TIMELINE_ONCE);
    	}
    
    DEFINE_FUNCTION CHAR[_LENGTH_ICON_TEXT] getDynamicResourceName(INTEGER nDevice, CHAR cFileName[])
    	{
    	STACK_VAR INTEGER nIndex1, nIndex2, nCounter;
    	STACK_VAR CHAR cResourceName[_LENGTH_ICON_TEXT];
    	nCounter = 0;
    	nIndex1 = 1
    	nIndex2 = FIND_STRING(cFileName, "'.'", nIndex1);
    	WHILE(nIndex2 > 0 && nCounter < 10)
    		{
    		cResourceName = "cResourceName,MID_STRING(cFileName,nIndex1,nIndex2-nIndex1),'_'";
    		nIndex1 = nIndex2+1;
    		nIndex2 = FIND_STRING(cFileName, "'.'", nIndex1);
    		nCounter++;
    		}
    	nIndex2 = LENGTH_STRING(cFileName);
    	RETURN "ITOA(nDevice),'_',cResourceName,MID_STRING(cFileName,nIndex1,nIndex2-nIndex1+1)";
    	}
    
    DEFINE_FUNCTION createDynamicConfigIcons(INTEGER nDevice, INTEGER nTp)
    	{
    	STACK_VAR INTEGER nIcon, nProtocol;
    	STACK_VAR IP_ADDRESS_STRUCT sIpAdress;
    	GET_IP_ADDRESS(0:0:0, sIpAdress);
    	nIcon =	nUpdateFtpIcons[nDevice][nTP];
    	nProtocol = 0;
    	IF(_USERNAME != "''" && _PASSWORD != "''")
    		{
    		nProtocol = 1;
    		}
    	sendDebug(nDevice, "'AV-UI: createDynamicConfigIcons: nDevice: ',ITOA(nDevice),' nTp: ',ITOA(nTp),' nIcon: ',ITOA(nIcon), ' nName: ',cConfigIcons[nDevice][nIcon]");
    	IF(nIcon <= LENGTH_ARRAY(cConfigIcons[nDevice]))
    		{
    		SEND_COMMAND dvTP[nTp],"'^RAF-',getDynamicResourceName(nDevice, cConfigIcons[nDevice][nIcon]),',%P',ITOA(nProtocol),'%U',_USERNAME,'%S',_PASSWORD,'%H',sIpAdress.IPADDRESS,'%A',_SYSTEM_DIR,_AV_DIR,cConfigPathName[nDevice],'%F',cConfigIcons[nDevice][nIcon],'%R0'";
    		}
    	IF(nIcon > 1)
    		{
    		SEND_COMMAND dvTP[nTp],"'^RFRP-',getDynamicResourceName(nDevice, cConfigIcons[nDevice][nIcon-1])";
    		}
    	IF(nUpdateFtpIcons[nDevice][nTP] > LENGTH_ARRAY(cConfigIcons[nDevice]))
    		{
    		nUpdateFtpIcons[nDevice][nTP] = 0;
    		}
    	ELSE
    		{
    		nUpdateFtpIcons[nDevice][nTP]++
    		}
    	}
    

    First function gets the names of all the icons residing in the folder of the device on the ftp of the controller.
    Second function is to generate a unique name containing no '.' in the name (tp-design didn't let me do this so i thought it might be not working :)).
    Third function is to create the ressources for all the devices on the touchpanels.
    All the nUpdateFtpIcons stuff is used for the timeline that actually does the updates. I used times up to 1000.

    Here what i found:
    • Http works better in general as the ftp of the controller is slower and not really stable. It sometimes hangs when used too much. A reboot or waiting for 20 or 30 min resolves the problem.
    • The order of the files being read from the ftp is not allways alphabetically but mostly (Not that big problem, i was just too lazy to write a sorting function up to now :)).
    • Http still doesn't work if protection is on. Also doesnt work if you create a ressource like this in tp-design. This is why i use ftp with and http without protection.
    • When i have a new panel, i need usually to wait for a long time and reboot everything once or twice to have all the images.
    • Once i have them it seems to work fine with that panel.
    • ^BBR really seems to cost a lot of performance. I have 20 favourites that i want to se quickly, so 20 times ^BBR in a for. I have a benchmark that logs the number of runs through define_program in a second. When i do a lot of ^BBR this benchmark can go down from 1000 to 40 for about 30-40 seconds, then its fine again.
    • When there is a dynamic image on a button (put there using ^BBR), ^BMP sometimes is not possible anymore. I can do ^BBR with a ressource that desn't exist to resolve the problem.

    And questions:
    • Is the problem with the ftp known? Is there a way around it? Is it maybe because of poor client programming that doesn't log out correctly?
    • How are the files sorted when i get them using file_dir?
    • Will the http problem ever be fixed? Is it so hard or just so low priority?
    • Do i need to wait between ^RAF? How long?
    • Is there a limit of ressources i can generate? How many?
    • When are the ressources deleted? The ones i create in tp-design survive reboots, also downloads? What about created ones? Does 'Remove User Pages' delete them? Can i see somehow, what ressources are on my panel (would be cool to be able to see if ^RAF didnt work or if the problem is somewhere else)?
    • Should i avoid using ^BBR? Is it completely different from ^BMP? Does it maybe refresh the images? Can i prevent it from refreshing (i never want to refresh, i always create new ressources)?
    • What could be the problem with using ^BMP after ^BBR? Is there a way around it?

    Thats what i could think of right now :).

    By now i have gone back to loading the images statically into the ressource manager of all the panels but it would be really nice to be able to make it work. Also i kind of lost too much time already to just give up now...
  • DHawthorneDHawthorne Posts: 4,584
    I gave up long ago and load images I need to switch around quickly to the panel. I'm only using dynamic images where they are truly dynamic ... like cameras or cover art. I imagine I'll hit the wall on image memory eventually, but I haven't come close yet.
  • a_riot42a_riot42 Posts: 1,624
    DHawthorne wrote: »
    I gave up long ago and load images I need to switch around quickly to the panel. I'm only using dynamic images where they are truly dynamic ... like cameras or cover art. I imagine I'll hit the wall on image memory eventually, but I haven't come close yet.

    I am a bit confused by this thread from the grave. I have been using dynamic images for cover art in a scrolling list for a while and it works almost perfectly. It will hiccup every once in a while but speed is never the issue as it updates almost instantly 12 files at a time even with files that are 10kb to 20kb and I use no timelines or waits. I am not getting the images from the controller anymore as I use a third party server, but I used to fetch them off the master using both ftp and http and noticed no real difference in speed.

    When compared to a Sonos controller for instance, the AMX panel updates its dynamic images faster than the Sonos controller populates its cover art. I was quite pleasantly surprised. I don't use dynamic images for tv icons because I have different icons for the pressed and unpressed state and don't want to change the image on a button press and prefer the instantaneous feedback but I have no doubt it could be made to work well. However, like Dave I only use dynamic images that are truly dynamic and only available at runtime, otherwise they are loaded to the touch panel.
    Paul
  • a_riot42 wrote: »
    I am a bit confused by this thread from the grave. I have been using dynamic images for cover art in a scrolling list for a while and it works almost perfectly. It will hiccup every once in a while but speed is never the issue as it updates almost instantly 12 files at a time even with files that are 10kb to 20kb and I use no timelines or waits. I am not getting the images from the controller anymore as I use a third party server, but I used to fetch them off the master using both ftp and http and noticed no real difference in speed.

    When compared to a Sonos controller for instance, the AMX panel updates its dynamic images faster than the Sonos controller populates its cover art. I was quite pleasantly surprised. I don't use dynamic images for tv icons because I have different icons for the pressed and unpressed state and don't want to change the image on a button press and prefer the instantaneous feedback but I have no doubt it could be made to work well. However, like Dave I only use dynamic images that are truly dynamic and only available at runtime, otherwise they are loaded to the touch panel.
    Paul

    Alright then, so could you help me a bit?
    You seem to work with ^RMF, is that correct? I tried this before and thought it updated not fast enough, which is why i try now to pre-load all the images with ^RAF and use ^BBR later to set them. However this is a bit more complicated so if ^RMF works fine im very interrested.
    So i prepared a small program with tp-design, it should be attached to this post if i did everything right. What it does is the following. At startup it goes to the folder AV on the ftp of the controller and reads all .png and .jpg files from there. Then i can scroll through the loaded icons on the tp. On the telnet you should see whenever you scroll up or down and a benchmark telling the times the define_program is executed per second. Here is what doesn't work fine for me.
    • When the tp comes online, i send the icons there but they dont show up
    • To start the icons to show up i have to press each of the buttons once, why is that?
    • When i scroll without waiting for all the images to load, the benchmark goes down for a while and the images take forever to load.
    Do you also notice this? Can you explain to me, why this happenes? Can you give me a solution?
    Thanks a lot.
  • a_riot42a_riot42 Posts: 1,624
    GarColl wrote: »
    Alright then, so could you help me a bit?
    You seem to work with ^RMF, is that correct? I tried this before and thought it updated not fast enough, which is why i try now to pre-load all the images with ^RAF and use ^BBR later to set them. However this is a bit more complicated so if ^RMF works fine im very interrested.
    So i prepared a small program with tp-design, it should be attached to this post if i did everything right. What it does is the following. At startup it goes to the folder AV on the ftp of the controller and reads all .png and .jpg files from there. Then i can scroll through the loaded icons on the tp. On the telnet you should see whenever you scroll up or down and a benchmark telling the times the define_program is executed per second. Here is what doesn't work fine for me.
    • When the tp comes online, i send the icons there but they dont show up
    • To start the icons to show up i have to press each of the buttons once, why is that?
    • When i scroll without waiting for all the images to load, the benchmark goes down for a while and the images take forever to load.
    Do you also notice this? Can you explain to me, why this happenes? Can you give me a solution?
    Thanks a lot.

    I'm a bit swamped at the moment but if you download the Kaleidescape module and search for RMF you will see what they are doing and its similar to what I do. It sounds like you have other stuff going on that may not be related to the RMF command. Using define_program to run code can lead to timing problems as has been discussed here in the past. I don't use the RAF or BBR command. I don't think BBR is available on all panels but I could be wrong. A simple RMF command is all that is required once the images are loaded on the controller. There is no sending of icons, just a URI to the panel using the RMF command and it does the rest.
    Paul
Sign In or Register to comment.