mirror of
https://github.com/Utyff/Zintercom.git
synced 2026-01-12 09:17:41 +03:00
@@ -88,8 +88,6 @@ static void zclApp_RingRun(void);
|
||||
static void zclApp_TalkStart(void);
|
||||
static void zclApp_RingEnd(void);
|
||||
|
||||
//static uint32 pressTime = 0;
|
||||
|
||||
/*********************************************************************
|
||||
* ZCL General Profile Callback table
|
||||
*/
|
||||
@@ -141,6 +139,8 @@ static void zclApp_HandleKeys(byte portAndAction, byte keyCode) {
|
||||
//exit old stop timer
|
||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
//start new stop timer (ring ends timer)
|
||||
osal_start_reload_timer(zclApp_TaskID, APP_RING_STOP_EVT, 3000);
|
||||
|
||||
if (portAndAction & HAL_KEY_PRESS) {
|
||||
//osal_pwrmgr_task_state(zclApp_TaskID, PWRMGR_HOLD);
|
||||
@@ -157,17 +157,27 @@ static void zclApp_HandleKeys(byte portAndAction, byte keyCode) {
|
||||
}
|
||||
}
|
||||
|
||||
//start new stop timer (ring ends timer)
|
||||
osal_start_reload_timer(zclApp_TaskID, APP_RING_STOP_EVT, 3000);
|
||||
}
|
||||
|
||||
if (portAndAction & 0x04) { //P2 Btn //S2 P2_0
|
||||
zclFactoryResetter_HandleKeys(portAndAction, keyCode);
|
||||
if (portAndAction & HAL_KEY_PRESS) {
|
||||
LREPMaster("Key pressed\r\n");
|
||||
zclApp_State.pressTime = osal_getClock();
|
||||
LREP("pressTime = %d\r\n", zclApp_State.pressTime);
|
||||
}
|
||||
if (portAndAction & HAL_KEY_RELEASE) {
|
||||
LREPMaster("Key released\r\n");
|
||||
uint32 holdTime = osal_getClock() - zclApp_State.pressTime;
|
||||
LREP("holdTime = %d \r\n", holdTime);
|
||||
zclApp_State.pressTime = 0;
|
||||
if (holdTime >= 1) { //seconds
|
||||
osal_start_reload_timer(zclApp_TaskID, APP_BTN_HOLD_EVT, 50);
|
||||
}
|
||||
else {
|
||||
osal_start_reload_timer(zclApp_TaskID, APP_BTN_CLICK_EVT, 50);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +296,7 @@ static void zclApp_RingRun(void) {
|
||||
}
|
||||
break;
|
||||
case Droped:
|
||||
if (zclApp_State.RingRunStep > 3) {
|
||||
if (zclApp_State.RingRunStep > 1) {
|
||||
zclApp_RingEnd();
|
||||
}
|
||||
break;
|
||||
@@ -379,9 +389,6 @@ static void zclApp_BtnClick(bool hold) {
|
||||
currentBtnClickPhase = 0;
|
||||
break;
|
||||
}
|
||||
#if defined( ZIC_BATTERY_MODE )
|
||||
zclBattery_Report();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void zclApp_Report(void) {
|
||||
|
||||
@@ -64,8 +64,8 @@ const uint8 zclApp_PowerSource = POWER_SOURCE_DC;
|
||||
#define DEFAULT_ModeOpen Never
|
||||
#define DEFAULT_ModeSound TRUE
|
||||
|
||||
#define DEFAULT_TimeRing 3 //seconds to ring, before answer
|
||||
#define DEFAULT_TimeTalk 1 //seconds to talk, before open
|
||||
#define DEFAULT_TimeRing 7 //seconds to ring, before answer
|
||||
#define DEFAULT_TimeTalk 3 //seconds to talk, before open
|
||||
#define DEFAULT_TimeOpen 2 //seconds to hold open
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ application_config_t zclApp_Config = {
|
||||
device_state_t zclApp_State = {
|
||||
.State = Idle,
|
||||
.RingRunStep = 0,
|
||||
.pressTime = 0,
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user