Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fix #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions library/__dali2_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,18 +486,7 @@ static void _sendingData()
{
uint8_t pulsePosition;

if (_tickCounter < 8)
{
if (_tickCounter < 4)
{
hal_gpio_rstSet( 1 );
}
else
{
hal_gpio_rstSet( 0 );
}
}
else if (_bitCounter < 17)
if (_bitCounter < 17)
{
if (_tickCounter % 4 == 0)
{
Expand Down Expand Up @@ -567,7 +556,7 @@ static uint8_t _checkSpecCmd(uint8_t addrByte)

addrToCheck = addrByte;

if ((addrToCheck == 0x90) || (addrToCheck == 0xA0))
if ((addrToCheck >= 0x90) || (addrToCheck <= 0xA0))
{
if (addrToCheck & 0x01)
return TRUE;
Expand All @@ -593,7 +582,7 @@ static void _prepareData(uint8_t *commandArray, uint8_t *tx_array, uint8_t bytes

for (i = 0; i < 9; i++)
{
tx_array[0] = 0;
tx_array[i] = 0;
}

for (bytes_counter = 0; bytes_counter < bytesInCmd; bytes_counter++)
Expand Down Expand Up @@ -633,6 +622,11 @@ static void _prepareData(uint8_t *commandArray, uint8_t *tx_array, uint8_t bytes
static void _prepareAddress(uint8_t *commandArray, uint8_t addressType, uint8_t byteAddressPosition, uint8_t followingType)
{
uint8_t addr_tmp;

if(_checkSpecCmd(commandArray[byteAddressPosition]))
{
return;
}

if (addressType == _DALI2_BROADCAST_CMD)
{
Expand Down Expand Up @@ -753,8 +747,7 @@ void dali2_sendCmd(const uint8_t balAddress, const uint8_t cmd, const uint8_t cm

_tickCounter = 0;
_bitCounter = 0;

_daliState = _DALI2_SENDING_DATA;


tmp[0] = balAddress;
tmp[1] = cmd;
Expand Down Expand Up @@ -802,6 +795,7 @@ void dali2_sendCmd(const uint8_t balAddress, const uint8_t cmd, const uint8_t cm
}
}

_daliState = _DALI2_SENDING_DATA;
_tickCounter = 0;
_bitCounter = 0;
}
Expand Down Expand Up @@ -1009,4 +1003,4 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

----------------------------------------------------------------------------- */
----------------------------------------------------------------------------- */