Preset Strategy
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
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); } }BUTTON_EVENT [dvTP,1] { PUSH : {} HOLD[5] : { nFlag = 1 // save preset } RELEASE : { IF(!nFlag) { // recall preset } OFF[nFlag] } }Paul