mirror of
https://github.com/Utyff/Zintercom.git
synced 2026-01-12 17:27:42 +03:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c833dc48ab | ||
|
|
bc3f698efc | ||
|
|
29ff218b19 | ||
|
|
44087fceb9 | ||
|
|
a4fe271d30 | ||
|
|
deafb7667e | ||
|
|
29c71487ea | ||
|
|
5e02f3c97a |
17
README.md
17
README.md
@@ -23,24 +23,25 @@ Reset to FN by press and hold BTN for 5 seconds.
|
|||||||
|
|
||||||
LED will flash during reset.
|
LED will flash during reset.
|
||||||
|
|
||||||
<img src="./images/z2m_dashboard.gif" width="45%">
|

|
||||||
|
|
||||||
|
|
||||||
### How to add device into zigbe2mqtt
|
### How to add device into zigbe2mqtt
|
||||||
Use [external converters](https://www.zigbee2mqtt.io/information/configuration.html#external-converters-configuration) feature
|
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](https://github.com/diyruz/Zintercom/blob/master/converters/DIYRuZ_Zintercom.js)
|
||||||
|
|
||||||
<img src="./images/z2m_exposes.png" width="90%">
|

|
||||||
|
|
||||||
### Schematic
|
### Schematic
|
||||||
|
|
||||||
<img src="./hardware/Schematic_Zintercom.png" width="90%">
|

|
||||||
|
|
||||||
|
|
||||||
### PCB size
|
### PCB size
|
||||||
|
|
||||||
`57.5mm x 27.3mm`
|
`57.5mm x 27.3mm`
|
||||||
<img src="./images/dimensions.png" width="60%">
|

|
||||||
|
|
||||||
|
|
||||||
### DC Power
|
### DC Power
|
||||||
@@ -48,9 +49,9 @@ Converter file located [here](./converters/DIY_Zintercom.js)
|
|||||||
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`.
|
||||||
|
|
||||||
<img src="./images/front_side.png" width="70%">
|

|
||||||
|
|
||||||
<img src="./images/back_DC_5-9V.png" width="70%">
|

|
||||||
|
|
||||||
|
|
||||||
### Battery Power
|
### Battery Power
|
||||||
@@ -65,7 +66,7 @@ But you have the ability to 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.
|
||||||
|
|
||||||
<img src="./images/back_2xAAA.png" width="70%">
|

|
||||||
|
|
||||||
##### 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.
|
||||||
|
|
||||||
|
|||||||
@@ -88,8 +88,6 @@ static void zclApp_RingRun(void);
|
|||||||
static void zclApp_TalkStart(void);
|
static void zclApp_TalkStart(void);
|
||||||
static void zclApp_RingEnd(void);
|
static void zclApp_RingEnd(void);
|
||||||
|
|
||||||
//static uint32 pressTime = 0;
|
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* ZCL General Profile Callback table
|
* ZCL General Profile Callback table
|
||||||
*/
|
*/
|
||||||
@@ -141,6 +139,8 @@ static void zclApp_HandleKeys(byte portAndAction, byte keyCode) {
|
|||||||
//exit old stop timer
|
//exit old stop timer
|
||||||
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);
|
||||||
|
//start new stop timer (ring ends timer)
|
||||||
|
osal_start_reload_timer(zclApp_TaskID, APP_RING_STOP_EVT, 3000);
|
||||||
|
|
||||||
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);
|
||||||
@@ -148,26 +148,36 @@ static void zclApp_HandleKeys(byte portAndAction, byte keyCode) {
|
|||||||
|
|
||||||
//start ring
|
//start ring
|
||||||
if (zclApp_State.RingRunStep == 0) {
|
if (zclApp_State.RingRunStep == 0) {
|
||||||
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);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
LREPMaster("Key pressed\r\n");
|
LREPMaster("Key pressed\r\n");
|
||||||
osal_start_reload_timer(zclApp_TaskID, APP_BTN_CLICK_EVT, 50);
|
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;
|
break;
|
||||||
case Droped:
|
case Droped:
|
||||||
if (zclApp_State.RingRunStep > 3) {
|
if (zclApp_State.RingRunStep > 1) {
|
||||||
zclApp_RingEnd();
|
zclApp_RingEnd();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -379,9 +389,6 @@ 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) {
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ extern "C" {
|
|||||||
#define APP_SAVE_ATTRS_EVT 0x0002
|
#define APP_SAVE_ATTRS_EVT 0x0002
|
||||||
#define APP_BTN_CLICK_EVT 0x0004
|
#define APP_BTN_CLICK_EVT 0x0004
|
||||||
#define APP_RING_RUN_EVT 0x0008
|
#define APP_RING_RUN_EVT 0x0008
|
||||||
#define APP_BTN_HOLD_EVT 0x0016
|
#define APP_BTN_HOLD_EVT 0x0010
|
||||||
#define APP_RING_STOP_EVT 0x0032
|
#define APP_RING_STOP_EVT 0x0020
|
||||||
#define APP_TALK_START_EVT 0x0064
|
#define APP_TALK_START_EVT 0x0040
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* MACROS
|
* MACROS
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ const uint8 zclApp_PowerSource = POWER_SOURCE_DC;
|
|||||||
#define DEFAULT_ModeOpen Never
|
#define DEFAULT_ModeOpen Never
|
||||||
#define DEFAULT_ModeSound TRUE
|
#define DEFAULT_ModeSound TRUE
|
||||||
|
|
||||||
#define DEFAULT_TimeRing 3 //seconds to ring, before answer
|
#define DEFAULT_TimeRing 7 //seconds to ring, before answer
|
||||||
#define DEFAULT_TimeTalk 1 //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
|
||||||
|
|
||||||
|
|
||||||
@@ -81,6 +81,7 @@ application_config_t zclApp_Config = {
|
|||||||
device_state_t zclApp_State = {
|
device_state_t zclApp_State = {
|
||||||
.State = Idle,
|
.State = Idle,
|
||||||
.RingRunStep = 0,
|
.RingRunStep = 0,
|
||||||
|
.pressTime = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user