mirror of
https://github.com/Utyff/Zintercom.git
synced 2026-01-12 17:27:42 +03:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e98969e3c5 | ||
|
|
a3ec8d06b0 | ||
|
|
66869f7d0c | ||
|
|
db6995dc7b | ||
|
|
7994aead0c | ||
|
|
5de49cbeae | ||
|
|
6255791281 | ||
|
|
a872b42ff1 | ||
|
|
b2d9a718a4 | ||
|
|
21106958c5 | ||
|
|
e58b8a0f97 | ||
|
|
0439847dd5 | ||
|
|
a34f4319d9 | ||
|
|
c9ff7819b2 |
@@ -142,11 +142,11 @@
|
|||||||
<option>
|
<option>
|
||||||
<name>Input variant</name>
|
<name>Input variant</name>
|
||||||
<version>2</version>
|
<version>2</version>
|
||||||
<state>0</state>
|
<state>5</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>Input description</name>
|
<name>Input description</name>
|
||||||
<state>Automatic choice of formatter.</state>
|
<state>No float.</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>Output variant</name>
|
<name>Output variant</name>
|
||||||
@@ -1284,11 +1284,11 @@
|
|||||||
<option>
|
<option>
|
||||||
<name>Input variant</name>
|
<name>Input variant</name>
|
||||||
<version>2</version>
|
<version>2</version>
|
||||||
<state>0</state>
|
<state>5</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>Input description</name>
|
<name>Input description</name>
|
||||||
<state>Automatic choice of formatter.</state>
|
<state>No float.</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>Output variant</name>
|
<name>Output variant</name>
|
||||||
@@ -1604,7 +1604,7 @@
|
|||||||
<option>
|
<option>
|
||||||
<name>Compiler Extra Options Edit</name>
|
<name>Compiler Extra Options Edit</name>
|
||||||
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wRouter.cfg</state>
|
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wRouter.cfg</state>
|
||||||
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wConfig.cfg</state>
|
<state>-f $PROJ_DIR$\..\zstack-lib\f8wConfig.cfg</state>
|
||||||
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wZCL.cfg</state>
|
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wZCL.cfg</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
@@ -3704,7 +3704,7 @@
|
|||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>OGChipConfigPath</name>
|
<name>OGChipConfigPath</name>
|
||||||
<state>$TOOLKIT_DIR$\config\devices\Texas Instruments\CC2530F256.i51</state>
|
<state>$TOOLKIT_DIR$\config\devices\Texas Instruments\CC25xx\3x\CC2530F256.i51</state>
|
||||||
</option>
|
</option>
|
||||||
</data>
|
</data>
|
||||||
</settings>
|
</settings>
|
||||||
@@ -3887,7 +3887,7 @@
|
|||||||
<option>
|
<option>
|
||||||
<name>Compiler Extra Options Edit</name>
|
<name>Compiler Extra Options Edit</name>
|
||||||
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wRouter.cfg</state>
|
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wRouter.cfg</state>
|
||||||
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wConfig.cfg</state>
|
<state>-f $PROJ_DIR$\..\zstack-lib\f8wConfig.cfg</state>
|
||||||
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wZCL.cfg</state>
|
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wZCL.cfg</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
@@ -5989,7 +5989,7 @@
|
|||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>OGChipConfigPath</name>
|
<name>OGChipConfigPath</name>
|
||||||
<state>$TOOLKIT_DIR$\config\devices\Texas Instruments\CC2530F256.i51</state>
|
<state>$TOOLKIT_DIR$\config\devices\Texas Instruments\CC25xx\3x\CC2530F256.i51</state>
|
||||||
</option>
|
</option>
|
||||||
</data>
|
</data>
|
||||||
</settings>
|
</settings>
|
||||||
@@ -6174,7 +6174,7 @@
|
|||||||
<option>
|
<option>
|
||||||
<name>Compiler Extra Options Edit</name>
|
<name>Compiler Extra Options Edit</name>
|
||||||
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wRouter.cfg</state>
|
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wRouter.cfg</state>
|
||||||
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wConfig.cfg</state>
|
<state>-f $PROJ_DIR$\..\zstack-lib\f8wConfig.cfg</state>
|
||||||
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wZCL.cfg</state>
|
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wZCL.cfg</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
@@ -8276,7 +8276,7 @@
|
|||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>OGChipConfigPath</name>
|
<name>OGChipConfigPath</name>
|
||||||
<state>$TOOLKIT_DIR$\config\devices\Texas Instruments\CC2530F256.i51</state>
|
<state>$TOOLKIT_DIR$\config\devices\Texas Instruments\CC25xx\3x\CC2530F256.i51</state>
|
||||||
</option>
|
</option>
|
||||||
</data>
|
</data>
|
||||||
</settings>
|
</settings>
|
||||||
@@ -8461,7 +8461,7 @@
|
|||||||
<option>
|
<option>
|
||||||
<name>Compiler Extra Options Edit</name>
|
<name>Compiler Extra Options Edit</name>
|
||||||
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wRouter.cfg</state>
|
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wRouter.cfg</state>
|
||||||
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wConfig.cfg</state>
|
<state>-f $PROJ_DIR$\..\zstack-lib\f8wConfig.cfg</state>
|
||||||
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wZCL.cfg</state>
|
<state>-f $PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wZCL.cfg</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
@@ -9687,7 +9687,7 @@
|
|||||||
<name>$PROJ_DIR$\..\..\..\Tools\CC2530DB\f8w2530.xcl</name>
|
<name>$PROJ_DIR$\..\..\..\Tools\CC2530DB\f8w2530.xcl</name>
|
||||||
</file>
|
</file>
|
||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wConfig.cfg</name>
|
<name>$PROJ_DIR$\..\zstack-lib\f8wConfig.cfg</name>
|
||||||
</file>
|
</file>
|
||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wCoord.cfg</name>
|
<name>$PROJ_DIR$\..\..\..\Tools\CC2530DB\f8wCoord.cfg</name>
|
||||||
|
|||||||
51
README.md
51
README.md
@@ -1,29 +1,54 @@
|
|||||||
# Zintercom
|
# Zintercom
|
||||||
|
|
||||||
|
## How to compile
|
||||||
|
Follow this article https://zigdevwiki.github.io/Begin/IAR_install/
|
||||||
|
|
||||||
##### Zigbee Intercom Automator
|
##### Zigbee Intercom Automator
|
||||||
This device is designed to control the matrix intercom using Zigbee.
|
This device is designed to control the matrix intercom using Zigbee.
|
||||||
|
|
||||||
Using zigbee2mqtt you can:
|
Using zigbee2mqtt you can:
|
||||||
1. Receive notification when the intercom rings. (also support **direct bind**)
|
1. Receive a notification when the intercom rings. (also support **direct bind**)
|
||||||
2. Mute the sound on the intercom handset.
|
2. Mute the sound on the intercom handset.
|
||||||
3. Automatically or manually open the door or hang up when the intercom rings.
|
3. Automatically or manually open the door or hang up when the intercom rings.
|
||||||
|
|
||||||
There are 4 work modes:
|
There are 4 work modes:
|
||||||
1. `Never` - ordinary work mode, use handset to control
|
1. `Never` - ordinary work mode, use a handset to control
|
||||||
2. `Once` - one time open door when intercom rings
|
2. `Once` - one-time open door when intercom rings
|
||||||
3. `Always` - open door when intercom rings
|
3. `Always` - open door when intercom rings
|
||||||
4. `Drop` - hangs up all intercom rings, right after start
|
4. `Drop` - hangs up all intercom rings, right after the start
|
||||||
|
|
||||||
You can change the operating mode uisng z2m or by short press the button. (< 1000ms)
|
You can change the operating mode using z2m or by short press the button. (< 1000ms)
|
||||||
After pressing the button, the LED will flash at 4 Hz.
|
After pressing the button, the LED will flash at 4 Hz.
|
||||||
The number of flashes indicates the current operating mode.
|
The number of flashes indicates the current operating mode.
|
||||||
|
|
||||||
You can control sound mode using z2m or by long press the button. (1000ms < X < 5000ms)
|
You can control sound mode using z2m or by long-press the button. (1000ms < X < 5000ms)
|
||||||
After pressing the button, the LED will flash at 1.5 Hz.
|
After pressing the button, the LED will flash at 1.5 Hz.
|
||||||
One flash - OFF, two flashes - ON.
|
One flash - OFF, two flashes - ON.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Important info
|
||||||
|
#### 1
|
||||||
|
In Gerber PCB v1.0 committed on Apr 14, there are some errors in the silkscreen layers:
|
||||||
|
1. 'Line-' and 'Phone-' are reversed.
|
||||||
|
2. '+' and '-' are also reversed.
|
||||||
|
|
||||||
|
Just plug by swapping.
|
||||||
|
|
||||||
|
#### 2
|
||||||
|
The problem of cross-calls to other apartments:
|
||||||
|
it was revealed that the intercom circuit is closed through the reverse diode of the u2 transistor (thanks to @Alex_AW)
|
||||||
|
to prevent it, you need to add a diode according to the diagram:
|
||||||
|

