Preset Strategy
dtucker
Junior Member
What is the general strategy for savings presets (could be channel presets, camera presets, or something else).
In general I see "push to recall a preset", and "hold to save a preset".
However, if you are trying to save a preset, the PUSH event will fire before the HOLD event, meaning any time you try and save a preset, the previous preset will be recalled and then resaved. In short, the problem is both PUSH and HOLD fire, not PUSH or HOLD.
I can think of several messy ways to solve this problem, such as setting a timer on PUSH and reading it on RELEASE to see if they pushed or held. But I figure there may be a more elegant solution.
How do you all generally go about handling presets?
In general I see "push to recall a preset", and "hold to save a preset".
However, if you are trying to save a preset, the PUSH event will fire before the HOLD event, meaning any time you try and save a preset, the previous preset will be recalled and then resaved. In short, the problem is both PUSH and HOLD fire, not PUSH or HOLD.
I can think of several messy ways to solve this problem, such as setting a timer on PUSH and reading it on RELEASE to see if they pushed or held. But I figure there may be a more elegant solution.
How do you all generally go about handling presets?
Comments
-
I use a TouchPanel Structure with a ButtonHold variable
On HOLD:
- the ButtonHold variable is set to True.
- Execute Code for a HOLD Event
On RELEASE:
- If ButtonHold is False
- Execute Code for a RELEASE Event that would otherwise be done in a PUSH Event
- the ButtonHold variable is set to False.DEFINE_TYPE Struct TTouchPanel { Integer Initialized;//Deprecate AFL v3.0 Integer State; Integer OnlineStatus; Integer Zone; //Indexes Integer Use; Integer Source; Integer Display; Integer Audio; Integer MatrixSource; Integer MatrixDisplay; Char ActivePage[LEN_NAME]; Char ActivePopup[LEN_NAME]; //A Button on the Panel is in Hold State Integer ButtonHold; } DEFINE_EVENT BUTTON_EVENT[tpsAudio, btnsAudioUp] { HOLD[5, REPEAT]: { System.CurrentPanelIndex = Get_Last(tpsAudio); //Set ButtonHold to True TTouchPanel_SetButtonHold(System.CurrentPanelIndex, True); //Code to Execute TTouchPanel_SetAudio(System.CurrentPanelIndex, Button.Input.Channel - OFFSET_VOLUME_UP); Handle_AudioVolumeUp(System.CurrentPanelIndex, True); } RELEASE: { System.CurrentPanelIndex = Get_Last(tpsAudio); if ( !TTouchPanel_GetButtonHold(System.CurrentPanelIndex) ) {//If ButtonHold is False then execute code TTouchPanel_SetAudio(System.CurrentPanelIndex, Button.Input.Channel - OFFSET_VOLUME_UP); Handle_AudioVolumeUp(System.CurrentPanelIndex, False); } //Set ButtonHold to False TTouchPanel_SetButtonHold(System.CurrentPanelIndex, False); } } -
Don't use the PUSH event. Only use the HOLD and RELEASE events. Like so:
BUTTON_EVENT [dvTP,1] { PUSH : {} HOLD[5] : { nFlag = 1 // save preset } RELEASE : { IF(!nFlag) { // recall preset } OFF[nFlag] } } -
Thanks guys. That'll work fine.
-
I don't use the hold event for presets due to a bug in Netlinx, which I don't think has been fixed yet. If you have multiple instances of a module running that contains a structure for the presets, when you try to do an assignment in the hold event to the structure, its always the first module's structure that gets written to.
Paul
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums