Skip to content

Commit 6a42f03

Browse files
committed
VSCP framework v0.5.0 merged
1 parent 2f2aa21 commit 6a42f03

File tree

6 files changed

+45
-33
lines changed

6 files changed

+45
-33
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.4.0 (unreleased)
2+
3+
- Update to VSCP framework v0.5.0, please see the ![changelog](https://github.com/BlueAndi/vscp-framework/blob/v0.5.0/CHANGELOG.md) there.
4+
- Seeed-Studio-CAN_BUS_Shield example got a retry mechanism in the send routine.
5+
- Sparkfun_CAN-BUS_Shield example got a retry mechanism in the send routine.
6+
17
## 0.3.0
28

39
- DigInDebounce class for digital input debouncing implemented.

VSCP/library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name=VSCP
2-
version=0.2.1
2+
version=0.4.0
33
author=Andreas Merkle
44
maintainer=Andreas Merkle <vscp@blue-andi.de>
5-
sentence=Very Simple Control Protocol framework for all Arduino boards.
5+
sentence=Very Simple Control Protocol L1 framework for all Arduino boards.
66
paragraph=
77
url=http://github.com/BlueAndi/vscp-arduino
88
architectures=avr

VSCP/src/framework/vscp_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ extern "C"
112112

113113
#ifndef VSCP_CONFIG_HEARTBEAT_NODE
114114

115-
/** Enable sending node heartbeat. */
116-
#define VSCP_CONFIG_HEARTBEAT_NODE VSCP_CONFIG_BASE_DISABLED
115+
/** Enable sending node heartbeat (mandatory since 2015-09-10). */
116+
#define VSCP_CONFIG_HEARTBEAT_NODE VSCP_CONFIG_BASE_ENABLED
117117

118118
#endif /* Undefined VSCP_CONFIG_HEARTBEAT_NODE */
119119

@@ -224,8 +224,8 @@ extern "C"
224224

225225
#ifndef VSCP_CONFIG_HEARTBEAT_NODE_PERIOD
226226

227-
/** Node heartbeat period in ms. */
228-
#define VSCP_CONFIG_HEARTBEAT_NODE_PERIOD ((uint16_t)1000)
227+
/** Node heartbeat period in ms (recommended 30s - 60s). */
228+
#define VSCP_CONFIG_HEARTBEAT_NODE_PERIOD ((uint16_t)30000)
229229

230230
#endif /* Undefined VSCP_CONFIG_HEARTBEAT_NODE_PERIOD */
231231

VSCP/src/framework/vscp_config_overwrite.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ extern "C"
7676
7777
#define VSCP_CONFIG_HEARTBEAT_SUPPORT_SEGMENT VSCP_CONFIG_BASE_DISABLED
7878
79-
#define VSCP_CONFIG_HEARTBEAT_NODE VSCP_CONFIG_BASE_DISABLED
79+
#define VSCP_CONFIG_HEARTBEAT_NODE VSCP_CONFIG_BASE_ENABLED
8080
8181
#define VSCP_CONFIG_IDLE_CALLOUT VSCP_CONFIG_BASE_DISABLED
8282
@@ -110,7 +110,7 @@ extern "C"
110110
111111
#define VSCP_CONFIG_MULTI_MSG_TIMEOUT ((uint16_t)1000)
112112
113-
#define VSCP_CONFIG_HEARTBEAT_NODE_PERIOD ((uint16_t)1000)
113+
#define VSCP_CONFIG_HEARTBEAT_NODE_PERIOD ((uint16_t)30000)
114114
115115
#define VSCP_CONFIG_DM_PAGE 1
116116

VSCP/src/framework/vscp_core.c

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,53 +1606,59 @@ static inline void vscp_core_handleProtocolDropNicknameId(void)
16061606
vscp_core_changeToStateReset(0);
16071607
}
16081608
/* Additional flags received? */
1609-
else if (2 <= vscp_core_rxMessage.dataNum)
1609+
else if ((2 == vscp_core_rxMessage.dataNum) ||
1610+
(3 == vscp_core_rxMessage.dataNum))
16101611
{
1611-
/* Clear the nickname? */
1612-
if (0 == (vscp_core_rxMessage.data[1] & 0x20))
1612+
uint8_t waitTime = 0;
1613+
1614+
/* Wait time received? */
1615+
if (3 == vscp_core_rxMessage.dataNum)
16131616
{
1614-
vscp_core_writeNicknameId(VSCP_NICKNAME_NOT_INIT);
1617+
waitTime = vscp_core_rxMessage.data[2];
16151618
}
1616-
1617-
/* Set persistent memory to default? */
1618-
if (0 != (vscp_core_rxMessage.data[1] & 0x40))
1619+
1620+
/* Byte 1:
1621+
* Bit 5 - Reset device. Keep nickname.
1622+
* Bit 6 - Set persistent storage to default.
1623+
* Bit 7 - Go idle. Do not start up again.
1624+
*/
1625+
1626+
/* Set persistent memory to default (bit 6)? */
1627+
if (0 != (vscp_core_rxMessage.data[1] & (1 << 6)))
16191628
{
1620-
/* Backup nickname */
1629+
/* Backup nickname, because restore factory settings will clear it. */
16211630
uint8_t nicknameBackup = vscp_core_nickname;
16221631

16231632
/* Set defaults to persistent memory. */
16241633
vscp_core_restoreFactoryDefaultSettings();
16251634

1626-
/* Keep nickname? */
1627-
if (0 != (vscp_core_rxMessage.data[1] & 0x20))
1635+
/* Restore nickname? */
1636+
if (0 != (vscp_core_rxMessage.data[1] & (1 << 5)))
16281637
{
16291638
/* Restore nickname */
16301639
vscp_core_writeNicknameId(nicknameBackup);
16311640
}
16321641
}
16331642

1634-
/* Reset device?
1643+
/* Reset device (bit 5)?
16351644
* Note that "reset device" has a higher priority than "go idle".
16361645
* There is no exact description in the specification yet.
16371646
*/
1638-
if ((0 != (vscp_core_rxMessage.data[1] & 0x20)) ||
1639-
(0 == (vscp_core_rxMessage.data[1] & 0x80)))
1647+
if (0 != (vscp_core_rxMessage.data[1] & (1 << 5)))
16401648
{
1641-
/* Wait time received? */
1642-
if (3 == vscp_core_rxMessage.dataNum)
1643-
{
1644-
vscp_core_changeToStateReset(vscp_core_rxMessage.data[2]);
1645-
}
1646-
else
1647-
{
1648-
vscp_core_changeToStateReset(0);
1649-
}
1649+
vscp_core_changeToStateReset(waitTime);
16501650
}
1651-
/* Change to idle state? */
1652-
else if (0 != (vscp_core_rxMessage.data[1] & 0x80))
1651+
/* Change to idle state (bit 7)? */
1652+
else if (0 != (vscp_core_rxMessage.data[1] & (1 << 7)))
16531653
{
1654+
vscp_core_writeNicknameId(VSCP_NICKNAME_NOT_INIT);
16541655
vscp_core_changeToStateIdle();
16551656
}
1657+
else
1658+
{
1659+
vscp_core_writeNicknameId(VSCP_NICKNAME_NOT_INIT);
1660+
vscp_core_changeToStateReset(waitTime);
1661+
}
16561662
}
16571663
}
16581664
}

VSCP/src/framework/vscp_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ extern "C"
103103
#define VSCP_CORE_VERSION_STR "v1.10.16"
104104

105105
/** VSCP framework version string */
106-
#define VSCP_CORE_FRAMEWORK_VERSION "v0.4.0"
106+
#define VSCP_CORE_FRAMEWORK_VERSION "v0.5.0"
107107

108108
/*******************************************************************************
109109
MACROS

0 commit comments

Comments
 (0)