|
||||||
|
|
||||||
|
#### 3
|
||||||
|
If you want to use the battery version without a handset, do not turn off the sound in z2m, but use an external resistor to emulate the intercom handset, according to the diagram:
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
### How to join
|
### How to join
|
||||||
Reset to FN by reboot device 5 times with interval less than 10 seconds.
|
Reset to FN by reboot the device 5 times with intervals of less than 10 seconds.
|
||||||
Reset to FN by press and hold BTN for 5 seconds.
|
Reset to FN by pressing and holding BTN for 5 seconds.
|
||||||
|
|
||||||
LED will flash during reset.
|
LED will flash during reset.
|
||||||
|
|
||||||
@@ -50,6 +75,8 @@ Converter file located [here](https://github.com/diyruz/Zintercom/blob/master/co
|
|||||||
|
|
||||||
### DC Power
|
### DC Power
|
||||||
|
|
||||||
|
5-10 V
|
||||||
|
|
||||||
Support `router` and `end device` modes.
|
Support `router` and `end device` modes.
|
||||||
Install `E18-MS1PA1`, `E18-MS1PA2` or `E18-MS1-PCB`.
|
Install `E18-MS1PA1`, `E18-MS1PA2` or `E18-MS1-PCB`.
|
||||||
|
|
||||||
@@ -60,13 +87,15 @@ Install `E18-MS1PA1`, `E18-MS1PA2` or `E18-MS1-PCB`.
|
|||||||
|
|
||||||
### Battery Power
|
### Battery Power
|
||||||
|
|
||||||
|
2 * AAA batteries
|
||||||
|
|
||||||
Support only `end device` mode.
|
Support only `end device` mode.
|
||||||
Install `E18-MS1-PCB` only!
|
Install `E18-MS1-PCB` only!
|
||||||
|
|
||||||
Do not turn off `sound` because it turns U2 forever, which will drain the battery much faster.
|
Do not turn off `sound` because it turns U2 forever, which will drain the battery much faster.
|
||||||
|
|
||||||
Since the device is in sleep mode, it cannot receive commands.
|
Since the device is in sleep mode, it cannot receive commands.
|
||||||
But you have the ability to set the button mode or at the time of the call.
|
But you can set the button mode or at the time of the call.
|
||||||
|
|
||||||
If any commands are in the coordinator's queue, they will be executed after a button is pressed or a call is received.
|
If any commands are in the coordinator's queue, they will be executed after a button is pressed or a call is received.
|
||||||
|
|
||||||
@@ -75,7 +104,7 @@ If any commands are in the coordinator's queue, they will be executed after a bu
|
|||||||
##### The mode set by the Zigbee command `overwrites` the mode set by the button.
|
##### The mode set by the Zigbee command `overwrites` the mode set by the button.
|
||||||
|
|
||||||
### Binding
|
### Binding
|
||||||
The device supports direct binding of an incoming call to the onOff cluster.
|
The device supports the direct binding of an incoming call to the onOff cluster.
|
||||||
|
|
||||||
For example, you can turn on the light while a call comes to the intercom, for notification in mute mode.
|
For example, you can turn on the light while a call comes to the intercom, for notification in mute mode.
|
||||||
|
|
||||||
@@ -83,7 +112,9 @@ For example, you can turn on the light while a call comes to the intercom, for n
|
|||||||
### Files to reproduce
|
### Files to reproduce
|
||||||
* [Gerbers and BOM](https://github.com/diyruz/Zintercom/tree/master/hardware) by [xyzroe](https://t.me/xyzroe)
|
* [Gerbers and BOM](https://github.com/diyruz/Zintercom/tree/master/hardware) by [xyzroe](https://t.me/xyzroe)
|
||||||
* [Firmware](https://github.com/diyruz/Zintercom/releases) by [xyzroe](https://t.me/xyzroe)
|
* [Firmware](https://github.com/diyruz/Zintercom/releases) by [xyzroe](https://t.me/xyzroe)
|
||||||
|
* [Case stl](https://www.thingiverse.com/thing:4866356) by [dreamertwo](https://t.me/dreamertwo)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### Inspired by
|
### Inspired by
|
||||||
The original scheme of the intercom opener by [Alexander Vaidurov](https://easyeda.com/Alex_AW/domofon-with-battery)
|
The original scheme of the intercom opener by [Alexander Vaidurov](https://easyeda.com/Alex_AW/domofon-with-battery)
|
||||||
|
|||||||
@@ -42,20 +42,29 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( HAL_BOARD_TARGET )
|
#if defined( HAL_BOARD_TARGET )
|
||||||
|
// Income ring - P0_0
|
||||||
|
#define KEY_INCOME_PORT HAL_KEY_PORT0
|
||||||
#define HAL_KEY_P0_INPUT_PINS BV(0)
|
#define HAL_KEY_P0_INPUT_PINS BV(0)
|
||||||
#define HAL_KEY_P0_INPUT_PINS_EDGE HAL_KEY_RISING_EDGE
|
#define HAL_KEY_P0_INPUT_PINS_EDGE HAL_KEY_RISING_EDGE
|
||||||
|
// Button - P2_0
|
||||||
|
#define KEY1_PORT HAL_KEY_PORT2
|
||||||
#define HAL_KEY_P2_INPUT_PINS BV(0)
|
#define HAL_KEY_P2_INPUT_PINS BV(0)
|
||||||
#define HAL_KEY_P2_INPUT_PINS_EDGE HAL_KEY_FALLING_EDGE
|
#define HAL_KEY_P2_INPUT_PINS_EDGE HAL_KEY_FALLING_EDGE
|
||||||
#define INT_HEAP_LEN 2200//2256
|
#define INT_HEAP_LEN 2200//2256
|
||||||
#elif defined( HAL_BOARD_CHDTECH_DEV )
|
#elif defined( HAL_BOARD_CHDTECH_DEV )
|
||||||
|
// Income ring - P0_1
|
||||||
|
#define KEY_INCOME_PORT HAL_KEY_PORT0
|
||||||
#define HAL_KEY_P0_INPUT_PINS BV(1)
|
#define HAL_KEY_P0_INPUT_PINS BV(1)
|
||||||
#define HAL_KEY_P0_INPUT_PINS_EDGE HAL_KEY_FALLING_EDGE
|
#define HAL_KEY_P0_INPUT_PINS_EDGE HAL_KEY_FALLING_EDGE
|
||||||
|
// Button - P2_0
|
||||||
|
#define KEY1_PORT HAL_KEY_PORT2
|
||||||
#define HAL_KEY_P2_INPUT_PINS BV(0)
|
#define HAL_KEY_P2_INPUT_PINS BV(0)
|
||||||
#define HAL_KEY_P2_INPUT_PINS_EDGE HAL_KEY_FALLING_EDGE
|
#define HAL_KEY_P2_INPUT_PINS_EDGE HAL_KEY_FALLING_EDGE
|
||||||
#define DO_DEBUG_UART
|
#define DO_DEBUG_UART
|
||||||
#define INT_HEAP_LEN 2060
|
#define INT_HEAP_LEN 2060
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define BTN_HOLD_TIME 1000
|
||||||
#define FACTORY_RESET_HOLD_TIME_LONG 5000
|
#define FACTORY_RESET_HOLD_TIME_LONG 5000
|
||||||
|
|
||||||
#if defined( DO_DEBUG_UART )
|
#if defined( DO_DEBUG_UART )
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ byte zclApp_TaskID;
|
|||||||
* LOCAL VARIABLES
|
* LOCAL VARIABLES
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static uint8 currentBtnClickPhase = 0;
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* LOCAL FUNCTIONS
|
* LOCAL FUNCTIONS
|
||||||
@@ -135,17 +136,19 @@ static void zclApp_HandleKeys(byte portAndAction, byte keyCode) {
|
|||||||
//LREP("zclApp_HandleKeys portAndAction=0x%X keyCode=0x%X\r\n", portAndAction, keyCode);
|
//LREP("zclApp_HandleKeys portAndAction=0x%X keyCode=0x%X\r\n", portAndAction, keyCode);
|
||||||
//zclCommissioning_HandleKeys(portAndAction, keyCode);
|
//zclCommissioning_HandleKeys(portAndAction, keyCode);
|
||||||
|
|
||||||
if (portAndAction & 0x01) { //P0 Ring //S1 P0_1
|
if (portAndAction & KEY_INCOME_PORT) { //P0 Ring //S1 P0_1 TODO add check Income pin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//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_timerEx(zclApp_TaskID, APP_RING_STOP_EVT, 3000);
|
||||||
|
//zclApp_Config.TimeRing
|
||||||
|
uint32 TimeBell = (uint32)zclApp_Config.TimeBell *(uint32)1000;
|
||||||
|
osal_start_timerEx(zclApp_TaskID, APP_RING_STOP_EVT, (uint32)TimeBell);
|
||||||
if (portAndAction & HAL_KEY_PRESS) {
|
if (portAndAction & HAL_KEY_PRESS) {
|
||||||
|
|
||||||
//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_timerEx(zclApp_TaskID, APP_RING_STOP_EVT, 3000);
|
|
||||||
|
|
||||||
//start ring
|
//start ring
|
||||||
if (zclApp_State.RingRunStep == 0) {
|
if (zclApp_State.RingRunStep == 0) {
|
||||||
@@ -155,7 +158,8 @@ static void zclApp_HandleKeys(byte portAndAction, byte keyCode) {
|
|||||||
LREPMaster("Ring start\r\n");
|
LREPMaster("Ring start\r\n");
|
||||||
//HalLedSet(LED_PIN, HAL_LED_MODE_BLINK);
|
//HalLedSet(LED_PIN, HAL_LED_MODE_BLINK);
|
||||||
zclApp_State.RingRunStep = 1;
|
zclApp_State.RingRunStep = 1;
|
||||||
osal_start_reload_timer(zclApp_TaskID, APP_RING_RUN_EVT, 500);
|
//osal_start_reload_timer(zclApp_TaskID, APP_RING_RUN_EVT, 500);
|
||||||
|
osal_start_timerEx(zclApp_TaskID, APP_RING_RUN_EVT, 500);
|
||||||
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());
|
||||||
}
|
}
|
||||||
@@ -163,24 +167,24 @@ static void zclApp_HandleKeys(byte portAndAction, byte keyCode) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (portAndAction & 0x04) { //P2 Btn //S2 P2_0
|
if (portAndAction & KEY1_PORT) { //P2 Btn //S2 P2_0 TODO add check BUTTON pin
|
||||||
zclFactoryResetter_HandleKeys(portAndAction, keyCode);
|
zclFactoryResetter_HandleKeys(portAndAction, keyCode);
|
||||||
if (portAndAction & HAL_KEY_PRESS) {
|
if (portAndAction & HAL_KEY_PRESS) {
|
||||||
LREPMaster("Key pressed\r\n");
|
LREPMaster("Key pressed\r\n");
|
||||||
zclApp_State.pressTime = osal_getClock();
|
zclApp_State.pressTime = osal_GetSystemClock();
|
||||||
LREP("pressTime = %d\r\n", zclApp_State.pressTime);
|
LREP("pressTime = %ld\r\n", zclApp_State.pressTime);
|
||||||
}
|
}
|
||||||
if (portAndAction & HAL_KEY_RELEASE) {
|
if (portAndAction & HAL_KEY_RELEASE) {
|
||||||
LREPMaster("Key released\r\n");
|
LREPMaster("Key released\r\n");
|
||||||
uint32 holdTime = osal_getClock() - zclApp_State.pressTime;
|
uint32 holdTime = osal_GetSystemClock() - zclApp_State.pressTime;
|
||||||
LREP("holdTime = %d \r\n", holdTime);
|
LREP("holdTime = %ld \r\n", holdTime);
|
||||||
zclApp_State.pressTime = 0;
|
if (zclApp_State.pressTime != 0 && holdTime >= BTN_HOLD_TIME) { // check release without press and hold milliseconds
|
||||||
if (holdTime >= 1) { //seconds
|
osal_start_timerEx(zclApp_TaskID, APP_BTN_HOLD_EVT, 50);
|
||||||
osal_start_reload_timer(zclApp_TaskID, APP_BTN_HOLD_EVT, 50);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
osal_start_reload_timer(zclApp_TaskID, APP_BTN_CLICK_EVT, 50);
|
osal_start_timerEx(zclApp_TaskID, APP_BTN_CLICK_EVT, 50);
|
||||||
}
|
}
|
||||||
|
zclApp_State.pressTime = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -254,7 +258,9 @@ uint16 zclApp_event_loop(uint8 task_id, uint16 events) {
|
|||||||
|
|
||||||
if (events & APP_BTN_HOLD_EVT) {
|
if (events & APP_BTN_HOLD_EVT) {
|
||||||
LREPMaster("APP_BTN_HOLD_EVT\r\n");
|
LREPMaster("APP_BTN_HOLD_EVT\r\n");
|
||||||
zclApp_BtnClick(true);
|
#if !defined( ZIC_BATTERY_MODE )
|
||||||
|
zclApp_BtnClick(true);
|
||||||
|
#endif
|
||||||
return (events ^ APP_BTN_HOLD_EVT);
|
return (events ^ APP_BTN_HOLD_EVT);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -266,6 +272,7 @@ static void zclApp_RingRun(void) {
|
|||||||
LREP("zclApp_State.RingRunStep %d\r\n", zclApp_State.RingRunStep);
|
LREP("zclApp_State.RingRunStep %d\r\n", zclApp_State.RingRunStep);
|
||||||
LREP("zclApp_State.State %d\r\n", zclApp_State.State);
|
LREP("zclApp_State.State %d\r\n", zclApp_State.State);
|
||||||
|
|
||||||
|
osal_start_timerEx(zclApp_TaskID, APP_RING_RUN_EVT, 500);
|
||||||
|
|
||||||
|
|
||||||
switch (zclApp_State.State) {
|
switch (zclApp_State.State) {
|
||||||
@@ -304,6 +311,7 @@ static void zclApp_RingRun(void) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Droped:
|
case Droped:
|
||||||
|
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||||
if (zclApp_State.RingRunStep > 1) {
|
if (zclApp_State.RingRunStep > 1) {
|
||||||
zclApp_RingEnd();
|
zclApp_RingEnd();
|
||||||
}
|
}
|
||||||
@@ -314,7 +322,7 @@ static void zclApp_RingRun(void) {
|
|||||||
|
|
||||||
static void zclApp_TalkStart(void) {
|
static void zclApp_TalkStart(void) {
|
||||||
LREPMaster("Talk start\r\n");
|
LREPMaster("Talk start\r\n");
|
||||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
//osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||||
//osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
|
//osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||||
zclApp_OneReport();
|
zclApp_OneReport();
|
||||||
HalLedSet(ANSWER_PIN, HAL_LED_MODE_ON);
|
HalLedSet(ANSWER_PIN, HAL_LED_MODE_ON);
|
||||||
@@ -332,8 +340,8 @@ static void zclApp_RingEnd(void) {
|
|||||||
HalLedSet(HANDSET_PIN, !zclApp_Config.ModeSound);
|
HalLedSet(HANDSET_PIN, !zclApp_Config.ModeSound);
|
||||||
HalLedSet(ANSWER_PIN, HAL_LED_MODE_OFF);
|
HalLedSet(ANSWER_PIN, HAL_LED_MODE_OFF);
|
||||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_RUN_EVT);
|
osal_stop_timerEx(zclApp_TaskID, APP_RING_RUN_EVT);
|
||||||
osal_clear_event(zclApp_TaskID, APP_RING_RUN_EVT);
|
//osal_clear_event(zclApp_TaskID, APP_RING_RUN_EVT);
|
||||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
//osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||||
//osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
|
//osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||||
zclApp_State.RingRunStep = 0;
|
zclApp_State.RingRunStep = 0;
|
||||||
zclApp_State.State = Idle;
|
zclApp_State.State = Idle;
|
||||||
@@ -353,17 +361,13 @@ static void zclApp_RingEnd(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void zclApp_BtnClick(bool hold) {
|
static void zclApp_BtnClick(bool hold) {
|
||||||
|
|
||||||
static uint8 currentBtnClickPhase = 0;
|
|
||||||
LREP("currentBtnClickPhase %d\r\n", currentBtnClickPhase);
|
LREP("currentBtnClickPhase %d\r\n", currentBtnClickPhase);
|
||||||
switch (currentBtnClickPhase++) {
|
switch (currentBtnClickPhase++) {
|
||||||
case 0:
|
case 0:
|
||||||
if (hold) {
|
if (hold) {
|
||||||
#if !defined( ZIC_BATTERY_MODE )
|
zclApp_Config.ModeSound = !zclApp_Config.ModeSound;
|
||||||
zclApp_Config.ModeSound = !zclApp_Config.ModeSound;
|
HalLedSet(HANDSET_PIN, !zclApp_Config.ModeSound);
|
||||||
HalLedSet(HANDSET_PIN, !zclApp_Config.ModeSound);
|
HalLedSet(CATCH_PIN, !zclApp_Config.ModeSound);
|
||||||
HalLedSet(CATCH_PIN, !zclApp_Config.ModeSound);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (zclApp_Config.ModeOpen < Drop) {
|
if (zclApp_Config.ModeOpen < Drop) {
|
||||||
@@ -385,7 +389,8 @@ static void zclApp_BtnClick(bool hold) {
|
|||||||
HalLedBlink(LED_PIN, zclApp_Config.ModeOpen+1, 50, 250);
|
HalLedBlink(LED_PIN, zclApp_Config.ModeOpen+1, 50, 250);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
default:
|
||||||
|
/*
|
||||||
if (hold) {
|
if (hold) {
|
||||||
osal_stop_timerEx(zclApp_TaskID, APP_BTN_HOLD_EVT);
|
osal_stop_timerEx(zclApp_TaskID, APP_BTN_HOLD_EVT);
|
||||||
osal_clear_event(zclApp_TaskID, APP_BTN_HOLD_EVT);
|
osal_clear_event(zclApp_TaskID, APP_BTN_HOLD_EVT);
|
||||||
@@ -394,9 +399,18 @@ static void zclApp_BtnClick(bool hold) {
|
|||||||
osal_stop_timerEx(zclApp_TaskID, APP_BTN_CLICK_EVT);
|
osal_stop_timerEx(zclApp_TaskID, APP_BTN_CLICK_EVT);
|
||||||
osal_clear_event(zclApp_TaskID, APP_BTN_CLICK_EVT);
|
osal_clear_event(zclApp_TaskID, APP_BTN_CLICK_EVT);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
currentBtnClickPhase = 0;
|
currentBtnClickPhase = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (currentBtnClickPhase != 0) {
|
||||||
|
if (hold) {
|
||||||
|
osal_start_timerEx(zclApp_TaskID, APP_BTN_HOLD_EVT, 50);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
osal_start_timerEx(zclApp_TaskID, APP_BTN_CLICK_EVT, 50);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void zclApp_Report(void) {
|
static void zclApp_Report(void) {
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ extern "C" {
|
|||||||
#define ATTRID_TIMERING 0x0053
|
#define ATTRID_TIMERING 0x0053
|
||||||
#define ATTRID_TIMETALK 0x0054
|
#define ATTRID_TIMETALK 0x0054
|
||||||
#define ATTRID_TIMEOPEN 0x0055
|
#define ATTRID_TIMEOPEN 0x0055
|
||||||
|
#define ATTRID_TIMEBELL 0x0057
|
||||||
#define ATTRID_TIMEREPORT 0x0056
|
#define ATTRID_TIMEREPORT 0x0056
|
||||||
|
|
||||||
#define LED_PIN HAL_LED_1
|
#define LED_PIN HAL_LED_1
|
||||||
@@ -107,6 +108,7 @@ typedef struct {
|
|||||||
uint8 TimeRing;
|
uint8 TimeRing;
|
||||||
uint8 TimeTalk;
|
uint8 TimeTalk;
|
||||||
uint8 TimeOpen;
|
uint8 TimeOpen;
|
||||||
|
uint8 TimeBell;
|
||||||
uint8 TimeReport;
|
uint8 TimeReport;
|
||||||
} application_config_t;
|
} application_config_t;
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ const uint8 zclApp_PowerSource = POWER_SOURCE_DC;
|
|||||||
#define DEFAULT_TimeRing 7 //seconds to ring, before answer
|
#define DEFAULT_TimeRing 7 //seconds to ring, before answer
|
||||||
#define DEFAULT_TimeTalk 3 //seconds to talk, before open
|
#define DEFAULT_TimeTalk 3 //seconds to talk, before open
|
||||||
#define DEFAULT_TimeOpen 2 //seconds to hold open
|
#define DEFAULT_TimeOpen 2 //seconds to hold open
|
||||||
|
#define DEFAULT_TimeBell 3 //seconds after last bell to finish ring
|
||||||
|
|
||||||
application_config_t zclApp_Config = {
|
application_config_t zclApp_Config = {
|
||||||
.ModeOpen = DEFAULT_ModeOpen,
|
.ModeOpen = DEFAULT_ModeOpen,
|
||||||
@@ -75,6 +75,7 @@ application_config_t zclApp_Config = {
|
|||||||
.TimeRing = DEFAULT_TimeRing,
|
.TimeRing = DEFAULT_TimeRing,
|
||||||
.TimeTalk = DEFAULT_TimeTalk,
|
.TimeTalk = DEFAULT_TimeTalk,
|
||||||
.TimeOpen = DEFAULT_TimeOpen,
|
.TimeOpen = DEFAULT_TimeOpen,
|
||||||
|
.TimeBell = DEFAULT_TimeBell,
|
||||||
.TimeReport = DEFAULT_TimeReport,
|
.TimeReport = DEFAULT_TimeReport,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -122,6 +123,7 @@ CONST zclAttrRec_t zclApp_AttrsFirstEP[] = {
|
|||||||
{ZCL_INTERCOM, {ATTRID_TIMERING, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeRing}},
|
{ZCL_INTERCOM, {ATTRID_TIMERING, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeRing}},
|
||||||
{ZCL_INTERCOM, {ATTRID_TIMETALK, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeTalk}},
|
{ZCL_INTERCOM, {ATTRID_TIMETALK, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeTalk}},
|
||||||
{ZCL_INTERCOM, {ATTRID_TIMEOPEN, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeOpen}},
|
{ZCL_INTERCOM, {ATTRID_TIMEOPEN, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeOpen}},
|
||||||
|
{ZCL_INTERCOM, {ATTRID_TIMEBELL, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeBell}},
|
||||||
{ZCL_INTERCOM, {ATTRID_TIMEREPORT, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeReport}},
|
{ZCL_INTERCOM, {ATTRID_TIMEREPORT, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeReport}},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -157,5 +159,6 @@ void zclApp_ResetAttributesToDefaultValues(void) {
|
|||||||
zclApp_Config.TimeRing = DEFAULT_TimeRing;
|
zclApp_Config.TimeRing = DEFAULT_TimeRing;
|
||||||
zclApp_Config.TimeTalk = DEFAULT_TimeTalk;
|
zclApp_Config.TimeTalk = DEFAULT_TimeTalk;
|
||||||
zclApp_Config.TimeOpen = DEFAULT_TimeOpen;
|
zclApp_Config.TimeOpen = DEFAULT_TimeOpen;
|
||||||
|
zclApp_Config.TimeBell = DEFAULT_TimeBell;
|
||||||
zclApp_Config.TimeReport = DEFAULT_TimeReport;
|
zclApp_Config.TimeReport = DEFAULT_TimeReport;
|
||||||
}
|
}
|
||||||
@@ -82,6 +82,9 @@ const fz = {
|
|||||||
if (msg.data.hasOwnProperty(0x0055)) {
|
if (msg.data.hasOwnProperty(0x0055)) {
|
||||||
result.time_open = msg.data[0x0055];
|
result.time_open = msg.data[0x0055];
|
||||||
}
|
}
|
||||||
|
if (msg.data.hasOwnProperty(0x0057)) {
|
||||||
|
result.time_bell = msg.data[0x0057];
|
||||||
|
}
|
||||||
if (msg.data.hasOwnProperty(0x0056)) {
|
if (msg.data.hasOwnProperty(0x0056)) {
|
||||||
result.time_report = msg.data[0x0056];
|
result.time_report = msg.data[0x0056];
|
||||||
}
|
}
|
||||||
@@ -92,7 +95,7 @@ const fz = {
|
|||||||
|
|
||||||
const tz = {
|
const tz = {
|
||||||
diy_zintercom_config: {
|
diy_zintercom_config: {
|
||||||
key: ['state', 'mode', 'sound', 'time_ring', 'time_talk', 'time_open', 'time_report'],
|
key: ['state', 'mode', 'sound', 'time_ring', 'time_talk', 'time_open', 'time_bell', 'time_report'],
|
||||||
convertSet: async (entity, key, rawValue, meta) => {
|
convertSet: async (entity, key, rawValue, meta) => {
|
||||||
const lookup = {
|
const lookup = {
|
||||||
'OFF': 0x00,
|
'OFF': 0x00,
|
||||||
@@ -118,6 +121,7 @@ const tz = {
|
|||||||
time_ring: {0x0053: {value, type: 0x20}},
|
time_ring: {0x0053: {value, type: 0x20}},
|
||||||
time_talk: {0x0054: {value, type: 0x20}},
|
time_talk: {0x0054: {value, type: 0x20}},
|
||||||
time_open: {0x0055: {value, type: 0x20}},
|
time_open: {0x0055: {value, type: 0x20}},
|
||||||
|
time_bell: {0x0057: {value, type: 0x20}},
|
||||||
time_report: {0x0056: {value, type: 0x20}},
|
time_report: {0x0056: {value, type: 0x20}},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -134,6 +138,7 @@ const tz = {
|
|||||||
time_ring: ['closuresDoorLock', 0x0053],
|
time_ring: ['closuresDoorLock', 0x0053],
|
||||||
time_talk: ['closuresDoorLock', 0x0054],
|
time_talk: ['closuresDoorLock', 0x0054],
|
||||||
time_open: ['closuresDoorLock', 0x0055],
|
time_open: ['closuresDoorLock', 0x0055],
|
||||||
|
time_bell: ['closuresDoorLock', 0x0057],
|
||||||
time_report: ['closuresDoorLock', 0x0056],
|
time_report: ['closuresDoorLock', 0x0056],
|
||||||
};
|
};
|
||||||
await entity.read(payloads[key][0], [payloads[key][1]]);
|
await entity.read(payloads[key][0], [payloads[key][1]]);
|
||||||
@@ -193,10 +198,11 @@ const device = {
|
|||||||
.withDescription('Time to hold before open'),
|
.withDescription('Time to hold before open'),
|
||||||
exposes.numeric('time_open', ea.ALL).withUnit('sec')
|
exposes.numeric('time_open', ea.ALL).withUnit('sec')
|
||||||
.withDescription('Time to open before end'),
|
.withDescription('Time to open before end'),
|
||||||
|
exposes.numeric('time_bell', ea.ALL).withUnit('sec')
|
||||||
|
.withDescription('Time after last bell to finish ring'),
|
||||||
exposes.numeric('time_report', ea.ALL).withUnit('min')
|
exposes.numeric('time_report', ea.ALL).withUnit('min')
|
||||||
.withDescription('Reporting interval'),
|
.withDescription('Reporting interval'),
|
||||||
ep.battery(),
|
ep.battery(),
|
||||||
ep.linkquality(),
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
BIN
images/battery_no_handset.png
Normal file
BIN
images/battery_no_handset.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
BIN
images/fix_error_rings.png
Normal file
BIN
images/fix_error_rings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 71 KiB |
Reference in New Issue
Block a user