1
0
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:
lost
2021-03-23 20:57:03 +02:00
parent 425b8fa578
commit 9006169c6a
5 changed files with 25 additions and 31 deletions

View File

@@ -11,8 +11,11 @@ LED will flash during reset.
### How to add device into zigbe2mqtt
Use [external converters](https://www.zigbee2mqtt.io/information/configuration.html#external-converters-configuration) feature
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
<img src="./hardware/Schematic_Zintercom.png" width="90%">

View File

@@ -137,15 +137,14 @@ static void zclApp_HandleKeys(byte portAndAction, byte keyCode) {
//zclCommissioning_HandleKeys(portAndAction, keyCode);
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) {
//osal_pwrmgr_task_state(zclApp_TaskID, PWRMGR_HOLD);
//exit old stop timer
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
//osal_pwrmgr_task_state(Hal_TaskID, PWRMGR_CONSERVE);
//start ring
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};
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
zclFactoryResetter_HandleKeys(portAndAction, keyCode);
if (portAndAction & HAL_KEY_PRESS) {
#if defined( ZIC_BATTERY_MODE )
zclBattery_Report();
#endif
LREPMaster("Key pressed\r\n");
osal_start_reload_timer(zclApp_TaskID, APP_BTN_CLICK_EVT, 50);
}
@@ -262,10 +256,6 @@ static void zclApp_RingRun(void) {
case Idle:
zclApp_State.State = Ring;
zclApp_OneReport();
if (zclApp_Config.ModeOpen == Drop){
zclApp_State.State = Droped;
zclApp_TalkStart();
}
break;
case Ring:
if ((zclApp_Config.ModeOpen == Once) || (zclApp_Config.ModeOpen == Always)){
@@ -274,6 +264,10 @@ static void zclApp_RingRun(void) {
zclApp_TalkStart();
}
}
if (zclApp_Config.ModeOpen == Drop){
zclApp_State.State = Droped;
zclApp_TalkStart();
}
break;
case Talk:
if ((zclApp_Config.ModeOpen == Once) || (zclApp_Config.ModeOpen == Always)){
@@ -286,20 +280,15 @@ static void zclApp_RingRun(void) {
break;
case Open:
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();
}
}
break;
case Droped:
switch (zclApp_State.RingRunStep) {
case 3:
zclApp_OneReport();
break;
case 4:
zclApp_RingEnd();
break;
}
if (zclApp_State.RingRunStep > 3) {
zclApp_RingEnd();
}
break;
}
@@ -390,7 +379,9 @@ static void zclApp_BtnClick(bool hold) {
currentBtnClickPhase = 0;
break;
}
#if defined( ZIC_BATTERY_MODE )
zclBattery_Report();
#endif
}
static void zclApp_Report(void) {

View File

@@ -65,8 +65,8 @@ const uint8 zclApp_PowerSource = POWER_SOURCE_DC;
#define DEFAULT_ModeSound TRUE
#define DEFAULT_TimeRing 3 //seconds to ring, before answer
#define DEFAULT_TimeTalk 2 //seconds to talk, before open
#define DEFAULT_TimeOpen 1 //seconds to hold open
#define DEFAULT_TimeTalk 1 //seconds to talk, before open
#define DEFAULT_TimeOpen 2 //seconds to hold open
application_config_t zclApp_Config = {

BIN
images/z2m_dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
images/z2m_light.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB