Hi Guys,
I working to implement a sensitive push button based on existent OSAL timer and I have to understand how to increase and decrease dimmer level. As I have posted the main algorithm I have done before.
- Normal press just turn on or off
- Press and hold more than 3 seconds the first time will increase the level,
- Press and hold more than 3 seconds will decrease level,
my last threads for references: https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/p/830526/3072158#3072158
We have two existent LEVEL CONTROL functions, as I described below. I do not know each one I can use, maybe I need to create a new one.
zclTTa0003_LevelControlMoveToLevelCB, // Level Control Move to Level command
zclTTa0003_LevelControlMoveCB, // Level Control Move command
Part of my BtnHOLD_EVT code:
if ( events & TTa0003_BtnHOLD_EVT )
{
uint8 UPLevel;
uint8 DOWNLevel;
if ( HAL_PUSH_BUTTON1())//Btn long press
{
// BtnHoldCnt++;
if(BtnHoldCnt >=30)
{
BtnHoldCnt=0;
HalLedSet (HAL_LED_3, HAL_LED_MODE_ON);
if ( ( zclTTa0003_LevelCurrentLevel >= LEVEL_MIN && zclTTa0003_LevelCurrentLevel < LEVEL_MAX ) || ( zclTTa0003_OnOff == LIGHT_OFF ) ) {
UPLevel = zclTTa0003_LevelCurrentLevel + 30;
// start the dimmer LEVEL UP Command ???
} else if ( zclTTa0003_LevelCurrentLevel == LEVEL_MAX ){
DOWNLevel = zclTTa0003_LevelCurrentLevel - 30;
// start the dimmer LEVEL DOWN Command ???
}
} else {
BtnHoldCnt++;
HalLedSet ( HAL_LED_3, HAL_LED_MODE_OFF);
osal_start_timerEx( zclTTa0003_TaskID, TTa0003_BtnHOLD_EVT, 100);}
} else // Btn short press
{ret=osal_start_timerEx( zclTTa0003_TaskID, TTa0003_BtnHOLD_EVT, 100);} // return to handle key
return ( events ^ TTa0003_BtnHOLD_EVT );
}
Please, someone can give an idea?
BR,
Alex