mirror of
https://github.com/Utyff/Zintercom.git
synced 2026-01-12 09:17:41 +03:00
fixed drop while ring
added z2m dashboard screens
This commit is contained in:
@@ -13,6 +13,9 @@ Use [external converters](https://www.zigbee2mqtt.io/information/configuration.h
|
|||||||
|
|
||||||
Converter file located [here](./converters/DIY_Zintercom.js)
|
Converter file located [here](./converters/DIY_Zintercom.js)
|
||||||
|
|
||||||
|
<img src="./images/z2m_dark.png" width="45%">
|
||||||
|
<img src="./images/z2m_light.png" width="45%">
|
||||||
|
|
||||||
### Schematic
|
### Schematic
|
||||||
|
|
||||||
<img src="./hardware/Schematic_Zintercom.png" width="90%">
|
<img src="./hardware/Schematic_Zintercom.png" width="90%">
|
||||||
|
|||||||
@@ -138,14 +138,13 @@ static void zclApp_HandleKeys(byte portAndAction, byte keyCode) {
|
|||||||
|
|
||||||
if (portAndAction & 0x01) { //P0 Ring //S1 P0_1
|
if (portAndAction & 0x01) { //P0 Ring //S1 P0_1
|
||||||
|
|
||||||
|
//exit old stop timer
|
||||||
|
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||||
|
osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||||
|
|
||||||
if (portAndAction & HAL_KEY_PRESS) {
|
if (portAndAction & HAL_KEY_PRESS) {
|
||||||
|
|
||||||
//osal_pwrmgr_task_state(zclApp_TaskID, PWRMGR_HOLD);
|
//osal_pwrmgr_task_state(zclApp_TaskID, PWRMGR_HOLD);
|
||||||
|
//osal_pwrmgr_task_state(Hal_TaskID, PWRMGR_CONSERVE);
|
||||||
|
|
||||||
//exit old stop timer
|
|
||||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
|
||||||
osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
|
|
||||||
|
|
||||||
//start ring
|
//start ring
|
||||||
if (zclApp_State.RingRunStep == 0) {
|
if (zclApp_State.RingRunStep == 0) {
|
||||||
@@ -156,20 +155,15 @@ static void zclApp_HandleKeys(byte portAndAction, byte keyCode) {
|
|||||||
afAddrType_t inderect_DstAddr = {.addrMode = (afAddrMode_t)AddrNotPresent, .endPoint = 0, .addr.shortAddr = 0};
|
afAddrType_t inderect_DstAddr = {.addrMode = (afAddrMode_t)AddrNotPresent, .endPoint = 0, .addr.shortAddr = 0};
|
||||||
zclGeneral_SendOnOff_CmdOn(zclApp_FirstEP.EndPoint, &inderect_DstAddr, FALSE, bdb_getZCLFrameCounter());
|
zclGeneral_SendOnOff_CmdOn(zclApp_FirstEP.EndPoint, &inderect_DstAddr, FALSE, bdb_getZCLFrameCounter());
|
||||||
}
|
}
|
||||||
|
|
||||||
//start new stop timer (ring ends timer)
|
|
||||||
osal_start_reload_timer(zclApp_TaskID, APP_RING_STOP_EVT, 3000);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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
|
if (portAndAction & 0x04) { //P2 Btn //S2 P2_0
|
||||||
zclFactoryResetter_HandleKeys(portAndAction, keyCode);
|
zclFactoryResetter_HandleKeys(portAndAction, keyCode);
|
||||||
if (portAndAction & HAL_KEY_PRESS) {
|
if (portAndAction & HAL_KEY_PRESS) {
|
||||||
#if defined( ZIC_BATTERY_MODE )
|
|
||||||
zclBattery_Report();
|
|
||||||
#endif
|
|
||||||
LREPMaster("Key pressed\r\n");
|
LREPMaster("Key pressed\r\n");
|
||||||
osal_start_reload_timer(zclApp_TaskID, APP_BTN_CLICK_EVT, 50);
|
osal_start_reload_timer(zclApp_TaskID, APP_BTN_CLICK_EVT, 50);
|
||||||
}
|
}
|
||||||
@@ -262,10 +256,6 @@ static void zclApp_RingRun(void) {
|
|||||||
case Idle:
|
case Idle:
|
||||||
zclApp_State.State = Ring;
|
zclApp_State.State = Ring;
|
||||||
zclApp_OneReport();
|
zclApp_OneReport();
|
||||||
if (zclApp_Config.ModeOpen == Drop){
|
|
||||||
zclApp_State.State = Droped;
|
|
||||||
zclApp_TalkStart();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Ring:
|
case Ring:
|
||||||
if ((zclApp_Config.ModeOpen == Once) || (zclApp_Config.ModeOpen == Always)){
|
if ((zclApp_Config.ModeOpen == Once) || (zclApp_Config.ModeOpen == Always)){
|
||||||
@@ -274,6 +264,10 @@ static void zclApp_RingRun(void) {
|
|||||||
zclApp_TalkStart();
|
zclApp_TalkStart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (zclApp_Config.ModeOpen == Drop){
|
||||||
|
zclApp_State.State = Droped;
|
||||||
|
zclApp_TalkStart();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Talk:
|
case Talk:
|
||||||
if ((zclApp_Config.ModeOpen == Once) || (zclApp_Config.ModeOpen == Always)){
|
if ((zclApp_Config.ModeOpen == Once) || (zclApp_Config.ModeOpen == Always)){
|
||||||
@@ -286,19 +280,14 @@ static void zclApp_RingRun(void) {
|
|||||||
break;
|
break;
|
||||||
case Open:
|
case Open:
|
||||||
if ((zclApp_Config.ModeOpen == Once) || (zclApp_Config.ModeOpen == Always)){
|
if ((zclApp_Config.ModeOpen == Once) || (zclApp_Config.ModeOpen == Always)){
|
||||||
if (zclApp_State.RingRunStep > ((zclApp_Config.TimeRing + zclApp_Config.TimeTalk+ zclApp_Config.TimeOpen) * 2)) {
|
if (zclApp_State.RingRunStep > ((zclApp_Config.TimeRing + zclApp_Config.TimeTalk + zclApp_Config.TimeOpen) * 2)) {
|
||||||
zclApp_RingEnd();
|
zclApp_RingEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Droped:
|
case Droped:
|
||||||
switch (zclApp_State.RingRunStep) {
|
if (zclApp_State.RingRunStep > 3) {
|
||||||
case 3:
|
|
||||||
zclApp_OneReport();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
zclApp_RingEnd();
|
zclApp_RingEnd();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -390,7 +379,9 @@ static void zclApp_BtnClick(bool hold) {
|
|||||||
currentBtnClickPhase = 0;
|
currentBtnClickPhase = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if defined( ZIC_BATTERY_MODE )
|
||||||
|
zclBattery_Report();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void zclApp_Report(void) {
|
static void zclApp_Report(void) {
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ const uint8 zclApp_PowerSource = POWER_SOURCE_DC;
|
|||||||
#define DEFAULT_ModeSound TRUE
|
#define DEFAULT_ModeSound TRUE
|
||||||
|
|
||||||
#define DEFAULT_TimeRing 3 //seconds to ring, before answer
|
#define DEFAULT_TimeRing 3 //seconds to ring, before answer
|
||||||
#define DEFAULT_TimeTalk 2 //seconds to talk, before open
|
#define DEFAULT_TimeTalk 1 //seconds to talk, before open
|
||||||
#define DEFAULT_TimeOpen 1 //seconds to hold open
|
#define DEFAULT_TimeOpen 2 //seconds to hold open
|
||||||
|
|
||||||
|
|
||||||
application_config_t zclApp_Config = {
|
application_config_t zclApp_Config = {
|
||||||
|
|||||||
BIN
images/z2m_dark.png
Normal file
BIN
images/z2m_dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
BIN
images/z2m_light.png
Normal file
BIN
images/z2m_light.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
Reference in New Issue
Block a user